Author: sebb
Date: Sun May 21 08:25:50 2006
New Revision: 408180

URL: http://svn.apache.org/viewvc?rev=408180&view=rev
Log:
Bug 38707 - encode spaces in extracted URLs

Modified:
    
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java

Modified: 
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=408180&r1=408179&r2=408180&view=diff
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
 Sun May 21 08:25:50 2006
@@ -681,14 +681,26 @@
                        while (urls.hasNext()) {
                                Object binURL = urls.next();
                                try {
-                                       HTTPSampleResult binRes = sample((URL) 
binURL, GET, false, frameDepth + 1);
+                                       URL url = (URL) binURL;
+                    String urlstr = url.toString();
+                    String urlStrEnc=encodeSpaces(urlstr);
+                    if (!urlstr.equals(urlStrEnc)){// There were some spaces 
in the URL
+                        try {
+                            url = new URL(urlStrEnc);
+                        } catch (MalformedURLException e) {
+                            res.addSubResult(errorResult(new 
Exception(urlStrEnc + " is not a correct URI"), res));
+                            res.setSuccessful(false);
+                            continue;
+                        }
+                    }
+                    HTTPSampleResult binRes = sample(url, GET, false, 
frameDepth + 1);
                                        res.addSubResult(binRes);
                                        res.setSuccessful(res.isSuccessful() && 
binRes.isSuccessful());
                                } catch (ClassCastException e) {
                                        res.addSubResult(errorResult(new 
Exception(binURL + " is not a correct URI"), res));
                                        res.setSuccessful(false);
                                        continue;
-                               }
+                }
                        }
                }
                return res;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to