ASF Bugzilla – Attachment 31555 Details for
Bug 53011
Ant Jasper task fails after one error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Patch to add an option "failFast"
failfast.patch (text/plain), 4.41 KB, created by
Marc Pompl
on 2014-04-24 06:56:59 UTC
(
hide
)
Description:
Patch to add an option "failFast"
Filename:
MIME Type:
Creator:
Marc Pompl
Created:
2014-04-24 06:56:59 UTC
Size:
4.41 KB
patch
obsolete
>Index: trunk/java/org/apache/jasper/JspC.java >=================================================================== >--- trunk/java/org/apache/jasper/JspC.java (revision 1589513) >+++ trunk/java/org/apache/jasper/JspC.java (working copy) >@@ -108,6 +108,7 @@ > protected static final String SWITCH_CLASS_NAME = "-c"; > protected static final String SWITCH_FULL_STOP = "--"; > protected static final String SWITCH_COMPILE = "-compile"; >+ protected static final String SWITCH_FAIL_FAST = "-failFast"; > protected static final String SWITCH_SOURCE = "-source"; > protected static final String SWITCH_TARGET = "-target"; > protected static final String SWITCH_URI_BASE = "-uribase"; >@@ -175,6 +176,7 @@ > protected int dieLevel; > protected boolean helpNeeded = false; > protected boolean compile = false; >+ protected boolean failFast = false; > protected boolean smapSuppressed = true; > protected boolean smapDumped = false; > protected boolean caching = true; >@@ -303,6 +305,8 @@ > targetPackage = nextArg(); > } else if (tok.equals(SWITCH_COMPILE)) { > compile=true; >+ } else if (tok.equals(SWITCH_FAIL_FAST)) { >+ failFast=true; > } else if (tok.equals(SWITCH_CLASS_NAME)) { > targetClassName = nextArg(); > } else if (tok.equals(SWITCH_URI_BASE)) { >@@ -1338,29 +1342,47 @@ > initWebXml(); > > Iterator<String> iter = pages.iterator(); >- while (iter.hasNext()) { >- String nextjsp = iter.next().toString(); >- File fjsp = new File(nextjsp); >- if (!fjsp.isAbsolute()) { >- fjsp = new File(uriRootF, nextjsp); >- } >- if (!fjsp.exists()) { >- if (log.isWarnEnabled()) { >- log.warn >- (Localizer.getMessage >- ("jspc.error.fileDoesNotExist", fjsp.toString())); >- } >- continue; >- } >- String s = fjsp.getAbsolutePath(); >- if (s.startsWith(uriRoot)) { >- nextjsp = s.substring(uriRoot.length()); >- } >- if (nextjsp.startsWith("." + File.separatorChar)) { >- nextjsp = nextjsp.substring(2); >- } >- processFile(nextjsp); >- } >+ long time=System.currentTimeMillis(); >+ int errors = 0; >+ while (iter.hasNext()) { >+ String nextjsp = iter.next().toString(); >+ File fjsp = new File(nextjsp); >+ if (!fjsp.isAbsolute()) { >+ fjsp = new File(uriRootF, nextjsp); >+ } >+ if (!fjsp.exists()) { >+ if (log.isWarnEnabled()) { >+ log.warn(Localizer.getMessage( >+ "jspc.error.fileDoesNotExist", fjsp.toString())); >+ } >+ continue; >+ } >+ String s = fjsp.getAbsolutePath(); >+ if (s.startsWith(uriRoot)) { >+ nextjsp = s.substring(uriRoot.length()); >+ } >+ if (nextjsp.startsWith("." + File.separatorChar)) { >+ nextjsp = nextjsp.substring(2); >+ } >+ try { >+ processFile(nextjsp); >+ } catch (JasperException ex) { >+ if (failFast) { >+ throw ex; >+ } >+ errors++; >+ log.error(nextjsp + ":" + ex.getMessage()); >+ } >+ } >+ String timeFromatted = new DecimalFormat("#.###") >+ .format((double) (System.currentTimeMillis() - time) / 1000); >+ System.out.println("JSP-compilations: " + pages.size() >+ + ", Errors: " + errors + ", Time elapsed: " >+ + timeFromatted + " sec"); >+ if (errors > 0) { >+ throw new JasperException( >+ "Aborted due to compilation failures!"); >+ } > > completeWebXml(); > >Index: trunk/java/org/apache/jasper/resources/LocalStrings.properties >=================================================================== >--- trunk/java/org/apache/jasper/resources/LocalStrings.properties (revision 1589513) >+++ trunk/java/org/apache/jasper/resources/LocalStrings.properties (working copy) >@@ -253,6 +253,7 @@ > \ (default "/")\n\ > \ -uriroot <dir> Same as -webapp\n\ > \ -compile Compiles generated servlets\n\ >+\ -failFast Stop on first compile error\n\ > \ -webinc <file> Creates a partial servlet mappings in the file\n\ > \ -webxml <file> Creates a complete web.xml in the file\n\ > \ -webxmlencoding <enc> Set the encoding charset used to read and write the web.xml\n\
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 53011
: 31555