You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2022/01/07 02:59:47 UTC

[royale-asjs] branch develop updated: Fix to avoid errors for missing ResourceBundle definitions and for default 'ignoreMissingBundles' in 'Falcon' (tested in JSRoyale, not checked in SWF)

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new e5a9928  Fix to avoid errors for missing ResourceBundle definitions and for default 'ignoreMissingBundles' in 'Falcon' (tested in JSRoyale, not checked in SWF)
e5a9928 is described below

commit e5a99280c9e52ec153c6ff783331b3cb4cf1d0c7
Author: greg-dove <gr...@gmail.com>
AuthorDate: Fri Jan 7 15:57:29 2022 +1300

    Fix to avoid errors for missing ResourceBundle definitions and for default 'ignoreMissingBundles' in 'Falcon' (tested in JSRoyale, not checked in SWF)
---
 .../royale/mx/resources/ResourceManagerImpl.as     | 31 ++++++++++++++++------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/resources/ResourceManagerImpl.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/resources/ResourceManagerImpl.as
index 6bed1e1..3be5f78 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/resources/ResourceManagerImpl.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/resources/ResourceManagerImpl.as
@@ -25,6 +25,7 @@ import org.apache.royale.events.EventDispatcher;
 import org.apache.royale.events.IEventDispatcher;
 import org.apache.royale.utils.LocaleUtils;
 import org.apache.royale.reflection.getDefinitionByName;
+import org.apache.royale.reflection.hasDefinitionWithName;
 /*
 import flash.events.FocusEvent;
 import flash.events.TimerEvent;
@@ -148,13 +149,21 @@ public class ResourceManagerImpl extends EventDispatcher implements IResourceMan
 		// Falcon injects this property and it is always false
 		// We ignore missing bundles because Falcon doesn't
 		// generate fallback bundles like MXMLC;
-		if (!inFrame1)
-			ignoreMissingBundles = info && info.hasOwnProperty("isMXMLC");
-		
+        COMPILE::SWF{
+            if (!inFrame1)
+                ignoreMissingBundles = info && info.hasOwnProperty("isMXMLC"); //@todo check this is actually happening in swf builds
+        }
+
+        //in JSRoyale, was not currently seeing the 'isMXMLC property, even though it is 'Falcon' also:
+        COMPILE::JS {
+            if (!inFrame1)
+                ignoreMissingBundles = true;
+        }
+
         if (info)
             processInfo(info, false);
 
-        ignoreMissingBundles = info && info.hasOwnProperty("isMXMLC");
+        ignoreMissingBundles = true /* because Royale is 'always' falcon-like * /* was : info && info.hasOwnProperty("isMXMLC")*/;
         
         /*
         if (SystemManagerGlobals.topLevelSystemManagers.length)
@@ -382,16 +391,20 @@ public class ResourceManagerImpl extends EventDispatcher implements IResourceMan
             resourceBundleClassName = packageName + "." + resourceBundleClassName;
                 
         // Find the bundle class by its name.
-        // We do a hasDefinition() check before calling getDefinition()
+        // We do a hasDefinitionWithName() check before calling getDefinition()
         // because getDefinition() will throw an RTE
         // if the class doesn't exist.
         var bundleClass:Class = null;
-        bundleClass = getDefinitionByName(resourceBundleClassName) as Class;
+        if (hasDefinitionWithName(resourceBundleClassName)) {
+            bundleClass = getDefinitionByName(resourceBundleClassName) as Class;
+        }
 
         if (!bundleClass)
         {
             resourceBundleClassName = bundleName;
-            bundleClass = getDefinitionByName(resourceBundleClassName) as Class;
+            if (hasDefinitionWithName(resourceBundleClassName)) {
+                bundleClass = getDefinitionByName(resourceBundleClassName) as Class;
+            }
         }
         
         // In case we linked against a Flex 2 SWC, look for the old
@@ -399,7 +412,9 @@ public class ResourceManagerImpl extends EventDispatcher implements IResourceMan
         if (!bundleClass)
         {
             resourceBundleClassName = bundleName + "_properties";
-            bundleClass = getDefinitionByName(resourceBundleClassName) as Class;
+            if (hasDefinitionWithName(resourceBundleClassName)) {
+                bundleClass = getDefinitionByName(resourceBundleClassName) as Class;
+            }
         }
         
         if (!bundleClass)