publicclass Test4080522 { publicstaticvoid main(String[] args) {
OurSecurityManager sm = new OurSecurityManager();
String[] path = {"a", "b"}; // with no security manager we shuld be able to do these calls OK
test(path); // add our own security manager
System.setSecurityManager(sm); // now each of the calls should raise an exception try {
Beans.setDesignTime(true); thrownew Error("Beans.setDesignTime should throw SecurityException");
} catch (SecurityException exception) { // expected exception
} try {
Beans.setGuiAvailable(true); thrownew Error("Beans.setGuiAvailable should throw SecurityException");
} catch (SecurityException exception) { // expected exception
} try {
Introspector.setBeanInfoSearchPath(path); thrownew Error("Introspector.setBeanInfoSearchPath should throw SecurityException");
} catch (SecurityException exception) { // expected exception
} try {
PropertyEditorManager.setEditorSearchPath(path); thrownew Error("PropertyEditorManager.setEditorSearchPath should throw SecurityException");
} catch (SecurityException exception) { // expected exception
} // now set the security manager to be friendly
sm.friendly = true; // now the calls should be OK again.
test(path);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.