You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Jacopo Cappellato (JIRA)" <ji...@apache.org> on 2008/04/06 13:17:24 UTC

[jira] Created: (OFBIZ-1739) If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached

If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached
---------------------------------------------------------------------------------------------------------------------------------

                 Key: OFBIZ-1739
                 URL: https://issues.apache.org/jira/browse/OFBIZ-1739
             Project: OFBiz
          Issue Type: Improvement
          Components: framework
            Reporter: Jacopo Cappellato
            Priority: Minor


For example:
let's suppose we have a recource bundle with name SomeResourceBundle.xml that only contains labels in "it" and "cn".
Every time a label for the "en" language is looked up, the method UtilProperties.getBundle("SomeResourceBundle", enLocale) is invoked.
However the bundleCache map (line 818) doesn' contain the bundle for the en local, and a call to the getProperties(...) method is done.
That method call is very expensive because it parses the whole xml file searching for a property in the desired locale; if non is found, then the bundle is not put in the cache for the locale.
This ends up with a huge number of calls to the getProperties method (and parsing again and again).
Ideally, we should put the base bundle in the cache for the en locale, even if it doesn't contain any labels in that locale.


 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1739) If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached

Posted by "Adrian Crum (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586137#action_12586137 ] 

Adrian Crum commented on OFBIZ-1739:
------------------------------------

Jacopo,

You are correct that the getBundle(...) method calls the getProperties(...) method repeatedly, but if you trace through the code further, you'll see that the resolvePropertiesUrl(...) method that is called keeps a list of non-existent properties files which is used to prevent unnecessary lookups.


> If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-1739
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1739
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Jacopo Cappellato
>            Priority: Minor
>
> For example:
> let's suppose we have a recource bundle with name SomeResourceBundle.xml that only contains labels in "it" and "cn".
> Every time a label for the "en" language is looked up, the method UtilProperties.getBundle("SomeResourceBundle", enLocale) is invoked.
> However the bundleCache map (line 818) doesn' contain the bundle for the en local, and a call to the getProperties(...) method is done.
> That method call is very expensive because it parses the whole xml file searching for a property in the desired locale; if non is found, then the bundle is not put in the cache for the locale.
> This ends up with a huge number of calls to the getProperties method (and parsing again and again).
> Ideally, we should put the base bundle in the cache for the en locale, even if it doesn't contain any labels in that locale.
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (OFBIZ-1739) If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-1739?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacopo Cappellato closed OFBIZ-1739.
------------------------------------

    Resolution: Fixed

> If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-1739
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1739
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Jacopo Cappellato
>            Priority: Minor
>
> For example:
> let's suppose we have a recource bundle with name SomeResourceBundle.xml that only contains labels in "it" and "cn".
> Every time a label for the "en" language is looked up, the method UtilProperties.getBundle("SomeResourceBundle", enLocale) is invoked.
> However the bundleCache map (line 818) doesn' contain the bundle for the en local, and a call to the getProperties(...) method is done.
> That method call is very expensive because it parses the whole xml file searching for a property in the desired locale; if non is found, then the bundle is not put in the cache for the locale.
> This ends up with a huge number of calls to the getProperties method (and parsing again and again).
> Ideally, we should put the base bundle in the cache for the en locale, even if it doesn't contain any labels in that locale.
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1739) If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached

Posted by "Adrian Crum (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586149#action_12586149 ] 

Adrian Crum commented on OFBIZ-1739:
------------------------------------

Jacopo,

How are you sure that the properties file is parsed again and again? I put a Debug.logInfo(...) statement on line 520 of UtilProperties.java, changed languages a few times, and checked the console log - it only had entries for properties files that actually exist.


> If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-1739
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1739
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Jacopo Cappellato
>            Priority: Minor
>
> For example:
> let's suppose we have a recource bundle with name SomeResourceBundle.xml that only contains labels in "it" and "cn".
> Every time a label for the "en" language is looked up, the method UtilProperties.getBundle("SomeResourceBundle", enLocale) is invoked.
> However the bundleCache map (line 818) doesn' contain the bundle for the en local, and a call to the getProperties(...) method is done.
> That method call is very expensive because it parses the whole xml file searching for a property in the desired locale; if non is found, then the bundle is not put in the cache for the locale.
> This ends up with a huge number of calls to the getProperties method (and parsing again and again).
> Ideally, we should put the base bundle in the cache for the en locale, even if it doesn't contain any labels in that locale.
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1739) If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587066#action_12587066 ] 

Jacopo Cappellato commented on OFBIZ-1739:
------------------------------------------

I think that we can close this issue... I've not tested but it seems to me that Adrian's last change should have fixed the issue.



> If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-1739
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1739
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Jacopo Cappellato
>            Priority: Minor
>
> For example:
> let's suppose we have a recource bundle with name SomeResourceBundle.xml that only contains labels in "it" and "cn".
> Every time a label for the "en" language is looked up, the method UtilProperties.getBundle("SomeResourceBundle", enLocale) is invoked.
> However the bundleCache map (line 818) doesn' contain the bundle for the en local, and a call to the getProperties(...) method is done.
> That method call is very expensive because it parses the whole xml file searching for a property in the desired locale; if non is found, then the bundle is not put in the cache for the locale.
> This ends up with a huge number of calls to the getProperties method (and parsing again and again).
> Ideally, we should put the base bundle in the cache for the en locale, even if it doesn't contain any labels in that locale.
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1739) If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586139#action_12586139 ] 

Jacopo Cappellato commented on OFBIZ-1739:
------------------------------------------

Adrian,

in my example the file exists, but no en labels are in it... that is why the file is parsed again and again... 



> If a resource bundle (for localized labels) is found, but it doesn't contain any labels in the desired language, it is not cached
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-1739
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1739
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Jacopo Cappellato
>            Priority: Minor
>
> For example:
> let's suppose we have a recource bundle with name SomeResourceBundle.xml that only contains labels in "it" and "cn".
> Every time a label for the "en" language is looked up, the method UtilProperties.getBundle("SomeResourceBundle", enLocale) is invoked.
> However the bundleCache map (line 818) doesn' contain the bundle for the en local, and a call to the getProperties(...) method is done.
> That method call is very expensive because it parses the whole xml file searching for a property in the desired locale; if non is found, then the bundle is not put in the cache for the locale.
> This ends up with a huge number of calls to the getProperties method (and parsing again and again).
> Ideally, we should put the base bundle in the cache for the en locale, even if it doesn't contain any labels in that locale.
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.