Skip to content

[LANG-1705] SerializationUtils.clone() throws a ClassCastException when override writeReplace() #1110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

a1batr0ss
Copy link

JIRA: https://issues.apache.org/jira/browse/LANG-1705

Due to the possibility that the serialized object type may be a different type after overriding writeReplace(), directly converting the serialized object to the original type(the type of parameter) will result in a ClassCastException.

Fix: Two templates are used for the return value and parameters of SerializationUtils.clone().

@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2023

Codecov Report

Merging #1110 (c17883a) into master (14be5e5) will increase coverage by 0.01%.
Report is 7 commits behind head on master.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master    #1110      +/-   ##
============================================
+ Coverage     92.19%   92.20%   +0.01%     
- Complexity     7548     7549       +1     
============================================
  Files           197      197              
  Lines         15805    15801       -4     
  Branches       2922     2920       -2     
============================================
- Hits          14572    14570       -2     
+ Misses          661      660       -1     
+ Partials        572      571       -1     
Files Changed Coverage Δ
...a/org/apache/commons/lang3/SerializationUtils.java 88.88% <100.00%> (ø)

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@garydgregory
Copy link
Member

@a1batr0ss
Please run mvn -- which uses the default goal -- locally before pushing and you'll catch build failures like what just happened.

@a1batr0ss a1batr0ss force-pushed the LANG-1705-SerializationUtils branch from ecd17b1 to aba4239 Compare September 13, 2023 10:07
Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1, you cannot disable the JApiCmp check within a major release line.

pom.xml Outdated
@@ -624,7 +624,7 @@

<checkstyle.configdir>src/site/resources/checkstyle</checkstyle.configdir>

<japicmp.skip>false</japicmp.skip>
<japicmp.skip>true</japicmp.skip>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1, you cannot disable this check within a major release line.

@garydgregory
Copy link
Member

Closing: No reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants