diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java
index e7503e6de4..f23a7092b7 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java
@@ -91,7 +91,15 @@ public final class UtilXml {
private static XStream createXStream() {
XStream xstream = new XStream();
- xstream.registerConverter(new UnsupportedClassConverter());
+ /* This method is a pure helper method for XStream 1.4.x.
+ * It initializes an XStream instance with a white list of well-known and simply types of the Java runtime
+ * as it is done in XStream 1.5.x by default. This method will do therefore nothing in XStream 1.5
+ * and could be removed them
+ */
+ XStream.setupDefaultSecurity(xstream);
+ /* You may want to enhance the white list created by XStream::setupDefaultSecurity (or by default with XStream 1.5)
+ * using xstream::allowTypesByWildcard with your own classes
+ */
return xstream;
}
@@ -1167,6 +1175,11 @@ public final class UtilXml {
}
}
+ /** This method is now useless
+ * Enhance rather the white list created by XStream::setupDefaultSecurity
+ * using xstream::allowTypesByWildcard with your own classes
+ */
+ @Deprecated
private static class UnsupportedClassConverter implements Converter {
@Override
@@ -1191,7 +1204,7 @@ public final class UtilXml {
/**
* get node name without any prefix
* @param node
- * @return
+ * @return nodeName
*/
public static String getNodeNameIgnorePrefix(Node node){
if (node==null) {
@@ -1208,8 +1221,8 @@ public final class UtilXml {
/**
* get tag name without any prefix
* @param element
- * @return
- */
+ * @return tagName
+ */
public static String getTagNameIgnorePrefix(Element element){
if (element==null) {
return null;
@@ -1225,7 +1238,7 @@ public final class UtilXml {
/**
* get attribute value ignoring prefix in attribute name
* @param element
- * @return
+ * @return The value of the node, depending on its type; see the table Node class
*/
public static String getAttributeValueIgnorePrefix(Element element, String attributeName){
if (element==null) {
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilXmlTests.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilXmlTests.java
deleted file mode 100644
index b7f5c6d88e..0000000000
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilXmlTests.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.apache.ofbiz.base.util.test;
-
-import org.apache.ofbiz.base.test.GenericTestCaseBase;
-import org.apache.ofbiz.base.util.UtilXml;
-
-public class UtilXmlTests extends GenericTestCaseBase {
-
- public UtilXmlTests(String name) {
- super(name);
- }
-
- public void testUnsupportedClassConverter() throws Exception {
- String unsupportedClassInXml =
- "" +
- " " +
- " " +
- " open" +
- " ." +
- " " +
- " " +
- " start" +
- "";
- try {
- @SuppressWarnings("unused")
- Object unsupportedObject = UtilXml.fromXml(unsupportedClassInXml);
- fail("Unsupported class in XML");
- } catch (Exception e) {
- }
- }
-}
diff --git a/framework/base/testdef/basetests.xml b/framework/base/testdef/basetests.xml
index 165715f598..41b7d494e9 100644
--- a/framework/base/testdef/basetests.xml
+++ b/framework/base/testdef/basetests.xml
@@ -42,7 +42,6 @@
-