HDFS-5830. WebHdfsFileSystem.getFileBlockLocations throws IllegalArgumentException when accessing another cluster. (Yongjun Zhang via Colin Patrick McCabe)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1561885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6016d7d4da
commit
07c004db06
|
@ -1151,6 +1151,10 @@ Release 2.3.0 - UNRELEASED
|
||||||
HDFS-5297. Fix dead links in HDFS site documents. (Akira Ajisaka via
|
HDFS-5297. Fix dead links in HDFS site documents. (Akira Ajisaka via
|
||||||
Arpit Agarwal)
|
Arpit Agarwal)
|
||||||
|
|
||||||
|
HDFS-5830. WebHdfsFileSystem.getFileBlockLocations throws
|
||||||
|
IllegalArgumentException when accessing another cluster. (Yongjun Zhang via
|
||||||
|
Colin Patrick McCabe)
|
||||||
|
|
||||||
Release 2.2.0 - 2013-10-13
|
Release 2.2.0 - 2013-10-13
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -98,9 +98,8 @@ public class LocatedBlock {
|
||||||
}
|
}
|
||||||
this.storageIDs = storageIDs;
|
this.storageIDs = storageIDs;
|
||||||
this.storageTypes = storageTypes;
|
this.storageTypes = storageTypes;
|
||||||
Preconditions.checkArgument(cachedLocs != null,
|
|
||||||
"cachedLocs should not be null, use a different constructor");
|
if (cachedLocs == null || cachedLocs.length == 0) {
|
||||||
if (cachedLocs.length == 0) {
|
|
||||||
this.cachedLocs = EMPTY_LOCS;
|
this.cachedLocs = EMPTY_LOCS;
|
||||||
} else {
|
} else {
|
||||||
this.cachedLocs = cachedLocs;
|
this.cachedLocs = cachedLocs;
|
||||||
|
|
|
@ -118,6 +118,20 @@ public class TestDFSUtil {
|
||||||
assertEquals(0, bs.length);
|
assertEquals(0, bs.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test constructing LocatedBlock with null cachedLocs
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testLocatedBlockConstructorWithNullCachedLocs() {
|
||||||
|
DatanodeInfo d = DFSTestUtil.getLocalDatanodeInfo();
|
||||||
|
DatanodeInfo[] ds = new DatanodeInfo[1];
|
||||||
|
ds[0] = d;
|
||||||
|
|
||||||
|
ExtendedBlock b1 = new ExtendedBlock("bpid", 1, 1, 1);
|
||||||
|
LocatedBlock l1 = new LocatedBlock(b1, ds, null, null, 0, false, null);
|
||||||
|
final DatanodeInfo[] cachedLocs = l1.getCachedLocations();
|
||||||
|
assertTrue(cachedLocs.length == 0);
|
||||||
|
}
|
||||||
|
|
||||||
private Configuration setupAddress(String key) {
|
private Configuration setupAddress(String key) {
|
||||||
HdfsConfiguration conf = new HdfsConfiguration();
|
HdfsConfiguration conf = new HdfsConfiguration();
|
||||||
|
|
Loading…
Reference in New Issue