[ 
https://issues.apache.org/jira/browse/JAMES-850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Burrell Donkin updated JAMES-850:
----------------------------------------

    Attachment: TEST-org.apache.james.transport.mailets.RemoteDeliveryTest.txt

Using the following patch, it appears that there's a certain amount of 
circularity

Index: core-library/src/main/java/org/apache/james/core/MailImpl.java
===================================================================
--- core-library/src/main/java/org/apache/james/core/MailImpl.java      
(revision 682170)
+++ core-library/src/main/java/org/apache/james/core/MailImpl.java      
(working copy)
@@ -27,7 +27,10 @@
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.RFC2822Headers;
 
+import com.sun.mail.smtp.SMTPAddressFailedException;
+
 import javax.mail.MessagingException;
+import javax.mail.SendFailedException;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.ParseException;
@@ -158,16 +161,19 @@
         setRemoteAddr(mail.getRemoteAddr());
         setLastUpdated(mail.getLastUpdated());
         try {
-            if (mail instanceof MailImpl) {
-                setAttributesRaw((HashMap) cloneSerializableObject(((MailImpl) 
mail).getAttributesRaw()));
-            } else {
-                HashMap attribs = new HashMap();
-                for (Iterator i = mail.getAttributeNames(); i.hasNext(); ) {
-                    String hashKey = (String) i.next();
-                    
attribs.put(hashKey,cloneSerializableObject(mail.getAttribute(hashKey)));
+            HashMap attribs = new HashMap();
+            for (Iterator i = mail.getAttributeNames(); i.hasNext(); ) {
+                String hashKey = (String) i.next();
+                final Serializable attribute = mail.getAttribute(hashKey);
+                if (attribute instanceof SendFailedException) {
+                    SendFailedException ex = (SendFailedException) attribute;
+                    Throwable t = ex.getNextException();
+                    debug(t); 
                 }
-                setAttributesRaw(attribs);
+                final Object cloneSerializableObject = 
cloneSerializableObject(attribute);
+                attribs.put(hashKey,cloneSerializableObject);
             }
+            setAttributesRaw(attribs);
         } catch (IOException e) {
             // should never happen for in memory streams
             setAttributesRaw(new HashMap());
@@ -176,6 +182,28 @@
             setAttributesRaw(new HashMap());
         }
     }
+    private void debug(Throwable t) {
+        if (t == null) {
+            System.err.println("[END]");
+        } else {
+            System.err.println("NEXT@" + System.identityHashCode(t)  + t );
+            if (t instanceof MessagingException) {
+                MessagingException e = (MessagingException) t;
+                System.err.println("NEXT@" + System.identityHashCode(e)  + e );
+                t = e.getNextException();
+                if (t == null) {
+                    t = e.getCause();
+                }
+                debug(t);
+            } else {
+                System.err.println("NEXT@" + System.identityHashCode(t)  + t );
+                Throwable next = t.getCause();
+                if (next != t) {
+                    debug(next);
+                }
+            }
+        }
+    }
 
     /**
      * A constructor that creates a MailImpl with the specified name,


> RemoteDeliveryTest intermitant failure
> --------------------------------------
>
>                 Key: JAMES-850
>                 URL: https://issues.apache.org/jira/browse/JAMES-850
>             Project: James
>          Issue Type: Test
>    Affects Versions: Trunk
>         Environment: GNULinux/Gentoo
> % java -version
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_16-b02, mixed mode)
> % cat /proc/cpuinfo 
> processor     : 0
> vendor_id     : AuthenticAMD
> cpu family    : 15
> model         : 67
> model name    : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
> stepping      : 3
> cpu MHz               : 1000.000
> cache size    : 1024 KB
> physical id   : 0
> siblings      : 2
> core id               : 0
> cpu cores     : 2
> fpu           : yes
> fpu_exception : yes
> cpuid level   : 1
> wp            : yes
> flags         : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
> pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 
> 3dnowext 3dnow rep_good pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
> bogomips      : 2012.31
> TLB size      : 1024 4K pages
> clflush size  : 64
> cache_alignment       : 64
> address sizes : 40 bits physical, 48 bits virtual
> power management: ts fid vid ttp tm stc
> processor     : 1
> vendor_id     : AuthenticAMD
> cpu family    : 15
> model         : 67
> model name    : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
> stepping      : 3
> cpu MHz               : 1000.000
> cache size    : 1024 KB
> physical id   : 0
> siblings      : 2
> core id               : 1
> cpu cores     : 2
> fpu           : yes
> fpu_exception : yes
> cpuid level   : 1
> wp            : yes
> flags         : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
> pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 
> 3dnowext 3dnow rep_good pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
> bogomips      : 2012.31
> TLB size      : 1024 4K pages
> clflush size  : 64
> cache_alignment       : 64
> address sizes : 40 bits physical, 48 bits virtual
> power management: ts fid vid ttp tm stc
>            Reporter: Robert Burrell Donkin
>            Priority: Critical
>         Attachments: 
> TEST-org.apache.james.transport.mailets.RemoteDeliveryTest - 
> expected-continuation.txt, 
> TEST-org.apache.james.transport.mailets.RemoteDeliveryTest.txt, 
> TEST-org.apache.james.transport.mailets.RemoteDeliveryTest.txt, 
> TEST-org.apache.james.transport.mailets.RemoteDeliveryTest.txt, 
> TEST-org.apache.james.transport.mailets.RemoteDeliveryTest.txt, 
> TEST-org.apache.james.transport.mailets.RemoteDeliveryTest.txt
>
>
> Open to track information related to intermittent failures of this test

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to