geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1741822 - /geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java
Date Sat, 30 Apr 2016 22:04:39 GMT
Author: adc
Date: Sat Apr 30 22:04:39 2016
New Revision: 1741822

URL: http://svn.apache.org/viewvc?rev=1741822&view=rev
Log:
Fix SMTPConnection.sendData(MimeMessage msg) to read multi-lined responses

GERONIMO-6552: Javamail module not fully reads SMTP server responses
               Alexei Osipov

Modified:
    geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java

Modified: geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java?rev=1741822&r1=1741821&r2=1741822&view=diff
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java
Sat Apr 30 22:04:39 2016
@@ -551,13 +551,7 @@ public class SMTPConnection extends Mail
 
         // use a longer time out here to give the server time to process the
         // data.
-        try {
-            line = new SMTPReply(receiveLine(TIMEOUT * 2));
-        } catch (MalformedSMTPReplyException e) {
-            throw new MessagingException(e.toString());
-        } catch (MessagingException e) {
-            throw new MessagingException(e.toString());
-        }
+        line = getReply(TIMEOUT * 2);
 
         if (line.isError()) {
             throw new MessagingException("Error issuing SMTP 'DATA' command: " + line);
@@ -686,23 +680,25 @@ public class SMTPConnection extends Mail
         return receiveLine(TIMEOUT);
     }
 
+    protected SMTPReply getReply() throws MessagingException {
+        return getReply(TIMEOUT);
+    }
+
     /**
      * Get a reply line for an SMTP command.
      *
      * @return An SMTP reply object from the stream.
      */
-    protected SMTPReply getReply() throws MessagingException {
+    protected SMTPReply getReply(int timeout) throws MessagingException {
         try {
-            lastServerResponse = new SMTPReply(receiveLine());
+            lastServerResponse = new SMTPReply(receiveLine(timeout));
             // if the first line we receive is a continuation, continue
             // reading lines until we reach the non-continued one.
             while (lastServerResponse.isContinued()) {
-                lastServerResponse.addLine(receiveLine());
+                lastServerResponse.addLine(receiveLine(timeout));
             }
         } catch (MalformedSMTPReplyException e) {
             throw new MessagingException(e.toString());
-        } catch (MessagingException e) {
-            throw e;
         }
         return lastServerResponse;
     }



Mime
View raw message