kamranzafar / JCL

Jar Class Loader, a configurable and dynamic custom classloader designed to create, manage and manipulate isolated Java classloaders in IoC frameworks and web applications.
http://kamranzafar.github.com/
579 stars 161 forks source link

With Java8 #37

Closed youngmip closed 8 years ago

youngmip commented 9 years ago

Hi,

We have been using this for a while and always thank you !

We tested our code with Java 8 and found an exception, which was never seen before.

Caused by: java.util.ConcurrentModificationException: null

    at java.util.ArrayList.sort(ArrayList.java:1456) ~[na:1.8.0_31]

    at java.util.Collections.sort(Collections.java:141) ~[na:1.8.0_31]

    at org.xeustechnologies.jcl.AbstractClassLoader.loadClass(AbstractClassLoader.java:97) ~[ebinocle-indexer-25.9-jar-with-dependencies.jar:25.9]

    at org.xeustechnologies.jcl.AbstractClassLoader.loadClass(AbstractClassLoader.java:82) ~[ebinocle-indexer-25.9-jar-with-dependencies.jar:25.9]

    at org.xeustechnologies.jcl.JclObjectFactory.create(JclObjectFactory.java:95) ~[ebinocle-indexer-25.9-jar-with-dependencies.jar:25.9]

In Java8, Collections.sort is implemented differently from the previous Java.

Someone had a similar issue and wrote about it here: http://onelineatatime.io/collections-sort-the-java8u20-modification/

I had a look at the relevant code. Moving 'Collections.sort' into methods modifying the list (addDefaultLoader & addLoader) can be a simple solution but I am unsure if it is okay enough.

I would appreciate it if you have a look at this issue.

Regards, Youngmi.

kamranzafar commented 8 years ago

Fix available in version 2.7