You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Vincenzo Gianferrari Pini <vi...@praxis.it> on 2003/05/19 17:37:30 UTC

[no virus] RE: Redirect - bugzilla 17805

> > 2) Looking at bug#17805, [it seems] that, for both 
> <static>FALSE</static>
> >    and <static>TRUE</static>, if using the "sender" magic value 
> for sender
> >    the original message's FROM header is used for the redirected one
> >    (getSender() returns null and service(Mail) handles it dynamically):
> 
> If I understand you correctly, then the above is wrong.  This code:
> 
>   if(sender == null) {
>       reply.setHeader(RFC2822Headers.FROM,
> message.getHeader(RFC2822Headers.FROM, ","));
>       sender = new
> MailAddress(((InternetAddress)message.getFrom()[0]).getAddress());
>   }
> 
> sets the sender value to a non-null value.  If static is true and 
> the sender
> magic value is "sender", then the first message's sender will be 
> the sender
> for all subsequent operations.  Please note that the sender address is an
> instance member, not block scoped within the method.
Now I see why I am not wrong: the way I corrected the "Redirect - thread safety and non-static values" problem corrects also this one. Please have a look at the code: all variables become local (block scoped within the method), and the line
sender = new MailAddress(((InternetAddress)message.getFrom()[0]).getAddress());
updates a local sender variable.

> 
> > <sender>sender</sender> seems to be always not static
> 
> Actually, this is what should be enforced.  If the sender magic value is
> "sender", then it is a configuration error to have static == true.
> 
See above: I think that the way the code is now all variables behave like static == false from the point of view of this bug #17805, although the "static" parameter still controls the performance.

Have here attached a more fresh set of mailets, including NotifyPostmaster.

Vincenzo