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


The following commit(s) were added to refs/heads/master by this push:
     new 8f7d4d6b Use compact array declaration
8f7d4d6b is described below

commit 8f7d4d6bc5c1fbc2dd9a97a9e921919174d84c0e
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Jun 13 15:02:36 2025 -0400

    Use compact array declaration
    
    Use final
---
 src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java        | 2 +-
 src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java    | 6 +++---
 .../java/org/apache/commons/net/tftp/TFTPRequestPacketTest.java     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java 
b/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
index 103e3ebf..3e25e879 100644
--- a/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
+++ b/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
@@ -46,7 +46,7 @@ public final class NewsgroupInfo {
     /**
      * The empty array of this type.
      */
-    static final NewsgroupInfo[] EMPTY_ARRAY = new NewsgroupInfo[0];
+    static final NewsgroupInfo[] EMPTY_ARRAY = {};
 
     private String newsgroup;
     private long estimatedArticleCount;
diff --git a/src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java 
b/src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java
index df79877a..159c6ae9 100644
--- a/src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java
+++ b/src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java
@@ -208,7 +208,7 @@ public abstract class TFTPRequestPacket extends TFTPPacket {
         modeLength = modeBytes[mode].length;
 
         int optionsLength = 0;
-        for (Map.Entry<String, String> entry : options.entrySet()) {
+        for (final Map.Entry<String, String> entry : options.entrySet()) {
             optionsLength += entry.getKey().length() + 1 + 
entry.getValue().length() + 1;
         }
         data = new byte[fileLength + modeLength + 3 + optionsLength];
@@ -257,9 +257,9 @@ public abstract class TFTPRequestPacket extends TFTPPacket {
         return datagram;
     }
 
-    private void handleOptions(byte[] data, int fileLength, int modeLength) {
+    private void handleOptions(final byte[] data, final int fileLength, final 
int modeLength) {
         int index = fileLength + modeLength + 2;
-        for (Map.Entry<String, String> entry : options.entrySet()) {
+        for (final Map.Entry<String, String> entry : options.entrySet()) {
             data[index] = 0;
             final String key = entry.getKey();
             final String value = entry.getValue();
diff --git 
a/src/test/java/org/apache/commons/net/tftp/TFTPRequestPacketTest.java 
b/src/test/java/org/apache/commons/net/tftp/TFTPRequestPacketTest.java
index 407cc12f..9308be5c 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPRequestPacketTest.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPRequestPacketTest.java
@@ -83,7 +83,7 @@ class TFTPRequestPacketTest {
             byteStream.write(0);
             byteStream.write("1024".getBytes(StandardCharsets.US_ASCII));
             byteStream.write(0);
-        } catch (IOException e) {
+        } catch (final IOException e) {
             throw new RuntimeException("Error creating TFTP request packet", 
e);
         }
 

Reply via email to