Committed by
Gerrit Code Review
Fix for missing case in set test cli
-Also avoid bug in toArray by using the current set size Change-Id: Ie838b9fe755859a1cb5af11934f29049466eb93f
Showing
1 changed file
with
4 additions
and
2 deletions
... | @@ -74,7 +74,7 @@ public class SetTestGetCommand extends AbstractShellCommand { | ... | @@ -74,7 +74,7 @@ public class SetTestGetCommand extends AbstractShellCommand { |
74 | if (set.isEmpty()) { | 74 | if (set.isEmpty()) { |
75 | print("[]"); | 75 | print("[]"); |
76 | } else { | 76 | } else { |
77 | - for (String e : set.toArray(new String[0])) { | 77 | + for (String e : set.toArray(new String[set.size()])) { |
78 | if (output.isEmpty()) { | 78 | if (output.isEmpty()) { |
79 | output += e; | 79 | output += e; |
80 | } else { | 80 | } else { |
... | @@ -84,7 +84,9 @@ public class SetTestGetCommand extends AbstractShellCommand { | ... | @@ -84,7 +84,9 @@ public class SetTestGetCommand extends AbstractShellCommand { |
84 | print("[%s]", output); | 84 | print("[%s]", output); |
85 | } | 85 | } |
86 | // Check if given values are in the set | 86 | // Check if given values are in the set |
87 | - if (values.length == 1) { | 87 | + if (values == null) { |
88 | + return; | ||
89 | + } else if (values.length == 1) { | ||
88 | // contains | 90 | // contains |
89 | if (set.contains(values[0])) { | 91 | if (set.contains(values[0])) { |
90 | print("Set %s contains the value %s", setName, values[0]); | 92 | print("Set %s contains the value %s", setName, values[0]); | ... | ... |
-
Please register or login to post a comment