HDFS-6143. WebHdfsFileSystem open should throw FileNotFoundException for non-existing paths. Contributed by Gera Shegalov.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1585639 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Haohui Mai 2014-04-08 01:39:23 +00:00
parent 5bbf271712
commit bcf1f33acd
4 changed files with 9 additions and 5 deletions

View File

@ -317,6 +317,9 @@ Release 2.5.0 - UNRELEASED
HDFS-6180. dead node count / listing is very broken in JMX and old GUI.
(wheat9)
HDFS-6143. WebHdfsFileSystem open should throw FileNotFoundException for
non-existing paths. (Gera Shegalov via wheat9)
Release 2.4.1 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -83,9 +83,10 @@ enum StreamStatus {
* @param o Original url
* @param r Resolved url
*/
public ByteRangeInputStream(URLOpener o, URLOpener r) {
public ByteRangeInputStream(URLOpener o, URLOpener r) throws IOException {
this.originalURL = o;
this.resolvedURL = r;
getInputStream();
}
protected abstract URL getResolvedUrl(final HttpURLConnection connection

View File

@ -962,7 +962,8 @@ static URL removeOffsetParam(final URL url) throws MalformedURLException {
}
static class OffsetUrlInputStream extends ByteRangeInputStream {
OffsetUrlInputStream(OffsetUrlOpener o, OffsetUrlOpener r) {
OffsetUrlInputStream(OffsetUrlOpener o, OffsetUrlOpener r)
throws IOException {
super(o, r);
}

View File

@ -182,9 +182,8 @@ public void testOpenNonExistFile() throws IOException {
final Path p = new Path("/test/testOpenNonExistFile");
//open it as a file, should get FileNotFoundException
try {
final FSDataInputStream in = fs.open(p);
in.read();
fail();
fs.open(p);
fail("Expected FileNotFoundException was not thrown");
} catch(FileNotFoundException fnfe) {
WebHdfsFileSystem.LOG.info("This is expected.", fnfe);
}