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 2024/05/11 18:16:04 UTC

(commons-net) branch master updated (f46571db -> ca2801f1)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git


    from f46571db Merge pull request #249 from apache/dependabot/github_actions/ossf/scorecard-action-2.3.3
     new 336fa8d0 macos no longer has Java 8 on GitHub
     new ca2801f1 [SpotBugs] Make explicit use of the default encoding

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/maven.yml                        |  4 --
 .../apache/commons/net/PrintCommandListener.java   | 55 ++++++++++++++--------
 2 files changed, 35 insertions(+), 24 deletions(-)


(commons-net) 01/02: macos no longer has Java 8 on GitHub

Posted by gg...@apache.org.
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 336fa8d0a3fbcbe2ff8fac715acbbd320477b145
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat May 11 14:15:52 2024 -0400

    macos no longer has Java 8 on GitHub
---
 .github/workflows/maven.yml | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 8fb349a3..e7c50572 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -43,10 +43,6 @@ jobs:
           - java: 8
             os: macos-13
             experimental: false
-          - java: 8
-            # Java 8 not currently available
-            os: macos-latest
-            experimental: true
           - java: 8
             os: windows-latest
             experimental: false


(commons-net) 02/02: [SpotBugs] Make explicit use of the default encoding

Posted by gg...@apache.org.
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 ca2801f1fd732affdfaa50fa2d6303b32438b772
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat May 11 14:15:59 2024 -0400

    [SpotBugs] Make explicit use of the default encoding
    
    Javadoc
---
 .../apache/commons/net/PrintCommandListener.java   | 55 ++++++++++++++--------
 1 file changed, 35 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/PrintCommandListener.java b/src/main/java/org/apache/commons/net/PrintCommandListener.java
index f7110611..28820da3 100644
--- a/src/main/java/org/apache/commons/net/PrintCommandListener.java
+++ b/src/main/java/org/apache/commons/net/PrintCommandListener.java
@@ -17,8 +17,10 @@
 
 package org.apache.commons.net;
 
+import java.io.OutputStreamWriter;
 import java.io.PrintStream;
 import java.io.PrintWriter;
+import java.nio.charset.Charset;
 
 /**
  * This is a support class for some example programs. It is a sample implementation of the ProtocolCommandListener interface which just prints out to a
@@ -28,62 +30,75 @@ import java.io.PrintWriter;
  */
 
 public class PrintCommandListener implements ProtocolCommandListener {
+
+    /**
+     * @param printStream
+     * @return
+     */
+    private static PrintWriter newPrintWriter(final PrintStream printStream) {
+        return new PrintWriter(new OutputStreamWriter(printStream, Charset.defaultCharset()));
+    }
     private final PrintWriter writer;
     private final boolean nologin;
     private final char eolMarker;
+
     private final boolean directionMarker;
 
     /**
-     * Create the default instance which prints everything.
+     * Constructs an instance which prints everything using the default Charset.
      *
-     * @param stream where to write the commands and responses e.g. System.out
+     * @param printStream where to write the commands and responses e.g. System.out
      * @since 3.0
      */
-    public PrintCommandListener(final PrintStream stream) {
-        this(new PrintWriter(stream));
+    @SuppressWarnings("resource")
+    public PrintCommandListener(final PrintStream printStream) {
+        this(newPrintWriter(printStream));
     }
 
     /**
-     * Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
+     * Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      *
-     * @param stream        where to write the commands and responses
+     * @param printStream        where to write the commands and responses
      * @param suppressLogin if {@code true}, only print command name for login
      *
      * @since 3.0
      */
-    public PrintCommandListener(final PrintStream stream, final boolean suppressLogin) {
-        this(new PrintWriter(stream), suppressLogin);
+    @SuppressWarnings("resource")
+    public PrintCommandListener(final PrintStream printStream, final boolean suppressLogin) {
+        this(newPrintWriter(printStream), suppressLogin);
     }
 
     /**
-     * Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
+     * Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      *
-     * @param stream        where to write the commands and responses
+     * @param printStream        where to write the commands and responses
      * @param suppressLogin if {@code true}, only print command name for login
      * @param eolMarker     if non-zero, add a marker just before the EOL.
      *
      * @since 3.0
      */
-    public PrintCommandListener(final PrintStream stream, final boolean suppressLogin, final char eolMarker) {
-        this(new PrintWriter(stream), suppressLogin, eolMarker);
+    @SuppressWarnings("resource")
+    public PrintCommandListener(final PrintStream printStream, final boolean suppressLogin, final char eolMarker) {
+        this(newPrintWriter(printStream), suppressLogin, eolMarker);
     }
 
     /**
-     * Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
+     * Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      *
-     * @param stream        where to write the commands and responses
+     * @param printStream        where to write the commands and responses
      * @param suppressLogin if {@code true}, only print command name for login
      * @param eolMarker     if non-zero, add a marker just before the EOL.
      * @param showDirection if {@code true}, add {@code "> "} or {@code "< "} as appropriate to the output
      *
      * @since 3.0
      */
-    public PrintCommandListener(final PrintStream stream, final boolean suppressLogin, final char eolMarker, final boolean showDirection) {
-        this(new PrintWriter(stream), suppressLogin, eolMarker, showDirection);
+    @SuppressWarnings("resource")
+    public PrintCommandListener(final PrintStream printStream, final boolean suppressLogin, final char eolMarker, final boolean showDirection) {
+        this(newPrintWriter(printStream), suppressLogin, eolMarker, showDirection);
     }
 
     /**
-     * Create the default instance which prints everything.
+     * Constructs the default instance which prints everything.
      *
      * @param writer where to write the commands and responses
      */
@@ -92,7 +107,7 @@ public class PrintCommandListener implements ProtocolCommandListener {
     }
 
     /**
-     * Create an instance which optionally suppresses login command text.
+     * Constructs an instance which optionally suppresses login command text.
      *
      * @param writer        where to write the commands and responses
      * @param suppressLogin if {@code true}, only print command name for login
@@ -104,7 +119,7 @@ public class PrintCommandListener implements ProtocolCommandListener {
     }
 
     /**
-     * Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
+     * Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      *
      * @param writer        where to write the commands and responses
      * @param suppressLogin if {@code true}, only print command name for login
@@ -117,7 +132,7 @@ public class PrintCommandListener implements ProtocolCommandListener {
     }
 
     /**
-     * Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
+     * Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      *
      * @param writer        where to write the commands and responses
      * @param suppressLogin if {@code true}, only print command name for login