svn commit: r645278 - in /ofbiz/trunk/framework: base/src/base/org/ofbiz/base/util/UtilProperties.java entity/src/org/ofbiz/entity/GenericEntity.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r645278 - in /ofbiz/trunk/framework: base/src/base/org/ofbiz/base/util/UtilProperties.java entity/src/org/ofbiz/entity/GenericEntity.java

adrianc
Author: adrianc
Date: Sun Apr  6 11:06:06 2008
New Revision: 645278

URL: http://svn.apache.org/viewvc?rev=645278&view=rev
Log:
Fixed problem with entity engine trying to translate fields using properties files that don't exist. Reported by Jacopo in https://issues.apache.org/jira/browse/OFBIZ-1736.

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java?rev=645278&r1=645277&r2=645278&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java Sun Apr  6 11:06:06 2008
@@ -18,6 +18,11 @@
  *******************************************************************************/
 package org.ofbiz.base.util;
 
+import java.io.BufferedInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.text.MessageFormat;
 import java.util.Enumeration;
@@ -30,23 +35,17 @@
 import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.Set;
-import java.io.BufferedInputStream;
-import java.io.FileOutputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.IOException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
 
 import javolution.util.FastList;
 import javolution.util.FastSet;
 
 import org.ofbiz.base.location.FlexibleLocation;
+import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.base.util.collections.FlexibleProperties;
 import org.ofbiz.base.util.collections.ResourceBundleMapWrapper;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
-import org.ofbiz.base.util.cache.UtilCache;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 /** Generic Property Accessor with Cache - Utilities for working with properties files.
  * <p>UtilProperties divides properties files into two classes: non-locale-specific -
@@ -647,7 +646,7 @@
         return resourceName;
     }
 
-    protected static Set<String> propertiesNotFound = FastSet.newInstance();
+    public static Set<String> propertiesNotFound = FastSet.newInstance();
     /** Resolve a properties file URL.
      * <p>This method uses the following strategy:<br />
      * <ul>

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=645278&r1=645277&r2=645278&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Sun Apr  6 11:06:06 2008
@@ -38,6 +38,7 @@
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
+import org.ofbiz.base.crypto.HashCrypt;
 import org.ofbiz.base.util.Base64;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.ObjectType;
@@ -53,12 +54,9 @@
 import org.ofbiz.entity.model.ModelFieldType;
 import org.ofbiz.entity.model.ModelViewEntity;
 import org.ofbiz.entity.model.ModelViewEntity.ModelAlias;
-
 import org.ofbiz.entity.util.ByteWrapper;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
-import org.ofbiz.base.crypto.HashCrypt;
 /**
  * Generic Entity Value Object - Handles persistence for any defined entity.
  * <p>Note that this class extends <code>Observable</code> to achieve change notification for
@@ -724,6 +722,10 @@
                 //Debug.logWarning("Tried to getResource value for field named " + name + " but no resource name was passed to the method or specified in the default-resource-name attribute of the entity definition", module);
                 return fieldValue;
             }
+        }
+        if (UtilProperties.propertiesNotFound.contains(UtilProperties.createResourceName(resource, locale, false))) {
+            // Properties do not exist for this resource+locale combination
+            return fieldValue;
         }
         ResourceBundle bundle = null;
         try {