Michael Froh created CODEC-324:
----------------------------------

             Summary: BeiderMorse engine doesn't work with JPMS enabled
                 Key: CODEC-324
                 URL: https://issues.apache.org/jira/browse/CODEC-324
             Project: Commons Codec
          Issue Type: Bug
    Affects Versions: 1.17.1, 1.17.0, 1.16.1
         Environment: Corretto JDK21
JPMS enabled
            Reporter: Michael Froh


With the upgrade of commons-parent from 58 to 66 in the 1.16.1 release, 
commons-codec started using Moditect to generate a modules-info.class file as 
part of the jar (which I think was added in commons-parent 59). 

A decompiled version of the modules-info looks like:

{code:java}
module org.apache.commons.codec {
    exports org.apache.commons.codec;
    exports org.apache.commons.codec.binary;
    exports org.apache.commons.codec.cli;
    exports org.apache.commons.codec.digest;
    exports org.apache.commons.codec.language;
    exports org.apache.commons.codec.language.bm;
    exports org.apache.commons.codec.net;
}
{code}

Unfortunately, the Lang class uses reflection to load language rules. 

Eventually, it gets to the isOpen check in BuiltinClassLoader (called from 
BuiltInClassLoader's findResource), which finds that the commons-codec module 
is not open and the org.apache.commons.codec.language.bm package is not open. 
As a result, attempting to load any of the language rule files returns `null`, 
and the Resources class throws an IllegalArgumentException.

You can see a stack trace of one such failure when trying to upgrade Lucene to 
commons-codec 1.16.1: https://github.com/apache/lucene/pull/13269

I think there might need to be a way to pass a hint to commons-parent's pom to 
specify "opensResources" configuration for Moditect to allow the language rules 
to be loaded.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to