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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to