You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mb...@apache.org on 2017/10/22 13:03:31 UTC

svn commit: r1812910 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java

Author: mbrohl
Date: Sun Oct 22 13:03:31 2017
New Revision: 1812910

URL: http://svn.apache.org/viewvc?rev=1812910&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package 
org.apache.ofbiz.entity.serialize.
(OFBIZ-9705)

Thanks Julian Leichert for reporting and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java?rev=1812910&r1=1812909&r2=1812910&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java Sun Oct 22 13:03:31 2017
@@ -69,7 +69,7 @@ import org.xml.sax.SAXException;
 public class XmlSerializer {
     public static final String module = XmlSerializer.class.getName();
 
-    private static WeakReference<DateFormat> simpleDateFormatter;
+    private volatile static WeakReference<DateFormat> simpleDateFormatter;
 
     public static String serialize(Object object) throws SerializeException, FileNotFoundException, IOException {
         Document document = UtilXml.makeEmptyXmlDocument("ofbiz-ser");
@@ -132,7 +132,8 @@ public class XmlSerializer {
     public static Element serializeSingle(Object object, Document document) throws SerializeException {
         if (document == null) return null;
 
-        if (object == null) return makeElement("null", object, document);
+        if (object == null)
+            return makeElement("null", null, document);
 
         // - Standard Objects -
         if (object instanceof String) {