Author: sebb
Date: Tue Mar 29 14:49:19 2011
New Revision: 1086610

URL: http://svn.apache.org/viewvc?rev=1086610&view=rev
Log:
All commands should be defined in SMTPCommand

Modified:
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java?rev=1086610&r1=1086609&r2=1086610&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
 Tue Mar 29 14:49:19 2011
@@ -48,7 +48,13 @@ public final class SMTPCommand
     public static final int TURN = 12;
     public static final int QUIT = 13;
 
-    private static final int _NEXT_ = QUIT + 1; // update as necessary when 
adding new entries
+    /** 
+     * The TLS start command.
+     * @since 3.0 
+     */
+    public static final int STLS = 14 ;
+    
+    private static final int _NEXT_ = STLS + 1; // update as necessary when 
adding new entries
 
     public static final int HELLO = HELO;
     public static final int LOGIN = HELO;
@@ -73,7 +79,8 @@ public final class SMTPCommand
 
     private static final String[] _commands = {
                                           "HELO", "MAIL FROM:", "RCPT TO:", 
"DATA", "SEND FROM:", "SOML FROM:",
-                                          "SAML FROM:", "RSET", "VRFY", 
"EXPN", "HELP", "NOOP", "TURN", "QUIT"
+                                          "SAML FROM:", "RSET", "VRFY", 
"EXPN", "HELP", "NOOP", "TURN", "QUIT",
+                                          "STARTTLS"
                                       };
 
 

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java?rev=1086610&r1=1086609&r2=1086610&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
 Tue Mar 29 14:49:19 2011
@@ -44,8 +44,6 @@ import org.apache.commons.net.util.SSLCo
  */
 public class SMTPSClient extends SMTPClient
 {
-    /** The TLS start command. */
-    private static final String tlsCommand = "STARTTLS";
     /** Default secure socket protocol name, like TLS */
     private static final String DEFAULT_PROTOCOL = "TLS";
 
@@ -255,14 +253,13 @@ public class SMTPSClient extends SMTPCli
 
     /**
      * The TLS command execution.
-     * @throws SSLException If the server reply code is not positive.
      * @throws IOException If an I/O error occurs while sending
      * the command or performing the negotiation.
      * @return TRUE if the command and negotiation succeeded.
      */
     public boolean execTLS() throws SSLException, IOException
     {
-        if (!SMTPReply.isPositiveCompletion(sendCommand(tlsCommand)))
+        if (!SMTPReply.isPositiveCompletion(sendCommand(SMTPCommand.STLS)))
         {
             return false;
             //throw new SSLException(getReplyString());


Reply via email to