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

Anne Jessel commented on OFBIZ-4723:
------------------------------------

According to viewvc, UtilProperties.java has not been changed in 13 months. 
Which means this patch has not been applied successfully. Can anyone see why 
this part of the patch is not ending up in svn? Is the file locked or read-only 
or something?

Index: framework/base/src/org/ofbiz/base/util/UtilProperties.java
===================================================================
--- framework/base/src/org/ofbiz/base/util/UtilProperties.java  (revision 
1304746)
+++ framework/base/src/org/ofbiz/base/util/UtilProperties.java  (working copy)
@@ -964,8 +964,14 @@
                 throw new IllegalArgumentException("locale cannot be null");
             }
             String localeString = locale.toString();
+            String correctedLocaleString = localeString.replace('_','-');
             for (Element property : propertyList) {
-                Element value = UtilXml.firstChildElement(property, "value", 
"xml:lang", localeString);
+                // Support old way of specifying xml:lang value.
+                // Old way: en_AU, new way: en-AU
+                Element value = UtilXml.firstChildElement(property, "value", 
"xml:lang", correctedLocaleString);
+                if( value == null ) {
+                    value = UtilXml.firstChildElement(property, "value", 
"xml:lang", localeString);
+                }
                 if (value != null) {
                     if (properties == null) {
                         properties = new Properties();
@@ -1053,7 +1059,9 @@
                         bundle = new UtilResourceBundle(bundle.properties, 
locale, parentBundle);
                     }
                     double totalTime = System.currentTimeMillis() - startTime;
-                    Debug.logInfo("ResourceBundle " + resource + " (" + locale 
+ ") created in " + totalTime/1000.0 + "s with " + numProperties + " 
properties", module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("ResourceBundle " + resource + " (" + 
locale + ") created in " + totalTime/1000.0 + "s with " + numProperties + " 
properties", module);
+                    }
                     bundleCache.put(resourceName, bundle);
                 }
             }
                
> Support validation of resource xml files
> ----------------------------------------
>
>                 Key: OFBIZ-4723
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4723
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: REV 1297286
>            Reporter: Anne Jessel
>            Assignee: Jacques Le Roux
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: OFBIZ-4723_both.patch, OFBIZ-4723_code_cleanups.patch, 
> OFBIZ-4723_combined.patch, OFBIZ-4723_support-validation-resource-xml.patch
>
>
> The xsd for the resource xml files is invalid. In addition, the format of the 
> value of the xml:lang attribute in resource xml files is invalid, according 
> to the xml standard.
> The attached patch:
> * provides a valid xsd
> * updates UtilProperties and the Label Manager to deal with the correct 
> formatting of the xml:lang value, while still working with the old format, 
> following Adrian Crum's recommendation on the mailing list
> * includes simple unit tests for UtilProperties to ensure it does work with 
> both formats
> * changes the Label Manager to include a reference to the new xsd, and to use 
> the correct format of the xml:lang value, when writing a resource xml file.
> This problem exists in released versions, but I doubt it is important enough 
> to back port.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to