From ce701485d811daac24613a17d6b8e3fa241da5b2 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Thu, 7 Jan 2021 06:52:46 +0000 Subject: [PATCH] Improve EmptyFileException when the file actually does not exist at all git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885227 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/EmptyFileException.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/poi/EmptyFileException.java b/src/java/org/apache/poi/EmptyFileException.java index 07828343be..5abbcd0fe6 100644 --- a/src/java/org/apache/poi/EmptyFileException.java +++ b/src/java/org/apache/poi/EmptyFileException.java @@ -29,6 +29,8 @@ public class EmptyFileException extends IllegalArgumentException { } public EmptyFileException(File file) { - super("The supplied file '" + file.getAbsolutePath() + "' was empty (zero bytes long)"); + super(file.exists() ? + "The supplied file '" + file.getAbsolutePath() + "' was empty (zero bytes long)" : + "The file '" + file.getAbsolutePath() + "' does not exist"); } } \ No newline at end of file -- 2.39.5