Skip to content
Permalink
Browse files

Improved: Do not use deprecated ‘Class#newInstance’

(OFBIZ-11262)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869008 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Oct 26, 2019
1 parent 8f9fa56 commit 129ef1e601005bfc8b3696a60eb3353be5a1964e
Showing with 2 additions and 2 deletions.
  1. +2 −2 framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
@@ -150,7 +150,7 @@ public String sanitize(String original, String contentTypeId) {
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 static String checkStringForHtmlSafe(String valueName, String value, List
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);

0 comments on commit 129ef1e

Please sign in to comment.
You can’t perform that action at this time.