You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Steen Jansdal <sj...@buanco.dk> on 2003/05/08 09:30:30 UTC

My little fix wasn't implemented :-(

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


RE: My little fix wasn't implemented :-(

Posted by Danny Angus <da...@apache.org>.
Steen,

I think it probably didn't get included because you didn't follow the instructions.
But most importantly you didn't post it to the developers list.

http://james.apache.org/contribute.html

d.

> -----Original Message-----
> From: Steen Jansdal [mailto:sja@buanco.dk]
> Sent: 08 May 2003 08:31
> To: James Users List
> Subject: My little fix wasn't implemented :-(
> 
> 
> 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
> 


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


RE: My little fix wasn't implemented :-(

Posted by "Noel J. Bergman" <no...@devtech.com>.
When I was looking for patches to apply, I have to admit that "Fetch pop'ing
mails with 'Newsgroup' header fails" didn't stand out.  As Danny says,
following the procedure for submitting patches makes things work much
better.

> Javamail treats the "newsgroups:" header field as a recipient,

That was a useful thing to note.  Does this mean that the bounce() method
should also be changed?

	--- Noel


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