You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/07/19 14:02:06 UTC

[commons-net] 03/05: Use final

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-net.git

commit 7875a56374ebbb51cf446dda825fb953bc9bea7a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jul 19 09:56:22 2023 -0400

    Use final
---
 src/test/java/org/apache/commons/net/tftp/TFTPServer.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/net/tftp/TFTPServer.java b/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
index 8a8c790a..ee20676e 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
@@ -93,11 +93,10 @@ public class TFTPServer implements Runnable, AutoCloseable {
         }
 
         /*
-         * Utility method to make sure that paths provided by TFTP clients do not get outside of the serverRoot directory.
+         * Makes sure that paths provided by TFTP clients do not get outside of the serverRoot directory.
          */
         private File buildSafeFile(final File serverDirectory, final String fileName, final boolean createSubDirs) throws IOException {
-            File temp = new File(serverDirectory, fileName);
-            temp = temp.getCanonicalFile();
+            final File temp = new File(serverDirectory, fileName).getCanonicalFile();
 
             if (!isSubdirectoryOf(serverDirectory, temp)) {
                 throw new IOException("Cannot access files outside of TFTP server root.");