[pkg-java] r4014 - trunk/aspectj/debian/patches

tgg at alioth.debian.org tgg at alioth.debian.org
Tue Aug 14 12:59:10 UTC 2007


Author: tgg
Date: 2007-08-14 12:59:09 +0000 (Tue, 14 Aug 2007)
New Revision: 4014

Modified:
   trunk/aspectj/debian/patches/02_use_gjdoc.diff
Log:
rework the gjdoc patch so that it looks for Sun compatible Javadoc before looking for gjdoc


Modified: trunk/aspectj/debian/patches/02_use_gjdoc.diff
===================================================================
--- trunk/aspectj/debian/patches/02_use_gjdoc.diff	2007-08-14 11:56:40 UTC (rev 4013)
+++ trunk/aspectj/debian/patches/02_use_gjdoc.diff	2007-08-14 12:59:09 UTC (rev 4014)
@@ -1,37 +1,54 @@
+--- aspectj.orig/org.aspectj/modules/ajdoc/.classpath
++++ aspectj/org.aspectj/modules/ajdoc/.classpath
+@@ -7,6 +7,7 @@
+ 	<classpathentry kind="src" path="/util"/>
+ 	<classpathentry kind="src" path="testsrc"/>
+ 	<classpathentry sourcepath="/lib/junit/junit-src.jar" kind="lib" path="/lib/junit/junit.jar"/>
++	<classpathentry kind="lib" path="/lib/gnu-classpath-tools-gjdoc.jar"/>
+ 	<classpathentry kind="var" path="JAVA_HOME/lib/tools.jar"/>
+ 	<classpathentry kind="var" path="JRE14_LIB"/>
+ 	<classpathentry kind="output" path="bin"/>
 --- aspectj.orig/org.aspectj/modules/ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java
 +++ aspectj/org.aspectj/modules/ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java
-@@ -24,7 +24,7 @@
+@@ -21,10 +21,21 @@
+  * @author Mik Kersten
+  */
+ class JavadocRunner {
++	private static Class getJavadocMainClass() throws NoClassDefFoundError {
++		try {
++			return Class.forName("com.sun.tools.javadoc.Main");
++		} catch (ClassNotFoundException nf1) {
++			try {
++				return Class.forName("gnu.classpath.tools.gjdoc.Main");
++			} catch (ClassNotFoundException nf2) {
++				throw new NoClassDefFoundError(nf2.getMessage());
++			}
++		}
++	}
  	
  	static boolean has14ToolsAvailable() {
  		try {
 -            Class jdMainClass = com.sun.tools.javadoc.Main.class;
-+            Class jdMainClass = gnu.classpath.tools.gjdoc.Main.class;
++            Class jdMainClass = getJavadocMainClass();
  			Class[] paramTypes = new Class[] {String[].class};
  			jdMainClass.getMethod("execute", paramTypes);
          } catch (NoClassDefFoundError e) {
-@@ -65,13 +65,13 @@
+@@ -65,7 +76,7 @@
  
          try {
          	// for JDK 1.4 and above call the execute method...
 -        	Class jdMainClass = com.sun.tools.javadoc.Main.class;
-+        	Class jdMainClass = gnu.classpath.tools.gjdoc.Main.class;
++        	Class jdMainClass = getJavadocMainClass();
          	Method executeMethod = null;
  			try {
  				Class[] paramTypes = new Class[] {String[].class};
- 				executeMethod = jdMainClass.getMethod("execute", paramTypes);
- 			} catch (NoSuchMethodException e) {
--				 com.sun.tools.javadoc.Main.main(javadocargs); 
-+				 gnu.classpath.tools.gjdoc.Main.main(javadocargs); 
- //				throw new UnsupportedOperationException("ajdoc requires a tools library from JDK 1.4 or later.");
- 			}
- 			try {
---- aspectj.orig/org.aspectj/modules/ajdoc/.classpath
-+++ aspectj/org.aspectj/modules/ajdoc/.classpath
-@@ -7,6 +7,7 @@
- 	<classpathentry kind="src" path="/util"/>
- 	<classpathentry kind="src" path="testsrc"/>
- 	<classpathentry sourcepath="/lib/junit/junit-src.jar" kind="lib" path="/lib/junit/junit.jar"/>
-+	<classpathentry kind="lib" path="/lib/gnu-classpath-tools-gjdoc.jar"/>
- 	<classpathentry kind="var" path="JAVA_HOME/lib/tools.jar"/>
- 	<classpathentry kind="var" path="JRE14_LIB"/>
- 	<classpathentry kind="output" path="bin"/>
+@@ -90,6 +101,9 @@
+             // Do nothing since we expect it to be thrown
+             //System.out.println( ">> se: " + se.getMessage() );
+         }
++	catch ( NoClassDefFoundError nf ) {
++		throw new RuntimeException("Failed to invoke javadoc");
++	}
+         // Set the security manager back
+         System.setSecurityManager( defaultSecurityManager );
+     }




More information about the pkg-java-commits mailing list