AmarGhugare opened a new pull request, #1868: URL: https://github.com/apache/commons-lang/pull/1868
`SerializationUtils.clone()` resolves ordinary classes with the original object's class loader, falling back to the thread context loader. Proxy interfaces use the inherited `ObjectInputStream.resolveProxyClass()` lookup instead. A proxy whose interface exists only in a plugin loader therefore fails with `ClassNotFoundException`; if a separate copy of the interface is visible to the default lookup, the clone implements the wrong interface type. Override proxy resolution to try the configured loader and then the thread context loader for the complete interface list. Keep non-public interfaces in their defining loader, reject conflicting non-public interface loaders, and wrap invalid proxy definitions in `ClassNotFoundException`. Obtain the proxy class through `Proxy.newProxyInstance()` to avoid introducing a deprecated API. Validation: - Added 11 regression test invocations covering custom/context loaders, public/non-public interfaces, ordinary application proxies, multiple public interfaces, null loaders, parent-loader interfaces, and invalid/missing interfaces. - Four end-to-end regression cases fail before the fix. All 39 `SerializationUtilsTest` cases pass with the fix. - A separate plugin-only reproduction fails on Commons Lang 3.8.1 and 3.22.0 and succeeds with the patch. - The default Maven build passed with JDK 25.0.4.1 and compiler release 8: 108,493 tests, zero failures/errors, 18 skipped. RAT, Checkstyle, Japicmp, SpotBugs, PMD and Javadoc passed. - `git diff --check` passed. The full build was run as `mvn -o -B -ntp` using cached dependencies. This change covers the proxy-resolution hook separately from the ordinary class-resolution issue in the closed LANG-626 ticket. A new Jira ticket has not yet been created for this case. - [x] Read the contribution guidelines. - [x] Run the default Maven build successfully. - [x] Add regression tests that expose the original behavior. - [x] Describe the behavior change and validation. - [x] Use a meaningful commit subject and body. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
