-
Notifications
You must be signed in to change notification settings - Fork 806
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
Initial attempt to address WW-5101 #460
Initial attempt to address WW-5101 #460
Conversation
- Add comments to methods related to ResrouceBundle cache clearing. - Correct clearTomcatCache() so that it acts as intended for Tomcat 7-10. - Add clearResourceBundleClassloaderCaches() method that uses standard Java API calls to perform the cache clearing. - Adjust clearMap() logic to only change accessiblity when required.
Hello Apache Struts Team. This is an an initial attempt to address the reported issue. Basic local testing indicates it is working, with no illegal reflective access warnings seen with Java 11. People may decide to eventually remove the Please let me know if the PR looks OK when you have time. |
* | ||
* Note: With Java 9+, calling this method may result in "Illegal reflective access" warnings. Be aware | ||
* its logic may fail in a future version of Java that blocks the reflection calls needed for this method. | ||
* {<code></code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* {<code></code> |
this line can probably be omitted
|
||
try { | ||
if ("org.apache.catalina.loader.WebappClassLoader".equals(cl.getName())) { | ||
clearMap(cl, loader, TOMCAT_RESOURCE_ENTRIES_FIELD); | ||
if ( (TOMCAT_WEBAPP_CLASSLOADER.equals(cl.getName()) || TOMCAT_PARALLEL_WEBAPP_CLASSLOADER.equals(cl.getName())) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( (TOMCAT_WEBAPP_CLASSLOADER.equals(cl.getName()) || TOMCAT_PARALLEL_WEBAPP_CLASSLOADER.equals(cl.getName())) && | |
if ((TOMCAT_WEBAPP_CLASSLOADER.equals(cl.getName()) || TOMCAT_PARALLEL_WEBAPP_CLASSLOADER.equals(cl.getName())) && |
consistent formatting
if ("org.apache.catalina.loader.WebappClassLoader".equals(cl.getName())) { | ||
clearMap(cl, loader, TOMCAT_RESOURCE_ENTRIES_FIELD); | ||
if ( (TOMCAT_WEBAPP_CLASSLOADER.equals(cl.getName()) || TOMCAT_PARALLEL_WEBAPP_CLASSLOADER.equals(cl.getName())) && | ||
(superCl != null && TOMCAT_WEBAPP_CLASSLOADER_BASE.equals(superCl.getName())) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(superCl != null && TOMCAT_WEBAPP_CLASSLOADER_BASE.equals(superCl.getName())) ) { | |
(superCl != null && TOMCAT_WEBAPP_CLASSLOADER_BASE.equals(superCl.getName()))) { |
- Changed formatting as per review. - Added null guard for unlikely dereference in clearTomcatCache() logging statement. - Added a unit test for basic correctness check and better code coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
No complains, so let's merge! |
Initial attempt to address WW-5101