}
// PASS
logger.fine("Privileges are enabled inside 'doPrivileged' "
+ "method as expected.");
final PEAThrowingUncheckedEx peaEx2 =
new PEAThrowingUncheckedEx(perm);
try {
callDoPrivileged(peaEx2);
// FAIL
throw new TestException(
"Method did not throw any exception while "
+ "RuntimeException was expected.");
} catch (RuntimeException re) {
if (peaEx2.getException() != re) {
// FAIL
throw new TestException(
"'doPrivileged' method threw " + re + " while "
+ peaEx2.getException() + " was expected.");
}
}
// PASS
logger.fine("RuntimeException was thrown as expected.");