You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2018/09/17 12:19:37 UTC

svn commit: r1841069 - in /tomcat/trunk: java/org/apache/jasper/JspC.java webapps/docs/changelog.xml

Author: markt
Date: Mon Sep 17 12:19:37 2018
New Revision: 1841069

URL: http://svn.apache.org/viewvc?rev=1841069&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62674
Correct a regression in the stand-alone JSP compiler utility, JspC, caused by the fix for 53492, that caused the JCP compiler to hang.

Modified:
    tomcat/trunk/java/org/apache/jasper/JspC.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/jasper/JspC.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspC.java?rev=1841069&r1=1841068&r2=1841069&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspC.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspC.java Mon Sep 17 12:19:37 2018
@@ -1484,55 +1484,59 @@ public class JspC extends Task implement
 
             ExecutorService threadPool = Executors.newFixedThreadPool(threadCount);
             ExecutorCompletionService<Void> service = new ExecutorCompletionService<>(threadPool);
-            int pageCount = pages.size();
+            try {
+                int pageCount = pages.size();
 
-            for (String nextjsp : pages) {
-                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()));
+                for (String nextjsp : pages) {
+                    File fjsp = new File(nextjsp);
+                    if (!fjsp.isAbsolute()) {
+                        fjsp = new File(uriRootF, nextjsp);
                     }
-                    continue;
-                }
-                String s = fjsp.getAbsolutePath();
-                if (s.startsWith(uriRoot)) {
-                    nextjsp = s.substring(uriRoot.length());
-                }
-                if (nextjsp.startsWith("." + File.separatorChar)) {
-                    nextjsp = nextjsp.substring(2);
+                    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);
+                    }
+                    service.submit(new ProcessFile(nextjsp));
                 }
-                service.submit(new ProcessFile(nextjsp));
-            }
-            JasperException reportableError = null;
-            for (int i = 0; i < pageCount; i++) {
-                try {
-                    service.take().get();
-                } catch (ExecutionException e) {
-                    if (failFast) {
-                        // Generation is not interruptible so any tasks that
-                        // have started will complete.
-                        List<Runnable> notExecuted = threadPool.shutdownNow();
-                        i += notExecuted.size();
-                        Throwable t = e.getCause();
-                        if (t instanceof JasperException) {
-                            reportableError = (JasperException) t;
+                JasperException reportableError = null;
+                for (int i = 0; i < pageCount; i++) {
+                    try {
+                        service.take().get();
+                    } catch (ExecutionException e) {
+                        if (failFast) {
+                            // Generation is not interruptible so any tasks that
+                            // have started will complete.
+                            List<Runnable> notExecuted = threadPool.shutdownNow();
+                            i += notExecuted.size();
+                            Throwable t = e.getCause();
+                            if (t instanceof JasperException) {
+                                reportableError = (JasperException) t;
+                            } else {
+                                reportableError = new JasperException(t);
+                            }
                         } else {
-                            reportableError = new JasperException(t);
+                            errorCount++;
+                            log.error(e.getMessage());
                         }
-                    } else {
-                        errorCount++;
-                        log.error(e.getMessage());
+                    } catch (InterruptedException e) {
+                        // Ignore
                     }
-                } catch (InterruptedException e) {
-                    // Ignore
                 }
-            }
-            if (reportableError != null) {
-                throw reportableError;
+                if (reportableError != null) {
+                    throw reportableError;
+                }
+            } finally {
+                threadPool.shutdown();
             }
 
             long time = System.currentTimeMillis() - start;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1841069&r1=1841068&r2=1841069&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Sep 17 12:19:37 2018
@@ -84,6 +84,11 @@
         <bug>62721</bug>: Correct generation of web.xml header when using JspC.
         (markt)
       </fix>
+      <fix>
+        <bug>62674</bug>: Correct a regression in the stand-alone JSP compiler
+        utility, <code>JspC</code>, caused by the fix for <bug>53492</bug>, that
+        caused the JCP compiler to hang. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">



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


Re: svn commit: r1841069 - in /tomcat/trunk: java/org/apache/jasper/JspC.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.

On 24/09/2018 13:44, Rainer Jung wrote:
> Am 17.09.2018 um 14:19 schrieb markt@apache.org:
>> Author: markt
>> Date: Mon Sep 17 12:19:37 2018
>> New Revision: 1841069
>>
>> URL: http://svn.apache.org/viewvc?rev=1841069&view=rev
>> Log:
>> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62674
>> Correct a regression in the stand-alone JSP compiler utility, JspC, 
>> caused by the fix for 53492, that caused the JCP compiler to hang.
>>
>> Modified:
>>      tomcat/trunk/java/org/apache/jasper/JspC.java
>>      tomcat/trunk/webapps/docs/changelog.xml
> 
> ... snip ...
> 
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1841069&r1=1841068&r2=1841069&view=diff 
>>
>> ============================================================================== 
>>
>> --- tomcat/trunk/webapps/docs/changelog.xml (original)
>> +++ tomcat/trunk/webapps/docs/changelog.xml Mon Sep 17 12:19:37 2018
>> @@ -84,6 +84,11 @@
>>           <bug>62721</bug>: Correct generation of web.xml header when 
>> using JspC.
>>           (markt)
>>         </fix>
>> +      <fix>
>> +        <bug>62674</bug>: Correct a regression in the stand-alone JSP 
>> compiler
>> +        utility, <code>JspC</code>, caused by the fix for 
>> <bug>53492</bug>, that
>> +        caused the JCP compiler to hang. (markt)
> 
> JCP => JSP

This one. I'll get it fixed.

Thanks for the catch.

Mark


> 
> or
> 
> JCP => JspC ?
> 
> Regards,
> 
> Rainer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 

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


Re: svn commit: r1841069 - in /tomcat/trunk: java/org/apache/jasper/JspC.java webapps/docs/changelog.xml

Posted by Rainer Jung <ra...@kippdata.de>.
Am 17.09.2018 um 14:19 schrieb markt@apache.org:
> Author: markt
> Date: Mon Sep 17 12:19:37 2018
> New Revision: 1841069
> 
> URL: http://svn.apache.org/viewvc?rev=1841069&view=rev
> Log:
> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62674
> Correct a regression in the stand-alone JSP compiler utility, JspC, caused by the fix for 53492, that caused the JCP compiler to hang.
> 
> Modified:
>      tomcat/trunk/java/org/apache/jasper/JspC.java
>      tomcat/trunk/webapps/docs/changelog.xml

... snip ...

> URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1841069&r1=1841068&r2=1841069&view=diff
> ==============================================================================
> --- tomcat/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/trunk/webapps/docs/changelog.xml Mon Sep 17 12:19:37 2018
> @@ -84,6 +84,11 @@
>           <bug>62721</bug>: Correct generation of web.xml header when using JspC.
>           (markt)
>         </fix>
> +      <fix>
> +        <bug>62674</bug>: Correct a regression in the stand-alone JSP compiler
> +        utility, <code>JspC</code>, caused by the fix for <bug>53492</bug>, that
> +        caused the JCP compiler to hang. (markt)

JCP => JSP

or

JCP => JspC ?

Regards,

Rainer

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