Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/2485#discussion_r159734646 --- Diff: storm-server/src/main/java/org/apache/storm/scheduler/resource/NormalizedResources.java --- @@ -184,30 +191,25 @@ public void remove(NormalizedResources other) { int otherLength = other.otherResources.length; int length = otherResources.length; if (otherLength > length) { - double [] newResources = new double[otherLength]; + double[] newResources = new double[otherLength]; System.arraycopy(newResources, 0, otherResources, 0, length); otherResources = newResources; } - for (int i = 0; i < Math.min(length, otherLength); i++) { + for (int i = 0; i < otherLength; i++) { --- End diff -- I think that other may have a longer array, and if that happens then we will get an ArrayIndexOutOfBoundsException. ``` NormalizedResources A = new NormalizedResources({"cpu": 1}); NormalizedResources B = new NormalizedResources({"cpu":1, "foo": 100}); A.remove(B); ```
---