neth 01/10/11 05:07:13
Modified: src/org/apache/jmeter/protocol/http/sampler
HTTPSamplerFull.java
Log:
When following <input type="image"...> tags ensure that it's not null before looking
for the 'src' attributes
Revision Changes Path
1.10 +35 -29
jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFull.java
Index: HTTPSamplerFull.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFull.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- HTTPSamplerFull.java 2001/10/05 19:57:12 1.9
+++ HTTPSamplerFull.java 2001/10/11 12:07:13 1.10
@@ -83,7 +83,7 @@
*
* @author Khor Soon Hin
* @version 1.0
- * @created $Date: 2001/10/05 19:57:12 $
+ * @created $Date: 2001/10/11 12:07:13 $
*/
public class HTTPSamplerFull extends HTTPSampler
{
@@ -277,34 +277,40 @@
// get the url of those images
NamedNodeMap nnm = tempNode.getAttributes();
Node namedItem = nnm.getNamedItem("type");
- String inputType = namedItem.getNodeValue();
- if(catClass.isDebugEnabled())
- {
- 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);
- 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);
- }
+ if(namedItem != null)
+ {
+ String inputType = namedItem.getNodeValue();
+ if(catClass.isDebugEnabled())
+ {
+ 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);
+ 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]