Such a method generally looks dangerous, since a new String will be allocated every time it's called, possibly creating a ton of Garbage (or consuming a ton of memory) if there's a lot of responses processed this way or they are very large.
Would you mind adding a note to this effect to the method's JavaDoc?
-- Salut,
Jordi.
[EMAIL PROTECTED] wrote:
sebb 2003/10/02 09:18:22
Modified: src/core/org/apache/jmeter/samplers SampleResult.java
Log:
Add convenience method responseDataToString
Revision Changes Path
1.10 +13 -2 jakarta-jmeter/src/core/org/apache/jmeter/samplers/SampleResult.java
Index: SampleResult.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/samplers/SampleResult.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SampleResult.java 7 Sep 2003 18:54:53 -0000 1.9
+++ SampleResult.java 2 Oct 2003 16:18:21 -0000 1.10
@@ -255,6 +255,17 @@
return responseData;
}
+ /**
+ * Convenience method to return responseData as a String
+ * + * @return the responseData as a string. If responseData is null
+ * then the empty string is returned, rather than null.
+ */
+ public String responseDatatoString()
+ {
+ return (responseData == null) ? "" : new String(responseData);
+ }
+
public void setSamplerData(String s)
{
samplerData = s;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
