Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-22525

ResourceManagerImpl possible error, variable defined as ResourceBundle instead of IResourceBundle

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Adobe Flex SDK 3.4 (Release)
    • None
    • i18n : Bundle Support
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Browser: Internet Explorer 7.x
      Language Found: English

    Description

      Steps to reproduce:
      1.create a class that implements IResourceBundle, create an instance "myBundleInstance" of this class
      2.add the instance to ResourceManager.getInstance().addResourceBundle(myBundleInstance)
      3.attemp to get a value from the resource bundle resourceManager.getString('BundleName','helloMessage');

      Actual Results:
      Type Coercion failed: cannot convert com.common.bundle::I18NBundle@c80e319 to mx.resources.ResourceBundle.
      at mx.resources::ResourceManagerImpl/findResourceBundleWithResource()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\resources\ResourceManagerImpl.as:534]
      at mx.resources::ResourceManagerImpl/findBundle()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\resources\ResourceManagerImpl.as:710]
      at mx.resources::ResourceManagerImpl/getString()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\resources\ResourceManagerImpl.as:571]
      at Function/http://adobe.com/AS3/2006/builtin::apply()
      at <anonymous>()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\binding\FunctionReturnWatcher.as:162]
      at Function/http://adobe.com/AS3/2006/builtin::apply()
      at mx.binding::Watcher/wrapUpdate()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\binding\Watcher.as:182]
      at mx.binding::FunctionReturnWatcher/updateFunctionReturn()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\binding\FunctionReturnWatcher.as:152]
      at mx.binding::FunctionReturnWatcher/updateParent()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\binding\FunctionReturnWatcher.as:122]
      at mx.binding::Watcher/addChild()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\binding\Watcher.as:102]
      at _com_petrobras_merchandising_ui_component_ShoppingCartWatcherSetupUtil/setup()
      at com.petrobras.merchandising.ui.component::ShoppingCart/initialize()[C:\Trabajo\Proyectos\Petrobras\Flash\ShoppingCart\src\com\petrobras\merchandising\ui\component\ShoppingCart.mxml:0]
      at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5267]
      at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:3305]
      at mx.core::Container/addChildAt()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:2217]
      at mx.core::Container/addChild()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:2140]
      at mx.core::Container/createComponentFromDescriptor()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:3681]
      at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:3493]
      at mx.containers::ViewStack/instantiateSelectedChild()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\containers\ViewStack.as:1140]
      at mx.containers::ViewStack/commitProperties()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\containers\ViewStack.as:664]
      at mx.core::UIComponent/validateProperties()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5807]
      at mx.managers::LayoutManager/validateProperties()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:539]
      at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:689]
      at Function/http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8633]
      at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8573]

      Expected Results:
      The value stored in the resource bundle

      Workaround (if any):
      the error seems to be in the class: mx.resources.ResourceManagerImpl.as

      in the method "findResourceBundleWithResource", when attemps to store the retrieved bundle in a varialbe of the type ResourceBundle instead of IResourceBundle.
      this is the line:
      "var bundle:ResourceBundle = bundleMap[bundleName];"
      The variable should be declared of type: IResourceBundle.

      this is the method:
      /**

      • @copy mx.resources.findResourceBundleWithResource
        */
        public function findResourceBundleWithResource(
        bundleName:String, resourceName:String):IResourceBundle
        {
        if (!_localeChain)
        return null;

      var n:int = _localeChain.length;
      for (var i:int = 0; i < n; i++)

      { var locale:String = localeChain[i]; var bundleMap:Object = localeMap[locale]; if (!bundleMap) continue; var bundle:ResourceBundle = bundleMap[bundleName]; if (!bundle) continue; if (resourceName in bundle.content) return bundle; }

      return null;
      }

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: