You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/01/02 15:11:00 UTC

[jira] [Work logged] (WW-5101) AbstractLocalizedTextProvider illegal reflective access operation has occurred

     [ https://issues.apache.org/jira/browse/WW-5101?focusedWorklogId=530212&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-530212 ]

ASF GitHub Bot logged work on WW-5101:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Jan/21 15:10
            Start Date: 02/Jan/21 15:10
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart commented on pull request #460:
URL: https://github.com/apache/struts/pull/460#issuecomment-753484972


   No complains, so let's merge!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 530212)
    Time Spent: 1.5h  (was: 1h 20m)

> AbstractLocalizedTextProvider illegal reflective access operation has occurred
> ------------------------------------------------------------------------------
>
>                 Key: WW-5101
>                 URL: https://issues.apache.org/jira/browse/WW-5101
>             Project: Struts 2
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 2.5.26
>            Reporter: Greg Huber
>            Assignee: Greg Huber
>            Priority: Minor
>             Fix For: 2.6
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Testing on java 11 AbstractLocalizedTextProvider outputs
> WARNING: An illegal reflective access operation has occurred
>  WARNING: Illegal reflective access by
>  com.opensymphony.xwork2.util.AbstractLocalizedTextProvider
>  (file:struts2-core-2.5.26.jar|file:///struts2-core-2.5.26.jar) to field java.util.ResourceBundle.cacheList
>  WARNING: Please consider reporting this to the maintainers of
>  com.opensymphony.xwork2.util.AbstractLocalizedTextProvider
>  WARNING: Use --illegal-access=warn to enable warnings of further illegal
>  reflective access operations
>  WARNING: All illegal access operations will be denied in a future release
> {code:java}
> clearMap(ResourceBundle.class, null, "cacheList");
> private void clearMap(Class cl, Object obj, String name)  throws NoSuchFieldException, IllegalAccessException,
>  NoSuchMethodException, InvocationTargetException{ 
>     Field field = cl.getDeclaredField(name);
>     field.setAccessible(true);
>     Object cache = field.get(obj);
>         synchronized (cache) {
>             Class ccl = cache.getClass();
>             Method clearMethod = ccl.getMethod("clear");
>             clearMethod.invoke(cache);
>         }
> }
>  {code}
> When it executes the line field.setAccessible(true); produces the warning.
> Seems we might be able to replace
> {code:java}
> try{
>     clearMap(ResourceBundle.class, null, "cacheList"); }
> catch (NoSuchFieldException e) { 
>     // happens in IBM JVM, that has a different ResourceBundle impl it has a 'cache' member
>    clearMap(ResourceBundle.class, null, "cache");
> }{code}
>  with
> {code:java}
> ResourceBundle.clearCache();
> {code}
> Tomcat also uses the same method to flush resourceEntries. Tomcat checks org.apache.catalina.loader.WebappClassLoader but for version #9 its using org.apache.catalina.loader.ParallelWebappClassLoader, so defaults to
> {code:java}
> clearMap(cl.getSuperclass(), loader, TOMCAT_RESOURCE_ENTRIES_FIELD);
> {code}
> Commenting out the tomcat reload, the Struts bundles seem to reload ok.  Maybe drop this going forward?
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)