Author: sebb
Date: Sat Apr 14 10:02:45 2007
New Revision: 528838

URL: http://svn.apache.org/viewvc?view=rev&rev=528838
Log:
Move method creation into try block as it can cause IllegalArgument

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

Modified: 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java?view=diff&rev=528838&r1=528837&r2=528838
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
 Sat Apr 14 10:02:45 2007
@@ -650,25 +650,6 @@
 
         HttpMethodBase httpMethod = null;
 
-        if (method.equals(POST)) {
-            httpMethod = new PostMethod(urlStr);
-        } else if (method.equals(PUT)){
-            httpMethod = new PutMethod(urlStr);
-        } else if (method.equals(HEAD)){
-            httpMethod = new HeadMethod(urlStr);
-        } else if (method.equals(TRACE)){
-            httpMethod = new TraceMethod(urlStr);
-        } else if (method.equals(OPTIONS)){
-            httpMethod = new OptionsMethod(urlStr);
-        } else if (method.equals(DELETE)){
-            httpMethod = new DeleteMethod(urlStr);
-        } else if (method.equals(GET)){
-            httpMethod = new GetMethod(urlStr);
-        } else {
-               log.error("Unexpected method (converted to GET): "+method);
-            httpMethod = new GetMethod(urlStr);
-        }
-
                HTTPSampleResult res = new HTTPSampleResult();
                res.setMonitor(isMonitor());
         
@@ -678,6 +659,26 @@
         HttpClient client = null;
         InputStream instream = null;
                try {
+                       // May generate IllegalArgumentException
+                       if (method.equals(POST)) {
+                           httpMethod = new PostMethod(urlStr);
+                       } else if (method.equals(PUT)){
+                           httpMethod = new PutMethod(urlStr);
+                       } else if (method.equals(HEAD)){
+                           httpMethod = new HeadMethod(urlStr);
+                       } else if (method.equals(TRACE)){
+                           httpMethod = new TraceMethod(urlStr);
+                       } else if (method.equals(OPTIONS)){
+                           httpMethod = new OptionsMethod(urlStr);
+                       } else if (method.equals(DELETE)){
+                           httpMethod = new DeleteMethod(urlStr);
+                       } else if (method.equals(GET)){
+                           httpMethod = new GetMethod(urlStr);
+                       } else {
+                               log.error("Unexpected method (converted to 
GET): "+method);
+                           httpMethod = new GetMethod(urlStr);
+                       }
+
                        client = setupConnection(url, httpMethod, res);
 
                        if (method.equals(POST)) {



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

Reply via email to