Author: sebb Date: Tue Mar 29 14:30:47 2011 New Revision: 1086595 URL: http://svn.apache.org/viewvc?rev=1086595&view=rev Log: All commands should be defined in POP3Command
Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Command.java Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java?rev=1086595&r1=1086594&r2=1086595&view=diff ============================================================================== --- commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java (original) +++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java Tue Mar 29 14:30:47 2011 @@ -37,11 +37,6 @@ import org.apache.commons.net.util.Base6 */ public class ExtendedPOP3Client extends POP3SClient { - /** The CAPA command. */ - public static final String capaCommand = "CAPA"; - /** The AUTH command. */ - public static final String authCommand = "AUTH"; - /** * The default ExtendedPOP3Client constructor. * Creates a new Extended POP3 Client. @@ -60,7 +55,7 @@ public class ExtendedPOP3Client extends ***/ public boolean capa() throws IOException { - return (sendCommand(capaCommand) == POP3Reply.OK); + return (sendCommand(POP3Command.CAPA) == POP3Reply.OK); } /*** @@ -85,7 +80,7 @@ public class ExtendedPOP3Client extends throws IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException { - if (sendCommand(authCommand, method.getAuthName()) + if (sendCommand(POP3Command.AUTH, method.getAuthName()) != POP3Reply.OK_INT) return false; switch(method) { Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Command.java URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Command.java?rev=1086595&r1=1086594&r2=1086595&view=diff ============================================================================== --- commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Command.java (original) +++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Command.java Tue Mar 29 14:30:47 2011 @@ -50,12 +50,30 @@ public final class POP3Command public static final int TOP = 10; /*** List unique message identifier(s). ***/ public static final int UIDL = 11; + /** + * The capabilities command. + * @since 3.0 + */ + public static final int CAPA = 12; + /** + * Authentication + * @since 3.0 + */ + public static final int AUTH = 13; + + private static final int _NEXT_ = AUTH + 1; // update as necessary when adding new entries static final String[] _commands = { "USER", "PASS", "QUIT", "STAT", "LIST", "RETR", "DELE", "NOOP", "RSET", - "APOP", "TOP", "UIDL" + "APOP", "TOP", "UIDL", "CAPA", "AUTH" }; + static { + if (_commands.length != _NEXT_) { + throw new RuntimeException("Error in array definition"); + } + } + // Cannot be instantiated. private POP3Command() {}