geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r491576 - in /geronimo/javamail/trunk: geronimo-javamail_1.3.1_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java
Date Mon, 01 Jan 2007 14:29:21 GMT
Author: rickmcguire
Date: Mon Jan  1 06:29:20 2007
New Revision: 491576

URL: http://svn.apache.org/viewvc?view=rev&rev=491576
Log:
GERONIMO-2679 ArrayIndexOutOfBoundsException when getting Mails from Pop3-Account with geronimo-javamail_1.4_mail-1.0.jar


Modified:
    geronimo/javamail/trunk/geronimo-javamail_1.3.1_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java
    geronimo/javamail/trunk/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java

Modified: geronimo/javamail/trunk/geronimo-javamail_1.3.1_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.3.1_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java?view=diff&rev=491576&r1=491575&r2=491576
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.3.1_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.3.1_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java
Mon Jan  1 06:29:20 2007
@@ -155,8 +155,11 @@
             // JavaMail API has no method in Folder to expose the total
             // size (no of bytes) of the mail drop;
 
-            msgCache = new Vector(msgCount);
-            msgCache.setSize(msgCount);
+            // NB:  We use the actual message number to access the messages from 
+            // the cache, which is origin 1.  Vectors are origin 0, so we add one additional

+            // element and burn the 
+            msgCache = new Vector(msgCount + 1);
+            msgCache.setSize(msgCount + 1);
 
         } catch (Exception e) {
             throw new MessagingException("Unable to execute STAT command", e);
@@ -173,7 +176,8 @@
             if (mode == READ_WRITE) {
                 // find all messages marked deleted and issue DELE commands
                 POP3Message m;
-                for (int i = 0; i < msgCache.size(); i++) {
+                // NB: the first element in the cache is not used.
+                for (int i = 1; i < msgCache.size(); i++) {
                     if ((m = (POP3Message) msgCache.elementAt(i)) != null) {
                         if (m.isSet(Flags.Flag.DELETED)) {
                             try {

Modified: geronimo/javamail/trunk/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java?view=diff&rev=491576&r1=491575&r2=491576
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java
Mon Jan  1 06:29:20 2007
@@ -155,8 +155,11 @@
             // JavaMail API has no method in Folder to expose the total
             // size (no of bytes) of the mail drop;
 
-            msgCache = new Vector(msgCount);
-            msgCache.setSize(msgCount);
+            // NB:  We use the actual message number to access the messages from 
+            // the cache, which is origin 1.  Vectors are origin 0, so we add one additional

+            // element and burn the 
+            msgCache = new Vector(msgCount + 1);
+            msgCache.setSize(msgCount + 1);
 
         } catch (Exception e) {
             throw new MessagingException("Unable to execute STAT command", e);
@@ -173,7 +176,8 @@
             if (mode == READ_WRITE) {
                 // find all messages marked deleted and issue DELE commands
                 POP3Message m;
-                for (int i = 0; i < msgCache.size(); i++) {
+                // NB: the first element in the cache is not used.
+                for (int i = 1; i < msgCache.size(); i++) {
                     if ((m = (POP3Message) msgCache.elementAt(i)) != null) {
                         if (m.isSet(Flags.Flag.DELETED)) {
                             try {



Mime
View raw message