Author: tcurdt
Date: Sat Sep 22 15:16:44 2007
New Revision: 578516

URL: http://svn.apache.org/viewvc?rev=578516&view=rev
Log:
fix unreported problems in janino,
report jre and system for javac


Modified:
    
commons/proper/jci/trunk/compilers/janino/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java
    
commons/proper/jci/trunk/compilers/javac/src/test/java/org/apache/commons/jci/compilers/JavacJavaCompilerTestCase.java

Modified: 
commons/proper/jci/trunk/compilers/janino/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/janino/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java?rev=578516&r1=578515&r2=578516&view=diff
==============================================================================
--- 
commons/proper/jci/trunk/compilers/janino/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java
 (original)
+++ 
commons/proper/jci/trunk/compilers/janino/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java
 Sat Sep 22 15:16:44 2007
@@ -37,6 +37,8 @@
 import org.codehaus.janino.FilterWarningHandler;
 import org.codehaus.janino.Location;
 import org.codehaus.janino.WarningHandler;
+import org.codehaus.janino.Parser.ParseException;
+import org.codehaus.janino.Scanner.ScanException;
 import org.codehaus.janino.UnitCompiler.ErrorHandler;
 import org.codehaus.janino.util.StringPattern;
 import org.codehaus.janino.util.resource.Resource;
@@ -83,7 +85,7 @@
                }
     }
 
-    private final class JciOutputStream extends ByteArrayOutputStream {
+    private final static class JciOutputStream extends ByteArrayOutputStream {
 
        private final String name;
        private final ResourceStore store;
@@ -98,8 +100,6 @@
 
                        final byte[] bytes = toByteArray();
                        
-                       log.debug("writing " + name + " (" + bytes.length + 
")");
-
                        store.write(name, bytes);
                }
     }
@@ -186,11 +186,18 @@
         }
         
         try {
-                       compiler.compile(resources);
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-        
+            compiler.compile(resources);
+        } catch ( ScanException e ) {
+            problems.add(new JaninoCompilationProblem(e));
+        } catch ( ParseException e ) {
+            problems.add(new JaninoCompilationProblem(e)); 
+        } catch ( IOException e ) {
+            // I'm hoping the existing compiler problems handler catches these
+               log.error("this error should have been cought before", e);
+        } catch ( CompileException e ) {
+            // I'm hoping the existing compiler problems handler catches these
+               log.error("this error should have been cought before", e);
+        }        
         final CompilationProblem[] result = new 
CompilationProblem[problems.size()];
         problems.toArray(result);
         return new CompilationResult(result);

Modified: 
commons/proper/jci/trunk/compilers/javac/src/test/java/org/apache/commons/jci/compilers/JavacJavaCompilerTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/javac/src/test/java/org/apache/commons/jci/compilers/JavacJavaCompilerTestCase.java?rev=578516&r1=578515&r2=578516&view=diff
==============================================================================
--- 
commons/proper/jci/trunk/compilers/javac/src/test/java/org/apache/commons/jci/compilers/JavacJavaCompilerTestCase.java
 (original)
+++ 
commons/proper/jci/trunk/compilers/javac/src/test/java/org/apache/commons/jci/compilers/JavacJavaCompilerTestCase.java
 Sat Sep 22 15:16:44 2007
@@ -26,5 +26,12 @@
     public String getCompilerName() {
         return "javac";
     }
+    
+    public void testJavaVersion() {
+       System.out.println("java.version: " + 
System.getProperty("java.version"));
+       System.out.println("os.name: " + System.getProperty("os.name"));
+       System.out.println("os.version: " + System.getProperty("os.version"));
+       System.out.println("os.arch: " + System.getProperty("os.arch"));
+    }
 
 }


Reply via email to