YARN-2707. Potential null dereference in FSDownload. Contributed by Gera Shegalov
This commit is contained in:
parent
6ce32f593b
commit
7bc179f9f5
@ -826,6 +826,9 @@ Release 2.6.0 - UNRELEASED
|
||||
modified in YARN-2698 so that tests in YARN frameworks don't break. (Wangda
|
||||
Tan via vinodkv)
|
||||
|
||||
YARN-2707. Potential null dereference in FSDownload (Gera Shegalov via
|
||||
jlowe)
|
||||
|
||||
Release 2.5.1 - 2014-09-05
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -266,7 +266,7 @@ private Path copy(Path sCopy, Path dstdir) throws IOException {
|
||||
return dCopy;
|
||||
}
|
||||
|
||||
private long unpack(File localrsrc, File dst, Pattern pattern) throws IOException {
|
||||
private long unpack(File localrsrc, File dst) throws IOException {
|
||||
switch (resource.getType()) {
|
||||
case ARCHIVE: {
|
||||
String lowerDst = dst.getName().toLowerCase();
|
||||
@ -290,7 +290,9 @@ private long unpack(File localrsrc, File dst, Pattern pattern) throws IOExceptio
|
||||
case PATTERN: {
|
||||
String lowerDst = dst.getName().toLowerCase();
|
||||
if (lowerDst.endsWith(".jar")) {
|
||||
RunJar.unJar(localrsrc, dst, pattern);
|
||||
String p = resource.getPattern();
|
||||
RunJar.unJar(localrsrc, dst,
|
||||
p == null ? RunJar.MATCH_ANY : Pattern.compile(p));
|
||||
File newDst = new File(dst, dst.getName());
|
||||
if (!dst.exists() && !dst.mkdir()) {
|
||||
throw new IOException("Unable to create directory: [" + dst + "]");
|
||||
@ -356,12 +358,7 @@ public Path run() throws Exception {
|
||||
return files.makeQualified(copy(sCopy, dst_work));
|
||||
};
|
||||
});
|
||||
Pattern pattern = null;
|
||||
String p = resource.getPattern();
|
||||
if (p != null) {
|
||||
pattern = Pattern.compile(p);
|
||||
}
|
||||
unpack(new File(dTmp.toUri()), new File(dFinal.toUri()), pattern);
|
||||
unpack(new File(dTmp.toUri()), new File(dFinal.toUri()));
|
||||
changePermissions(dFinal.getFileSystem(conf), dFinal);
|
||||
files.rename(dst_work, destDirPath, Rename.OVERWRITE);
|
||||
} catch (Exception e) {
|
||||
|
@ -500,9 +500,8 @@ private void downloadWithFileType(TEST_FILE_TYPE fileType) throws IOException,
|
||||
pending.put(rsrc, exec.submit(fsd));
|
||||
exec.shutdown();
|
||||
while (!exec.awaitTermination(1000, TimeUnit.MILLISECONDS));
|
||||
Assert.assertTrue(pending.get(rsrc).isDone());
|
||||
|
||||
try {
|
||||
pending.get(rsrc).get(); // see if there was an Exception during download
|
||||
FileStatus[] filesstatus = files.getDefaultFileSystem().listStatus(
|
||||
basedir);
|
||||
for (FileStatus filestatus : filesstatus) {
|
||||
|
Loading…
Reference in New Issue
Block a user