You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by sebb <se...@gmail.com> on 2011/11/17 00:32:40 UTC
Re: svn commit: r1202910 - /jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
On 16 November 2011 22:22, <pm...@apache.org> 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) {
>
>
>
Re: svn commit: r1202910 - /jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
Posted by Philippe Mouawad <ph...@gmail.com>.
no pb, always good to double check.
On Thu, Nov 17, 2011 at 11:44 AM, sebb <se...@gmail.com> wrote:
> On 17 November 2011 06:35, Philippe Mouawad <ph...@gmail.com>
> wrote:
> > 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.
>
> OK.
>
> Sorry, I was just looking at the change in the message, and did not
> have the full context to hand.
>
>
> >
> > Regards
> > Philippe
> >
> > On Thu, Nov 17, 2011 at 12:32 AM, sebb <se...@gmail.com> wrote:
> >
> >> On 16 November 2011 22:22, <pm...@apache.org> 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.
> >
>
--
Cordialement.
Philippe Mouawad.
Re: svn commit: r1202910 - /jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
Posted by sebb <se...@gmail.com>.
On 17 November 2011 06:35, Philippe Mouawad <ph...@gmail.com> wrote:
> 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.
OK.
Sorry, I was just looking at the change in the message, and did not
have the full context to hand.
>
> Regards
> Philippe
>
> On Thu, Nov 17, 2011 at 12:32 AM, sebb <se...@gmail.com> wrote:
>
>> On 16 November 2011 22:22, <pm...@apache.org> 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.
>
Re: svn commit: r1202910 - /jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
Posted by Philippe Mouawad <ph...@gmail.com>.
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 <se...@gmail.com> wrote:
> On 16 November 2011 22:22, <pm...@apache.org> 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.