cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anathan...@apache.org
Subject svn commit: r1853817 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/xsp/conf/ src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/
Date Mon, 18 Feb 2019 18:18:28 GMT
Author: anathaniel
Date: Mon Feb 18 18:18:27 2019
New Revision: 1853817

URL: http://svn.apache.org/viewvc?rev=1853817&view=rev
Log:
XSP: Remove alternative Javac because there is no common API for Java 5 to 8

Removed:
    cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/Javac.java
Modified:
    cocoon/branches/BRANCH_2_1_X/build.properties
    cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/conf/xsp-program-language.xconf
    cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/Pizza.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/build.properties
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/build.properties?rev=1853817&r1=1853816&r2=1853817&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/build.properties (original)
+++ cocoon/branches/BRANCH_2_1_X/build.properties Mon Feb 18 18:18:27 2019
@@ -133,8 +133,8 @@ compiler.debug=on
 compiler.optimize=on
 compiler.deprecation=off
 compiler.nowarn=on
-source.vm=1.6
-target.vm=1.6
+source.vm=1.5
+target.vm=1.5
 
 # ---- System Properties -------------------------------------------------------
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/conf/xsp-program-language.xconf
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/conf/xsp-program-language.xconf?rev=1853817&r1=1853816&r2=1853817&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/conf/xsp-program-language.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/conf/xsp-program-language.xconf Mon Feb 18
18:18:27 2019
@@ -35,7 +35,6 @@
           | Specifies which Java compiler to use. Possible variants are:
           |
           |  - EclipseJavaCompiler: the Eclipse JDT java compiler
-          |  - Javac: the java compiler that comes with JDK
           |  - Jikes: the Jikes java compiler
           |  - Pizza: the Pizza java compiler (deprecated. Support will be removed in 2.2)
           |
@@ -47,7 +46,6 @@
           |       or you might experience problems in some servlet containers.
           +-->
       <parameter name="compiler" value="org.apache.cocoon.components.language.programming.java.EclipseJavaCompiler"/>
-      <!--parameter name="compiler" value="org.apache.cocoon.components.language.programming.java.Javac"/-->
       <!--parameter name="compiler" value="org.apache.cocoon.components.language.programming.java.Jikes"/-->
       <!--parameter name="compiler" value="org.apache.cocoon.components.language.programming.java.Pizza"/-->
<!-- deprecated-->
 
@@ -55,7 +53,7 @@
           | Specifies the java code source version used to compile the XSP code.
           |
           | Posible values:
-          | 1.3 = Java version 1.3 
+          | 1.3 = Java version 1.3
           | 1.4 = Java version 1.4
           | 1.5 = Java version 1.5
           | auto = The version of the JVM where cocoon is running. (Default value).

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/Pizza.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/Pizza.java?rev=1853817&r1=1853816&r2=1853817&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/Pizza.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/Pizza.java
Mon Feb 18 18:18:27 2019
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,14 +20,20 @@ import net.sf.pizzacompiler.compiler.Cla
 import net.sf.pizzacompiler.compiler.FileCompilerOutput;
 import net.sf.pizzacompiler.compiler.FileSourceReader;
 import net.sf.pizzacompiler.compiler.Main;
+import org.apache.cocoon.components.language.programming.CompilerError;
 import org.apache.cocoon.util.ClassUtils;
 import org.apache.log.Hierarchy;
 
+import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
 
 /**
  * This class wraps the Pizza Java Compiler.
@@ -36,7 +42,7 @@ import java.io.PrintStream;
  * @version CVS $Id$
  * @deprecated Will be removed in 2.2
  */
-public class Pizza extends Javac {
+public class Pizza extends AbstractJavaCompiler {
 
     public final static String PIZZA_CLASS = "net.sf.pizzacompiler.compiler.Main";
 
@@ -52,10 +58,8 @@ public class Pizza extends Javac {
 
     /**
      * Compile a source file yielding a loadable class file.
-     *
-     * @exception IOException
      */
-    public boolean compile() throws IOException {
+    public boolean compile() {
 
         ByteArrayOutputStream err = new ByteArrayOutputStream();
 
@@ -73,6 +77,69 @@ public class Pizza extends Javac {
         return err.size() == 0;
     }
 
+    /**
+     * Parse the compiler error stream to produce a list of
+     * <code>CompilerError</code>s
+     *
+     * @param input The error stream
+     * @return The list of compiler error messages
+     * @exception IOException If an error occurs during message collection
+     */
+    protected List<CompilerError> parseStream(BufferedReader input) throws IOException
{
+        List<CompilerError> errors = new ArrayList<CompilerError>();
+
+        while (true) {
+            StringBuilder buffer = new StringBuilder();
+
+            // most errors terminate with the '^' char
+            String line;
+            do {
+                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("^"));
+
+            // add the error bean
+            errors.add(parseModernError(buffer.toString()));
+        }
+    }
+
+    /**
+     * Parse an individual compiler error message with modern style.
+     *
+     * @param error The error text
+     * @return A messaged <code>CompilerError</code>
+     */
+    private CompilerError parseModernError(String error) {
+        StringTokenizer tokens = new StringTokenizer(error, ":");
+        try {
+            String file = tokens.nextToken();
+            if (file.length() == 1)
+                file = 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("no more tokens - could not parse error message: " +
error);
+        } catch(Exception nse) {
+            return new CompilerError("could not parse error message: " + error);
+        }
+    }
+
     public String toString() {
         return "Pizza Java Compiler";
     }

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=1853817&r1=1853816&r2=1853817&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Mon Feb 18 18:18:27 2019
@@ -185,7 +185,7 @@
   <changes>
   <release version="2.1.13" date="TBD">
     <action dev="AN" type="update">
-      Use javax.tools.JavaCompiler interface (available since Java 6).
+      XSP: Remove alternative Javac because there is no common API for Java 5 to 8.
     </action>
     <action dev="AN" type="update">
       Core: Update to xalan-2.7.2 and add serializer-2.7.2



Mime
View raw message