diff options
author | aclement <aclement> | 2009-06-18 18:37:30 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-06-18 18:37:30 +0000 |
commit | 59d5c3bcd7c045c55826f1b62576ffa05321626f (patch) | |
tree | c8ecaef2d6796aa8df37260919680adf99cb8414 /ajdoc/src | |
parent | 37503f9aca30f152c3bcc01b2d32f09429e85a87 (diff) | |
download | aspectj-59d5c3bcd7c045c55826f1b62576ffa05321626f.tar.gz aspectj-59d5c3bcd7c045c55826f1b62576ffa05321626f.zip |
280783: removed security manager - why is it there?
Diffstat (limited to 'ajdoc/src')
-rw-r--r-- | ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java b/ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java index 8aa4fd0f4..b0ab3cd21 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java @@ -21,61 +21,61 @@ import java.lang.reflect.Method; * @author Mik Kersten */ class JavadocRunner { - + static boolean has14ToolsAvailable() { try { - Class jdMainClass = com.sun.tools.javadoc.Main.class; - Class[] paramTypes = new Class[] {String[].class}; + Class jdMainClass = com.sun.tools.javadoc.Main.class; + Class[] paramTypes = new Class[] { String[].class }; jdMainClass.getMethod("execute", paramTypes); - } catch (NoClassDefFoundError e) { - return false; - } catch (UnsupportedClassVersionError e) { - return false; - } catch (NoSuchMethodException e) { + } catch (NoClassDefFoundError e) { + return false; + } catch (UnsupportedClassVersionError e) { + return false; + } catch (NoSuchMethodException e) { return false; } return true; } - - static void callJavadoc( String[] javadocargs ){ - final SecurityManager defaultSecurityManager = System.getSecurityManager(); - System.setSecurityManager( new SecurityManager() { - public void checkExit(int status) { - if (status == 0) { - throw new SecurityException(); - } - else { - System.setSecurityManager(defaultSecurityManager); - //System.out.println("Error: javadoc exited unexpectedly"); - System.exit(0); - throw new SecurityException(); - } - } - public void checkPermission( java.security.Permission permission ) { - if ( defaultSecurityManager != null ) - defaultSecurityManager.checkPermission( permission ); - } - public void checkPermission( java.security.Permission permission, - Object context ) { - if ( defaultSecurityManager != null ) - defaultSecurityManager.checkPermission( permission, context ); - } - } ); + static void callJavadoc(String[] javadocargs) { + // final SecurityManager defaultSecurityManager = System.getSecurityManager(); + // + // System.setSecurityManager( new SecurityManager() { + // public void checkExit(int status) { + // if (status == 0) { + // throw new SecurityException(); + // } + // else { + // System.setSecurityManager(defaultSecurityManager); + // //System.out.println("Error: javadoc exited unexpectedly"); + // System.exit(0); + // throw new SecurityException(); + // } + // } + // public void checkPermission( java.security.Permission permission ) { + // if ( defaultSecurityManager != null ) + // defaultSecurityManager.checkPermission( permission ); + // } + // public void checkPermission( java.security.Permission permission, + // Object context ) { + // if ( defaultSecurityManager != null ) + // defaultSecurityManager.checkPermission( permission, context ); + // } + // } ); - try { - // for JDK 1.4 and above call the execute method... - Class jdMainClass = com.sun.tools.javadoc.Main.class; - Method executeMethod = null; + try { + // for JDK 1.4 and above call the execute method... + Class jdMainClass = com.sun.tools.javadoc.Main.class; + Method executeMethod = null; try { - Class[] paramTypes = new Class[] {String[].class}; + Class[] paramTypes = new Class[] { String[].class }; executeMethod = jdMainClass.getMethod("execute", paramTypes); } catch (NoSuchMethodException e) { - com.sun.tools.javadoc.Main.main(javadocargs); -// throw new UnsupportedOperationException("ajdoc requires a tools library from JDK 1.4 or later."); + com.sun.tools.javadoc.Main.main(javadocargs); + // throw new UnsupportedOperationException("ajdoc requires a tools library from JDK 1.4 or later."); } try { - executeMethod.invoke(null, new Object[] {javadocargs}); + executeMethod.invoke(null, new Object[] { javadocargs }); } catch (IllegalArgumentException e1) { throw new RuntimeException("Failed to invoke javadoc"); } catch (IllegalAccessException e1) { @@ -83,14 +83,13 @@ class JavadocRunner { } catch (InvocationTargetException e1) { throw new RuntimeException("Failed to invoke javadoc"); } - // main method is documented as calling System.exit() - which stops us dead in our tracks - //com.sun.tools.javadoc.Main.main( javadocargs ); - } - catch ( SecurityException se ) { - // Do nothing since we expect it to be thrown - //System.out.println( ">> se: " + se.getMessage() ); - } - // Set the security manager back - System.setSecurityManager( defaultSecurityManager ); - } + // main method is documented as calling System.exit() - which stops us dead in our tracks + // com.sun.tools.javadoc.Main.main( javadocargs ); + } catch (SecurityException se) { + // Do nothing since we expect it to be thrown + // System.out.println( ">> se: " + se.getMessage() ); + } + // Set the security manager back + // System.setSecurityManager(defaultSecurityManager); + } } |