Skip to content

fix(common): skip unreadable bean properties - #21

Open
Hanabi9248 wants to merge 1 commit into
IvorySQL:IVYC_REL_5_STABLEfrom
Hanabi9248:codex/bean-readable-properties
Open

Hanabi9248 wants to merge 1 commit into
IvorySQL:IVYC_REL_5_STABLEfrom
Hanabi9248:codex/bean-readable-properties

Conversation

@Hanabi9248

Copy link
Copy Markdown

A setter-only JavaBean property has a PropertyDescriptor but no read method. BeanUtil.toMap currently invokes that null method and throws NullPointerException, even when the bean also has ordinary readable properties. The bean-to-map overload and copyNotNullProperties reach 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.

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>
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.

1 participant