geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r390524 [4/7] - in /geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail: authentication/ store/nntp/ store/nntp/newsrc/ store/pop3/ store/pop3/message/ store/pop3/response/ transport/nntp/ transport/smtp/ util/
Date Fri, 31 Mar 2006 22:24:56 GMT
Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java Fri Mar 31 14:24:52 2006
@@ -47,64 +47,84 @@
 import org.apache.geronimo.mail.util.SessionUtil;
 
 /**
- * Simple implementation of NNTP transport.  Just does plain RFC977-ish
- * delivery.
- * <p/>
- * There is no way to indicate failure for a given recipient (it's possible to have a
- * recipient address rejected).  The sun impl throws exceptions even if others successful),
- * but maybe we do a different way...
- * <p/>
- *
+ * Simple implementation of NNTP transport. Just does plain RFC977-ish delivery.
+ * <p/> There is no way to indicate failure for a given recipient (it's possible
+ * to have a recipient address rejected). The sun impl throws exceptions even if
+ * others successful), but maybe we do a different way... <p/>
+ * 
  * @version $Rev$ $Date$
  */
-public class NNTPConnection  {
+public class NNTPConnection {
 
     /**
      * constants for EOL termination
      */
     protected static final char CR = '\r';
+
     protected static final char LF = '\n';
 
     /**
      * property keys for protocol properties.
      */
     protected static final String MAIL_NNTP_AUTH = "auth";
+
     protected static final String MAIL_NNTP_PORT = "port";
+
     protected static final String MAIL_NNTP_TIMEOUT = "timeout";
+
     protected static final String MAIL_NNTP_SASL_REALM = "sasl.realm";
+
     protected static final String MAIL_NNTP_FACTORY_CLASS = "socketFactory.class";
+
     protected static final String MAIL_NNTP_FACTORY_FALLBACK = "fallback";
+
     protected static final String MAIL_NNTP_LOCALADDRESS = "localaddress";
+
     protected static final String MAIL_NNTP_LOCALPORT = "localport";
+
     protected static final String MAIL_NNTP_QUITWAIT = "quitwait";
+
     protected static final String MAIL_NNTP_FACTORY_PORT = "socketFactory.port";
+
     protected static final String MAIL_NNTP_ENCODE_TRACE = "encodetrace";
 
     protected static final int MIN_MILLIS = 1000 * 60;
+
     protected static final int TIMEOUT = MIN_MILLIS * 5;
+
     protected static final String DEFAULT_MAIL_HOST = "localhost";
+
     protected static final int DEFAULT_NNTP_PORT = 119;
 
     protected static final String AUTHENTICATION_PLAIN = "PLAIN";
+
     protected static final String AUTHENTICATION_LOGIN = "LOGIN";
+
     protected static final String AUTHENTICATION_CRAMMD5 = "CRAM-MD5";
+
     protected static final String AUTHENTICATION_DIGESTMD5 = "DIGEST-MD5";
 
     // the protocol in use (either nntp or nntp-post).
     String protocol;
+
     // the target host
     protected String host;
+
     // the target server port.
     protected int port;
 
-    // the connection socket...can be a plain socket or SSLSocket, if TLS is being used.
+    // the connection socket...can be a plain socket or SSLSocket, if TLS is
+    // being used.
     protected Socket socket;
 
-    // input stream used to read data.  If Sasl is in use, this might be other than the
+    // input stream used to read data. If Sasl is in use, this might be other
+    // than the
     // direct access to the socket input stream.
     protected InputStream inputStream;
+
     // the test reader wrapped around the input stream.
     protected BufferedReader in;
+
     // the other end of the connection pipeline.
     protected OutputStream outputStream;
 
@@ -113,9 +133,12 @@
 
     // the username we connect with
     protected String username;
+
     // the authentication password.
     protected String password;
-    // the target SASL realm (normally null unless explicitly set or we have an authentication mechanism that
+
+    // the target SASL realm (normally null unless explicitly set or we have an
+    // authentication mechanism that
     // requires it.
     protected String realm;
 
@@ -124,13 +147,16 @@
 
     // our attached session
     protected Session session;
+
     // our session provided debug output stream.
     protected PrintStream debugStream;
+
     // our debug flag (passed from the hosting transport)
     protected boolean debug;
 
     // list of authentication mechanisms supported by the server
     protected HashMap serverAuthenticationMechanisms;
+
     // map of server extension arguments
     protected HashMap serverExtensionArgs;
 
@@ -139,18 +165,25 @@
 
     /**
      * Normal constructor for an NNTPConnection() object.
-     *
-     * @param session  The attached session.
-     * @param host     The target host name of the NNTP server.
-     * @param port     The target listening port of the server.  Defaults to 119 if
-     *                 the port is specified as -1.
-     * @param username The login user name (can be null unless authentication is
-     *                 required).
-     * @param password Password associated with the userid account.  Can be null if
-     *                 authentication is not required.
-     * @param debug    The session debug flag.
+     * 
+     * @param session
+     *            The attached session.
+     * @param host
+     *            The target host name of the NNTP server.
+     * @param port
+     *            The target listening port of the server. Defaults to 119 if
+     *            the port is specified as -1.
+     * @param username
+     *            The login user name (can be null unless authentication is
+     *            required).
+     * @param password
+     *            Password associated with the userid account. Can be null if
+     *            authentication is not required.
+     * @param debug
+     *            The session debug flag.
      */
-    public NNTPConnection(String protocol, Session session, String host, int port, String username, String password, boolean debug) {
+    public NNTPConnection(String protocol, Session session, String host, int port, String username, String password,
+            boolean debug) {
         this.protocol = protocol;
         this.session = session;
         this.host = host;
@@ -163,10 +196,9 @@
         debugStream = session.getDebugOut();
     }
 
-
     /**
      * Connect to the server and do the initial handshaking.
-     *
+     * 
      * @exception MessagingException
      */
     public void connect() throws MessagingException {
@@ -186,11 +218,10 @@
         }
     }
 
-
     /**
-     * Close the connection.  On completion, we'll be disconnected from
-     * the server and unable to send more data.
-     *
+     * Close the connection. On completion, we'll be disconnected from the
+     * server and unable to send more data.
+     * 
      * @exception MessagingException
      */
     public void close() throws MessagingException {
@@ -202,34 +233,37 @@
             // say goodbye
             sendQuit();
         } finally {
-            // and close up the connection.  We do this in a finally block to make sure the connection
+            // and close up the connection. We do this in a finally block to
+            // make sure the connection
             // is shut down even if quit gets an error.
             closeServerConnection();
         }
     }
 
-
     /**
-     * Create a transport connection object and connect it to the
-     * target server.
-     *
+     * Create a transport connection object and connect it to the target server.
+     * 
      * @exception MessagingException
      */
-    protected void getConnection() throws IOException
-    {
-        // We might have been passed a socket to connect with...if not, we need to create one of the correct type.
+    protected void getConnection() throws IOException {
+        // We might have been passed a socket to connect with...if not, we need
+        // to create one of the correct type.
         if (socket == null) {
             getConnectedSocket();
         }
-        // if we already have a socket, get some information from it and override what we've been passed.
+        // if we already have a socket, get some information from it and
+        // override what we've been passed.
         else {
             port = socket.getPort();
             host = socket.getInetAddress().getHostName();
         }
 
         // now set up the input/output streams.
-        inputStream = new TraceInputStream(socket.getInputStream(), debugStream, debug, getBooleanProperty(MAIL_NNTP_ENCODE_TRACE, false)); ;
-        outputStream = new TraceOutputStream(socket.getOutputStream(), debugStream, debug, getBooleanProperty(MAIL_NNTP_ENCODE_TRACE, false));
+        inputStream = new TraceInputStream(socket.getInputStream(), debugStream, debug, getBooleanProperty(
+                MAIL_NNTP_ENCODE_TRACE, false));
+        ;
+        outputStream = new TraceOutputStream(socket.getOutputStream(), debugStream, debug, getBooleanProperty(
+                MAIL_NNTP_ENCODE_TRACE, false));
 
         // get a reader to read the input as lines
         in = new BufferedReader(new InputStreamReader(inputStream));
@@ -238,8 +272,7 @@
     /**
      * Close the server connection at termination.
      */
-    public void closeServerConnection()
-    {
+    public void closeServerConnection() {
         try {
             socket.close();
         } catch (IOException ignored) {
@@ -251,10 +284,9 @@
         in = null;
     }
 
-
     /**
      * Creates a connected socket
-     *
+     * 
      * @exception MessagingException
      */
     public void getConnectedSocket() throws IOException {
@@ -262,12 +294,13 @@
             debugOut("Attempting plain socket connection to server " + host + ":" + port);
         }
 
-
-        // the socket factory can be specified via a session property.  By default, we just directly
+        // the socket factory can be specified via a session property. By
+        // default, we just directly
         // instantiate a socket without using a factor.
         String socketFactory = getProperty(MAIL_NNTP_FACTORY_CLASS);
 
-        // there are several protocol properties that can be set to tune the created socket.  We need to
+        // there are several protocol properties that can be set to tune the
+        // created socket. We need to
         // retrieve those bits before creating the socket.
         int timeout = getIntProperty(MAIL_NNTP_TIMEOUT, -1);
         InetAddress localAddress = null;
@@ -282,7 +315,8 @@
 
         socket = null;
 
-        // if there is no socket factory defined (normal), we just create a socket directly.
+        // if there is no socket factory defined (normal), we just create a
+        // socket directly.
         if (socketFactory == null) {
             socket = new Socket(host, port, localAddress, localPort);
         }
@@ -298,32 +332,35 @@
                 ClassLoader loader = Thread.currentThread().getContextClassLoader();
                 Class factoryClass = loader.loadClass(socketFactory);
 
-                // done indirectly, we need to invoke the method using reflection.
+                // done indirectly, we need to invoke the method using
+                // reflection.
                 // This retrieves a factory instance.
                 Method getDefault = factoryClass.getMethod("getDefault", new Class[0]);
                 Object defFactory = getDefault.invoke(new Object(), new Object[0]);
 
-                // now that we have the factory, there are two different createSocket() calls we use,
+                // now that we have the factory, there are two different
+                // createSocket() calls we use,
                 // depending on whether we have a localAddress override.
 
                 if (localAddress != null) {
-                    // retrieve the createSocket(String, int, InetAddress, int) method.
+                    // retrieve the createSocket(String, int, InetAddress, int)
+                    // method.
                     Class[] createSocketSig = new Class[] { String.class, Integer.TYPE, InetAddress.class, Integer.TYPE };
                     Method createSocket = factoryClass.getMethod("createSocket", createSocketSig);
 
                     Object[] createSocketArgs = new Object[] { host, portArg, localAddress, new Integer(localPort) };
-                    socket = (Socket)createSocket.invoke(defFactory, createSocketArgs);
-                }
-                else {
+                    socket = (Socket) createSocket.invoke(defFactory, createSocketArgs);
+                } else {
                     // retrieve the createSocket(String, int) method.
                     Class[] createSocketSig = new Class[] { String.class, Integer.TYPE };
                     Method createSocket = factoryClass.getMethod("createSocket", createSocketSig);
 
                     Object[] createSocketArgs = new Object[] { host, portArg };
-                    socket = (Socket)createSocket.invoke(defFactory, createSocketArgs);
+                    socket = (Socket) createSocket.invoke(defFactory, createSocketArgs);
                 }
             } catch (Throwable e) {
-                // if a socket factor is specified, then we may need to fall back to a default.  This behavior
+                // if a socket factor is specified, then we may need to fall
+                // back to a default. This behavior
                 // is controlled by (surprise) more session properties.
                 if (getBooleanProperty(MAIL_NNTP_FACTORY_FALLBACK, false)) {
                     if (debug) {
@@ -331,19 +368,22 @@
                     }
                     socket = new Socket(host, port, localAddress, localPort);
                 }
-                // we have an exception.  We're going to throw an IOException, which may require unwrapping
+                // we have an exception. We're going to throw an IOException,
+                // which may require unwrapping
                 // or rewrapping the exception.
                 else {
-                    // we have an exception from the reflection, so unwrap the base exception
+                    // we have an exception from the reflection, so unwrap the
+                    // base exception
                     if (e instanceof InvocationTargetException) {
-                        e = ((InvocationTargetException)e).getTargetException();
+                        e = ((InvocationTargetException) e).getTargetException();
                     }
 
                     if (debug) {
                         debugOut("Plain socket creation failure", e);
                     }
 
-                    // throw this as an IOException, with the original exception attached.
+                    // throw this as an IOException, with the original exception
+                    // attached.
                     IOException ioe = new IOException("Error connecting to " + host + ", " + port);
                     ioe.initCause(e);
                     throw ioe;
@@ -370,8 +410,7 @@
         // remember we can post.
         if (line.getCode() == NNTPReply.POSTING_ALLOWED) {
             postingAllowed = true;
-        }
-        else {
+        } else {
             postingAllowed = false;
         }
 
@@ -386,12 +425,13 @@
      * Sends the QUIT message and receieves the response
      */
     public void sendQuit() throws MessagingException {
-        // there's yet another property that controls whether we should wait for a
-        // reply for a QUIT command.  If on, just send the command and get outta here.
+        // there's yet another property that controls whether we should wait for
+        // a
+        // reply for a QUIT command. If on, just send the command and get outta
+        // here.
         if (getBooleanProperty(MAIL_NNTP_QUITWAIT, false)) {
             sendLine("QUIT");
-        }
-        else {
+        } else {
             // handle as a real command...we're going to ignore the response.
             sendCommand("QUIT");
         }
@@ -399,9 +439,10 @@
 
     /**
      * Tell the server to switch to a named group.
-     *
-     * @param name   The name of the target group.
-     *
+     * 
+     * @param name
+     *            The name of the target group.
+     * 
      * @return The server response to the GROUP command.
      */
     public NNTPReply selectGroup(String name) throws MessagingException {
@@ -409,17 +450,17 @@
         return sendCommand("GROUP " + name);
     }
 
-
     /**
      * Ask the server what extensions it supports.
-     *
+     * 
      * @return True if the command was accepted ok, false for any errors.
      * @exception MessagingException
      */
     protected void getExtensions() throws MessagingException {
         NNTPReply reply = sendCommand("LIST EXTENSIONS", NNTPReply.EXTENSIONS_SUPPORTED);
 
-        // we get a 202 code back.  The first line is just a greeting, and extensions are deliverd as data
+        // we get a 202 code back. The first line is just a greeting, and
+        // extensions are deliverd as data
         // lines terminated with a "." line.
         if (reply.getCode() != NNTPReply.EXTENSIONS_SUPPORTED) {
             return;
@@ -435,24 +476,24 @@
         // process all of the continuation lines
         for (int i = 0; i < extensions.size(); i++) {
             // go process the extention
-            processExtension((String)extensions.get(i));
+            processExtension((String) extensions.get(i));
         }
     }
 
-
     /**
      * Process an extension string passed back as the EHLP response.
-     *
-     * @param extension The string value of the extension (which will be of the form
-     *                  "NAME arguments").
+     * 
+     * @param extension
+     *            The string value of the extension (which will be of the form
+     *            "NAME arguments").
      */
-    protected void processExtension(String extension)
-    {
+    protected void processExtension(String extension) {
         String extensionName = extension.toUpperCase();
         String argument = "";
 
         int delimiter = extension.indexOf(' ');
-        // if we have a keyword with arguments, parse them out and add to the argument map.
+        // if we have a keyword with arguments, parse them out and add to the
+        // argument map.
         if (delimiter != -1) {
             extensionName = extension.substring(0, delimiter).toUpperCase();
             argument = extension.substring(delimiter + 1);
@@ -478,31 +519,32 @@
         }
     }
 
-
     /**
-     * Retrieve any argument information associated with a extension
-     * reported back by the server on the EHLO command.
-     *
-     * @param name   The name of the target server extension.
-     *
-     * @return Any argument passed on a server extension.  Returns null if
-     *         the extension did not include an argument or the extension
-     *         was not supported.
+     * Retrieve any argument information associated with a extension reported
+     * back by the server on the EHLO command.
+     * 
+     * @param name
+     *            The name of the target server extension.
+     * 
+     * @return Any argument passed on a server extension. Returns null if the
+     *         extension did not include an argument or the extension was not
+     *         supported.
      */
     public String extensionParameter(String name) {
         if (serverExtensionArgs != null) {
-            return (String)serverExtensionArgs.get(name);
+            return (String) serverExtensionArgs.get(name);
         }
         return null;
     }
 
     /**
      * Tests whether the target server supports a named extension.
-     *
-     * @param name   The target extension name.
-     *
-     * @return true if the target server reported on the EHLO command that
-     *         is supports the targer server, false if the extension was not
+     * 
+     * @param name
+     *            The target extension name.
+     * 
+     * @return true if the target server reported on the EHLO command that is
+     *         supports the targer server, false if the extension was not
      *         supported.
      */
     public boolean supportsExtension(String name) {
@@ -510,26 +552,23 @@
         return extensionParameter(name) != null;
     }
 
-
     /**
-     * Determine if the target server supports a given authentication
-     * mechanism.
-     *
-     * @param mechanism The mechanism name.
-     *
+     * Determine if the target server supports a given authentication mechanism.
+     * 
+     * @param mechanism
+     *            The mechanism name.
+     * 
      * @return true if the server EHLO response indicates it supports the
      *         mechanism, false otherwise.
      */
-    protected boolean supportsAuthentication(String mechanism)
-    {
-       return serverAuthenticationMechanisms.get(mechanism) != null;
+    protected boolean supportsAuthentication(String mechanism) {
+        return serverAuthenticationMechanisms.get(mechanism) != null;
     }
 
-
     /**
-     * Sends the data in the message down the socket.  This presumes the
-     * server is in the right place and ready for getting the DATA message
-     * and the data right place in the sequence
+     * Sends the data in the message down the socket. This presumes the server
+     * is in the right place and ready for getting the DATA message and the data
+     * right place in the sequence
      */
     public synchronized void sendPost(Message msg) throws MessagingException {
 
@@ -540,16 +579,22 @@
             throw new MessagingException("Server rejected POST command: " + line);
         }
 
-        // we've received permission to send the data, so ask the message to write itself out.
+        // we've received permission to send the data, so ask the message to
+        // write itself out.
         try {
-            // the data content has two requirements we need to meet by filtering the
-            // output stream.  Requirement 1 is to conicalize any line breaks.  All line
+            // the data content has two requirements we need to meet by
+            // filtering the
+            // output stream. Requirement 1 is to conicalize any line breaks.
+            // All line
             // breaks will be transformed into properly formed CRLF sequences.
             //
-            // Requirement 2 is to perform byte-stuff for any line that begins with a "."
-            // so that data is not confused with the end-of-data marker (a "\r\n.\r\n" sequence.
+            // Requirement 2 is to perform byte-stuff for any line that begins
+            // with a "."
+            // so that data is not confused with the end-of-data marker (a
+            // "\r\n.\r\n" sequence.
             //
-            // The MIME output stream performs those two functions on behalf of the content
+            // The MIME output stream performs those two functions on behalf of
+            // the content
             // writer.
             OutputStream mimeOut = new MIMEOutputStream(outputStream);
 
@@ -565,8 +610,9 @@
         sendLine("");
         sendLine(".");
 
-        // use a longer time out here to give the server time to process the data.
-		line = new NNTPReply(receiveLine());
+        // use a longer time out here to give the server time to process the
+        // data.
+        line = new NNTPReply(receiveLine());
 
         if (line.getCode() != NNTPReply.POSTED_OK) {
             throw new MessagingException("Server rejected POST command: " + line);
@@ -574,15 +620,16 @@
     }
 
     /**
-     * Issue a command and retrieve the response.  If the given
-     * success indicator is received, the command is returning a longer
-     * response, terminated by a "crlf.crlf" sequence.  These lines
-     * are attached to the reply.
-     *
-     * @param command The command to issue.
-     * @param success The command reply that indicates additional data should be
-     *                retrieved.
-     *
+     * Issue a command and retrieve the response. If the given success indicator
+     * is received, the command is returning a longer response, terminated by a
+     * "crlf.crlf" sequence. These lines are attached to the reply.
+     * 
+     * @param command
+     *            The command to issue.
+     * @param success
+     *            The command reply that indicates additional data should be
+     *            retrieved.
+     * 
      * @return The command reply.
      */
     public synchronized NNTPReply sendCommand(String command, int success) throws MessagingException {
@@ -593,28 +640,31 @@
         return reply;
     }
 
-
     /**
-     * Send a command to the server, returning the first response line
-     * back as a reply.
-     *
-     * @param data   The data to send.
-     *
+     * Send a command to the server, returning the first response line back as a
+     * reply.
+     * 
+     * @param data
+     *            The data to send.
+     * 
      * @return A reply object with the reply line.
      * @exception MessagingException
      */
     public NNTPReply sendCommand(String data) throws MessagingException {
         sendLine(data);
         NNTPReply reply = getReply();
-        // did the server just inform us we need to authenticate?  The spec allows this
-        // response to be sent at any time, so we need to try to authenticate and then retry the command.
+        // did the server just inform us we need to authenticate? The spec
+        // allows this
+        // response to be sent at any time, so we need to try to authenticate
+        // and then retry the command.
         if (reply.getCode() == NNTPReply.AUTHINFO_REQUIRED || reply.getCode() == NNTPReply.AUTHINFO_SIMPLE_REQUIRED) {
             if (debug) {
                 debugOut("Authentication required received from server.");
             }
             // authenticate with the server, if necessary
             processAuthentication(reply.getCode());
-            // if we've safely authenticated, we can reissue the command and process the response.
+            // if we've safely authenticated, we can reissue the command and
+            // process the response.
             sendLine(data);
             reply = getReply();
         }
@@ -622,11 +672,12 @@
     }
 
     /**
-     * Send a command to the server, returning the first response line
-     * back as a reply.
-     *
-     * @param data   The data to send.
-     *
+     * Send a command to the server, returning the first response line back as a
+     * reply.
+     * 
+     * @param data
+     *            The data to send.
+     * 
      * @return A reply object with the reply line.
      * @exception MessagingException
      */
@@ -635,10 +686,8 @@
         return getReply();
     }
 
-
     /**
-     * Sends a  message down the socket and terminates with the
-     * appropriate CRLF
+     * Sends a message down the socket and terminates with the appropriate CRLF
      */
     public void sendLine(String data) throws MessagingException {
         if (socket == null || !socket.isConnected()) {
@@ -656,19 +705,19 @@
 
     /**
      * Get a reply line for an NNTP command.
-     *
+     * 
      * @return An NNTP reply object from the stream.
      */
     public NNTPReply getReply() throws MessagingException {
-		lastServerResponse = new NNTPReply(receiveLine());
+        lastServerResponse = new NNTPReply(receiveLine());
         return lastServerResponse;
     }
 
     /**
      * Retrieve the last response received from the NNTP server.
-     *
-     * @return The raw response string (including the error code) returned
-     *         from the NNTP server.
+     * 
+     * @return The raw response string (including the error code) returned from
+     *         the NNTP server.
      */
     public String getLastServerResponse() {
         if (lastServerResponse == null) {
@@ -677,12 +726,10 @@
         return lastServerResponse.getReply();
     }
 
-
-
     /**
-     * Receives one line from the server.  A line is a sequence of bytes
+     * Receives one line from the server. A line is a sequence of bytes
      * terminated by a CRLF
-     *
+     * 
      * @return the line from the server as String
      */
     public String receiveLine() throws MessagingException {
@@ -701,12 +748,11 @@
         }
     }
 
-
     /**
-     * Retrieve the SASL realm used for DIGEST-MD5 authentication.
-     * This will either be explicitly set, or retrieved using the
-     * mail.nntp.sasl.realm session property.
-     *
+     * Retrieve the SASL realm used for DIGEST-MD5 authentication. This will
+     * either be explicitly set, or retrieved using the mail.nntp.sasl.realm
+     * session property.
+     * 
      * @return The current realm information (which can be null).
      */
     public String getSASLRealm() {
@@ -717,23 +763,22 @@
         return realm;
     }
 
-
     /**
      * Explicitly set the SASL realm used for DIGEST-MD5 authenticaiton.
-     *
-     * @param name   The new realm name.
+     * 
+     * @param name
+     *            The new realm name.
      */
     public void setSASLRealm(String name) {
         realm = name;
     }
 
-
     /**
      * Authenticate with the server, if necessary (or possible).
      */
-    protected void processAuthentication(int request) throws MessagingException
-    {
-        // we need to authenticate, but we don't have userid/password information...fail this
+    protected void processAuthentication(int request) throws MessagingException {
+        // we need to authenticate, but we don't have userid/password
+        // information...fail this
         // immediately.
         if (username == null || password == null) {
             throw new MessagingException("Server requires user authentication");
@@ -741,19 +786,17 @@
 
         if (request == NNTPReply.AUTHINFO_SIMPLE_REQUIRED) {
             processAuthinfoSimple();
-        }
-        else {
+        } else {
             if (!processAuthinfoSasl()) {
                 processAuthinfoUser();
             }
         }
     }
 
-
     /**
-     * Process an AUTHINFO SIMPLE command.  Not widely used, but if
-     * the server asks for it, we can respond.
-     *
+     * Process an AUTHINFO SIMPLE command. Not widely used, but if the server
+     * asks for it, we can respond.
+     * 
      * @exception MessagingException
      */
     protected void processAuthinfoSimple() throws MessagingException {
@@ -767,14 +810,12 @@
         }
     }
 
-
     /**
-     * Process AUTHINFO GENERIC.  Right now, this appears not to be
-     * widely used and information on how the conversations are
-     * handled for different auth types is lacking, so right now,
-     * this just returns false to force the userid/password form
-     * to be used.
-     *
+     * Process AUTHINFO GENERIC. Right now, this appears not to be widely used
+     * and information on how the conversations are handled for different auth
+     * types is lacking, so right now, this just returns false to force the
+     * userid/password form to be used.
+     * 
      * @return Always returns false.
      * @exception MessagingException
      */
@@ -782,33 +823,29 @@
         return false;
     }
 
-
     /**
      * Process AUTHINFO SASL.
-     *
-     * @return Returns true if the server support a SASL authentication mechanism and
-     * accepted reponse challenges.
+     * 
+     * @return Returns true if the server support a SASL authentication
+     *         mechanism and accepted reponse challenges.
      * @exception MessagingException
      */
     protected boolean processAuthinfoSasl() throws MessagingException {
         ClientAuthenticator authenticator = null;
 
-        // now go through the progression of mechanisms we support, from the most secure to the
+        // now go through the progression of mechanisms we support, from the
+        // most secure to the
         // least secure.
 
         if (supportsAuthentication(AUTHENTICATION_DIGESTMD5)) {
             authenticator = new DigestMD5Authenticator(host, username, password, getSASLRealm());
-        }
-        else if (supportsAuthentication(AUTHENTICATION_CRAMMD5)) {
+        } else if (supportsAuthentication(AUTHENTICATION_CRAMMD5)) {
             authenticator = new CramMD5Authenticator(username, password);
-        }
-        else if (supportsAuthentication(AUTHENTICATION_LOGIN)) {
+        } else if (supportsAuthentication(AUTHENTICATION_LOGIN)) {
             authenticator = new LoginAuthenticator(username, password);
-        }
-        else if (supportsAuthentication(AUTHENTICATION_PLAIN)) {
+        } else if (supportsAuthentication(AUTHENTICATION_PLAIN)) {
             authenticator = new PlainAuthenticator(username, password);
-        }
-        else {
+        } else {
             // can't find a mechanism we support in common
             return false;
         }
@@ -817,7 +854,8 @@
             debugOut("Authenticating for user: " + username + " using " + authenticator.getMechanismName());
         }
 
-        // if the authenticator has some initial data, we compose a command containing the initial data.
+        // if the authenticator has some initial data, we compose a command
+        // containing the initial data.
         if (authenticator.hasInitialResponse()) {
             StringBuffer command = new StringBuffer();
             // the auth command initiates the handshaking.
@@ -841,13 +879,15 @@
             sendLine(command.toString());
         }
 
-        // now process the challenge sequence.  We get a 235 response back when the server accepts the
+        // now process the challenge sequence. We get a 235 response back when
+        // the server accepts the
         // authentication, and a 334 indicates we have an additional challenge.
         while (true) {
             // get the next line, and if it is an error response, return now.
             NNTPReply line = getReply();
 
-            // if we get a completion return, we've passed muster, so give an authentication response.
+            // if we get a completion return, we've passed muster, so give an
+            // authentication response.
             if (line.getCode() == NNTPReply.AUTHINFO_ACCEPTED || line.getCode() == NNTPReply.AUTHINFO_ACCEPTED_FINAL) {
                 if (debug) {
                     debugOut("Successful SMTP authentication");
@@ -856,7 +896,8 @@
             }
             // we have an additional challenge to process.
             else if (line.getCode() == NNTPReply.AUTHINFO_CHALLENGE) {
-                // Does the authenticator think it is finished?  We can't answer an additional challenge,
+                // Does the authenticator think it is finished? We can't answer
+                // an additional challenge,
                 // so fail this.
                 if (authenticator.isComplete()) {
                     if (debug) {
@@ -868,10 +909,12 @@
                 // we're passed back a challenge value, Base64 encoded.
                 byte[] challenge = Base64.decode(line.getMessage().getBytes());
 
-                // have the authenticator evaluate and send back the encoded response.
+                // have the authenticator evaluate and send back the encoded
+                // response.
                 sendLine(new String(Base64.encode(authenticator.evaluateChallenge(challenge))));
             }
-            // completion or challenge are the only responses we know how to handle.  Anything else must
+            // completion or challenge are the only responses we know how to
+            // handle. Anything else must
             // be a failure.
             else {
                 if (debug) {
@@ -882,10 +925,10 @@
         }
     }
 
-
     /**
-     * Process an AUTHINFO USER command.  Most common form of NNTP authentication.
-     *
+     * Process an AUTHINFO USER command. Most common form of NNTP
+     * authentication.
+     * 
      * @exception MessagingException
      */
     protected void processAuthinfoUser() throws MessagingException {
@@ -898,7 +941,7 @@
         if (reply.getCode() != NNTPReply.AUTHINFO_CONTINUE) {
             throw new MessagingException("Error authenticating with server using AUTHINFO USER: " + reply);
         }
-        // now send the password.  We expect an accepted response.
+        // now send the password. We expect an accepted response.
         reply = sendAuthCommand("AUTHINFO PASS " + password);
         if (reply.getCode() != NNTPReply.AUTHINFO_ACCEPTED) {
             throw new MessagingException("Error authenticating with server using AUTHINFO SIMPLE");
@@ -907,8 +950,9 @@
 
     /**
      * Internal debug output routine.
-     *
-     * @param value  The string value to output.
+     * 
+     * @param value
+     *            The string value to output.
      */
     protected void debugOut(String message) {
         debugStream.println("NNTPTransport DEBUG: " + message);
@@ -916,9 +960,11 @@
 
     /**
      * Internal debugging routine for reporting exceptions.
-     *
-     * @param message A message associated with the exception context.
-     * @param e       The received exception.
+     * 
+     * @param message
+     *            A message associated with the exception context.
+     * @param e
+     *            The received exception.
      */
     protected void debugOut(String message, Throwable e) {
         debugOut("Received exception -> " + message);
@@ -926,10 +972,9 @@
         e.printStackTrace(debugStream);
     }
 
-
     /**
      * Indicate whether posting is allowed for a given server.
-     *
+     * 
      * @return True if the server allows posting, false if the server is
      *         read-only.
      */
@@ -937,92 +982,98 @@
         return postingAllowed;
     }
 
-
     /**
      * Retrieve the welcome string sent back from the server.
-     *
+     * 
      * @return The server provided welcome string.
      */
     public String getWelcomeString() {
         return welcomeString;
     }
 
-
     /**
      * Return the server host for this connection.
-     *
+     * 
      * @return The String name of the server host.
      */
     public String getHost() {
         return host;
     }
 
-
     /**
      * Get a property associated with this mail protocol.
-     *
-     * @param name   The name of the property.
-     *
-     * @return The property value (returns null if the property has not been set).
+     * 
+     * @param name
+     *            The name of the property.
+     * 
+     * @return The property value (returns null if the property has not been
+     *         set).
      */
     String getProperty(String name) {
-        // the name we're given is the least qualified part of the name.  We construct the full property name
+        // the name we're given is the least qualified part of the name. We
+        // construct the full property name
         // using the protocol (either "nntp" or "nntp-post").
         String fullName = "mail." + protocol + "." + name;
         return session.getProperty(fullName);
     }
 
     /**
-     * Get a property associated with this mail session.  Returns
-     * the provided default if it doesn't exist.
-     *
-     * @param name   The name of the property.
+     * Get a property associated with this mail session. Returns the provided
+     * default if it doesn't exist.
+     * 
+     * @param name
+     *            The name of the property.
      * @param defaultValue
-     *               The default value to return if the property doesn't exist.
-     *
-     * @return The property value (returns defaultValue if the property has not been set).
+     *            The default value to return if the property doesn't exist.
+     * 
+     * @return The property value (returns defaultValue if the property has not
+     *         been set).
      */
     String getProperty(String name, String defaultValue) {
-        // the name we're given is the least qualified part of the name.  We construct the full property name
+        // the name we're given is the least qualified part of the name. We
+        // construct the full property name
         // using the protocol (either "nntp" or "nntp-post").
         String fullName = "mail." + protocol + "." + name;
         return SessionUtil.getProperty(session, fullName, defaultValue);
     }
 
-
     /**
-     * Get a property associated with this mail session as an integer value.  Returns
-     * the default value if the property doesn't exist or it doesn't have a valid int value.
-     *
-     * @param name   The name of the property.
+     * Get a property associated with this mail session as an integer value.
+     * Returns the default value if the property doesn't exist or it doesn't
+     * have a valid int value.
+     * 
+     * @param name
+     *            The name of the property.
      * @param defaultValue
-     *               The default value to return if the property doesn't exist.
-     *
+     *            The default value to return if the property doesn't exist.
+     * 
      * @return The property value converted to an int.
      */
     int getIntProperty(String name, int defaultValue) {
-        // the name we're given is the least qualified part of the name.  We construct the full property name
+        // the name we're given is the least qualified part of the name. We
+        // construct the full property name
         // using the protocol (either "nntp" or "nntp-post").
         String fullName = "mail." + protocol + "." + name;
         return SessionUtil.getIntProperty(session, fullName, defaultValue);
     }
 
-
     /**
-     * Get a property associated with this mail session as an boolean value.  Returns
-     * the default value if the property doesn't exist or it doesn't have a valid int value.
-     *
-     * @param name   The name of the property.
+     * Get a property associated with this mail session as an boolean value.
+     * Returns the default value if the property doesn't exist or it doesn't
+     * have a valid int value.
+     * 
+     * @param name
+     *            The name of the property.
      * @param defaultValue
-     *               The default value to return if the property doesn't exist.
-     *
+     *            The default value to return if the property doesn't exist.
+     * 
      * @return The property value converted to a boolean
      */
     boolean getBooleanProperty(String name, boolean defaultValue) {
-        // the name we're given is the least qualified part of the name.  We construct the full property name
+        // the name we're given is the least qualified part of the name. We
+        // construct the full property name
         // using the protocol (either "nntp" or "nntp-post").
         String fullName = "mail." + protocol + "." + name;
         return SessionUtil.getBooleanProperty(session, fullName, defaultValue);
     }
 }
-

Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPReply.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPReply.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPReply.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPReply.java Fri Mar 31 14:24:52 2006
@@ -16,10 +16,9 @@
  */
 
 package org.apache.geronimo.javamail.transport.nntp;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.BufferedReader;
 
+import java.io.BufferedReader;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -27,71 +26,102 @@
 
 /**
  * Util class to represent a reply from a NNTP server
- *
+ * 
  * @version $Rev$ $Date$
  */
 public class NNTPReply {
     // general server responses
     public static final int POSTING_ALLOWED = 200;
+
     public static final int NO_POSTING_ALLOWED = 201;
+
     public static final int EXTENSIONS_SUPPORTED = 202;
 
     public static final int SERVICE_DISCONTINUED = 400;
+
     public static final int COMMAND_NOT_RECOGNIZED = 500;
+
     public static final int COMMAND_SYNTAX_ERROR = 501;
+
     public static final int PERMISSION_DENIED = 502;
+
     public static final int PROGRAM_FAULT = 503;
 
     // article responses
-    public static final int ARTICLE_FOLLOWS   = 220;
-    public static final int HEAD_FOLLOWS      = 221;
-    public static final int BODY_FOLLOWS      = 222;
+    public static final int ARTICLE_FOLLOWS = 220;
+
+    public static final int HEAD_FOLLOWS = 221;
+
+    public static final int BODY_FOLLOWS = 222;
+
     public static final int REQUEST_TEXT_SEPARATELY = 223;
-    public static final int OVERVIEW_FOLLOWS  = 224;
-    public static final int NEW_ARTICLES_FOLLOWS  = 230;
-    public static final int NEW_GROUPS_FOLLOWS    = 231;
-    public static final int ARTICLE_TRANSFERRED   = 235;
+
+    public static final int OVERVIEW_FOLLOWS = 224;
+
+    public static final int NEW_ARTICLES_FOLLOWS = 230;
+
+    public static final int NEW_GROUPS_FOLLOWS = 231;
+
+    public static final int ARTICLE_TRANSFERRED = 235;
 
     public static final int NO_NEWSGROUP_SELECTED = 412;
+
     public static final int NO_ARTICLE_SELECTED = 420;
-    public static final int NO_ARTICLE_NUMBER   = 423;
-    public static final int NO_ARTICLE_FOUND    = 430;
+
+    public static final int NO_ARTICLE_NUMBER = 423;
+
+    public static final int NO_ARTICLE_FOUND = 430;
 
     // group responses
     public static final int GROUP_SELECTED = 211;
+
     public static final int NO_SUCH_NEWSGROUP = 411;
 
     // post responses
     public static final int POSTED_OK = 240;
+
     public static final int SEND_ARTICLE = 340;
+
     public static final int POSTING_NOT_ALLOWED = 440;
+
     public static final int POSTING_FAILED = 441;
 
     // quit responses
     public static final int CLOSING_CONNECTION = 205;
 
     // authentication responses
-    public static final int AUTHINFO_ACCEPTED        = 250;
-    public static final int AUTHINFO_ACCEPTED_FINAL  = 251;
-    public static final int AUTHINFO_CONTINUE        = 350;
-    public static final int AUTHINFO_CHALLENGE       = 350;
+    public static final int AUTHINFO_ACCEPTED = 250;
+
+    public static final int AUTHINFO_ACCEPTED_FINAL = 251;
+
+    public static final int AUTHINFO_CONTINUE = 350;
+
+    public static final int AUTHINFO_CHALLENGE = 350;
+
     public static final int AUTHINFO_SIMPLE_REJECTED = 402;
+
     public static final int AUTHENTICATION_ACCEPTED = 281;
+
     public static final int MORE_AUTHENTICATION_REQUIRED = 381;
+
     public static final int AUTHINFO_REQUIRED = 480;
+
     public static final int AUTHINFO_SIMPLE_REQUIRED = 450;
+
     public static final int AUTHENTICATION_REJECTED = 482;
 
     // list active reponses
-    public static final int LIST_FOLLOWS             = 215;
-
+    public static final int LIST_FOLLOWS = 215;
 
     // The original reply string
     private final String reply;
+
     // returned message code
     private final int code;
+
     // the returned message text
     private final String message;
+
     // data associated with a long response command.
     private ArrayList data;
 
@@ -99,9 +129,11 @@
         // save the reply
         reply = s;
 
-        // In a normal response, the first 3 must be the return code.  However,
-        // the response back from a QUIT command is frequently a null string.  Therefore, if the result is
-        // too short, just default the code to -1 and use the entire text for the message.
+        // In a normal response, the first 3 must be the return code. However,
+        // the response back from a QUIT command is frequently a null string.
+        // Therefore, if the result is
+        // too short, just default the code to -1 and use the entire text for
+        // the message.
         if (s == null || s.length() < 3) {
             code = -1;
             message = s;
@@ -111,7 +143,8 @@
         try {
             code = Integer.parseInt(s.substring(0, 3));
 
-            // message should be separated by a space OR a continuation character if this is a
+            // message should be separated by a space OR a continuation
+            // character if this is a
             // multi-line response.
             if (s.length() > 4) {
                 message = s.substring(4);
@@ -124,11 +157,11 @@
     }
 
     /**
-     * Retrieve data associated with a multi-line reponse from
-     * a server stream.
-     *
-     * @param in     The reader that's the source of the additional lines.
-     *
+     * Retrieve data associated with a multi-line reponse from a server stream.
+     * 
+     * @param in
+     *            The reader that's the source of the additional lines.
+     * 
      * @exception IOException
      */
     public void retrieveData(BufferedReader in) throws MessagingException {
@@ -136,9 +169,11 @@
             data = new ArrayList();
 
             String line = in.readLine();
-            // read until the end of file or until we see the end of data marker.
+            // read until the end of file or until we see the end of data
+            // marker.
             while (line != null && !line.equals(".")) {
-                // this line is not the terminator, but it may have been byte stuffed.  If it starts with
+                // this line is not the terminator, but it may have been byte
+                // stuffed. If it starts with
                 // '.', throw away the leading one.
                 if (line.startsWith(".")) {
                     line = line.substring(1);
@@ -155,17 +190,16 @@
 
     /**
      * Retrieve the long-command data from this response.
-     *
-     * @return The data list.  Returns null if there is no associated data.
+     * 
+     * @return The data list. Returns null if there is no associated data.
      */
     public List getData() {
         return data;
     }
 
-
     /**
      * Return the code value associated with the reply.
-     *
+     * 
      * @return The integer code associated with the reply.
      */
     public int getCode() {
@@ -174,7 +208,7 @@
 
     /**
      * Get the message text associated with the reply.
-     *
+     * 
      * @return The string value of the message from the reply.
      */
     public String getMessage() {
@@ -183,13 +217,12 @@
 
     /**
      * Retrieve the raw reply string for the reponse.
-     *
+     * 
      * @return The original reply string from the server.
      */
     public String getReply() {
         return reply;
     }
-
 
     /**
      * Indicates if reply is an error condition

Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPTransport.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPTransport.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPTransport.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPTransport.java Fri Mar 31 14:24:52 2006
@@ -34,14 +34,11 @@
 import org.apache.geronimo.mail.util.SessionUtil;
 
 /**
- * Simple implementation of NNTP transport.  Just does plain RFC977-ish
- * delivery.
- * <p/>
- * There is no way to indicate failure for a given recipient (it's possible to have a
- * recipient address rejected).  The sun impl throws exceptions even if others successful),
- * but maybe we do a different way...
- * <p/>
- *
+ * Simple implementation of NNTP transport. Just does plain RFC977-ish delivery.
+ * <p/> There is no way to indicate failure for a given recipient (it's possible
+ * to have a recipient address rejected). The sun impl throws exceptions even if
+ * others successful), but maybe we do a different way... <p/>
+ * 
  * @version $Rev$ $Date$
  */
 public class NNTPTransport extends Transport {
@@ -50,7 +47,9 @@
      * property keys for protocol properties.
      */
     protected static final String NNTP_AUTH = "auth";
+
     protected static final String NNTP_PORT = "port";
+
     protected static final String NNTP_FROM = "from";
 
     protected static final String protocol = "nntp-post";
@@ -63,14 +62,14 @@
     // our session provided debug output stream.
     protected PrintStream debugStream;
 
-
     /**
-     * Normal constructor for an NNTPTransport() object.  This
-     * constructor is used to build a transport instance for the
-     * "smtp" protocol.
-     *
-     * @param session The attached session.
-     * @param name    An optional URLName object containing target information.
+     * Normal constructor for an NNTPTransport() object. This constructor is
+     * used to build a transport instance for the "smtp" protocol.
+     * 
+     * @param session
+     *            The attached session.
+     * @param name
+     *            An optional URLName object containing target information.
      */
     public NNTPTransport(Session session, URLName name) {
         super(session, name);
@@ -79,63 +78,73 @@
         debugStream = session.getDebugOut();
     }
 
-
     /**
-     * Do the protocol connection for an NNTP transport.  This
-     * handles server authentication, if possible.  Returns false if
-     * unable to connect to the server.
-     *
-     * @param host     The target host name.
-     * @param port     The server port number.
-     * @param user     The authentication user (if any).
-     * @param password The server password.  Might not be sent directly if more
-     *                 sophisticated authentication is used.
-     *
-     * @return true if we were able to connect to the server properly, false
-     *         for any failures.
+     * Do the protocol connection for an NNTP transport. This handles server
+     * authentication, if possible. Returns false if unable to connect to the
+     * server.
+     * 
+     * @param host
+     *            The target host name.
+     * @param port
+     *            The server port number.
+     * @param user
+     *            The authentication user (if any).
+     * @param password
+     *            The server password. Might not be sent directly if more
+     *            sophisticated authentication is used.
+     * 
+     * @return true if we were able to connect to the server properly, false for
+     *         any failures.
      * @exception MessagingException
      */
-    protected boolean protocolConnect(String host, int port, String username, String password) throws MessagingException
-    {
+    protected boolean protocolConnect(String host, int port, String username, String password)
+            throws MessagingException {
         if (debug) {
             debugOut("Connecting to server " + host + ":" + port + " for user " + username);
         }
 
-        // first check to see if we need to authenticate.  If we need this, then we must have a username and
-        // password specified.  Failing this may result in a user prompt to collect the information.
+        // first check to see if we need to authenticate. If we need this, then
+        // we must have a username and
+        // password specified. Failing this may result in a user prompt to
+        // collect the information.
         boolean mustAuthenticate = SessionUtil.getBooleanProperty(session, NNTP_AUTH, false);
 
-        // if we need to authenticate, and we don't have both a userid and password, then we fail this
-        // immediately.  The Service.connect() method will try to obtain the user information and retry the
+        // if we need to authenticate, and we don't have both a userid and
+        // password, then we fail this
+        // immediately. The Service.connect() method will try to obtain the user
+        // information and retry the
         // connection one time.
         if (mustAuthenticate && (username == null || password == null)) {
             return false;
         }
 
-
-        // if the port is defaulted, then see if we have something configured in the session.
+        // if the port is defaulted, then see if we have something configured in
+        // the session.
         // if not configured, we just use the default default.
         if (port == -1) {
-            // check for a property and fall back on the default if it's not set.
+            // check for a property and fall back on the default if it's not
+            // set.
             port = SessionUtil.getIntProperty(session, NNTP_PORT, DEFAULT_NNTP_PORT);
         }
 
-
         // create socket and connect to server.
         connection = new NNTPConnection(protocol, session, host, port, username, password, debug);
         connection.connect();
 
-        // we're going to return success here, but in truth, the server may end up asking for our
+        // we're going to return success here, but in truth, the server may end
+        // up asking for our
         // bonafides at any time, and we'll be expected to authenticate then.
         return true;
     }
 
     /**
      * Send a message to multiple addressees.
-     *
-     * @param message   The message we're sending.
-     * @param addresses An array of addresses to send to.
-     *
+     * 
+     * @param message
+     *            The message we're sending.
+     * @param addresses
+     *            An array of addresses to send to.
+     * 
      * @exception MessagingException
      */
     public void sendMessage(Message message, Address[] addresses) throws MessagingException {
@@ -151,7 +160,8 @@
             throw new MessagingException("Null message");
         }
 
-        // NNTP only handles instances of MimeMessage, not the more general message case.
+        // NNTP only handles instances of MimeMessage, not the more general
+        // message case.
         if (!(message instanceof MimeMessage)) {
             throw new MessagingException("NNTP can only send MimeMessages");
         }
@@ -159,10 +169,10 @@
         // need to sort the from value out from a variety of sources.
         InternetAddress from = null;
 
-
         Address[] fromAddresses = message.getFrom();
 
-        // If the message has a From address set, we just use that.  Otherwise, we set a From using
+        // If the message has a From address set, we just use that. Otherwise,
+        // we set a From using
         // the property version, if available.
         if (fromAddresses == null || fromAddresses.length == 0) {
             // the from value can be set explicitly as a property
@@ -179,7 +189,8 @@
 
         boolean haveGroup = false;
 
-        // enforce the requirement that all of the targets are NewsAddress instances.
+        // enforce the requirement that all of the targets are NewsAddress
+        // instances.
         for (int i = 0; i < addresses.length; i++) {
             if (!(addresses[i] instanceof NewsAddress)) {
                 System.out.println("Illegal address is of class " + addresses[i].getClass());
@@ -187,13 +198,15 @@
             }
         }
 
-
-        // event notifcation requires we send lists of successes and failures broken down by category.
+        // event notifcation requires we send lists of successes and failures
+        // broken down by category.
         // The categories are:
         //
         // 1) addresses successfully processed.
-        // 2) addresses deemed valid, but had a processing failure that prevented sending.
-        // 3) addressed deemed invalid (basically all other processing failures).
+        // 2) addresses deemed valid, but had a processing failure that
+        // prevented sending.
+        // 3) addressed deemed invalid (basically all other processing
+        // failures).
         ArrayList sentAddresses = new ArrayList();
         ArrayList unsentAddresses = new ArrayList();
         ArrayList invalidAddresses = new ArrayList();
@@ -204,13 +217,12 @@
         for (int i = 0; i < addresses.length; i++) {
             try {
                 // select the target news group
-                NNTPReply reply = connection.selectGroup(((NewsAddress)addresses[i]).getNewsgroup());
+                NNTPReply reply = connection.selectGroup(((NewsAddress) addresses[i]).getNewsgroup());
 
                 if (reply.getCode() != NNTPReply.GROUP_SELECTED) {
                     invalidAddresses.add(addresses[i]);
                     sendFailure = true;
-                }
-                else {
+                } else {
                     // send data
                     connection.sendPost(message);
                     sentAddresses.add(addresses[i]);
@@ -221,18 +233,18 @@
             }
         }
 
-        // create our lists for notification and exception reporting from this point on.
-        Address[] sent = (Address[])sentAddresses.toArray(new Address[0]);
-        Address[] unsent = (Address[])unsentAddresses.toArray(new Address[0]);
-        Address[] invalid = (Address[])invalidAddresses.toArray(new Address[0]);
+        // create our lists for notification and exception reporting from this
+        // point on.
+        Address[] sent = (Address[]) sentAddresses.toArray(new Address[0]);
+        Address[] unsent = (Address[]) unsentAddresses.toArray(new Address[0]);
+        Address[] invalid = (Address[]) invalidAddresses.toArray(new Address[0]);
 
         if (sendFailure) {
             // did we deliver anything at all?
             if (sent.length == 0) {
                 // notify of the error.
                 notifyTransportListeners(TransportEvent.MESSAGE_NOT_DELIVERED, sent, unsent, invalid, message);
-            }
-            else {
+            } else {
                 // notify that we delivered at least part of this
                 notifyTransportListeners(TransportEvent.MESSAGE_PARTIALLY_DELIVERED, sent, unsent, invalid, message);
             }
@@ -244,24 +256,24 @@
         notifyTransportListeners(TransportEvent.MESSAGE_DELIVERED, sent, unsent, invalid, message);
     }
 
-
     /**
-     * Close the connection.  On completion, we'll be disconnected from
-     * the server and unable to send more data.
-     *
+     * Close the connection. On completion, we'll be disconnected from the
+     * server and unable to send more data.
+     * 
      * @exception MessagingException
      */
     public void close() throws MessagingException {
-		// This is done to ensure proper event notification.
-		super.close();
+        // This is done to ensure proper event notification.
+        super.close();
         connection.close();
         connection = null;
     }
 
     /**
      * Internal debug output routine.
-     *
-     * @param value  The string value to output.
+     * 
+     * @param value
+     *            The string value to output.
      */
     protected void debugOut(String message) {
         debugStream.println("NNTPTransport DEBUG: " + message);
@@ -269,9 +281,11 @@
 
     /**
      * Internal debugging routine for reporting exceptions.
-     *
-     * @param message A message associated with the exception context.
-     * @param e       The received exception.
+     * 
+     * @param message
+     *            A message associated with the exception context.
+     * @param e
+     *            The received exception.
      */
     protected void debugOut(String message, Throwable e) {
         debugOut("Received exception -> " + message);
@@ -279,69 +293,78 @@
         e.printStackTrace(debugStream);
     }
 
-
     /**
      * Get a property associated with this mail protocol.
-     *
-     * @param name   The name of the property.
-     *
-     * @return The property value (returns null if the property has not been set).
+     * 
+     * @param name
+     *            The name of the property.
+     * 
+     * @return The property value (returns null if the property has not been
+     *         set).
      */
     String getProperty(String name) {
-        // the name we're given is the least qualified part of the name.  We construct the full property name
+        // the name we're given is the least qualified part of the name. We
+        // construct the full property name
         // using the protocol (either "nntp" or "nntp-post").
         String fullName = "mail." + protocol + "." + name;
         return session.getProperty(fullName);
     }
 
     /**
-     * Get a property associated with this mail session.  Returns
-     * the provided default if it doesn't exist.
-     *
-     * @param name   The name of the property.
+     * Get a property associated with this mail session. Returns the provided
+     * default if it doesn't exist.
+     * 
+     * @param name
+     *            The name of the property.
      * @param defaultValue
-     *               The default value to return if the property doesn't exist.
-     *
-     * @return The property value (returns defaultValue if the property has not been set).
+     *            The default value to return if the property doesn't exist.
+     * 
+     * @return The property value (returns defaultValue if the property has not
+     *         been set).
      */
     String getProperty(String name, String defaultValue) {
-        // the name we're given is the least qualified part of the name.  We construct the full property name
+        // the name we're given is the least qualified part of the name. We
+        // construct the full property name
         // using the protocol (either "nntp" or "nntp-post").
         String fullName = "mail." + protocol + "." + name;
         return SessionUtil.getProperty(session, fullName, defaultValue);
     }
 
-
     /**
-     * Get a property associated with this mail session as an integer value.  Returns
-     * the default value if the property doesn't exist or it doesn't have a valid int value.
-     *
-     * @param name   The name of the property.
+     * Get a property associated with this mail session as an integer value.
+     * Returns the default value if the property doesn't exist or it doesn't
+     * have a valid int value.
+     * 
+     * @param name
+     *            The name of the property.
      * @param defaultValue
-     *               The default value to return if the property doesn't exist.
-     *
+     *            The default value to return if the property doesn't exist.
+     * 
      * @return The property value converted to an int.
      */
     int getIntProperty(String name, int defaultValue) {
-        // the name we're given is the least qualified part of the name.  We construct the full property name
+        // the name we're given is the least qualified part of the name. We
+        // construct the full property name
         // using the protocol (either "nntp" or "nntp-post").
         String fullName = "mail." + protocol + "." + name;
         return SessionUtil.getIntProperty(session, fullName, defaultValue);
     }
 
-
     /**
-     * Get a property associated with this mail session as an boolean value.  Returns
-     * the default value if the property doesn't exist or it doesn't have a valid int value.
-     *
-     * @param name   The name of the property.
+     * Get a property associated with this mail session as an boolean value.
+     * Returns the default value if the property doesn't exist or it doesn't
+     * have a valid int value.
+     * 
+     * @param name
+     *            The name of the property.
      * @param defaultValue
-     *               The default value to return if the property doesn't exist.
-     *
+     *            The default value to return if the property doesn't exist.
+     * 
      * @return The property value converted to a boolean
      */
     boolean getBooleanProperty(String name, boolean defaultValue) {
-        // the name we're given is the least qualified part of the name.  We construct the full property name
+        // the name we're given is the least qualified part of the name. We
+        // construct the full property name
         // using the protocol (either "nntp" or "nntp-post").
         String fullName = "mail." + protocol + "." + name;
         return SessionUtil.getBooleanProperty(session, fullName, defaultValue);

Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/StringListInputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/StringListInputStream.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/StringListInputStream.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/nntp/StringListInputStream.java Fri Mar 31 14:24:52 2006
@@ -16,7 +16,6 @@
  */
 package org.apache.geronimo.javamail.transport.nntp;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
@@ -28,13 +27,18 @@
 public class StringListInputStream extends InputStream {
     // the list of lines we're reading from
     protected List lines;
+
     // the next line to process.
     protected int nextLine = 0;
+
     // current buffer of bytes to read from
     byte[] buffer;
+
     // current offset within the buffer;
     int offset;
-    // indicator that we've left off at a split between the CR and LF of a line break.
+
+    // indicator that we've left off at a split between the CR and LF of a line
+    // break.
     boolean atLineBreak = false;
 
     public StringListInputStream(List lines) throws IOException {
@@ -51,20 +55,21 @@
     }
 
     /**
-     * Just override the single byte read version, which handles all
-     * of the lineend markers correctly.
-     *
+     * Just override the single byte read version, which handles all of the
+     * lineend markers correctly.
+     * 
      * @return The next byte from the stream or -1 if we've hit the EOF.
      */
     public int read() throws IOException {
         // leave off at the split between a line?
         if (atLineBreak) {
-            // flip this off and return the second line end character.  Also step to the next line.
+            // flip this off and return the second line end character. Also step
+            // to the next line.
             atLineBreak = false;
             nextBuffer();
             return '\n';
         }
-        // gone past the end?  Got an EOF
+        // gone past the end? Got an EOF
         if (buffer == null) {
             return -1;
         }
@@ -82,17 +87,16 @@
 
     /**
      * Step to the next buffer of string data.
-     *
+     * 
      * @exception IOException
      */
     protected void nextBuffer() throws IOException {
         // give an eof check.
         if (nextLine >= lines.size()) {
             buffer = null;
-        }
-        else {
+        } else {
             try {
-                String next = (String)lines.get(nextLine++);
+                String next = (String) lines.get(nextLine++);
                 buffer = next.getBytes("US-ASCII");
 
             } catch (UnsupportedEncodingException e) {
@@ -103,4 +107,3 @@
         offset = 0;
     }
 }
-

Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java Fri Mar 31 14:24:52 2006
@@ -22,7 +22,7 @@
  * 
  * @version $Rev$ $Date$
  */
-class MalformedSMTPReplyException  extends Exception {
+class MalformedSMTPReplyException extends Exception {
     MalformedSMTPReplyException() {
         super();
     }

Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressFailedException.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressFailedException.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressFailedException.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressFailedException.java Fri Mar 31 14:24:52 2006
@@ -18,25 +18,29 @@
 package org.apache.geronimo.javamail.transport.smtp;
 
 import javax.mail.MessagingException;
-import javax.mail.Address;
 import javax.mail.internet.InternetAddress;
 
-
 public class SMTPAddressFailedException extends MessagingException {
     // the failing address
     InternetAddress addr;
+
     // the failing command
     protected String cmd;
+
     // the error code for the failure
     protected int rc;
 
     /**
      * Constructor for an SMTPAddressFailingException.
-     *
-     * @param addr   The failing address.
-     * @param cmd    The failing command string.
-     * @param rc     The error code for the command.
-     * @param err    An error message for the exception.
+     * 
+     * @param addr
+     *            The failing address.
+     * @param cmd
+     *            The failing command string.
+     * @param rc
+     *            The error code for the command.
+     * @param err
+     *            An error message for the exception.
      */
     SMTPAddressFailedException(InternetAddress addr, java.lang.String cmd, int rc, java.lang.String err) {
         super(err);
@@ -47,7 +51,7 @@
 
     /**
      * Get the failing command string for the exception.
-     *
+     * 
      * @return The string value of the failing command.
      */
     public String getCommand() {
@@ -56,7 +60,7 @@
 
     /**
      * The failing command return code.
-     *
+     * 
      * @return The failure return code.
      */
     public int getReturnCode() {
@@ -65,12 +69,10 @@
 
     /**
      * Retrieve the internet address associated with this exception.
-     *
+     * 
      * @return The provided InternetAddress object.
      */
     public InternetAddress getAddress() {
         return addr;
     }
 }
-
-

Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressSucceededException.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressSucceededException.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressSucceededException.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressSucceededException.java Fri Mar 31 14:24:52 2006
@@ -18,25 +18,29 @@
 package org.apache.geronimo.javamail.transport.smtp;
 
 import javax.mail.MessagingException;
-import javax.mail.Address;
 import javax.mail.internet.InternetAddress;
 
-
 public class SMTPAddressSucceededException extends MessagingException {
     // the succeeding address
     InternetAddress addr;
+
     // the failing command
     protected String cmd;
+
     // the error code for the failure
     protected int rc;
 
     /**
      * Constructor for an SMTPAddressSucceededException.
-     *
-     * @param addr   The succeeding address.
-     * @param cmd    The succeeding command string.
-     * @param rc     The error code for the command.
-     * @param err    An error message for the exception.
+     * 
+     * @param addr
+     *            The succeeding address.
+     * @param cmd
+     *            The succeeding command string.
+     * @param rc
+     *            The error code for the command.
+     * @param err
+     *            An error message for the exception.
      */
     SMTPAddressSucceededException(InternetAddress addr, java.lang.String cmd, int rc, java.lang.String err) {
         super(err);
@@ -47,7 +51,7 @@
 
     /**
      * Get the failing command string for the exception.
-     *
+     * 
      * @return The string value of the failing command.
      */
     public String getCommand() {
@@ -56,7 +60,7 @@
 
     /**
      * The failing command return code.
-     *
+     * 
      * @return The failure return code.
      */
     public int getReturnCode() {
@@ -65,12 +69,10 @@
 
     /**
      * Retrieve the internet address associated with this exception.
-     *
+     * 
      * @return The provided InternetAddress object.
      */
     public InternetAddress getAddress() {
         return addr;
     }
 }
-
-

Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPMessage.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPMessage.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPMessage.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPMessage.java Fri Mar 31 14:24:52 2006
@@ -19,73 +19,82 @@
 
 import java.io.InputStream;
 
-import javax.mail.internet.MimeMessage;
 import javax.mail.MessagingException;
 import javax.mail.Session;
+import javax.mail.internet.MimeMessage;
 
 public class SMTPMessage extends MimeMessage {
 
     // never notify
     public static final int NOTIFY_NEVER = -1;
+
     // notify of successful deliveries.
     public static final int NOTIFY_SUCCESS = 1;
+
     // notify of delivery failures.
     public static final int NOTIFY_FAILURE = 2;
+
     // notify of delivery delays
     public static final int NOTIFY_DELAY = 4;
 
     // return full message with status notifications
     public static final int RETURN_FULL = 1;
+
     // return only message headers with status notifications
     public static final int RETURN_HDRS = 2;
 
     // support 8BitMime encodings
     protected boolean allow8bitMIME = false;
-    // a from address specified in the message envelope.  Overrides other from sources.
+
+    // a from address specified in the message envelope. Overrides other from
+    // sources.
     protected String envelopeFrom = null;
+
     // an option string to append to the MAIL command on sending.
     protected String mailExtension = null;
+
     // SMTP mail notification options if DSN is supported.
-    protected int    notifyOptions = 0;
+    protected int notifyOptions = 0;
+
     // DSN return option notification values.
-    protected int    returnOption = 0;
+    protected int returnOption = 0;
+
     // allow sending if some addresses give errors.
     protected boolean sendPartial = false;
-    // an RFC 2554 AUTH= value.
-    protected String  submitter = null;
 
+    // an RFC 2554 AUTH= value.
+    protected String submitter = null;
 
     /**
      * Default (and normal) constructor for an SMTPMessage.
-     *
-     * @param session The hosting Javamail Session.
+     * 
+     * @param session
+     *            The hosting Javamail Session.
      */
     public SMTPMessage(Session session) {
         // this is a simple one.
         super(session);
     }
 
-
     /**
-     * Construct an SMTPMessage instance by reading and parsing the
-     * data from the provided InputStream.  The InputStream will be
-     * left positioned at the end of the message data on constructor
-     * completion.
-     *
-     * @param session The hosting Javamail Session.
+     * Construct an SMTPMessage instance by reading and parsing the data from
+     * the provided InputStream. The InputStream will be left positioned at the
+     * end of the message data on constructor completion.
+     * 
+     * @param session
+     *            The hosting Javamail Session.
      */
     public SMTPMessage(Session session, InputStream source) throws MessagingException {
         // this is a simple one.
         super(session, source);
     }
 
-
     /**
-     * Construct an SMTPMimeMessage from another source MimeMessage
-     * object.  The new object and the old object are independent
-     * of each other.
-     *
-     * @param source The source MimeMessage object.
+     * Construct an SMTPMimeMessage from another source MimeMessage object. The
+     * new object and the old object are independent of each other.
+     * 
+     * @param source
+     *            The source MimeMessage object.
      */
     public SMTPMessage(MimeMessage source) throws MessagingException {
         super(source);
@@ -93,8 +102,9 @@
 
     /**
      * Change the allow8BitMime attribute for the message.
-     *
-     * @param a      The new setting.
+     * 
+     * @param a
+     *            The new setting.
      */
     public void setAllow8bitMIME(boolean a) {
         allow8bitMIME = a;
@@ -102,7 +112,7 @@
 
     /**
      * Retrieve the current 8bitMIME attribute.
-     *
+     * 
      * @return The current attribute value.
      */
     public boolean getAllow8bitMIME() {
@@ -111,17 +121,17 @@
 
     /**
      * Change the envelopeFrom attribute for the message.
-     *
-     * @param from   The new setting.
+     * 
+     * @param from
+     *            The new setting.
      */
     public void setEnvelopeFrom(String from) {
         envelopeFrom = from;
     }
 
-
     /**
      * Retrieve the current evelopeFrom attribute.
-     *
+     * 
      * @return The current attribute value.
      */
     public String getEnvelopeFrom() {
@@ -130,17 +140,17 @@
 
     /**
      * Change the mailExtension attribute for the message.
-     *
-     * @param e      The new setting.
+     * 
+     * @param e
+     *            The new setting.
      */
     public void setMailExtension(String e) {
         mailExtension = e;
     }
 
-
     /**
      * Retrieve the current mailExtension attribute.
-     *
+     * 
      * @return The current attribute value.
      */
     public String getMailExtension() {
@@ -149,17 +159,17 @@
 
     /**
      * Change the notifyOptions attribute for the message.
-     *
-     * @param options The new setting.
+     * 
+     * @param options
+     *            The new setting.
      */
     public void setNotifyOptions(int options) {
         notifyOptions = options;
     }
 
-
     /**
      * Retrieve the current notifyOptions attribute.
-     *
+     * 
      * @return The current attribute value.
      */
     public int getNotifyOptions() {
@@ -168,17 +178,17 @@
 
     /**
      * Change the returnOptions attribute for the message.
-     *
-     * @param option  The new setting.
+     * 
+     * @param option
+     *            The new setting.
      */
     public void setReturnOption(int option) {
         returnOption = option;
     }
 
-
     /**
      * Retrieve the current returnOption attribute.
-     *
+     * 
      * @return The current attribute value.
      */
     public int getReturnOption() {
@@ -187,8 +197,9 @@
 
     /**
      * Change the sendPartial attribute for the message.
-     *
-     * @param a      The new setting.
+     * 
+     * @param a
+     *            The new setting.
      */
     public void setSendPartial(boolean a) {
         sendPartial = a;
@@ -196,7 +207,7 @@
 
     /**
      * Retrieve the current sendPartial attribute.
-     *
+     * 
      * @return The current attribute value.
      */
     public boolean getSendPartial() {
@@ -205,17 +216,17 @@
 
     /**
      * Change the submitter attribute for the message.
-     *
-     * @param s       The new setting.
+     * 
+     * @param s
+     *            The new setting.
      */
     public void setSubmitter(String s) {
         submitter = s;
     }
 
-
     /**
      * Retrieve the current submitter attribute.
-     *
+     * 
      * @return The current attribute value.
      */
     public String getSubmitter() {

Modified: geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java?rev=390524&r1=390523&r2=390524&view=diff
==============================================================================
--- geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java (original)
+++ geronimo/trunk/modules/javamail-transport/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java Fri Mar 31 14:24:52 2006
@@ -19,16 +19,19 @@
 
 /**
  * Util class to represent a reply from a SMTP server
- *
+ * 
  * @version $Rev$ $Date$
  */
 class SMTPReply {
     // The original reply string
     private final String reply;
+
     // returned message code
     private final int code;
+
     // the returned message text
     private final String message;
+
     // indicates that this is a continuation response
     private boolean continued;
 
@@ -36,9 +39,11 @@
         // save the reply
         reply = s;
 
-        // In a normal response, the first 3 must be the return code.  However,
-        // the response back from a QUIT command is frequently a null string.  Therefore, if the result is
-        // too short, just default the code to -1 and use the entire text for the message.
+        // In a normal response, the first 3 must be the return code. However,
+        // the response back from a QUIT command is frequently a null string.
+        // Therefore, if the result is
+        // too short, just default the code to -1 and use the entire text for
+        // the message.
         if (s == null || s.length() < 3) {
             code = -1;
             message = s;
@@ -49,7 +54,8 @@
             continued = false;
             code = Integer.parseInt(s.substring(0, 3));
 
-            // message should be separated by a space OR a continuation character if this is a
+            // message should be separated by a space OR a continuation
+            // character if this is a
             // multi-line response.
             if (s.length() > 4) {
                 //
@@ -67,7 +73,7 @@
 
     /**
      * Return the code value associated with the reply.
-     *
+     * 
      * @return The integer code associated with the reply.
      */
     public int getCode() {
@@ -76,7 +82,7 @@
 
     /**
      * Get the message text associated with the reply.
-     *
+     * 
      * @return The string value of the message from the reply.
      */
     public String getMessage() {
@@ -85,14 +91,13 @@
 
     /**
      * Retrieve the raw reply string for the reponse.
-     *
+     * 
      * @return The original reply string from the server.
      */
     public String getReply() {
         return reply;
     }
 
-
     /**
      * Indicates if reply is an error condition
      */
@@ -101,13 +106,12 @@
         return code >= 400;
     }
 
-
     /**
-     * Indicates whether this response is flagged as part of a
-     * multiple line response.
-     *
-     * @return true if the response has multiple lines, false if this is
-     *         the last line of the response.
+     * Indicates whether this response is flagged as part of a multiple line
+     * response.
+     * 
+     * @return true if the response has multiple lines, false if this is the
+     *         last line of the response.
      */
     public boolean isContinued() {
         return continued;



Mime
View raw message