HDFS-6143. Merge r1585639 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1585641 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Haohui Mai 2014-04-08 01:45:21 +00:00
parent 4b31af597b
commit 02beaa7b18
5 changed files with 13 additions and 7 deletions

View File

@ -69,6 +69,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 @@ public abstract class ByteRangeInputStream extends FSInputStream {
* @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

@ -377,11 +377,13 @@ public class HftpFileSystem extends FileSystem
}
static class RangeHeaderInputStream extends ByteRangeInputStream {
RangeHeaderInputStream(RangeHeaderUrlOpener o, RangeHeaderUrlOpener r) {
RangeHeaderInputStream(RangeHeaderUrlOpener o, RangeHeaderUrlOpener r)
throws IOException {
super(o, r);
}
RangeHeaderInputStream(URLConnectionFactory connFactory, final URL url) {
RangeHeaderInputStream(URLConnectionFactory connFactory, final URL url)
throws IOException {
this(new RangeHeaderUrlOpener(connFactory, url),
new RangeHeaderUrlOpener(connFactory, null));
}

View File

@ -962,7 +962,8 @@ public class WebHdfsFileSystem extends FileSystem
}
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 class TestWebHdfsFileSystemContract extends FileSystemContractBaseTest {
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);
}