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 27e1e81
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ 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) {
System.err.println("Illegal access to field '" + field.getName() +
"'. Returning null instead.");
return null;
} catch (Exception ex) {
throw new IllegalStateException(
"Shouldn't be illegal to access field '" + field.getName()
Expand Down

0 comments on commit 27e1e81

Please sign in to comment.