diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java
index 2db4220dbb..5634904dd9 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/serialize/XmlSerializer.java
@@ -82,7 +82,7 @@ public class XmlSerializer {
/** Deserialize a Java object from an XML string.
This method should be used with caution.
* If the XML string contains a serialized GenericValue or GenericPK
* then it is possible to unintentionally corrupt the database.
- *
+ *
* @param content the content
* @param delegator the delegator
* @return return a deserialized object from XML string
@@ -100,17 +100,16 @@ public class XmlSerializer {
return UtilXml.fromXml(content);
}
return deserialize(document, delegator);
- } else {
- Debug.logWarning("Serialized document came back null", module);
- return null;
}
+ Debug.logWarning("Serialized document came back null", module);
+ return null;
}
/** Deserialize a Java object from a DOM Document.
*
This method should be used with caution. If the DOM Document
* contains a serialized GenericValue or GenericPK
* then it is possible to unintentionally corrupt the database.
- *
+ *
* @param document the document
* @param delegator the delegator
* @return returns a deserialized object from a DOM document
@@ -130,10 +129,13 @@ public class XmlSerializer {
}
public static Element serializeSingle(Object object, Document document) throws SerializeException {
- if (document == null) return null;
+ if (document == null) {
+ return null;
+ }
- if (object == null)
+ if (object == null) {
return makeElement("null", null, document);
+ }
// - Standard Objects -
if (object instanceof String) {
@@ -151,7 +153,7 @@ public class XmlSerializer {
} else if (object instanceof Locale) {
return makeElement("std-Locale", object, document);
} else if (object instanceof BigDecimal) {
- String stringValue = ((BigDecimal) object).setScale(10, RoundingMode.HALF_UP).toString();
+ String stringValue = ((BigDecimal) object).setScale(10, RoundingMode.HALF_UP).toString();
return makeElement("std-BigDecimal", stringValue, document);
// - SQL Objects -
} else if (object instanceof java.sql.Timestamp) {
@@ -193,8 +195,6 @@ public class XmlSerializer {
elementName = "col-Collection";
}
- // if (elementName == null) return serializeCustom(object, document);
-
Collection> value = UtilGenerics.cast(object);
Element element = document.createElement(elementName);
Iterator> iter = value.iterator();
@@ -263,24 +263,22 @@ public class XmlSerializer {
byte[] objBytes = UtilObject.getBytes(object);
if (objBytes == null) {
throw new SerializeException("Unable to serialize object; null byte array returned");
- } else {
- String byteHex = StringUtil.toHexString(objBytes);
- Element element = document.createElement("cus-obj");
- // this is hex encoded so does not need to be in a CDATA block
- element.appendChild(document.createTextNode(byteHex));
- return element;
}
- } else {
- throw new SerializeException("Cannot serialize object of class " + object.getClass().getName());
+ String byteHex = StringUtil.toHexString(objBytes);
+ Element element = document.createElement("cus-obj");
+ // this is hex encoded so does not need to be in a CDATA block
+ element.appendChild(document.createTextNode(byteHex));
+ return element;
}
+ throw new SerializeException("Cannot serialize object of class " + object.getClass().getName());
}
public static Element makeElement(String elementName, Object value, Document document) {
if (value == null) {
Element element = document.createElement("null");
element.setAttribute("xsi:nil", "true");
- // I tried to put the schema in the envelope header (in createAndSendSOAPResponse)
- // resEnv.declareNamespace("http://www.w3.org/2001/XMLSchema-instance", null);
+ // I tried to put the schema in the envelope header (in createAndSendSOAPResponse)
+ // resEnv.declareNamespace("http://www.w3.org/2001/XMLSchema-instance", null);
// But it gets prefixed and that does not work. So adding in each instance
element.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
return element;
@@ -294,7 +292,9 @@ public class XmlSerializer {
public static Object deserializeSingle(Element element, Delegator delegator) throws SerializeException {
String tagName = element.getLocalName();
- if ("null".equals(tagName)) return null;
+ if ("null".equals(tagName)) {
+ return null;
+ }
if (tagName.startsWith("std-")) {
// - Standard Objects -
@@ -364,96 +364,98 @@ public class XmlSerializer {
Collection