flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Mclean (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (FLEX-25045) ResourceManager.getInstance().getString() returns "undefined" instead of null
Date Sun, 12 Oct 2014 00:13:34 GMT

    [ https://issues.apache.org/jira/browse/FLEX-25045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14168417#comment-14168417
] 

Justin Mclean edited comment on FLEX-25045 at 10/12/14 12:13 AM:
-----------------------------------------------------------------

Not an issue, as this code shows if the resource doesn't exist, the string returned is null.

{code}
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init(event)">
	<fx:Script>
		<![CDATA[
			import mx.events.FlexEvent;
			import mx.resources.ResourceManager;
			
			protected function init(event:FlexEvent):void
			{
				var str:String = ResourceManager.getInstance().getString("core", "unknown");
				trace("String is " + str);
			}
			
		]]>
	</fx:Script>
</s:Application>
{code}

Relevant code in getString:
{code}
        var resourceBundle:IResourceBundle =
            findBundle(bundleName, resourceName, locale);
        if (!resourceBundle)
            return null;

        var value:String = String(resourceBundle.content[resourceName]);
{code}

findBundle will return null if resourceName does't exist and the method will return null before
calculating the value/casting to String.


was (Author: jmclean):
Not an issue, as this code shows if the resource doesn't exist, the string returned is null.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init(event)">
	<fx:Script>
		<![CDATA[
			import mx.events.FlexEvent;
			import mx.resources.ResourceManager;
			
			protected function init(event:FlexEvent):void
			{
				var str:String = ResourceManager.getInstance().getString("core", "unknown");
				trace("String is " + str);
			}
			
		]]>
	</fx:Script>
</s:Application>

Relevant code in getString:

        var resourceBundle:IResourceBundle =
            findBundle(bundleName, resourceName, locale);
        if (!resourceBundle)
            return null;

        var value:String = String(resourceBundle.content[resourceName]);

findBundle will return null if resourceName does't exist and the method will return null before
calculating the value/casting to String.

> ResourceManager.getInstance().getString() returns "undefined" instead of null
> -----------------------------------------------------------------------------
>
>                 Key: FLEX-25045
>                 URL: https://issues.apache.org/jira/browse/FLEX-25045
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Runtime Localization
>    Affects Versions: Adobe Flex SDK 3.5 (Release)
>         Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Language Found: English
>            Reporter: Adobe JIRA
>            Assignee: Justin Mclean
>              Labels: easyfix, easytest
>             Fix For: Apache Flex 4.10.0
>
>
> Steps to reproduce:
> 1. Create a resource bundle with key value pairs
> 2. Load the resource bundle in your application and add them to the resourcemanager instance
> 3. Use the ResourceManager.getInstance().getString() method with a key that is not in
the resource bundle and put the return value in a string
>  
>  Actual Results:
>  The return value is undefined as a string
>  
>  Expected Results:
>  The return (according to the docs) should be null



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message