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/06/23 13:24:25 UTC

[commons-net] branch master updated (c6b66581 -> 5586d0d3)

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 c6b66581 Format tweak
     new 7cc306f2 Clean up exception handling in example
     new fcf294f4 Javadoc
     new c6ba3526 Javadoc
     new 68c20046 IMAPExportMbox.MboxListener.chunkReceived(IMAP) now throws UncheckedIOException instead of RuntimeException.
     new f4839f86 IMAPUtils.imapLogin(URI, int, ProtocolCommandListener) now throws IOException instead of RuntimeException while maintaining method signature source compatibility
     new 5586d0d3 Clean up exception handling in example

The 6 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:
 src/changes/changes.xml                                   |  6 ++++++
 .../org/apache/commons/net/examples/ftp/TFTPExample.java  | 15 ++++++++-------
 .../apache/commons/net/examples/mail/IMAPExportMbox.java  |  3 ++-
 .../org/apache/commons/net/examples/mail/IMAPUtils.java   |  7 +++----
 4 files changed, 19 insertions(+), 12 deletions(-)


[commons-net] 05/06: IMAPUtils.imapLogin(URI, int, ProtocolCommandListener) now throws IOException instead of RuntimeException while maintaining method signature source compatibility

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 f4839f861a2756393ea7c124df74b4c4f82d91e3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:20:52 2023 -0400

    IMAPUtils.imapLogin(URI, int, ProtocolCommandListener) now throws
    IOException instead of RuntimeException while maintaining method
    signature source compatibility
---
 src/changes/changes.xml                                           | 3 +++
 src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0eeaa1cd..3c828368 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -106,6 +106,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">
         IMAPExportMbox.MboxListener.chunkReceived(IMAP) now throws UncheckedIOException instead of RuntimeException.
       </action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+        IMAPUtils.imapLogin(URI, int, ProtocolCommandListener) now throws IOException instead of RuntimeException while maintaining method signature source compatibility.
+      </action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">
         Bump commons-parent from 54 to 58 #132, #137, #153.
diff --git a/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java b/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
index a3afe2e8..6d718556 100644
--- a/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
+++ b/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
@@ -83,12 +83,12 @@ class IMAPUtils {
             imap.connect(server);
             System.out.println("Successfully connected");
         } catch (final IOException e) {
-            throw new RuntimeException("Could not connect to server.", e);
+            throw new IOException("Could not connect to server.", e);
         }
 
         if (!imap.login(username, password)) {
             imap.disconnect();
-            throw new RuntimeException("Could not login to server. Check login details.");
+            throw new IOException("Could not login to server. Check login details.");
         }
 
         return imap;


[commons-net] 04/06: IMAPExportMbox.MboxListener.chunkReceived(IMAP) now throws UncheckedIOException instead of RuntimeException.

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 68c200462a3117c53283ea2f8488163ca61edb95
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:17:49 2023 -0400

    IMAPExportMbox.MboxListener.chunkReceived(IMAP) now throws
    UncheckedIOException
    instead of RuntimeException.
---
 src/changes/changes.xml                                                | 3 +++
 src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b2e0f635..0eeaa1cd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -103,6 +103,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">
         SubnetUtils.SubnetInfo.getPreviousAddress() now throws IllegalStateException instead of RuntimeException.
       </action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+        IMAPExportMbox.MboxListener.chunkReceived(IMAP) now throws UncheckedIOException instead of RuntimeException.
+      </action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">
         Bump commons-parent from 54 to 58 #132, #137, #153.
diff --git a/src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java b/src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java
index 9960c850..562baeb4 100644
--- a/src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java
+++ b/src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java
@@ -21,6 +21,7 @@ import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.text.ParseException;
@@ -172,7 +173,7 @@ public final class IMAPExportMbox {
                 bufferedWriter.append(lineSeparator); // blank line between entries
             } catch (final IOException e) {
                 e.printStackTrace();
-                throw new RuntimeException(e); // chunkReceived cannot throw a checked Exception
+                throw new UncheckedIOException(e); // chunkReceived cannot throw a checked Exception
             }
             lastFetched = firstLine;
             total.incrementAndGet();


[commons-net] 02/06: Javadoc

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 fcf294f4b744bb3cd2b04606c0806ac65e79aa98
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:13:54 2023 -0400

    Javadoc
---
 src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java b/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
index 7e7f9804..73a27ada 100644
--- a/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
+++ b/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
@@ -27,7 +27,6 @@ import org.apache.commons.net.imap.IMAPSClient;
 /**
  * Utility class for shared IMAP utilities
  */
-
 class IMAPUtils {
 
     /**


[commons-net] 01/06: Clean up exception handling in example

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 7cc306f2def4114fe091620adf1178e9e109a6f6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:13:42 2023 -0400

    Clean up exception handling in example
---
 .../org/apache/commons/net/examples/ftp/TFTPExample.java    | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java b/src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java
index 19b3424b..c5dbe7d1 100644
--- a/src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java
+++ b/src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java
@@ -61,7 +61,7 @@ public final class TFTPExample {
         return closed;
     }
 
-    public static void main(final String[] args) {
+    public static void main(final String[] args) throws IOException {
         boolean receiveFile = true, closed;
         int transferMode = TFTP.BINARY_MODE, argc;
         String arg;
@@ -145,16 +145,16 @@ public final class TFTPExample {
         System.out.println("OK");
     }
 
-    private static void open(final TFTPClient tftp) {
+    private static void open(final TFTPClient tftp) throws IOException {
         try {
             tftp.open();
         } catch (final SocketException e) {
-            throw new RuntimeException("Error: could not open local UDP socket.", e);
+            throw new IOException("Error: could not open local UDP socket.", e);
         }
     }
 
     private static boolean receive(final int transferMode, final String hostname, final String localFilename, final String remoteFilename,
-            final TFTPClient tftp) {
+            final TFTPClient tftp) throws IOException {
         final boolean closed;
         FileOutputStream output;
         final File file;
@@ -172,7 +172,7 @@ public final class TFTPExample {
             output = new FileOutputStream(file);
         } catch (final IOException e) {
             tftp.close();
-            throw new RuntimeException("Error: could not open local file for writing.", e);
+            throw new IOException("Error: could not open local file for writing.", e);
         }
 
         open(tftp);
@@ -201,7 +201,8 @@ public final class TFTPExample {
         return closed;
     }
 
-    private static boolean send(final int transferMode, final String hostname, final String localFilename, final String remoteFilename, final TFTPClient tftp) {
+    private static boolean send(final int transferMode, final String hostname, final String localFilename, final String remoteFilename, final TFTPClient tftp)
+            throws IOException {
         final boolean closed;
         FileInputStream input;
 


[commons-net] 06/06: Clean up exception handling in example

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 5586d0d3f8c881eb076032d60f16c2e88a3fbe35
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:21:07 2023 -0400

    Clean up exception handling in example
---
 src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java b/src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java
index c5dbe7d1..10b15781 100644
--- a/src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java
+++ b/src/main/java/org/apache/commons/net/examples/ftp/TFTPExample.java
@@ -211,7 +211,7 @@ public final class TFTPExample {
             input = new FileInputStream(localFilename);
         } catch (final IOException e) {
             tftp.close();
-            throw new RuntimeException("Error: could not open local file for reading.", e);
+            throw new IOException("Error: could not open local file for reading.", e);
         }
 
         open(tftp);


[commons-net] 03/06: Javadoc

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 c6ba352653aeac2f607cf392c47b61f233d3cccc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:14:09 2023 -0400

    Javadoc
---
 src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java b/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
index 73a27ada..a3afe2e8 100644
--- a/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
+++ b/src/main/java/org/apache/commons/net/examples/mail/IMAPUtils.java
@@ -30,7 +30,7 @@ import org.apache.commons.net.imap.IMAPSClient;
 class IMAPUtils {
 
     /**
-     * Parse the URI and use the details to connect to the IMAP(S) server and login.
+     * Parses the URI and use the details to connect to the IMAP(S) server and login.
      *
      * @param uri            the URI to use, e.g. imaps://user:pass@imap.mail.yahoo.com/folder or imaps://user:pass@imap.googlemail.com/folder
      * @param defaultTimeout initial timeout (in milliseconds)