sylvain 01/10/10 02:30:51
Modified: src/org/apache/cocoon/components/language/programming/java
Javac.java
Log:
Class-level errors not ending with '^' were incorrectly parsed.
Revision Changes Path
1.9 +19 -15
xml-cocoon2/src/org/apache/cocoon/components/language/programming/java/Javac.java
Index: Javac.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/programming/java/Javac.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Javac.java 2001/10/08 20:03:13 1.8
+++ Javac.java 2001/10/10 09:30:51 1.9
@@ -8,21 +8,21 @@
package org.apache.cocoon.components.language.programming.java;
-import org.apache.cocoon.components.language.programming.CompilerError;
-import org.apache.cocoon.util.ClassUtils;
-import org.apache.log.Hierarchy;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.NoSuchElementException;
+import org.apache.cocoon.components.language.programming.CompilerError;
+import org.apache.cocoon.util.ClassUtils;
+import org.apache.log.Hierarchy;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
import java.util.StringTokenizer;
/**
* This class wraps the Sun's Javac Compiler.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version $Revision: 1.8 $ $Date: 2001/10/08 20:03:13 $
+ * @version $Revision: 1.9 $ $Date: 2001/10/10 09:30:51 $
* @since 2.0
*/
@@ -93,7 +93,7 @@
* @exception IOException If an error occurs during message collection
*/
protected List parseModernStream(BufferedReader input) throws IOException {
- List errors = null;
+ List errors = new ArrayList();
String line = null;
StringBuffer buffer = null;
@@ -101,15 +101,19 @@
// cleanup the buffer
buffer = new StringBuffer(); // this is quicker than clearing it
- // each error terminates with the '^' char
+ // most errors terminate with the '^' char
do {
- if ((line = input.readLine()) == null) return errors;
+ if ((line = input.readLine()) == null)
+ {
+ if (buffer.length() > 0) {
+ // There's an error which doesn't end with a '^'
+ errors.add(new CompilerError("\n" + buffer.toString()));
+ }
+ return errors;
+ }
buffer.append(line);
buffer.append('\n');
} while (!line.endsWith("^"));
-
- // if error is found create the vector
- if (errors == null) errors = new ArrayList();
// add the error bean
errors.add(parseModernError(buffer.toString()));
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]