-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed EDT Classloading issues after EDT shutdown. #679
Conversation
The EventQueue.class stores the classloader in a final field classLoader. The EventQueue itself is stored static inside SunToolkit.class. Even if the active EDT thread classloader is modified to a JNLP classloader, classloading will fail once an AWTAutoShutdown occurs. (No edt activity for 1 second). If any new activity starts, the EDT Thread is recreated and initialized with the classloader stored in field classLoader in EventQueue class. This was not the JNLP classloader anymore. The result are ClassNotFound Exceptions. As there does not seem to be a "nice solution" because of the EventQueue implementation details the current solution temporary sets a DelegatingClassLoader to the thread which will initialize the eventqueue. Once initialized the original classloader is restored to the thread. During webstart loading the DelegatingClassLoader uses the original classloader once the jnlp classloader is active it gets injected into the DelegatingClassLoader. See: karakun/OpenWebStart#201
Implementation of DelegatingClassLoader has same overriden methods than the original implementation of DelegationClassloader: |
As i am not so deeply into classloading, i am asking myself it this implementation is correct from security perspective. Feel free to modify |
@Gr33nbl00d great to see this PR. Thank you very much. I will try to have a look at this next week. |
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Outdated
Show resolved
Hide resolved
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Outdated
Show resolved
Hide resolved
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Outdated
Show resolved
Hide resolved
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Outdated
Show resolved
Hide resolved
…legatingClassLoader.java Co-authored-by: Hendrik Ebbers <[email protected]>
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Outdated
Show resolved
Hide resolved
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Outdated
Show resolved
Hide resolved
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Outdated
Show resolved
Hide resolved
…legatingClassLoader.java Co-authored-by: Hendrik Ebbers <[email protected]>
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Show resolved
Hide resolved
core/src/main/java/net/sourceforge/jnlp/runtime/AppContextFactory.java
Outdated
Show resolved
Hide resolved
core/src/main/java/net/sourceforge/jnlp/runtime/classloader/DelegatingClassLoader.java
Outdated
Show resolved
Hide resolved
@FlorianRoettges & @Gr33nbl00d thanks for taking care of all the mentioned points in the review. I like the current state. In general I think that the given "Workaround" (let's call it lime that) is a good way for ITW / OWS to handle the general problem. I will have a deeper look and additional tests with @sclassen before we merge this PR. Hope to have time for this next week. This would make it possible to have it in the August release of ITW & OWS. |
@sclassen merge? |
The EventQueue.class stores the classloader in a final field classLoader. The EventQueue itself is stored static inside SunToolkit.class. Even if the active EDT thread classloader is modified to a JNLP classloader, classloading will fail once an AWTAutoShutdown occurs. (No edt activity for 1 second). If any new activity starts, the EDT Thread is recreated and initialized with the classloader stored in field classLoader in EventQueue class. This was not the JNLP classloader anymore. The result are ClassNotFound Exceptions. As there does not seem to be a "nice solution" because of the EventQueue implementation details the current solution temporary sets a DelegatingClassLoader to the thread which will initialize the eventqueue. Once initialized the original classloader is restored to the thread. During webstart loading the DelegatingClassLoader uses the original classloader once the jnlp classloader is active it gets injected into the DelegatingClassLoader. See:
karakun/OpenWebStart#201