This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 5b3c8f72c20239fcc6b04592e3d06b15e94cc6d8 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Feb 13 12:33:21 2022 -0500 Clearer local variable name. --- .../commons/compress/archivers/examples/Expander.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java b/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java index 960a9dd..e6c425e 100644 --- a/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java +++ b/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java @@ -345,24 +345,24 @@ public class Expander { } ArchiveEntry nextEntry = supplier.getNextReadableEntry(); while (nextEntry != null) { - final File f = new File(targetDirectory, nextEntry.getName()); + final File targetFile = new File(targetDirectory, nextEntry.getName()); // check if targetDirectory and f are the same path - this may // happen if the nextEntry.getName() is "./" - if (!f.getCanonicalPath().startsWith(targetDirPath) - && !Files.isSameFile(targetDirectory.toPath(), f.toPath())) { + if (!targetFile.getCanonicalPath().startsWith(targetDirPath) + && !Files.isSameFile(targetDirectory.toPath(), targetFile.toPath())) { throw new IOException("Expanding " + nextEntry.getName() + " would create file outside of " + targetDirectory); } if (nextEntry.isDirectory()) { - if (!f.isDirectory() && !f.mkdirs()) { - throw new IOException("Failed to create directory " + f); + if (!targetFile.isDirectory() && !targetFile.mkdirs()) { + throw new IOException("Failed to create directory " + targetFile); } } else { - final File parent = f.getParentFile(); + final File parent = targetFile.getParentFile(); if (!parent.isDirectory() && !parent.mkdirs()) { throw new IOException("Failed to create directory " + parent); } - try (OutputStream o = Files.newOutputStream(f.toPath())) { + try (OutputStream o = Files.newOutputStream(targetFile.toPath())) { writer.writeEntryDataTo(nextEntry, o); } }