commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1085208 - in /commons/proper/net/trunk/src/main/java: examples/mail/POP3Mail.java org/apache/commons/net/pop3/POP3Client.java org/apache/commons/net/pop3/POP3MessageInfo.java
Date Fri, 25 Mar 2011 00:06:25 GMT
Author: sebb
Date: Fri Mar 25 00:06:25 2011
New Revision: 1085208

URL: http://svn.apache.org/viewvc?rev=1085208&view=rev
Log:
Revert some changes in favour of maintaining binary compatibility

Modified:
    commons/proper/net/trunk/src/main/java/examples/mail/POP3Mail.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3MessageInfo.java

Modified: commons/proper/net/trunk/src/main/java/examples/mail/POP3Mail.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/examples/mail/POP3Mail.java?rev=1085208&r1=1085207&r2=1085208&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/examples/mail/POP3Mail.java (original)
+++ commons/proper/net/trunk/src/main/java/examples/mail/POP3Mail.java Fri Mar 25 00:06:25
2011
@@ -124,7 +124,7 @@ public final class POP3Mail
             }
 
             for (POP3MessageInfo msginfo : messages) {
-                BufferedReader reader = pop3.retrieveMessageTop(msginfo.number, 0);
+                BufferedReader reader = (BufferedReader) pop3.retrieveMessageTop(msginfo.number,
0);
 
                 if (reader == null) {
                     System.err.println("Could not retrieve message header.");

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java?rev=1085208&r1=1085207&r2=1085208&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java Fri
Mar 25 00:06:25 2011
@@ -19,6 +19,7 @@ package org.apache.commons.net.pop3;
 
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.Reader;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Enumeration;
@@ -468,14 +469,10 @@ public class POP3Client extends POP3
     }
 
 
-    /***
+    /**
      * Retrieve a message from the POP3 server.  A retrieve message attempt
      * can only succeed if the client is in the
      * {@link org.apache.commons.net.pop3.POP3#TRANSACTION_STATE TRANSACTION_STATE }
-     * .  Returns a DotTerminatedMessageReader instance
-     * from which the entire message can be read.
-     * Returns null if the retrieval attempt fails  (e.g., if the specified
-     * message number does not exist).
      * <p>
      * You must not issue any commands to the POP3 server (i.e., call any
      * other methods) until you finish reading the message from the
@@ -490,12 +487,14 @@ public class POP3Client extends POP3
      * @param messageId  The number of the message to fetch.
      * @return A DotTerminatedMessageReader instance
      * from which the entire message can be read.
+     * This can safely be cast to a {@link BufferedReader} in order to
+     * use the {@link BufferedReader#readLine()} method.
      * Returns null if the retrieval attempt fails  (e.g., if the specified
-     * message number does not exist).
+     * message number does not exist). 
      * @exception IOException If a network I/O error occurs in the process of
      *        sending the retrieve message command.
-     ***/
-    public BufferedReader retrieveMessage(int messageId) throws IOException
+     */
+    public Reader retrieveMessage(int messageId) throws IOException
     {
         if (getState() != TRANSACTION_STATE) {
             return null;
@@ -508,16 +507,11 @@ public class POP3Client extends POP3
     }
 
 
-    /***
+    /**
      * Retrieve only the specified top number of lines of a message from the
      * POP3 server.  A retrieve top lines attempt
      * can only succeed if the client is in the
      * {@link org.apache.commons.net.pop3.POP3#TRANSACTION_STATE TRANSACTION_STATE }
-     * .  Returns a DotTerminatedMessageReader instance
-     * from which the specified top number of lines of the message can be
-     * read.
-     * Returns null if the retrieval attempt fails  (e.g., if the specified
-     * message number does not exist).
      * <p>
      * You must not issue any commands to the POP3 server (i.e., call any
      * other methods) until you finish reading the message from the returned
@@ -534,12 +528,14 @@ public class POP3Client extends POP3
      * @return  A DotTerminatedMessageReader instance
      * from which the specified top number of lines of the message can be
      * read.
+     * This can safely be cast to a {@link BufferedReader} in order to
+     * use the {@link BufferedReader#readLine()} method.
      * Returns null if the retrieval attempt fails  (e.g., if the specified
      * message number does not exist).
      * @exception IOException If a network I/O error occurs in the process of
      *       sending the top command.
-     ***/
-    public BufferedReader retrieveMessageTop(int messageId, int numLines)
+     */
+    public Reader retrieveMessageTop(int messageId, int numLines)
     throws IOException
     {
         if (numLines < 0 || getState() != TRANSACTION_STATE) {

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3MessageInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3MessageInfo.java?rev=1085208&r1=1085207&r2=1085208&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3MessageInfo.java
(original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3MessageInfo.java
Fri Mar 25 00:06:25 2011
@@ -41,9 +41,9 @@ package org.apache.commons.net.pop3;
 
 public final class POP3MessageInfo
 {
-    public final int number;
-    public final int size;
-    public final String identifier;
+    public int number;
+    public int size;
+    public String identifier;
 
     /***
      * Creates a POP3MessageInfo instance with <code>number</code> and
@@ -52,8 +52,7 @@ public final class POP3MessageInfo
      ***/
     public POP3MessageInfo()
     {
-        number = size = 0;
-        identifier = null;
+        this(0, null, 0);
     }
 
     /***
@@ -63,9 +62,7 @@ public final class POP3MessageInfo
      ***/
     public POP3MessageInfo(int num, int octets)
     {
-        number = num;
-        size = octets;
-        identifier = null;
+        this(num, null, octets);
     }
 
     /***
@@ -75,8 +72,12 @@ public final class POP3MessageInfo
      ***/
     public POP3MessageInfo(int num, String uid)
     {
-        number = num;
-        size = -1;
-        identifier = uid;
+        this(num, uid, -1);
+    }
+    
+    private POP3MessageInfo(int num, String uid, int size) {
+        this.number = num;
+        this.size = size;
+        this.identifier = uid;        
     }
 }



Mime
View raw message