You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Aryan Ganjoo (Jira)" <ji...@apache.org> on 2026/10/17 19:56:00 UTC
[jira] [Closed] (LANG-1838) ClassPathUtils mishandles resources in the unnamed package
[ https://issues.apache.org/jira/browse/LANG-1838?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aryan Ganjoo closed LANG-1838.
------------------------------
> ClassPathUtils mishandles resources in the unnamed package
> ----------------------------------------------------------
>
> Key: LANG-1838
> URL: https://issues.apache.org/jira/browse/LANG-1838
> Project: Commons Lang
> Issue Type: Bug
> Reporter: Aryan Ganjoo
> Assignee: Gary D. Gregory
> Priority: Minor
> Fix For: 3.21.1
>
>
> h3. Observed
> For a class in the unnamed (default) package, the Class overloads of {{ClassPathUtils.toFullyQualifiedName}} and {{toFullyQualifiedPath}} do not produce a classpath-root resource name. On JDK 17, the package name is empty and the methods return {{.Test.properties}} and {{/Test.properties}}. The Package overloads also prepend a separator when given an empty-named package. OpenJDK 8 source indicates that {{Class.getPackage()}} is null for an unnamed-package class, so the original Class overloads pass null to a Package overload and throw {{NullPointerException}}; that Java 8 path was not executed locally.
> h3. Expected
> Both methods should return {{Test.properties}} for an unnamed-package context. Named-package behavior should remain unchanged.
> h3. Reproduction and validation
> Place a class in the default package and call both overloads with {{Test.properties}} as the resource name. On Commons Lang master {{9c86ffe308e7c682df3b1cf76f27dfc5bb6a2243}}, the local JDK 17 regression reproduced the leading separators. The corrected patch passed 21 focused tests and 413 adjacent tests on JDK 17; its default Maven build completed successfully. Java 8-target bytecode was compiled and OpenJDK 8 source was inspected, but a Java 8 runtime test was not run locally. Other JDKs and released binaries were not tested.
> h3. Fix
> Treat a null or empty package name as the classpath root without adding a separator, preserving named-package and null-argument behavior. Implementation PR: https://github.com/apache/commons-lang/pull/1824 . AI assistance was used for discovery, implementation, tests, and review; the submitter reviewed the exact revision.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)