Skip to content

Commit

Permalink
STORM-3288: Fix issue with reources in jar files
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert (Bobby) Evans committed Nov 16, 2018
1 parent 29eb449 commit 5784eb1
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -189,14 +189,16 @@ protected void extractDirFromJar(String jarpath, String dir, Path dest) throws I
JarEntry entry = jarEnums.nextElement();
String name = entry.getName();
if (!entry.isDirectory() && name.startsWith(toRemove)) {
String shortenedName = name.replace(toRemove, "");
String shortenedName = name.substring(toRemove.length());
Path targetFile = dest.resolve(shortenedName);
LOG.debug("EXTRACTING {} SHORTENED to {} into {}", name, shortenedName, targetFile);
fsOps.forceMkdir(targetFile.getParent());
try (FileOutputStream out = new FileOutputStream(targetFile.toFile());
InputStream in = jarFile.getInputStream(entry)) {
IOUtils.copy(in, out);
}
} else {
LOG.debug("Skipping {}", entry);
}
}
}
Expand Down

0 comments on commit 5784eb1

Please sign in to comment.