svn commit: r1869008 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java

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

svn commit: r1869008 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java

mthl
Author: mthl
Date: Sat Oct 26 16:20:38 2019
New Revision: 1869008

URL: http://svn.apache.org/viewvc?rev=1869008&view=rev
Log:
Improved: Do not use deprecated ‘Class#newInstance’
(OFBIZ-11262)

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java?rev=1869008&r1=1869007&r2=1869008&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java Sat Oct 26 16:20:38 2019
@@ -150,7 +150,7 @@ public class UtilCodec {
                     try {
                         Class<?> customPolicyClass = Class.forName(UtilProperties.getPropertyValue("owasp",
                                 "sanitizer.custom.permissive.policy.class"));
-                        Object obj = customPolicyClass.newInstance();
+                        Object obj = customPolicyClass.getConstructor().newInstance();
                         if (SanitizerCustomPolicy.class.isAssignableFrom(customPolicyClass)) {
                             Method meth = customPolicyClass.getMethod("getSanitizerPolicy");
                             policy = (PolicyFactory) meth.invoke(obj);
@@ -469,7 +469,7 @@ public class UtilCodec {
             customPolicyClass = Class.forName(UtilProperties.getPropertyValue("owasp",
                     "sanitizer.custom.safe.policy.class"));
             }
-            Object obj = customPolicyClass.newInstance();
+            Object obj = customPolicyClass.getConstructor().newInstance();
             if (SanitizerCustomPolicy.class.isAssignableFrom(customPolicyClass)) {
                 Method meth = customPolicyClass.getMethod("getSanitizerPolicy");
                 policy = (PolicyFactory) meth.invoke(obj);