8147070: Dynalink GuardedInvocation must check the Class object passed

Reviewed-by: hannesw, mhaupt, attila
This commit is contained in:
Athijegannathan Sundararajan 2016-01-14 15:35:43 +05:30
parent 1689985910
commit e267b166cb

View File

@ -202,6 +202,9 @@ public class GuardedInvocation {
this.invocation = Objects.requireNonNull(invocation);
this.guard = guard;
this.switchPoints = switchPoint == null ? null : new SwitchPoint[] { switchPoint };
if (exception != null && !Throwable.class.isAssignableFrom(exception)) {
throw new IllegalArgumentException(exception.getName() + " is not assignable from Throwable");
}
this.exception = exception;
}
@ -228,6 +231,9 @@ public class GuardedInvocation {
this.invocation = Objects.requireNonNull(invocation);
this.guard = guard;
this.switchPoints = switchPoints == null ? null : switchPoints.clone();
if (exception != null && !Throwable.class.isAssignableFrom(exception)) {
throw new IllegalArgumentException(exception.getName() + " is not assignable from Throwable");
}
this.exception = exception;
}