Skip to content

Commit

Permalink
Return null on illegal field acces
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesharnais committed Feb 13, 2022
1 parent ef79693 commit 7c94417
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,13 @@ public boolean matches(final FieldWrapper field, final String name) {
protected Object invokeMember(final FieldWrapper field, final Object context) {
try {
return field.get(context);
} catch (IllegalAccessException ex) {
// Illegal access to field is expected for classes from external modules
return null;
} catch (Exception ex) {
throw new IllegalStateException(
"Shouldn't be illegal to access field '" + field.getName()
+ "'", ex);
"Shouldn't be illegal to access field '" + field.getName()
+ "'", ex);
}
}

Expand Down

0 comments on commit 7c94417

Please sign in to comment.