You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by be...@apache.org on 2026/04/16 16:14:28 UTC

(tapestry-5) 02/02: GoogleClosureMinimizer: return non-minimized JS on error

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

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

commit 8edf1ed6287f1667308b721f6ce38a5e8bbc32d2
Author: Ben Weidig <be...@netzgut.net>
AuthorDate: Wed Apr 15 09:29:54 2026 +0200

    GoogleClosureMinimizer: return non-minimized JS on error
    
    The Google Closure minimizer is only used to remove whitespace, but its
    Compiler trips over unrelated problems.
    Therefore we return the original JS to not break a page if the minimizer
    has an issue with code it doesn't understand.
---
 .../tapestry5/internal/webresources/GoogleClosureMinimizer.java     | 6 +++---
 .../webresources/GoogleClosureMinimizerOptionsProviderImpl.java     | 1 -
 2 files changed, 3 insertions(+), 4 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 f2385dccd..3a7835129 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
@@ -106,8 +106,8 @@ public class GoogleClosureMinimizer extends AbstractMinimizer
             return IOUtils.toInputStream(compiler.toSource(), StandardCharsets.UTF_8);
         }
 
-        throw new ResourceMinimizationException(String.format("Compilation failed for %s. Errors: %s.",
-        		resource,
-                InternalUtils.join(CollectionFactory.newList(result.errors), ";")));
+        logger.warn("Compilation failed for {}. Errors: %{}", resource, InternalUtils.join(CollectionFactory.newList(result.errors), ";"));
+
+        return IOUtils.toInputStream(source, StandardCharsets.UTF_8);
     }
 }
diff --git a/tapestry-webresources/src/main/java/org/apache/tapestry5/internal/webresources/GoogleClosureMinimizerOptionsProviderImpl.java b/tapestry-webresources/src/main/java/org/apache/tapestry5/internal/webresources/GoogleClosureMinimizerOptionsProviderImpl.java
index b07076864..e59f53a88 100644
--- a/tapestry-webresources/src/main/java/org/apache/tapestry5/internal/webresources/GoogleClosureMinimizerOptionsProviderImpl.java
+++ b/tapestry-webresources/src/main/java/org/apache/tapestry5/internal/webresources/GoogleClosureMinimizerOptionsProviderImpl.java
@@ -42,7 +42,6 @@ public class GoogleClosureMinimizerOptionsProviderImpl implements GoogleClosureM
         options.setModuleResolutionMode(ModuleLoader.ResolutionMode.BROWSER);
         options.setDependencyOptions(DependencyOptions.none());
         options.setCodingConvention(new ClosureCodingConvention());
-
         options.setErrorHandler(new BlackHoleErrorManager());
 
         return Optional.of(options);