Ok, I found it...

For some strange reasons the error message from javac could not
be parsed correctly and the tokenizer threw an exception that
was not caught.

Now it is rethrown as a CompilerException. Now I can at least
see the error ;)

Patch attached.

Thanks!
--
Torsten
Index: Javac.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/language/programming/java/Javac.java,v

retrieving revision 1.4
diff -u -r1.4 Javac.java
--- Javac.java  2001/07/12 15:01:27     1.4
+++ Javac.java  2001/09/04 14:37:58
@@ -16,6 +16,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.StringTokenizer;
+import java.util.NoSuchElementException;
 import org.apache.cocoon.components.language.programming.CompilerError;
 import org.apache.cocoon.util.ClassUtils;
 import org.apache.log.Hierarchy;
@@ -128,18 +129,22 @@
    */
   private CompilerError parseModernError(String error) {
     StringTokenizer tokens = new StringTokenizer(error, ":");
-    String file = tokens.nextToken();
-    if (file.length() == 1) file += ":" + tokens.nextToken();
-    int line = Integer.parseInt(tokens.nextToken());
-
-    String message = tokens.nextToken("\n").substring(1);
-    String context = tokens.nextToken("\n");
-    String pointer = tokens.nextToken("\n");
-    int startcolumn = pointer.indexOf("^");
-    int endcolumn = context.indexOf(" ", startcolumn);
-    if (endcolumn == -1) endcolumn = context.length();
-
-    return new CompilerError(file, false, line, startcolumn, line, endcolumn, 
message);
+    try {
+      String file = tokens.nextToken();
+      if (file.length() == 1) file += ":" + tokens.nextToken();
+      int line = Integer.parseInt(tokens.nextToken());
+
+      String message = tokens.nextToken("\n").substring(1);
+      String context = tokens.nextToken("\n");
+      String pointer = tokens.nextToken("\n");
+      int startcolumn = pointer.indexOf("^");
+      int endcolumn = context.indexOf(" ", startcolumn);
+      if (endcolumn == -1) endcolumn = context.length();
+      return new CompilerError(file, false, line, startcolumn, line, endcolumn, 
+message);
+    }
+    catch(NoSuchElementException nse) {
+      return new CompilerError("could not parse error message: " + error);
+    }
   }
 
   /**
@@ -184,24 +189,29 @@
   private CompilerError parseClassicError(String error) {
 
     StringTokenizer tokens = new StringTokenizer(error, ":");
-    String file = tokens.nextToken();
-    if (file.length() == 1) file += ":" + tokens.nextToken();
-    int line = Integer.parseInt(tokens.nextToken());
-
-    String last = tokens.nextToken();
-    // In case the message contains ':', it should be reassembled
-    while (tokens.hasMoreElements()) {
-      last += tokens.nextToken();
-    }
-    tokens = new StringTokenizer(last.trim(), "\n");
-    String message = tokens.nextToken();
-    String context = tokens.nextToken();
-    String pointer = tokens.nextToken();
-    int startcolumn = pointer.indexOf("^");
-    int endcolumn = context.indexOf(" ", startcolumn);
-    if (endcolumn == -1) endcolumn = context.length();
+    try {
+      String file = tokens.nextToken();
+      if (file.length() == 1) file += ":" + tokens.nextToken();
+      int line = Integer.parseInt(tokens.nextToken());
+
+      String last = tokens.nextToken();
+      // In case the message contains ':', it should be reassembled
+      while (tokens.hasMoreElements()) {
+        last += tokens.nextToken();
+      }
+      tokens = new StringTokenizer(last.trim(), "\n");
+      String message = tokens.nextToken();
+      String context = tokens.nextToken();
+      String pointer = tokens.nextToken();
+      int startcolumn = pointer.indexOf("^");
+      int endcolumn = context.indexOf(" ", startcolumn);
+      if (endcolumn == -1) endcolumn = context.length();
 
-    return new CompilerError(srcDir + File.separator + file, true, line, startcolumn, 
line, endcolumn, message);
+      return new CompilerError(srcDir + File.separator + file, true, line, 
+startcolumn, line, endcolumn, message);
+    }
+    catch(NoSuchElementException nse) {
+      return new CompilerError("could not parse error message: " + error);
+    }
   }
 
   public String toString() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to