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

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/develop by this push:
     new 31a548032 RoyaleAppSWFTarget: someone forgot to catch 
ProblemParsingCSSRuntimeException
31a548032 is described below

commit 31a54803262abf86fe12d3f73145db0501d245ef
Author: Josh Tynjala <[email protected]>
AuthorDate: Tue Apr 30 10:09:06 2024 -0700

    RoyaleAppSWFTarget: someone forgot to catch 
ProblemParsingCSSRuntimeException
    
    Was displaying a stack trace when defaults.css contained invalid CSS. Now 
displays proper problems.
---
 RELEASE_NOTES.md                                       |  2 +-
 .../compiler/internal/targets/RoyaleAppSWFTarget.java  | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index a98356b4d..e596c91b4 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -25,7 +25,7 @@ Apache Royale Compiler 0.9.11
 - compiler: Fix incorrect error or warning positions for CSS content inside 
`<fx:Style>` tag.
 - compiler: Fix non-string values in an MXML array sometimes getting 
incorrectly wrapped in quotes when emitting JavaScript.
 - compiler: Fix null exception for `<fx:Style>` tags that contain only 
comments.
-- compiler: Fix exceptions for `<fx:Style>` tags that contain invalid CSS.
+- compiler: Fix exceptions for `<fx:Style>` tags and _defaults.css_ files that 
contain invalid CSS.
 - compiler: Fix silently ignoring errors in some invalid CSS content, if it 
appears at the end after valid content.
 - compiler: Fix crash when attempting to use `--remove-circulars=false` with a 
release build.
 - compiler: Added CSS support for modern syntax without commas in `rgb` and 
`rgba` functions.
diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleAppSWFTarget.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleAppSWFTarget.java
index 597fbf4ac..a7a384627 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleAppSWFTarget.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleAppSWFTarget.java
@@ -64,6 +64,7 @@ import 
org.apache.royale.compiler.definitions.IStyleDefinition;
 import 
org.apache.royale.compiler.definitions.references.IResolvedQualifiersReference;
 import org.apache.royale.compiler.definitions.references.ReferenceFactory;
 import org.apache.royale.compiler.internal.abc.ClassGeneratorHelper;
+import org.apache.royale.compiler.internal.caches.CSSDocumentCache;
 import org.apache.royale.compiler.internal.css.codegen.CSSCompilationSession;
 import org.apache.royale.compiler.internal.css.codegen.ICSSCodeGenResult;
 import org.apache.royale.compiler.internal.css.semantics.ActivatedStyleSheets;
@@ -517,13 +518,20 @@ public class RoyaleAppSWFTarget extends AppSWFTarget
             allCompilationUnitsInTarget.addAll(dependencies);
 
             // Get all activated defaults.css from SWCs.
-            final Map<ICSSDocument, File> activatedDefaultCSSList =
-                        getAllDefaultCSS(cssManager, 
allCompilationUnitsInTarget);
-            for (final Map.Entry<ICSSDocument, File> entry : 
activatedDefaultCSSList.entrySet())
+            try
+            {
+                final Map<ICSSDocument, File> activatedDefaultCSSList =
+                            getAllDefaultCSS(cssManager, 
allCompilationUnitsInTarget);
+                for (final Map.Entry<ICSSDocument, File> entry : 
activatedDefaultCSSList.entrySet())
+                {
+                    activatedStyleSheets.addLibraryCSS(entry.getKey(), 
entry.getValue().getAbsolutePath());
+                }
+                
//LoggingProfiler.onDefaultsCSSCollectionChanged(activatedStyleSheets);
+            }
+            catch (CSSDocumentCache.ProblemParsingCSSRuntimeException cssError)
             {
-                activatedStyleSheets.addLibraryCSS(entry.getKey(), 
entry.getValue().getAbsolutePath());
+                problems.addAll(cssError.cssParserProblems);   
             }
-            
//LoggingProfiler.onDefaultsCSSCollectionChanged(activatedStyleSheets);
 
             // Get all dependencies introduced by defaults.css from SWCs. 
             final ImmutableList<IDefinition> definitions =

Reply via email to