jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1226928 - in /jmeter/trunk/src: components/org/apache/jmeter/assertions/ components/org/apache/jmeter/control/gui/ components/org/apache/jmeter/extractor/ components/org/apache/jmeter/timers/ jorphan/org/apache/jorphan/gui/ protocol/http/o...
Date Tue, 03 Jan 2012 19:37:22 GMT
Author: sebb
Date: Tue Jan  3 19:37:22 2012
New Revision: 1226928

URL: http://svn.apache.org/viewvc?rev=1226928&view=rev
Log:
Redundant null checks (Findbugs)

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/BSFAssertion.java
    jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java
    jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java
    jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java
    jmeter/trunk/src/jorphan/org/apache/jorphan/gui/JLabeledChoice.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParsingUtils.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/BSFAssertion.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/BSFAssertion.java?rev=1226928&r1=1226927&r2=1226928&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/BSFAssertion.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/BSFAssertion.java Tue Jan  3
19:37:22 2012
@@ -36,12 +36,6 @@ public class BSFAssertion extends BSFTes
         AssertionResult result = new AssertionResult(getName());
         try {
             BSFManager mgr = getManager();
-            if (mgr == null) {
-                result.setFailure(true);
-                result.setError(true);
-                result.setFailureMessage("BSF Manager not found");
-                return result;
-            }
             mgr.declareBean("SampleResult", response, SampleResult.class);
             mgr.declareBean("AssertionResult", result, AssertionResult.class);
             processFileOrScript(mgr);
@@ -49,6 +43,7 @@ public class BSFAssertion extends BSFTes
             result.setError(false);
         } catch (BSFException e) {
             log.warn("Problem in BSF script "+e);
+            result.setFailure(true);
             result.setError(true);
             result.setFailureMessage(e.toString());
         }

Modified: jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java?rev=1226928&r1=1226927&r2=1226928&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java Tue
Jan  3 19:37:22 2012
@@ -186,8 +186,7 @@ public class ModuleControllerGui extends
         if (selected != null) {
             for (int i = 0; i < nodesModel.getSize(); i++) {
                 current = (TreeNodeWrapper) nodesModel.getElementAt(i);
-                if ((current.getTreeNode() == null && selected == null)
-                        || (current.getTreeNode() != null && current.getTreeNode().equals(selected)))
{
+                if (current.getTreeNode() != null && current.getTreeNode().equals(selected))
{
                     nodesModel.setSelectedItem(current);
                     break;
                 }

Modified: jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java?rev=1226928&r1=1226927&r2=1226928&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/extractor/BSFPostProcessor.java Tue Jan
 3 19:37:22 2012
@@ -35,7 +35,6 @@ public class BSFPostProcessor extends BS
     public void process(){
         try {
             BSFManager mgr = getManager();
-            if (mgr == null) { return; }
             processFileOrScript(mgr);
             mgr.terminate();
         } catch (BSFException e) {

Modified: jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java?rev=1226928&r1=1226927&r2=1226928&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java Tue Jan  3 19:37:22
2012
@@ -35,9 +35,6 @@ public class BSFTimer extends BSFTestEle
         long delay = 0;
         try {
             BSFManager mgr = getManager();
-            if (mgr == null) {
-                return 0; 
-            }
             Object o = evalFileOrScript(mgr);
             if (o == null) {
                 log.warn("Script did not return a value");

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/gui/JLabeledChoice.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/JLabeledChoice.java?rev=1226928&r1=1226927&r2=1226928&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/gui/JLabeledChoice.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/gui/JLabeledChoice.java Tue Jan  3 19:37:22
2012
@@ -39,8 +39,6 @@ import javax.swing.event.ChangeListener;
 public class JLabeledChoice extends JPanel implements JLabeledField {
     private static final long serialVersionUID = 240L;
 
-    private static final Object[] EMPTY_OBJECT_ARRAY = new Object [0];
-
     private final JLabel mLabel = new JLabel();
 
     private final JComboBox choiceList;
@@ -203,11 +201,7 @@ public class JLabeledChoice extends JPan
     }
 
     public Object[] getSelectedItems() {
-        Object list[]=choiceList.getSelectedObjects();
-        if (list==null) {
-            return EMPTY_OBJECT_ARRAY;
-        }
-        return list;
+        return choiceList.getSelectedObjects();
     }
 
     public String[] getItems() {

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParsingUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParsingUtils.java?rev=1226928&r1=1226927&r2=1226928&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParsingUtils.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParsingUtils.java
Tue Jan  3 19:37:22 2012
@@ -82,9 +82,6 @@ public final class HtmlParsingUtils {
         }
 
         final Arguments arguments = config.getArguments();
-        if (query == null && arguments.getArgumentCount() > 0) {
-            return false;// failed to convert query, so assume no match
-        }
 
         final Perl5Matcher matcher = JMeterUtils.getMatcher();
         final PatternCacheLRU patternCache = JMeterUtils.getPatternCache();

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java?rev=1226928&r1=1226927&r2=1226928&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java (original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java Tue
Jan  3 19:37:22 2012
@@ -319,7 +319,7 @@ public class JMSSampler extends Abstract
             Object obj = context.lookup(getQueueConnectionFactory());
             if (!(obj instanceof QueueConnectionFactory)) {
                 String msg = "QueueConnectionFactory expected, but got "
-                    + obj == null ? "null" :  obj.getClass().getName();
+                    + obj.getClass().getName();
                 LOGGER.fatalError(msg);
                 throw new IllegalStateException(msg);
             }



Mime
View raw message