Hello,
I don't agree with you.

SendMailCommand is only used as a local field in SmtpSampler#sample so no
Multiple Threads usage risk.
Furthermore, nearly all fields of SendMailCommand are not thread safe.


Regards
Philippe

On Thu, Nov 17, 2011 at 12:32 AM, sebb <[email protected]> wrote:

> On 16 November 2011 22:22,  <[email protected]> wrote:
> > Author: pmouawad
> > Date: Wed Nov 16 22:22:34 2011
> > New Revision: 1202910
> >
> > URL: http://svn.apache.org/viewvc?rev=1202910&view=rev
> > Log:
> > Replace StringBuffer by StringBuider and return String in
> getServerResponse()
> >
> > Modified:
> >
>  
> jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
> >
> > Modified:
> jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
> > URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java?rev=1202910&r1=1202909&r2=1202910&view=diff
> >
> ==============================================================================
> > ---
> jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
> (original)
> > +++
> jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
> Wed Nov 16 22:22:34 2011
> > @@ -94,7 +94,7 @@ public class SendMailCommand {
> >
> >     private Session session;
> >
> > -    private StringBuffer serverResponse = new StringBuffer(); // TODO
> this is not populated currently
> > +    private StringBuilder serverResponse = new StringBuilder(); // TODO
> this is not populated currently
>
> StringBuilder is not thread-safe; this is a class field so is not
> guaranteed private to a thread.
>
> >
> >     /** send plain body, i.e. not multipart/mixed */
> >     private boolean plainBody;
> > @@ -759,8 +759,8 @@ public class SendMailCommand {
> >         this.plainBody = plainBody;
> >     }
> >
> > -    public StringBuffer getServerResponse() {
> > -        return this.serverResponse;
> > +    public String getServerResponse() {
> > +        return this.serverResponse.toString();
> >     }
> >
> >     public void setEnableDebug(boolean selected) {
> >
> >
> >
>



-- 
Cordialement.
Philippe Mouawad.

Reply via email to