//write the body as subject
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Subject run() throws IOException {
body.writeTo(out);
return null;
}
});
} catch (PrivilegedActionException privEx) {
Throwable cause = privEx.getCause();