james-server-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steen Jansdal <...@buanco.dk>
Subject My little fix wasn't implemented :-(
Date Thu, 08 May 2003 07:30:30 GMT
Hi,

I'm a little sad to see that my little fix that
I mentioned on April 28. wasn't implemented in
the newest release (v2.1.3a4) :-(

Maybe I wasn't giving a sufficient explanation
of the bug and the simple fix, so I try again:

I'm fetchpop'ing some mails from an external
mail server, and when some of these mails contains
a "newsgroups:" header field, I get the following
ClassCastException in the scheduler.log:

java.lang.ClassCastException: javax.mail.internet.NewsAddress
	at org.apache.james.James.sendMail(James.java:423)
	at java.lang.reflect.Method.invoke(Native Method)

(Note this only happens when the mails are fetchpopped)

This happens often if you have joined the bugtraq mail list.

Javamail treats the "newsgroups:" header field as a recipient,
so when we want to retrieve the recipients with

   Address addresses[] = message.getAllRecipients();

we also get the newsgroup, and therefore we get a
ClassCastException in the following:

   for (int i = 0; i < addresses.length; i++) {
     recipients.add(new MailAddress((InternetAddress)addresses[i]));
   }

It's easy to fix this problem with the following:

  for (int i = 0; i < addresses.length; i++) {
    if ( addresses[i] instanceof InternetAddress ) {
      recipients.add(new MailAddress((InternetAddress)addresses[i]));
    }
  }


I hope this is a better explanation of the problem, and
I hope that the fix goes into the officiel sourcecode, so
I don't have to patch the source code for each new release.

Best regards

Steen Jansdal










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


Mime
View raw message