You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/10/24 20:00:00 UTC

svn commit: r1813231 - /jmeter/trunk/src/jorphan/org/apache/jorphan/collections/HashTree.java

Author: pmouawad
Date: Tue Oct 24 20:00:00 2017
New Revision: 1813231

URL: http://svn.apache.org/viewvc?rev=1813231&view=rev
Log:
Fix some SONAR bugs and make code more readable

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/collections/HashTree.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/collections/HashTree.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/collections/HashTree.java?rev=1813231&r1=1813230&r2=1813231&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/collections/HashTree.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/collections/HashTree.java Tue Oct 24 20:00:00 2017
@@ -754,7 +754,7 @@ public class HashTree implements Seriali
      *            Array of keys used to recurse into HashTree structure
      * @return Set of all keys found in end HashTree
      */
-    public Collection<?> list(Object[] treePath) { // TODO not used?
+    public Collection<?> list(Object[] treePath) {
         if (treePath != null) {
             return list(Arrays.asList(treePath));
         }
@@ -858,12 +858,11 @@ public class HashTree implements Seriali
 
     protected HashTree getTreePath(Collection<?> treePath) {
         HashTree tree = this;
-        for (Object aTreePath : treePath) {
-            // Fixme why is this check here ?
+        for (Object aTreePath : treePath) {            
+            tree = tree.getTree(aTreePath);
             if (tree == null) {
                 return null;
             }
-            tree = tree.getTree(aTreePath);
         }
         return tree;
     }
@@ -918,7 +917,7 @@ public class HashTree implements Seriali
      *            Key to search for
      * @return HashTree mapped to key, if found, otherwise <code>null</code>
      */
-    public HashTree search(Object key) {// TODO does not appear to be used
+    public HashTree search(Object key) {
         HashTree result = getTree(key);
         if (result != null) {
             return result;
@@ -987,8 +986,7 @@ public class HashTree implements Seriali
      *            the {@link HashTreeTraverser} to be notified
      */
     private void traverseInto(HashTreeTraverser visitor) {
-
-        if (list().size() == 0) {
+        if (list().isEmpty()) {
             visitor.processPath();
         } else {
             for (Object item : list()) {
@@ -1075,6 +1073,7 @@ public class HashTree implements Seriali
 
         @Override
         public void processPath() {
+            // NOOP
         }
 
         @Override