Skip to content

Commit f43c85a

Browse files
author
Stephen Colebourne
committed
IO-107 - Add FileUtils.openInputStream, with better error messages than the JDK
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/io/trunk@491001 13f79535-47bb-0310-9956-ffa450edef68
1 parent 283bc42 commit f43c85a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/java/org/apache/commons/io/FileUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.io.InputStream;
2626
import java.io.OutputStream;
2727
import java.net.URL;
28-
import java.nio.channels.FileChannel;
2928
import java.util.Collection;
3029
import java.util.Date;
3130
import java.util.Iterator;
@@ -119,7 +118,7 @@ public FileUtils() {
119118
* An exception is thrown if the file exists but cannot be read.
120119
*
121120
* @param file the file to open for input, not null
122-
* @throws IOException if the file does not exist
121+
* @throws FileNotFoundException if the file does not exist
123122
* @throws IOException if the file object is a directory
124123
* @throws IOException if the file cannot be read
125124
* @since Commons IO 1.3
@@ -133,7 +132,7 @@ public static FileInputStream openInputStream(File file) throws IOException {
133132
throw new IOException("File '" + file + "' cannot be read");
134133
}
135134
} else {
136-
throw new IOException("File '" + file + "' does not exist");
135+
throw new FileNotFoundException("File '" + file + "' does not exist");
137136
}
138137
return new FileInputStream(file);
139138
}

0 commit comments

Comments
 (0)