regression - tried to access abstract protected method

Description

"ERROR","XNIO-1 task-1","06/24/2024","13:26:31","dynamic","class lucee.invoc.wrap.v1.java.util.PropertyResourceBundle.handleGetObject_6oi22wk4ims4 tried to access abstract protected method 'java.lang.Object java.util.ResourceBundle.handleGetObject(java.lang.String)' (lucee.invoc.wrap.v1.java.util.PropertyResourceBundle.handleGetObject_6oi22wk4ims4 is in unnamed module of loader lucee.transformer.dynamic.DynamicClassLoader @d969b17; java.util.ResourceBundle is in module java.base of loader 'bootstrap');java.lang.IllegalAccessError: class lucee.invoc.wrap.v1.java.util.PropertyResourceBundle.handleGetObject_6oi22wk4ims4 tried to access abstract protected method 'java.lang.Object java.util.ResourceBundle.handleGetObject(java.lang.String)' (lucee.invoc.wrap.v1.java.util.PropertyResourceBundle.handleGetObject_6oi22wk4ims4 is in unnamed module of loader lucee.transformer.dynamic.DynamicClassLoader @d969b17; java.util.ResourceBundle is in module java.base of loader 'bootstrap') at lucee.invoc.wrap.v1.java.util.PropertyResourceBundle.handleGetObject_6oi22wk4ims4.apply(Unknown Source) at lucee.runtime.reflection.pairs.MethodInstance.invoke(MethodInstance.java:64) at lucee.runtime.reflection.Reflector.callMethod(Reflector.java:928) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:840) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1996) at system.services.i18n.resourcebundleservice_cfc$cf.udfCall2(/var/www/preside/system/services/i18n/ResourceBundleService.cfc:222)

Preside-CMS/system/services/i18n/ResourceBundleService.cfc at stable · pixl8/Preside-CMS

private struct function _propertiesFileToStruct( required string propertiesFile ) output=false { var fis = CreateObject("java","java.io.FileInputStream").init( arguments.propertiesFile ); var fir = CreateObject("java","java.io.InputStreamReader").init( fis, "UTF-8" ); var prb = CreateObject("java","java.util.PropertyResourceBundle").init( fir ); var keys = prb.getKeys(); var key = ""; var returnStruct = {}; try{ while( keys.hasMoreElements() ){ key = keys.nextElement(); returnStruct[ key ] = prb.handleGetObject( key ); } } catch( any e ){ fis.close(); rethrow; } fis.close(); return returnStruct; }

Environment

java 11

works fine with 5.4.5

Activity

Show:

Michael Offner 24 June 2024 at 19:12

you test with an older version of Lucee, you can see that because it still says “lucee.invoc.wrap.v1.sun.nio.fs“ i switched the the version to 2, so it should say lucee.invoc.wrap.v2.sun.nio.fs

Zac Spitzer 24 June 2024 at 16:59

[INFO] [java] [script] Failed: The incoming function DID throw an exception of type [java.lang.IllegalAccessError] with message [failed to access class sun.nio.fs.UnixFileAttributes$UnixAsBasicFileAttributes from class lucee.invoc.wrap.v1.sun.nio.fs.UnixFileAttributes$UnixAsBasicFileAttributes.creationTime_11mw6cpi3sk2k (sun.nio.fs.UnixFileAttributes$UnixAsBasicFileAttributes is in module java.base of loader 'bootstrap'; lucee.invoc.wrap.v1.sun.nio.fs.UnixFileAttributes$UnixAsBasicFileAttributes.creationTime_11mw6cpi3sk2k is in unnamed module of loader lucee.transformer.dynamic.DynamicClassLoader @53e166ad)] detail [] [INFO] [java] [script] /home/runner/work/Lucee/Lucee/test/tickets/LDEV4859.cfc:22 [INFO] [java] [script] /home/runner/work/Lucee/Lucee/test/_testRunner.cfc:283 [INFO] [java] [script] /home/runner/work/Lucee/Lucee/test/run-tests.cfm:348

and

[INFO] [java] [script] class lucee.invoc.wrap.v1.sun.management.ThreadImpl.getThreadCount_11mw6cpi3sk2k (in unnamed module @0x576822dc) cannot access class sun.management.ThreadImpl (in module java.management) because module java.management does not export sun.management to unnamed module @0x576822dc [INFO] [java] [script] "lucee.runtime.exp.NativeException: class lucee.invoc.wrap.v1.sun.management.ThreadImpl.getThreadCount_11mw6cpi3sk2k (in unnamed module @0x576822dc) cannot access class sun.management.ThreadImpl (in module java.management) because module java.management does not export sun.management to unnamed module @0x576822dc [INFO] [java] [script] at lucee.invoc.wrap.v1.sun.management.ThreadImpl.getThreadCount_11mw6cpi3sk2k.apply(Unknown Source) [INFO] [java] [script] at lucee.runtime.reflection.pairs.MethodInstance.invoke(MethodInstance.java:64) [INFO] [java] [script] at lucee.runtime.reflection.Reflector.callMethod(Reflector.java:928) [INFO] [java] [script] at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:840) [INFO] [java] [script] at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1996) [INFO] [java] [script] at run_tests_cfm180$cf.call(/test/run-tests.cfm:377)

Michael Offner 24 June 2024 at 16:18

please give it a try

Michael Offner 24 June 2024 at 15:46

Lucee creates byte code to link CFML with Java method call to avoid reflection, in that case PropertyResourceBundle.handleGetObject is called. the code genrated does not cast the object to the class PropertyResourceBundle, it does it to the class that declares the method handleGetObject, what is in that case ResourceBundle. problem is that this calass access modifier is not public it is only protected what causes this issue.

Problem can be solved by taking this in consideration by chossing to which class to cast the object.

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Affects versions

Created 24 June 2024 at 12:36
Updated 27 June 2024 at 09:08
Resolved 27 June 2024 at 09:08