[
https://issues.apache.org/jira/browse/LANG-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18050756#comment-18050756
]
Jeremy Tonghao Sun commented on LANG-1711:
------------------------------------------
This change updates ReflectionDiffBuilder to skip fields that cannot be
accessed via reflection,
instead of aborting the entire diff process with an exception.
Previously, if reflective access to a field was denied (for example due to Java
9+ module restrictions
or security constraints), the diff operation would fail entirely, even when
most fields were accessible.
The change is limited to appendFields(...), where reflection access failures
are caught and ignored.
It covers IllegalAccessException on Java 8 as well as runtime reflection
failures on newer Java versions.
No public APIs are changed.
> Modify ReflectionToStringBuilder to use trySetAccessible and not throw
> exceptions
> ---------------------------------------------------------------------------------
>
> Key: LANG-1711
> URL: https://issues.apache.org/jira/browse/LANG-1711
> Project: Commons Lang
> Issue Type: Improvement
> Reporter: Oksana
> Priority: Major
>
> org.apache.commons.lang3.builder.ReflectionToStringBuilder#appendFieldsIn
> uses following method
> _AccessibleObject.setAccessible(fields, true);_
> It will throw exception when it is not possible to perform action. I think,
> better approach - just to skip not accessible fields and report only
> accessible once. Since Java 9 there is a method trySetAccessible for that.
> [https://github.com/apache/commons-lang/pull/1102]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)