jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1842124 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java xdocs/changes.xml
Date Thu, 27 Sep 2018 17:20:36 GMT
Author: pmouawad
Date: Thu Sep 27 17:20:36 2018
New Revision: 1842124

URL: http://svn.apache.org/viewvc?rev=1842124&view=rev
Log:
Bug 62767 - NPE when searching under certain conditions
Contributed by UbikLoadPack
Bugzilla Id: 62767

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java?rev=1842124&r1=1842123&r2=1842124&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java Thu Sep 27 17:20:36
2018
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 import javax.swing.ImageIcon;
@@ -47,7 +48,7 @@ public class JMeterTreeNode extends Defa
     private static final int TEST_PLAN_LEVEL = 1;
 
     // See Bug 54648
-    private transient JMeterTreeModel treeModel;
+    private transient Optional<JMeterTreeModel> treeModel;
 
     private boolean markedBySearch;
 
@@ -61,7 +62,7 @@ public class JMeterTreeNode extends Defa
 
     public JMeterTreeNode(TestElement userObj, JMeterTreeModel treeModel) {
         super(userObj);
-        this.treeModel = treeModel;
+        this.treeModel = Optional.ofNullable(treeModel);
     }
 
     public boolean isEnabled() {
@@ -70,7 +71,7 @@ public class JMeterTreeNode extends Defa
 
     public void setEnabled(boolean enabled) {
         getTestElement().setEnabled(enabled);
-        treeModel.nodeChanged(this);
+        treeModel.ifPresent(tm -> tm.nodeChanged(this));
     }
     
     /**
@@ -78,11 +79,11 @@ public class JMeterTreeNode extends Defa
      * @return {@link List} of {@link JMeterTreeNode}s
      */
     public List<JMeterTreeNode> getPathToThreadGroup() {
-        if (treeModel == null) {
+        if (!treeModel.isPresent()) {
             return new ArrayList<>();
         }
 
-        return Arrays.stream(treeModel.getPathToRoot(this))
+        return Arrays.stream(treeModel.get().getPathToRoot(this))
                 .map(node -> (JMeterTreeNode) node)
                 .filter(node -> node.getLevel() >= TEST_PLAN_LEVEL)
                 .collect(Collectors.toList());
@@ -97,7 +98,7 @@ public class JMeterTreeNode extends Defa
             return;
         }
         this.childrenMarkedBySearch = tagged;
-        treeModel.nodeChanged(this);
+        treeModel.ifPresent(tm -> tm.nodeChanged(this));
     }
     /**
      * Tag Node as result of a search
@@ -116,7 +117,7 @@ public class JMeterTreeNode extends Defa
             }
         }
 
-        treeModel.nodeChanged(this);
+        treeModel.ifPresent(tm -> tm.nodeChanged(this));
     }
     
     /**
@@ -215,9 +216,6 @@ public class JMeterTreeNode extends Defa
     /** {@inheritDoc} */
     @Override
     public void nameChanged() {
-        if (treeModel != null) { // may be null during startup
-            treeModel.nodeChanged(this);
-        }
+        treeModel.ifPresent(tm -> tm.nodeChanged(this));
     }
-
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1842124&r1=1842123&r2=1842124&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Sep 27 17:20:36 2018
@@ -160,6 +160,7 @@ Summary
 <ul>
     <li><bug>62745</bug>Fix undefined disabled icon. Contributed by Till
Neunast (https://github.com/tilln)</li>
     <li><bug>62743</bug>Client auth must be enabled on distributed testing</li>
+    <li><bug>62767</bug>NPE when searching under certain conditions. Contributed
by Ubik Load Pack (support at ubikloadpack.com)</li>
 </ul>
 
  <!--  =================== Thanks =================== -->
@@ -170,6 +171,7 @@ Summary
 <ul>
     <li>Till Neunast (https://github.com/tilln)</li>
     <li>Mingun (alexander_sergey at mail.ru)</li>
+    <li><a href="https://ubikloadpack.com">Ubik Load Pack</a></li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter.</p>
 <p>



Mime
View raw message