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:30 UTC

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

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;