Skip to content

Commit a303548

Browse files
Kristen Newburymbenz89
Kristen Newbury
authored andcommitted
Improve error message in FieldRefValidator
Previously in exception handling the error message printed was incorrect. Now reports the actual message for why the exception occurred.
1 parent 5d989a3 commit a303548

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/soot/jimple/validation/FieldRefValidator.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public void validate(Body body, List<ValidationException> exceptions) {
7575
.add(new UnitValidationException(unit, body, "Trying to get a static field which is non-static: " + v));
7676
}
7777
} catch (ResolutionFailedException e) {
78-
exceptions.add(new UnitValidationException(unit, body, "Trying to get a static field which is non-static: " + v));
78+
exceptions.add(new UnitValidationException(unit, body, "Processing field ref: " +
79+
v + ", encountered ResolutionFailedException: " + e.getMessage()));
7980
}
8081
} else if (fr instanceof InstanceFieldRef) {
8182
InstanceFieldRef v = (InstanceFieldRef) fr;
@@ -88,7 +89,8 @@ public void validate(Body body, List<ValidationException> exceptions) {
8889
exceptions.add(new UnitValidationException(unit, body, "Trying to get an instance field which is static: " + v));
8990
}
9091
} catch (ResolutionFailedException e) {
91-
exceptions.add(new UnitValidationException(unit, body, "Trying to get an instance field which is static: " + v));
92+
exceptions.add(new UnitValidationException(unit, body, "Processing field ref: " +
93+
v + ", encountered ResolutionFailedException: " + e.getMessage()));
9294
}
9395
} else {
9496
throw new RuntimeException("unknown field ref");

0 commit comments

Comments
 (0)