Author: markt
Date: Tue Jun  5 22:56:40 2012
New Revision: 1346644

URL: http://svn.apache.org/viewvc?rev=1346644&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53032
Modify JspC to extend o.a.tools.ant.Task so it works with name spaces
The main change is that execute() no longer throws JasperException so it 
matches the signature for Task.execute(). This required a small change to main()

Modified:
    tomcat/trunk/java/org/apache/jasper/JspC.java

Modified: tomcat/trunk/java/org/apache/jasper/JspC.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspC.java?rev=1346644&r1=1346643&r2=1346644&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspC.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspC.java Tue Jun  5 22:56:40 2012
@@ -56,7 +56,8 @@ import org.apache.jasper.servlet.JspCSer
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tools.ant.AntClassLoader;
-import org.apache.tools.ant.Project;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
 import org.apache.tools.ant.util.FileUtils;
 
 /**
@@ -91,7 +92,7 @@ import org.apache.tools.ant.util.FileUti
  * @author Costin Manolache
  * @author Yoav Shapira
  */
-public class JspC implements Options {
+public class JspC extends Task implements Options {
 
     public static final String DEFAULT_IE_CLASS_ID =
             "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
@@ -164,7 +165,6 @@ public class JspC implements Options {
     protected String targetClassName;
     protected String uriBase;
     protected String uriRoot;
-    protected Project project;
     protected int dieLevel;
     protected boolean helpNeeded = false;
     protected boolean compile = false;
@@ -263,6 +263,11 @@ public class JspC implements Options {
                 if (jspc.dieLevel != NO_DIE_LEVEL) {
                     System.exit(jspc.dieLevel);
                 }
+            } catch (BuildException je) {
+                System.err.println(je);
+                if (jspc.dieLevel != NO_DIE_LEVEL) {
+                    System.exit(jspc.dieLevel);
+                }
             }
         }
     }
@@ -778,25 +783,6 @@ public class JspC implements Options {
     }
 
     /**
-     * Sets the Ant project.
-     *
-     * @param theProject The project
-     */
-    public void setProject(final Project theProject) {
-        project = theProject;
-    }
-
-    /**
-     * Returns the project: may be <code>null</code> if not running
-     * inside an Ant project.
-     *
-     * @return The project
-     */
-    public Project getProject() {
-        return project;
-    }
-
-    /**
      * Base dir for the webapp. Used to generate class names and resolve
      * includes.
      */
@@ -1274,7 +1260,8 @@ public class JspC implements Options {
      *
      * @throws JasperException If an error occurs
      */
-    public void execute() throws JasperException {
+    @Override
+    public void execute() {
         if(log.isDebugEnabled()) {
             log.debug("execute() starting for " + pages.size() + " pages.");
         }
@@ -1349,7 +1336,7 @@ public class JspC implements Options {
             }
 
         } catch (IOException ioe) {
-            throw new JasperException(ioe);
+            throw new BuildException(ioe);
 
         } catch (JasperException je) {
             Throwable rootCause = je;
@@ -1360,7 +1347,7 @@ public class JspC implements Options {
             if (rootCause != je) {
                 rootCause.printStackTrace();
             }
-            throw je;
+            throw new BuildException(je);
         } finally {
             if (loader != null) {
                 LogFactory.release(loader);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to