If ObservableList.size() >= 18, Collections#reverse() throws an exception. If you run the attached test code(ObservableListTestCase.java), you will get the following exception.
testReverseObservableListWith18Elements(org.mule.module.launcher.util.ObservableListTestCase) Time elapsed: 0.012 sec <<< ERROR! java.lang.IndexOutOfBoundsException: Index: 18, Size: 18 at java.util.ArrayList.rangeCheck(ArrayList.java:638) at java.util.ArrayList.set(ArrayList.java:429) at org.mule.module.launcher.util.ObservableList.set(ObservableList.java:261) at org.mule.module.launcher.util.ObservableList$ObservableListIterator.set(ObservableList.java:385) at java.util.Collections.reverse(Collections.java:448) at org.mule.module.launcher.util.ObservableListTestCase.testReverse(ObservableListTestCase.java:21) at org.mule.module.launcher.util.ObservableListTestCase.testReverseObservableListWith18Elements(ObservableListTestCas\ e.java:31)
Results :
Tests in error: ObservableListTestCase.testReverseObservableListWith18Elements:31->testReverse:21 » IndexOutOfBounds
You can find that Collections#reverse is called with an instance of ObservableList<Application> in DeploymentDirectoryWatcher#stopArtifacts.
The attached patch fixes it. It is for 606a08f0381debca529e8fcf2aa963c0a618bb1e on mule-3.x branch. I can make a pull request, if you want.
|