You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/02/26 10:30:51 UTC
svn commit: r1784435 -
/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/SmtpSampler.java
Author: pmouawad
Date: Sun Feb 26 10:30:51 2017
New Revision: 1784435
URL: http://svn.apache.org/viewvc?rev=1784435&view=rev
Log:
Replace CounterOutputStream by commons-io CountingOutputStream
Modified:
jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/SmtpSampler.java
Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/SmtpSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/SmtpSampler.java?rev=1784435&r1=1784434&r2=1784435&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/SmtpSampler.java (original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/SmtpSampler.java Sun Feb 26 10:30:51 2017
@@ -41,10 +41,11 @@ import javax.mail.internet.ContentType;
import javax.mail.internet.InternetAddress;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.output.CountingOutputStream;
+import org.apache.commons.io.output.NullOutputStream;
import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.protocol.smtp.sampler.gui.SecuritySettingsPanel;
import org.apache.jmeter.protocol.smtp.sampler.protocol.SendMailCommand;
-import org.apache.jmeter.protocol.smtp.sampler.tools.CounterOutputStream;
import org.apache.jmeter.samplers.AbstractSampler;
import org.apache.jmeter.samplers.Entry;
import org.apache.jmeter.samplers.SampleResult;
@@ -54,6 +55,7 @@ import org.apache.jmeter.testelement.pro
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
/**
* Sampler-Class for JMeter - builds, starts and interprets the results of the
* sampler. Has to implement some standard-methods for JMeter in order to be
@@ -186,9 +188,9 @@ public class SmtpSampler extends Abstrac
private long calculateMessageSize(Message message) throws IOException, MessagingException {
if (getPropertyAsBoolean(MESSAGE_SIZE_STATS)) {
// calculate message size
- CounterOutputStream cs = new CounterOutputStream();
+ CountingOutputStream cs = new CountingOutputStream(new NullOutputStream());
message.writeTo(cs);
- return cs.getCount();
+ return cs.getByteCount();
} else {
return -1L;
}