You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Hes Siemelink (JIRA)" <se...@james.apache.org> on 2004/11/16 16:26:23 UTC

[jira] Created: (JAMES-337) Exception when FromRepository tries to delete a message

Exception when FromRepository tries to delete a message
-------------------------------------------------------

         Key: JAMES-337
         URL: http://nagoya.apache.org/jira/browse/JAMES-337
     Project: James
        Type: Bug
  Components: MailStore & MailRepository  
    Versions: 2.2.0    
    Reporter: Hes Siemelink


I am trying to get a FromRepository in the air, that will respool messages that were dumped in an error repository earlier.

This is my configuration:

         <!-- Respool messages that could not be delivered earlier -->
         <mailet match="SubjectStartsWith=Respool-Out" class="FromRepository">
            <repositoryPath> file://../../../../spool/outgoing-undeliverable/
            </repositoryPath>
           <processor> root </processor>
           <delete> true </delete>
         </mailet>

However, when this mailet is triggered I get the following exception. 

java.lang.ClassCastException
            at org.apache.james.mailrepository.AvalonMailRepository.remove(AvalonMailRepository.java:372)
            at org.apache.james.transport.mailets.FromRepository.service(FromRepository.java:132)
            at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:407)
            at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:451)
            at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:360)
            at java.lang.Thread.run(Unknown Source)

Messages seem to be respooled but are not deleted.



Proposed fix: Make AvalonMailRepository.remove(Collection) take Collections of Strings as well as Collections of MailImpl objects.

Proposed new implementation:

    /**
     * Removes a Collection of mails from the repository
     * @param mails The Collection of <code>MailImpl</code>'s to delete
     * @throws MessagingException
     * @since 2.2.0
     */
    public void remove(Collection mails) throws MessagingException {
        Iterator delList = mails.iterator();
        while (delList.hasNext()) {
            Object next = delList.next();
            if (next instanceof MailImpl) {
                remove( (MailImpl) next);
            }
            else if (next instanceof String) {
                remove( (String) next);
            }
            else if (next instanceof Collection) {
                remove( (Collection) next);
            }
        }
    }


Diff against 2.2.0 release tag:

Index: AvalonMailRepository.java
===================================================================
--- AvalonMailRepository.java	(revision 37982)
+++ AvalonMailRepository.java	(working copy)
@@ -369,7 +369,16 @@
     public void remove(Collection mails) throws MessagingException {
         Iterator delList = mails.iterator();
         while (delList.hasNext()) {
-            remove((MailImpl)delList.next());
+            Object next = delList.next();
+            if (next instanceof MailImpl) {
+                remove( (MailImpl) next);
+            }
+            else if (next instanceof String) {
+                remove( (String) next);
+            }
+            else if (next instanceof Collection) {
+                remove( (Collection) next);
+            }
         }
     }
 
@@ -404,7 +413,7 @@
      *
      */
     public Iterator list() {
-        // Fix ConcurrentModificationException by cloning 
+        // Fix ConcurrentModificationException by cloning
         // the keyset before getting an iterator
         final ArrayList clone;
         synchronized(keys) {




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Resolved: (JAMES-337) Exception when FromRepository tries to delete a message

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
     [ http://issues.apache.org/jira/browse/JAMES-337?page=all ]
     
Stefano Bagnara resolved JAMES-337:
-----------------------------------

    Fix Version: 2.3.0
     Resolution: Duplicate
      Assign To: Noel J. Bergman

Noel fix to JAMES-317 invalidate this.

> Exception when FromRepository tries to delete a message
> -------------------------------------------------------
>
>          Key: JAMES-337
>          URL: http://issues.apache.org/jira/browse/JAMES-337
>      Project: James
>         Type: Bug
>   Components: MailStore & MailRepository
>     Versions: 2.2.0
>     Reporter: Hes Siemelink
>     Assignee: Noel J. Bergman
>      Fix For: 2.3.0

>
> I am trying to get a FromRepository in the air, that will respool messages that were dumped in an error repository earlier.
> This is my configuration:
>          <!-- Respool messages that could not be delivered earlier -->
>          <mailet match="SubjectStartsWith=Respool-Out" class="FromRepository">
>             <repositoryPath> file://../../../../spool/outgoing-undeliverable/
>             </repositoryPath>
>            <processor> root </processor>
>            <delete> true </delete>
>          </mailet>
> However, when this mailet is triggered I get the following exception. 
> java.lang.ClassCastException
>             at org.apache.james.mailrepository.AvalonMailRepository.remove(AvalonMailRepository.java:372)
>             at org.apache.james.transport.mailets.FromRepository.service(FromRepository.java:132)
>             at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:407)
>             at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:451)
>             at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:360)
>             at java.lang.Thread.run(Unknown Source)
> Messages seem to be respooled but are not deleted.
> Proposed fix: Make AvalonMailRepository.remove(Collection) take Collections of Strings as well as Collections of MailImpl objects.
> Proposed new implementation:
>     /**
>      * Removes a Collection of mails from the repository
>      * @param mails The Collection of <code>MailImpl</code>'s to delete
>      * @throws MessagingException
>      * @since 2.2.0
>      */
>     public void remove(Collection mails) throws MessagingException {
>         Iterator delList = mails.iterator();
>         while (delList.hasNext()) {
>             Object next = delList.next();
>             if (next instanceof MailImpl) {
>                 remove( (MailImpl) next);
>             }
>             else if (next instanceof String) {
>                 remove( (String) next);
>             }
>             else if (next instanceof Collection) {
>                 remove( (Collection) next);
>             }
>         }
>     }
> Diff against 2.2.0 release tag:
> Index: AvalonMailRepository.java
> ===================================================================
> --- AvalonMailRepository.java	(revision 37982)
> +++ AvalonMailRepository.java	(working copy)
> @@ -369,7 +369,16 @@
>      public void remove(Collection mails) throws MessagingException {
>          Iterator delList = mails.iterator();
>          while (delList.hasNext()) {
> -            remove((MailImpl)delList.next());
> +            Object next = delList.next();
> +            if (next instanceof MailImpl) {
> +                remove( (MailImpl) next);
> +            }
> +            else if (next instanceof String) {
> +                remove( (String) next);
> +            }
> +            else if (next instanceof Collection) {
> +                remove( (Collection) next);
> +            }
>          }
>      }
>  
> @@ -404,7 +413,7 @@
>       *
>       */
>      public Iterator list() {
> -        // Fix ConcurrentModificationException by cloning 
> +        // Fix ConcurrentModificationException by cloning
>          // the keyset before getting an iterator
>          final ArrayList clone;
>          synchronized(keys) {

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-337) Exception when FromRepository tries to delete a message

Posted by "Hes Siemelink (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-337?page=comments#action_12322932 ] 

Hes Siemelink commented on JAMES-337:
-------------------------------------

By all means!

> Exception when FromRepository tries to delete a message
> -------------------------------------------------------
>
>          Key: JAMES-337
>          URL: http://issues.apache.org/jira/browse/JAMES-337
>      Project: James
>         Type: Bug
>   Components: MailStore & MailRepository
>     Versions: 2.2.0
>     Reporter: Hes Siemelink

>
> I am trying to get a FromRepository in the air, that will respool messages that were dumped in an error repository earlier.
> This is my configuration:
>          <!-- Respool messages that could not be delivered earlier -->
>          <mailet match="SubjectStartsWith=Respool-Out" class="FromRepository">
>             <repositoryPath> file://../../../../spool/outgoing-undeliverable/
>             </repositoryPath>
>            <processor> root </processor>
>            <delete> true </delete>
>          </mailet>
> However, when this mailet is triggered I get the following exception. 
> java.lang.ClassCastException
>             at org.apache.james.mailrepository.AvalonMailRepository.remove(AvalonMailRepository.java:372)
>             at org.apache.james.transport.mailets.FromRepository.service(FromRepository.java:132)
>             at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:407)
>             at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:451)
>             at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:360)
>             at java.lang.Thread.run(Unknown Source)
> Messages seem to be respooled but are not deleted.
> Proposed fix: Make AvalonMailRepository.remove(Collection) take Collections of Strings as well as Collections of MailImpl objects.
> Proposed new implementation:
>     /**
>      * Removes a Collection of mails from the repository
>      * @param mails The Collection of <code>MailImpl</code>'s to delete
>      * @throws MessagingException
>      * @since 2.2.0
>      */
>     public void remove(Collection mails) throws MessagingException {
>         Iterator delList = mails.iterator();
>         while (delList.hasNext()) {
>             Object next = delList.next();
>             if (next instanceof MailImpl) {
>                 remove( (MailImpl) next);
>             }
>             else if (next instanceof String) {
>                 remove( (String) next);
>             }
>             else if (next instanceof Collection) {
>                 remove( (Collection) next);
>             }
>         }
>     }
> Diff against 2.2.0 release tag:
> Index: AvalonMailRepository.java
> ===================================================================
> --- AvalonMailRepository.java	(revision 37982)
> +++ AvalonMailRepository.java	(working copy)
> @@ -369,7 +369,16 @@
>      public void remove(Collection mails) throws MessagingException {
>          Iterator delList = mails.iterator();
>          while (delList.hasNext()) {
> -            remove((MailImpl)delList.next());
> +            Object next = delList.next();
> +            if (next instanceof MailImpl) {
> +                remove( (MailImpl) next);
> +            }
> +            else if (next instanceof String) {
> +                remove( (String) next);
> +            }
> +            else if (next instanceof Collection) {
> +                remove( (Collection) next);
> +            }
>          }
>      }
>  
> @@ -404,7 +413,7 @@
>       *
>       */
>      public Iterator list() {
> -        // Fix ConcurrentModificationException by cloning 
> +        // Fix ConcurrentModificationException by cloning
>          // the keyset before getting an iterator
>          final ArrayList clone;
>          synchronized(keys) {

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-337) Exception when FromRepository tries to delete a message

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-337?page=comments#action_12322924 ] 

Stefano Bagnara commented on JAMES-337:
---------------------------------------

Can we mark this as closed?

> Exception when FromRepository tries to delete a message
> -------------------------------------------------------
>
>          Key: JAMES-337
>          URL: http://issues.apache.org/jira/browse/JAMES-337
>      Project: James
>         Type: Bug
>   Components: MailStore & MailRepository
>     Versions: 2.2.0
>     Reporter: Hes Siemelink

>
> I am trying to get a FromRepository in the air, that will respool messages that were dumped in an error repository earlier.
> This is my configuration:
>          <!-- Respool messages that could not be delivered earlier -->
>          <mailet match="SubjectStartsWith=Respool-Out" class="FromRepository">
>             <repositoryPath> file://../../../../spool/outgoing-undeliverable/
>             </repositoryPath>
>            <processor> root </processor>
>            <delete> true </delete>
>          </mailet>
> However, when this mailet is triggered I get the following exception. 
> java.lang.ClassCastException
>             at org.apache.james.mailrepository.AvalonMailRepository.remove(AvalonMailRepository.java:372)
>             at org.apache.james.transport.mailets.FromRepository.service(FromRepository.java:132)
>             at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:407)
>             at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:451)
>             at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:360)
>             at java.lang.Thread.run(Unknown Source)
> Messages seem to be respooled but are not deleted.
> Proposed fix: Make AvalonMailRepository.remove(Collection) take Collections of Strings as well as Collections of MailImpl objects.
> Proposed new implementation:
>     /**
>      * Removes a Collection of mails from the repository
>      * @param mails The Collection of <code>MailImpl</code>'s to delete
>      * @throws MessagingException
>      * @since 2.2.0
>      */
>     public void remove(Collection mails) throws MessagingException {
>         Iterator delList = mails.iterator();
>         while (delList.hasNext()) {
>             Object next = delList.next();
>             if (next instanceof MailImpl) {
>                 remove( (MailImpl) next);
>             }
>             else if (next instanceof String) {
>                 remove( (String) next);
>             }
>             else if (next instanceof Collection) {
>                 remove( (Collection) next);
>             }
>         }
>     }
> Diff against 2.2.0 release tag:
> Index: AvalonMailRepository.java
> ===================================================================
> --- AvalonMailRepository.java	(revision 37982)
> +++ AvalonMailRepository.java	(working copy)
> @@ -369,7 +369,16 @@
>      public void remove(Collection mails) throws MessagingException {
>          Iterator delList = mails.iterator();
>          while (delList.hasNext()) {
> -            remove((MailImpl)delList.next());
> +            Object next = delList.next();
> +            if (next instanceof MailImpl) {
> +                remove( (MailImpl) next);
> +            }
> +            else if (next instanceof String) {
> +                remove( (String) next);
> +            }
> +            else if (next instanceof Collection) {
> +                remove( (Collection) next);
> +            }
>          }
>      }
>  
> @@ -404,7 +413,7 @@
>       *
>       */
>      public Iterator list() {
> -        // Fix ConcurrentModificationException by cloning 
> +        // Fix ConcurrentModificationException by cloning
>          // the keyset before getting an iterator
>          final ArrayList clone;
>          synchronized(keys) {

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-337) Exception when FromRepository tries to delete a message

Posted by "Hes Siemelink (JIRA)" <se...@james.apache.org>.
     [ http://nagoya.apache.org/jira/browse/JAMES-337?page=comments#action_55541 ]
     
Hes Siemelink commented on JAMES-337:
-------------------------------------

Oh sorry, I see this is a duplicate of JAMES-317.


> Exception when FromRepository tries to delete a message
> -------------------------------------------------------
>
>          Key: JAMES-337
>          URL: http://nagoya.apache.org/jira/browse/JAMES-337
>      Project: James
>         Type: Bug
>   Components: MailStore & MailRepository
>     Versions: 2.2.0
>     Reporter: Hes Siemelink

>
> I am trying to get a FromRepository in the air, that will respool messages that were dumped in an error repository earlier.
> This is my configuration:
>          <!-- Respool messages that could not be delivered earlier -->
>          <mailet match="SubjectStartsWith=Respool-Out" class="FromRepository">
>             <repositoryPath> file://../../../../spool/outgoing-undeliverable/
>             </repositoryPath>
>            <processor> root </processor>
>            <delete> true </delete>
>          </mailet>
> However, when this mailet is triggered I get the following exception. 
> java.lang.ClassCastException
>             at org.apache.james.mailrepository.AvalonMailRepository.remove(AvalonMailRepository.java:372)
>             at org.apache.james.transport.mailets.FromRepository.service(FromRepository.java:132)
>             at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:407)
>             at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:451)
>             at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:360)
>             at java.lang.Thread.run(Unknown Source)
> Messages seem to be respooled but are not deleted.
> Proposed fix: Make AvalonMailRepository.remove(Collection) take Collections of Strings as well as Collections of MailImpl objects.
> Proposed new implementation:
>     /**
>      * Removes a Collection of mails from the repository
>      * @param mails The Collection of <code>MailImpl</code>'s to delete
>      * @throws MessagingException
>      * @since 2.2.0
>      */
>     public void remove(Collection mails) throws MessagingException {
>         Iterator delList = mails.iterator();
>         while (delList.hasNext()) {
>             Object next = delList.next();
>             if (next instanceof MailImpl) {
>                 remove( (MailImpl) next);
>             }
>             else if (next instanceof String) {
>                 remove( (String) next);
>             }
>             else if (next instanceof Collection) {
>                 remove( (Collection) next);
>             }
>         }
>     }
> Diff against 2.2.0 release tag:
> Index: AvalonMailRepository.java
> ===================================================================
> --- AvalonMailRepository.java	(revision 37982)
> +++ AvalonMailRepository.java	(working copy)
> @@ -369,7 +369,16 @@
>      public void remove(Collection mails) throws MessagingException {
>          Iterator delList = mails.iterator();
>          while (delList.hasNext()) {
> -            remove((MailImpl)delList.next());
> +            Object next = delList.next();
> +            if (next instanceof MailImpl) {
> +                remove( (MailImpl) next);
> +            }
> +            else if (next instanceof String) {
> +                remove( (String) next);
> +            }
> +            else if (next instanceof Collection) {
> +                remove( (Collection) next);
> +            }
>          }
>      }
>  
> @@ -404,7 +413,7 @@
>       *
>       */
>      public Iterator list() {
> -        // Fix ConcurrentModificationException by cloning 
> +        // Fix ConcurrentModificationException by cloning
>          // the keyset before getting an iterator
>          final ArrayList clone;
>          synchronized(keys) {

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org