svn commit: r1869007 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/AbstractCursorHandler.java

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

svn commit: r1869007 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/AbstractCursorHandler.java

mthl
Author: mthl
Date: Sat Oct 26 16:18:24 2019
New Revision: 1869007

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

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/AbstractCursorHandler.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/AbstractCursorHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/AbstractCursorHandler.java?rev=1869007&r1=1869006&r2=1869007&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/AbstractCursorHandler.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/AbstractCursorHandler.java Sat Oct 26 16:18:24 2019
@@ -18,7 +18,6 @@
  *******************************************************************************/
 package org.apache.ofbiz.entity.jdbc;
 
-import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -60,9 +59,9 @@ public abstract class AbstractCursorHand
 
     protected static <T> T newHandler(InvocationHandler handler, Class<T> implClass) throws IllegalAccessException, IllegalArgumentException, InstantiationException, InvocationTargetException, NoSuchMethodException, SecurityException {
         ClassLoader loader = implClass.getClassLoader();
-        if (loader == null) loader = ClassLoader.getSystemClassLoader();
-        Class<?> proxyClass = Proxy.getProxyClass(loader, implClass);
-        Constructor<?> constructor = proxyClass.getConstructor(InvocationHandler.class);
-        return implClass.cast(constructor.newInstance(handler));
+        if (loader == null) {
+            loader = ClassLoader.getSystemClassLoader();
+        }
+        return implClass.cast(Proxy.newProxyInstance(loader, new Class<?>[] {implClass}, handler));
     }
 }