Skip to content


Improved: Do not use deprecated ‘Proxyclass#getConstructor’
Browse files Browse the repository at this point in the history

git-svn-id: 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Oct 26, 2019
1 parent 81be0b8 commit 8f9fa56
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -60,9 +59,9 @@ protected Object invoke(Object obj, Object proxy, Method method, Object... args)

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));

0 comments on commit 8f9fa56

Please sign in to comment.