This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch gradle-improvements
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/gradle-improvements by this 
push:
     new 515a71539 If JS minifying fails, serve the file unchanged
515a71539 is described below

commit 515a71539e6ecdabbd45bf0f7844e73ae43299e9
Author: Thiago H. de Paula Figueiredo <[email protected]>
AuthorDate: Sat Aug 23 17:20:58 2025 -0300

    If JS minifying fails, serve the file unchanged
    
    then log a warning message about it and let it run instead of throwing
    an exception
---
 .../internal/webresources/GoogleClosureMinimizer.java       | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git 
a/tapestry-webresources/src/main/java/org/apache/tapestry5/internal/webresources/GoogleClosureMinimizer.java
 
b/tapestry-webresources/src/main/java/org/apache/tapestry5/internal/webresources/GoogleClosureMinimizer.java
index b134b2bad..6b3d1b6ae 100644
--- 
a/tapestry-webresources/src/main/java/org/apache/tapestry5/internal/webresources/GoogleClosureMinimizer.java
+++ 
b/tapestry-webresources/src/main/java/org/apache/tapestry5/internal/webresources/GoogleClosureMinimizer.java
@@ -30,6 +30,7 @@ import 
org.apache.tapestry5.services.assets.AssetChecksumGenerator;
 import org.apache.tapestry5.services.assets.StreamableResource;
 import org.apache.tapestry5.webresources.GoogleClosureMinimizerOptionsProvider;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.javascript.jscomp.Compiler;
 import com.google.javascript.jscomp.CompilerOptions;
@@ -42,6 +43,8 @@ import com.google.javascript.jscomp.SourceFile;
  */
 public class GoogleClosureMinimizer extends AbstractMinimizer
 {
+    
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(GoogleClosureMinimizer.class);
 
     private final List<SourceFile> EXTERNS = Collections.emptyList();
 
@@ -105,9 +108,13 @@ public class GoogleClosureMinimizer extends 
AbstractMinimizer
         {
             return IOUtils.toInputStream(compiler.toSource(), 
StandardCharsets.UTF_8);
         }
-
-        throw new RuntimeException(String.format("Compilation failed for %s. 
Errors: %s.",
+        else
+        {
+            logger.warn(String.format("Minimization failed for %s. Errors: 
%s.",
                        resource,
-                InternalUtils.join(CollectionFactory.newList(result.errors), 
";")));
+                InternalUtils.join(CollectionFactory.newList(result.errors), 
";")) + 
+                    " Providing unchanged resource instead.");
+            return resource.openStream();
+        }
     }
 }

Reply via email to