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:
parent
5bbf271712
commit
bcf1f33acd
@ -317,6 +317,9 @@ Release 2.5.0 - UNRELEASED
|
|||||||
HDFS-6180. dead node count / listing is very broken in JMX and old GUI.
|
HDFS-6180. dead node count / listing is very broken in JMX and old GUI.
|
||||||
(wheat9)
|
(wheat9)
|
||||||
|
|
||||||
|
HDFS-6143. WebHdfsFileSystem open should throw FileNotFoundException for
|
||||||
|
non-existing paths. (Gera Shegalov via wheat9)
|
||||||
|
|
||||||
Release 2.4.1 - UNRELEASED
|
Release 2.4.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -83,9 +83,10 @@ enum StreamStatus {
|
|||||||
* @param o Original url
|
* @param o Original url
|
||||||
* @param r Resolved url
|
* @param r Resolved url
|
||||||
*/
|
*/
|
||||||
public ByteRangeInputStream(URLOpener o, URLOpener r) {
|
public ByteRangeInputStream(URLOpener o, URLOpener r) throws IOException {
|
||||||
this.originalURL = o;
|
this.originalURL = o;
|
||||||
this.resolvedURL = r;
|
this.resolvedURL = r;
|
||||||
|
getInputStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract URL getResolvedUrl(final HttpURLConnection connection
|
protected abstract URL getResolvedUrl(final HttpURLConnection connection
|
||||||
|
@ -962,7 +962,8 @@ static URL removeOffsetParam(final URL url) throws MalformedURLException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static class OffsetUrlInputStream extends ByteRangeInputStream {
|
static class OffsetUrlInputStream extends ByteRangeInputStream {
|
||||||
OffsetUrlInputStream(OffsetUrlOpener o, OffsetUrlOpener r) {
|
OffsetUrlInputStream(OffsetUrlOpener o, OffsetUrlOpener r)
|
||||||
|
throws IOException {
|
||||||
super(o, r);
|
super(o, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,9 +182,8 @@ public void testOpenNonExistFile() throws IOException {
|
|||||||
final Path p = new Path("/test/testOpenNonExistFile");
|
final Path p = new Path("/test/testOpenNonExistFile");
|
||||||
//open it as a file, should get FileNotFoundException
|
//open it as a file, should get FileNotFoundException
|
||||||
try {
|
try {
|
||||||
final FSDataInputStream in = fs.open(p);
|
fs.open(p);
|
||||||
in.read();
|
fail("Expected FileNotFoundException was not thrown");
|
||||||
fail();
|
|
||||||
} catch(FileNotFoundException fnfe) {
|
} catch(FileNotFoundException fnfe) {
|
||||||
WebHdfsFileSystem.LOG.info("This is expected.", fnfe);
|
WebHdfsFileSystem.LOG.info("This is expected.", fnfe);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user