From my understanding it should be correct. Is the "-" for nullsender?

Here the rfc part:

The structure of the separator lines vary across implementations, but
  usually contain the exact character sequence of "From", followed by a
  single Space character (0x20), an email address of some kind, another
  Space character, a timestamp sequence of some kind, and an end-of-
  line marker.  However, due to the lack of any authoritative
  specification, each of these attributes are known to vary widely
  across implementations.  For example, the email address can reflect
  any addressing syntax that has ever been used on any messaging system
  in all of history (specifically including address forms that are not
  compatible with Internet messages, as defined by RFC 2822 
<http://www.rfc-archive.org/getrfc.php?rfc=2822> [RFC 2822 
<http://www.rfc-archive.org/getrfc.php?rfc=2822>]).
  Similarly, the timestamp sequences can also vary according to system
  output, while the end-of-line sequences will often reflect platform-
  specific requirements.  Different data formats can even appear within
  a single database as a result of multiple mbox files being
  concatenated together, or because a single file was accessed by
  multiple messaging clients, each of which has used its own syntax for
  the separator line.



Stefano Bagnara schrieb:
I'm not sure that the From is correctly created in the patched version.

Maybe we should retrun "From - Date".

I don't know the MBOX format but I see the format "From - Date" in my sendmail mailbox.

Stefano

[EMAIL PROTECTED] wrote:
Author: norman
Date: Sat Oct  7 09:00:53 2006
New Revision: 453945

URL: http://svn.apache.org/viewvc?view=rev&rev=453945
Log:
Fix NPE on null sender. See JAMES-655

Modified:
james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java?view=diff&rev=453945&r1=453944&r2=453945 ============================================================================== --- james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java (original) +++ james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java Sat Oct 7 09:00:53 2006
@@ -62,7 +62,6 @@
 import javax.mail.MessagingException;
 import javax.mail.Session;
 import javax.mail.internet.MimeMessage;
-import javax.mail.internet.InternetAddress;
import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -515,7 +514,13 @@
         String message = null;
         try {
             message = getRawMessage(mc.getMessage());
- fromHeader = "From " + ((InternetAddress)mc.getMessage().getFrom()[0]).getAddress() + " " + dy.format(Calendar.getInstance().getTime());
+            // check for nullsender
+            if (mc.getMessage().getFrom() == null) {
+ fromHeader = "From " + dy.format(Calendar.getInstance().getTime());
+            } else {
+ fromHeader = "From " + mc.getMessage().getFrom()[0] + " " + dy.format(Calendar.getInstance().getTime());
+            }
+                     } catch (IOException e) {
getLogger().error("Unable to parse mime message for " + mboxFile, e);
         } catch (MessagingException e) {



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





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

!EXCUBATOR:1,4527d12553072182126909!



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

Reply via email to