From aff0cffce954c9c8abc5a87e7dfc816cc5642fe1 Mon Sep 17 00:00:00 2001 From: Adrian Crum Date: Thu, 3 Jan 2008 02:50:58 +0000 Subject: [PATCH] Fixed properties file resolver in new UtilProperties code. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@608315 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/base/org/ofbiz/base/util/UtilProperties.java | 11 +++++++++-- .../org/ofbiz/example/ExamplePermissionServices.xml | 2 +- .../org/ofbiz/example/example/ExampleServices.xml | 2 +- .../ofbiz/example/feature/ExampleFeatureServices.xml | 12 ++++++------ framework/example/widget/example/CommonScreens.xml | 2 +- .../example/widget/example/ExampleFeatureScreens.xml | 2 +- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java b/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java index b44dcf0b26..91e7d9cba7 100644 --- a/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java +++ b/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java @@ -56,7 +56,7 @@ import org.ofbiz.base.util.cache.UtilCache; *

The locale-specific class of properties files can be in any one of three * formats: the standard text-based key=value format (*.properties file), the Java * XML properties format, and the OFBiz-specific XML file format - * (see the toProperties + * (see the xmlToProperties * method).

*/ @SuppressWarnings("serial") @@ -477,7 +477,14 @@ public class UtilProperties implements java.io.Serializable { ResourceBundle bundle = null; try { bundle = UtilResourceBundle.getBundle(resource, locale, (ClassLoader) null); - } catch (MissingResourceException e) { + } catch (MissingResourceException e) {} + if (bundle == null && !resource.endsWith(".xml")) { + try { + // Try custom XML format + bundle = UtilResourceBundle.getBundle(resource + ".xml", locale, (ClassLoader) null); + } catch (MissingResourceException e) {} + } + if (bundle == null) { String resourceCacheKey = resource + "_" + locale.toString(); if (!resourceNotFoundMessagesShown.contains(resourceCacheKey)) { resourceNotFoundMessagesShown.add(resourceCacheKey); diff --git a/framework/example/script/org/ofbiz/example/ExamplePermissionServices.xml b/framework/example/script/org/ofbiz/example/ExamplePermissionServices.xml index 7669749daa..b1ca359653 100644 --- a/framework/example/script/org/ofbiz/example/ExamplePermissionServices.xml +++ b/framework/example/script/org/ofbiz/example/ExamplePermissionServices.xml @@ -31,7 +31,7 @@ under the License. - + diff --git a/framework/example/script/org/ofbiz/example/example/ExampleServices.xml b/framework/example/script/org/ofbiz/example/example/ExampleServices.xml index b39dbce23f..36b163b9e8 100644 --- a/framework/example/script/org/ofbiz/example/example/ExampleServices.xml +++ b/framework/example/script/org/ofbiz/example/example/ExampleServices.xml @@ -46,7 +46,7 @@ under the License. - + diff --git a/framework/example/script/org/ofbiz/example/feature/ExampleFeatureServices.xml b/framework/example/script/org/ofbiz/example/feature/ExampleFeatureServices.xml index 00f789da79..e1f2eb167b 100644 --- a/framework/example/script/org/ofbiz/example/feature/ExampleFeatureServices.xml +++ b/framework/example/script/org/ofbiz/example/feature/ExampleFeatureServices.xml @@ -23,7 +23,7 @@ under the License. - + @@ -33,7 +33,7 @@ under the License. - + @@ -41,7 +41,7 @@ under the License. - + @@ -50,7 +50,7 @@ under the License. - + @@ -61,7 +61,7 @@ under the License. - + @@ -69,7 +69,7 @@ under the License. - + diff --git a/framework/example/widget/example/CommonScreens.xml b/framework/example/widget/example/CommonScreens.xml index 19f9e72644..a9f4bc864d 100644 --- a/framework/example/widget/example/CommonScreens.xml +++ b/framework/example/widget/example/CommonScreens.xml @@ -24,7 +24,7 @@ under the License.
- + diff --git a/framework/example/widget/example/ExampleFeatureScreens.xml b/framework/example/widget/example/ExampleFeatureScreens.xml index 4d78a6501e..20dc2f0cc1 100644 --- a/framework/example/widget/example/ExampleFeatureScreens.xml +++ b/framework/example/widget/example/ExampleFeatureScreens.xml @@ -93,7 +93,7 @@ under the License. - +