}
private static void checkAccessibility(Object objMaybeNull,Class clazz, Key methodName) {
// do not allow java.lang.System.exit()
if(methodName.equals(EXIT) && clazz==System.class) { // TODO better implementation
throw new PageRuntimeException(new SecurityException("Calling the method java.lang.System.exit is not allowed"));
}
// change the accessibility of Railo methods is not allowed
else if(methodName.equals(SET_ACCESSIBLE)) {
if(objMaybeNull instanceof JavaObject)
objMaybeNull=((JavaObject)objMaybeNull).getEmbededObject(null);
if(objMaybeNull instanceof Member) {
Member member=(Member) objMaybeNull;
Class<?> cls = member.getDeclaringClass();
if(cls!=null) {
String name=cls.getName();
if(name!=null && name.startsWith("railo.")) {
throw new PageRuntimeException(new SecurityException("Changing the accessibility of an object's members in the railo.* package is not allowed"));
}
}
}
}