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 ba...@apache.org on 2006/09/12 14:45:35 UTC

svn commit: r442573 - /james/server/trunk/src/java/org/apache/james/core/MailImpl.java

Author: bago
Date: Tue Sep 12 05:45:35 2006
New Revision: 442573

URL: http://svn.apache.org/viewvc?view=rev&rev=442573
Log:
Fixed a cause of NPEs in MailImpl.setMessage when the new message was the same of the previous message (JAMES-609)

Modified:
    james/server/trunk/src/java/org/apache/james/core/MailImpl.java

Modified: james/server/trunk/src/java/org/apache/james/core/MailImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/core/MailImpl.java?view=diff&rev=442573&r1=442572&r2=442573
==============================================================================
--- james/server/trunk/src/java/org/apache/james/core/MailImpl.java (original)
+++ james/server/trunk/src/java/org/apache/james/core/MailImpl.java Tue Sep 12 05:45:35 2006
@@ -395,13 +395,15 @@
      * @param message the new MimeMessage associated with this MailImpl
      */
     public void setMessage(MimeMessage message) {
-        // If a setMessage is called on a Mail that already have a message
-        // (discouraged) we have to make sure that the message we remove is
-        // correctly unreferenced and disposed, otherwise it will keep locks
-        if (this.message != null) {
-            ContainerUtil.dispose(this.message);
+        if (this.message != message) {
+            // If a setMessage is called on a Mail that already have a message
+            // (discouraged) we have to make sure that the message we remove is
+            // correctly unreferenced and disposed, otherwise it will keep locks
+            if (this.message != null) {
+                ContainerUtil.dispose(this.message);
+            }
+            this.message = message;
         }
-        this.message = message;
     }
     /**
      * Set the recipients for this MailImpl.



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