Author: kkolinko
Date: Sun Jun 24 11:40:06 2012
New Revision: 1353247

URL: http://svn.apache.org/viewvc?rev=1353247&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 namespaces
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()
Backport of r1346644. (markt)

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1353247&r1=1353246&r2=1353247&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sun Jun 24 11:40:06 2012
@@ -152,12 +152,6 @@ PATCHES PROPOSED TO BACKPORT:
               to TC6. As a minimum, the WebappClassLoader needs the changes 
from
               r1201555 before this patch is applied 
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53032
-  Make JspC extend o.a.tools.ant.Task so it works with namespaces
-  http://svn.apache.org/viewvc?rev=1346644&view=rev
-  +1: markt, schultz, kkolinko
-  -1:
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53047
   Allow database realms configured with an all roles mode that is 
authentication
   only to not have to define a role table

Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java?rev=1353247&r1=1353246&r2=1353247&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java Sun Jun 24 11:40:06 
2012
@@ -53,7 +53,8 @@ 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;
 
 /**
@@ -88,7 +89,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";
@@ -151,7 +152,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;
@@ -236,8 +236,8 @@ public class JspC implements Options {
         if (arg.length == 0) {
             System.out.println(Localizer.getMessage("jspc.usage"));
         } else {
+            JspC jspc = new JspC();
             try {
-                JspC jspc = new JspC();
                 jspc.setArgs(arg);
                 if (jspc.helpNeeded) {
                     System.out.println(Localizer.getMessage("jspc.usage"));
@@ -249,6 +249,11 @@ public class JspC implements Options {
                 if (die != NO_DIE_LEVEL) {
                     System.exit(die);
                 }
+            } catch (BuildException je) {
+                System.err.println(je);
+                if (jspc.dieLevel != NO_DIE_LEVEL) {
+                    System.exit(jspc.dieLevel);
+                }
             }
         }
     }
@@ -772,25 +777,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.
      */
@@ -1273,7 +1259,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.");
         }
@@ -1348,7 +1335,7 @@ public class JspC implements Options {
             }
 
         } catch (IOException ioe) {
-            throw new JasperException(ioe);
+            throw new BuildException(ioe);
 
         } catch (JasperException je) {
             Throwable rootCause = je;
@@ -1359,7 +1346,7 @@ public class JspC implements Options {
             if (rootCause != je) {
                 rootCause.printStackTrace();
             }
-            throw je;
+            throw new BuildException(je);
         } finally {
             if (loader != null) {
                 LogFactory.release(loader);

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1353247&r1=1353246&r2=1353247&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sun Jun 24 11:40:06 2012
@@ -195,6 +195,11 @@
         described in the bug is invalid since it breaks the EL specification.
         (markt)
       </fix>
+      <fix>
+        <bug>53032</bug>: Modify <code>JspC</code> so it extends
+        <code>org.apache.tools.ant.Task</code> enabling it to work with 
features
+        such as namespaces within build.xml files. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">



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

Reply via email to