wozhenbang2004 opened a new pull request, #1892:
URL: https://github.com/apache/commons-lang/pull/1892

   <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
   
       https://www.apache.org/licenses/LICENSE-2.0
   
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
   -->
   
   Addresses [LANG-1049](https://issues.apache.org/jira/browse/LANG-1049).
   
   Application classes inside an OSGi bundle may not be visible to the class 
loader used by `SerializationUtils.deserialize()`. The issue discussion 
recommends accepting a class loader instead of adding container-specific 
manifest settings.
   
   This adds `deserialize(byte[], ClassLoader)` and `deserialize(InputStream, 
ClassLoader)`. A non-null loader resolves classes and proxy interfaces 
explicitly, including primitive `Class` descriptors. Non-public proxy 
interfaces use their shared defining loader. Null retains standard 
`ObjectInputStream` resolution, as do the existing overloads. The serialized 
format and `clone()` implementation stay unchanged.
   
   The regression cases cover isolated classes, arrays, shared references, 
public/non-public proxies, primitive classes and input failures. In a real 
Equinox 3.24.0 framework on JDK 21, the same consumer bundle reproduces the 
original class-resolution failure on the base. Both new overloads restore its 
bundle-private object, array, `Class` and shared reference with the patch.
   
   The [JDK 21 CI 
run](https://github.com/wozhenbang2004/contribution-validation/actions/runs/45226152349)
 passed the unmodified default Maven goals on Linux: `mvn --errors 
--show-version --batch-mode --no-transfer-progress -Ddoclint=all`. It ran 
111,689 tests with zero failures/errors and 29 conditional skips, and passed 
coverage, license, API compatibility, Checkstyle, SpotBugs, PMD and Javadoc 
checks. The workflow pins the proposed commit and verifies all three changed 
files before building.
   
   ### Contribution checklist
   
   - [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
   - [x] Read the [ASF Generative Tooling 
Guidance](https://www.apache.org/legal/generative-tooling.html) if you use 
Artificial Intelligence (AI).
   - [x] I used AI to create part or all of this pull request. OpenAI ChatGPT 
generated the implementation, regression tests, release note and PR draft, and 
ran the local verification. A separate ChatGPT agent reviewed the complete 
patch and ran independent class-loader, proxy and stream checks.
   - [x] Run a successful build using the default Maven goal with `mvn`.
   - [x] Write unit tests matching behavioral changes. These overloads are new 
APIs; the same consumer reproduces the existing class-resolution failure on the 
base.
   - [x] Write a detailed pull request description.
   - [x] Each commit has a meaningful 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]

Reply via email to