You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2013/12/31 10:35:06 UTC

[3/4] git commit: CLEREZZA-857: code cleaning

CLEREZZA-857: code cleaning

Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/9f18b034
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/9f18b034
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/9f18b034

Branch: refs/heads/master
Commit: 9f18b034dc06b17bb6538412c2585feaf6a65fcd
Parents: e8ebca1
Author: retobg <re...@apache.org>
Authored: Tue Dec 31 10:34:07 2013 +0100
Committer: retobg <re...@apache.org>
Committed: Tue Dec 31 10:34:07 2013 +0100

----------------------------------------------------------------------
 .../clerezza/scala/scripting/CompilerService.scala    | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/9f18b034/scala-scripting/script-engine/src/main/scala/org/apache/clerezza/scala/scripting/CompilerService.scala
----------------------------------------------------------------------
diff --git a/scala-scripting/script-engine/src/main/scala/org/apache/clerezza/scala/scripting/CompilerService.scala b/scala-scripting/script-engine/src/main/scala/org/apache/clerezza/scala/scripting/CompilerService.scala
index 56205b1..982204f 100644
--- a/scala-scripting/script-engine/src/main/scala/org/apache/clerezza/scala/scripting/CompilerService.scala
+++ b/scala-scripting/script-engine/src/main/scala/org/apache/clerezza/scala/scripting/CompilerService.scala
@@ -21,12 +21,8 @@ package org.apache.clerezza.scala.scripting;
 
 import java.security.AccessController
 import java.security.Permission
-import java.security.PrivilegedAction
 import java.security.PrivilegedActionException
 import java.security.PrivilegedExceptionAction
-import org.apache.clerezza.scala.scripting.util.FileWrapper
-import org.apache.clerezza.scala.scripting.util.GenericFileWrapperTrait
-import org.apache.clerezza.scala.scripting.util.VirtualDirectoryWrapper
 import org.osgi.framework.BundleContext
 import org.osgi.framework.BundleEvent
 import org.osgi.framework.BundleListener
@@ -35,19 +31,16 @@ import scala.tools.nsc._;
 import scala.tools.nsc.interpreter._;
 import scala.tools.nsc.io.AbstractFile
 import scala.tools.nsc.io.VirtualDirectory
-import scala.tools.nsc.reporters.ConsoleReporter
 import scala.tools.nsc.util._
 import java.io.ByteArrayOutputStream
-import java.io.File
 import java.io.IOException
 import java.io.OutputStream
 import java.io.PrintWriter
-import java.io.Reader
 import java.net._
 
 class CompileErrorsException(message: String, cause: Exception) extends Exception(message, cause) {
-  def this(cause: Exception) = this(null, cause)
-  def this() = this(null)
+  def this(cause: Exception) = this("Compilation failed", cause)
+  def this() = this("Compile failed", null)
 }
 
 class CompilePermission extends Permission("Compile Permssion") {
@@ -120,8 +113,9 @@ class CompilerService() extends BundleListener  {
                 sharedCompiler.compile(sources)
               } catch {
                 case c: CompileErrorsException => {  
+                    val compilerOutput = new String(baos.toByteArray, "utf-8")
                     throw new CompileErrorsException(
-                      new String(baos.toByteArray, "utf-8"), c)
+                      compilerOutput, c)
                   }
                 case e: Exception => throw e
               } finally {