jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1294195 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Date Mon, 27 Feb 2012 16:10:00 GMT
Author: pmouawad
Date: Mon Feb 27 16:09:59 2012
New Revision: 1294195

URL: http://svn.apache.org/viewvc?rev=1294195&view=rev
Log:
Revert back invokeLater as we must wait for sample to occur before delivering otherwise a
NPE will occurs in ResultCollector

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1294195&r1=1294194&r2=1294195&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Mon Feb 27 16:09:59 2012
@@ -28,8 +28,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import javax.swing.SwingUtilities;
-
 import org.apache.jmeter.assertions.ResponseAssertion;
 import org.apache.jmeter.assertions.gui.AssertionGui;
 import org.apache.jmeter.config.Arguments;
@@ -396,42 +394,30 @@ public class ProxyControl extends Generi
      * server's response while recording. A future consideration.
      */
     public synchronized void deliverSampler(final HTTPSamplerBase sampler, final TestElement[]
subConfigs, final SampleResult result) {
-        try {
-            SwingUtilities.invokeAndWait(new Runnable() {
-                public void run() {
-                    if (filterContentType(result) && filterUrl(sampler)) {
-                        JMeterTreeNode myTarget = findTargetControllerNode();
-                        @SuppressWarnings("unchecked") // OK, because find only returns correct
element types
-                        Collection<ConfigTestElement> defaultConfigurations = (Collection<ConfigTestElement>)
findApplicableElements(myTarget, ConfigTestElement.class, false);
-                        @SuppressWarnings("unchecked") // OK, because find only returns correct
element types
-                        Collection<Arguments> userDefinedVariables = (Collection<Arguments>)
findApplicableElements(myTarget, Arguments.class, true);
-
-                        removeValuesFromSampler(sampler, defaultConfigurations);
-                        replaceValues(sampler, subConfigs, userDefinedVariables);
-                        sampler.setAutoRedirects(samplerRedirectAutomatically);
-                        sampler.setFollowRedirects(samplerFollowRedirects);
-                        sampler.setUseKeepAlive(useKeepAlive);
-                        sampler.setImageParser(samplerDownloadImages);
+        if (filterContentType(result) && filterUrl(sampler)) {
+            JMeterTreeNode myTarget = findTargetControllerNode();
+            @SuppressWarnings("unchecked") // OK, because find only returns correct element
types
+            Collection<ConfigTestElement> defaultConfigurations = (Collection<ConfigTestElement>)
findApplicableElements(myTarget, ConfigTestElement.class, false);
+            @SuppressWarnings("unchecked") // OK, because find only returns correct element
types
+            Collection<Arguments> userDefinedVariables = (Collection<Arguments>)
findApplicableElements(myTarget, Arguments.class, true);
+
+            removeValuesFromSampler(sampler, defaultConfigurations);
+            replaceValues(sampler, subConfigs, userDefinedVariables);
+            sampler.setAutoRedirects(samplerRedirectAutomatically);
+            sampler.setFollowRedirects(samplerFollowRedirects);
+            sampler.setUseKeepAlive(useKeepAlive);
+            sampler.setImageParser(samplerDownloadImages);
 
-                        placeSampler(sampler, subConfigs, myTarget);
-                    }
-                    else {
-                        if(log.isDebugEnabled()) {
-                            log.debug("Sample excluded based on url or content-type: " +
result.getUrlAsString() + " - " + result.getContentType());
-                        }
-                        result.setSampleLabel("["+result.getSampleLabel()+"]");
-                    }
-                    // SampleEvent is not passed JMeterVariables, because they don't make
sense for Proxy Recording
-                    notifySampleListeners(new SampleEvent(result, "WorkBench")); // TODO
- is this the correct threadgroup name?
-                }
-            });
-        } catch (InterruptedException e) {
-            log.error("Program error", e);
-            throw new Error(e);
-        } catch (InvocationTargetException e) {
-            log.error("Program error", e);
-            throw new Error(e);
+            placeSampler(sampler, subConfigs, myTarget);
+        }
+        else {
+            if(log.isDebugEnabled()) {
+                log.debug("Sample excluded based on url or content-type: " + result.getUrlAsString()
+ " - " + result.getContentType());
+            }
+            result.setSampleLabel("["+result.getSampleLabel()+"]");
         }
+        // SampleEvent is not passed JMeterVariables, because they don't make sense for Proxy
Recording
+        notifySampleListeners(new SampleEvent(result, "WorkBench")); // TODO - is this the
correct threadgroup name?
     }
 
     public void stopProxy() {



Mime
View raw message