|
20 | 20 |
|
21 | 21 | import java.io.FileNotFoundException; |
22 | 22 | import java.io.IOException; |
23 | | -import java.io.Serializable; |
24 | 23 | import java.lang.ref.WeakReference; |
25 | 24 | import java.math.BigDecimal; |
26 | 25 | import java.math.RoundingMode; |
|
48 | 47 | import javax.xml.parsers.ParserConfigurationException; |
49 | 48 |
|
50 | 49 | import org.apache.ofbiz.base.util.Debug; |
51 | | -import org.apache.ofbiz.base.util.StringUtil; |
52 | 50 | import org.apache.ofbiz.base.util.UtilGenerics; |
53 | 51 | import org.apache.ofbiz.base.util.UtilMisc; |
54 | | -import org.apache.ofbiz.base.util.UtilObject; |
55 | 52 | import org.apache.ofbiz.base.util.UtilXml; |
56 | 53 | import org.apache.ofbiz.entity.Delegator; |
57 | 54 | import org.apache.ofbiz.entity.GenericPK; |
@@ -259,18 +256,11 @@ public static Element serializeSingle(Object object, Document document) throws S |
259 | 256 | } |
260 | 257 |
|
261 | 258 | public static Element serializeCustom(Object object, Document document) throws SerializeException { |
262 | | - if (object instanceof Serializable) { |
263 | | - byte[] objBytes = UtilObject.getBytes(object); |
264 | | - if (objBytes == null) { |
265 | | - throw new SerializeException("Unable to serialize object; null byte array returned"); |
266 | | - } |
267 | | - String byteHex = StringUtil.toHexString(objBytes); |
268 | | - Element element = document.createElement("cus-obj"); |
269 | | - // this is hex encoded so does not need to be in a CDATA block |
270 | | - element.appendChild(document.createTextNode(byteHex)); |
271 | | - return element; |
272 | | - } |
273 | | - throw new SerializeException("Cannot serialize object of class " + object.getClass().getName()); |
| 259 | + Debug.logError("Serialization of custom Java objects (cus-obj) is no longer supported. " |
| 260 | + + "This feature has been removed for security reasons. Object class: " |
| 261 | + + object.getClass().getName(), MODULE); |
| 262 | + throw new SerializeException("Serialization of custom Java objects is not supported. " |
| 263 | + + "Object class: " + object.getClass().getName()); |
274 | 264 | } |
275 | 265 |
|
276 | 266 | public static Element makeElement(String elementName, Object value, Document document) { |
@@ -467,17 +457,9 @@ public static Object deserializeSingle(Element element, Delegator delegator) thr |
467 | 457 | public static Object deserializeCustom(Element element) throws SerializeException { |
468 | 458 | String tagName = element.getLocalName(); |
469 | 459 | if ("cus-obj".equals(tagName)) { |
470 | | - String value = UtilXml.elementValue(element); |
471 | | - if (value != null) { |
472 | | - byte[] valueBytes = StringUtil.fromHexString(value); |
473 | | - if (valueBytes != null) { |
474 | | - Object obj = UtilObject.getObject(valueBytes); |
475 | | - if (obj != null) { |
476 | | - return obj; |
477 | | - } |
478 | | - } |
479 | | - } |
480 | | - throw new SerializeException("Problem deserializing object from byte array + " + element.getLocalName()); |
| 460 | + Debug.logError("Deserialization of cus-obj elements is no longer supported. " |
| 461 | + + "This feature has been removed for security reasons.", MODULE); |
| 462 | + throw new SerializeException("Deserialization of cus-obj elements is not supported."); |
481 | 463 | } |
482 | 464 | throw new SerializeException("Cannot deserialize element named " + element.getLocalName()); |
483 | 465 | } |
|
0 commit comments