Repository navigation
fix(common): skip unreadable bean properties - #21
Open
Hanabi9248 wants to merge 1 commit into
Open
Hanabi9248 wants to merge 1 commit into
Hanabi9248 wants to merge 1 commit into
Conversation
A setter-only JavaBean property has no read method. Skip it before invocation so toMap and its copy callers retain readable values instead of throwing NullPointerException. Cover all three affected entry points and preserve read-only getters, null values, ignore lists and throwing-getter exception handling. Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A setter-only JavaBean property has a PropertyDescriptor but no read method.
BeanUtil.toMapcurrently invokes that null method and throws NullPointerException, even when the bean also has ordinary readable properties. The bean-to-map overload andcopyNotNullPropertiesreach the same failure.Skip descriptors without a getter. Readable and read-only properties, null values, ignore lists and the existing PropertyException handling remain unchanged. This repairs the public utility contract; no deployed setter-only DTO incident is claimed.
Validated the complete real BeanUtil and four unchanged support classes on Windows using JDK 25.0.4.101 with
--release 8: baseline three failures plus three passing controls; candidate six passes. The new standalone regression calls all three affected entry points and checks the unchanged controls. Real Spring beans/core 5.2.10.RELEASE, Commons BeanUtils 1.9.4, Commons Logging 1.2, Commons Collections 3.2.2, commons-lang 2.4, slf4j-api 1.7.30 and Lombok 1.18.42 were used. No framework or logger replacements were introduced.The project's commons-lang 2.6 and Lombok 1.18.20, a Java 8 runtime, Linux and the full Maven/backend suite were not tested. The regression is a manual Java main, not an assertion of hosted CI coverage.