Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STORM-3288: Fix issue with reources in jar files #2910

Merged
merged 1 commit into from Nov 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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