in src/main/org/apache/ant/compress/taskdefs/Unzip.java [53:92]
protected void expandFile(FileUtils fileUtils, File srcF, File dir) {
log("Expanding: " + srcF + " into " + dir, Project.MSG_INFO);
FileNameMapper mapper = getMapper();
if (!srcF.exists()) {
throw new BuildException("Unable to expand " + srcF
+ " as the file does not exist",
getLocation());
}
try (ZipFile zf = new ZipFile(srcF, getEncoding(), true)) {
boolean empty = true;
Enumeration e = zf.getEntries();
while (e.hasMoreElements()) {
empty = false;
ZipArchiveEntry ze = (ZipArchiveEntry) e.nextElement();
if (getSkipUnreadableEntries() && !zf.canReadEntryData(ze)) {
log(Messages.skippedIsUnreadable(ze));
continue;
}
log("extracting " + ze.getName(), Project.MSG_DEBUG);
InputStream is = null;
try {
extractFile(fileUtils, srcF, dir,
is = zf.getInputStream(ze),
ze.getName(), new Date(ze.getTime()),
ze.isDirectory(), mapper);
} finally {
FileUtils.close(is);
}
}
if (empty && getFailOnEmptyArchive()) {
throw new BuildException("archive '" + srcF + "' is empty");
}
log("expand complete", Project.MSG_VERBOSE);
} catch (IOException ioe) {
throw new BuildException(
"Error while expanding " + srcF.getPath()
+ "\n" + ioe.toString(),
ioe);
}
}