neth 01/10/11 05:08:21
Modified: src/org/apache/jmeter/protocol/http/sampler
MultipartFormSamplerFull.java
Log:
When following <input type="image"..> tags, ensure that it exist before looking for
the 'src' attribute
Revision Changes Path
1.3 +35 -26
jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/MultipartFormSamplerFull.java
Index: MultipartFormSamplerFull.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/MultipartFormSamplerFull.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MultipartFormSamplerFull.java 2001/10/07 15:47:00 1.2
+++ MultipartFormSamplerFull.java 2001/10/11 12:08:21 1.3
@@ -273,37 +273,46 @@
// get the url of those images
NamedNodeMap nnm = tempNode.getAttributes();
Node namedItem = nnm.getNamedItem("type");
- String inputType = namedItem.getNodeValue();
- if(catClass.isDebugEnabled())
+ if(namedItem != null)
{
- catClass.debug("sample2 : Input type - " +
inputType);
- }
-
- if(inputType != null &&
inputType.equalsIgnoreCase("image"))
- {
- imgRes = new SampleResult();
- namedItem = nnm.getNamedItem("src");
- String imgUrlStr = namedItem.getNodeValue();
-
- // set the baseUrl and imgUrl so that if error
occurs
- // due to MalformedException then at least the
values will be
- // visible to the user to aid correction
- imgRes.putValue(SampleResult.DISPLAY_NAME,
baseUrl + "," + imgUrlStr);
-
- // download those images
- URL imgUrl = new URL(baseUrl, imgUrlStr);
+ String inputType = namedItem.getNodeValue();
if(catClass.isDebugEnabled())
{
- catClass.debug("sample2 : Image url
without baseUrl - " + imgUrlStr);
- catClass.debug("sample2 : Image url
with baseUrl - " + imgUrl);
+ catClass.debug("sample2 : Input type -
" +
+ inputType);
}
- loadBinary(imgUrl, e, imgRes);
- ImageIcon image = new ImageIcon(imgUrl,
imgUrl.toString());
- imgRes.putValue(IMAGE, image);
- imgRes.putValue(SampleResult.DISPLAY_NAME,
imgUrl.toString());
- totalTime += imgRes.getTime();
- imgRes.remove(SampleResult.TEXT_RESPONSE);
+ if(inputType != null &&
+ inputType.equalsIgnoreCase("image"))
+ {
+ imgRes = new SampleResult();
+ namedItem = nnm.getNamedItem("src");
+ String imgUrlStr =
namedItem.getNodeValue();
+
+ // set the baseUrl and imgUrl so that
if error occurs
+ // due to MalformedException then at
least the values
+ // will be visible to the user to aid
correction
+
imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl
+ + "," + imgUrlStr);
+
+ // download those images
+ URL imgUrl = new URL(baseUrl,
imgUrlStr);
+ if(catClass.isDebugEnabled())
+ {
+ catClass.debug(
+ "sample2 : Image url
without baseUrl - " + imgUrlStr);
+ catClass.debug("sample2 :
Image url with baseUrl - " + imgUrl);
+ }
+
+ loadBinary(imgUrl, e, imgRes);
+ ImageIcon image = new
ImageIcon(imgUrl,
+ imgUrl.toString());
+ imgRes.putValue(IMAGE, image);
+
imgRes.putValue(SampleResult.DISPLAY_NAME,
+ imgUrl.toString());
+ totalTime += imgRes.getTime();
+
imgRes.remove(SampleResult.TEXT_RESPONSE);
+ }
}
}
catch(IOException exception)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]