Resolves the JNDI object upon invoking any method on the associated Proxy

@param proxy  proxy
@param method method
@param args   arguments
@return return value
@throws Throwable in case of failures
547259
@Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (target == null) {
            target = JndiUtils.lookup(name);
        }
        return method.invoke(target, args);
    }
622159
@Override
   protected String resolveMethod(Method method)
   {
      final String fallBackName = convertToBeanName(method.getName()); 
      final String resourceName = method.getAnnotation(Resource.class).name();

      return getName(resourceName, fallBackName);
   }
367326
private void stripProxy(JsonBuilder proxy) throws Throwable {
    Class<?> type = proxy.getClass().getInterfaces()[0];

    HashSet<String> validAttrs = getAttributeNames(type.getMethods());
    Hashtable<String, Method> ispropertyGetters = getJsonBuilders(type.getMethods());

    for (String key : jsonObject.keys()) {
      String name = methodName2AttrName(key);
      if (!validAttrs.contains(name)) {
        jsonObject.remove(key);
        continue;
      }
      Method ispropertyGetter = ispropertyGetters.get(name);
      if (ispropertyGetter != null) {
        ((IsProperties) invoke(proxy, ispropertyGetter, new Object[] {})).strip();
      }
    }
  }
190106
protected T handleRealize(T proxy)
	{
		T ret = createInstance(proxy);
		PropertyResolverConverter prc = getPropertyResolverConverter();
		for (Map.Entry<String, Object> entry: values.entrySet()) {
			String propertyName = entry.getKey();
			Object value = entry.getValue();
			int mappedIndicatorIndx = propertyName.indexOf(':');
			if(mappedIndicatorIndx<0)
			{
				try
				{
					PropertyResolver.setValue(propertyName, ret, value, prc);
				} catch (WicketRuntimeException e)
				{
					LOG.error("Can't set property"+propertyName, e);
				}
			}
			else
			{
				String propertyExp = propertyName.substring(0, mappedIndicatorIndx);
				String fieldExp = propertyName.substring(mappedIndicatorIndx+1);
				Object object = ret;
				int subObject = propertyExp.lastIndexOf('.');
				if(subObject>=0)
				{
					object = PropertyResolver.getValue(propertyExp.substring(0, subObject), object);
					propertyExp = propertyExp.substring(subObject+1);
				}
				if(object!=null)
				{
					String methodName="set"+propertyExp.substring(0, 1).toUpperCase()+propertyExp.substring(1);
					Method[] methods = object.getClass().getMethods();
					try
					{
						for (Method method : methods)
						{
							if(method.getName().equals(methodName))
							{
								Class<?>[] paramTypes = method.getParameterTypes();
								if(paramTypes.length==2 
										&& paramTypes[0].isAssignableFrom(String.class)
										&& (value==null || paramTypes[1].isInstance(value)))
								{
									method.invoke(object, fieldExp, value);
									break;
								}
							}
						}
					} catch (Exception e)
					{
						LOG.error("Can't set property "+propertyName, e);
					} 
					
				}
			}
		}
		realized = ret;
		if(listener!=null) listener.onRealizePrototype((IPrototype<T>)proxy);
		return ret;
	}
196803
private static void invokeMethod(final Object instance, final Method method, final Object[] args)
   {
      final boolean accessability = method.isAccessible();

      try
      {
         method.setAccessible(true);
         method.invoke(instance, args);
      }
      catch (Exception e)
      {
         InjectionException.rethrow(e);
      }
      finally
      {
         method.setAccessible(accessability);
      }
   }
424715
public static Invoker parseInvoker(Object proxyObject) {
        InvocationHandler handler = java.lang.reflect.Proxy.getInvocationHandler(proxyObject);
        if (handler instanceof JDKInvocationHandler) {
            return ((JDKInvocationHandler) handler).getProxyInvoker();
        }
        return null;
    }
653916
public Object execute(Method method, Object targetObj, Object[] p_args) throws Throwable {
		try {
			if ((method == null) || (targetObj == null))
				Debug.logError("[JdonFramework] no method or target, please check your configure", module);
			if (p_args == null)
				p_args = new Object[0];
			Debug.logVerbose("[JdonFramework] method invoke: " + targetObj.getClass().getName() + " method=" + method.getName(), module);
			Object result = method.invoke(targetObj, p_args);
			Debug.logVerbose("[JdonFramework] method invoke successfully ", module);
			return result;
		} catch (IllegalArgumentException iex) {
			String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]";
			Debug.logError(errorInfo, module);
			errorInfo = "[JdonFramework] method invoke IllegalArgumentException: " + iex + " method argument type :[" + method.getParameterTypes()
					+ "], but method arguments value p_args type:" + p_args.getClass().getName();
			Debug.logError(errorInfo, module);
			throw new Throwable(errorInfo, iex);
		} catch (InvocationTargetException ex) {
			Debug.logError(ex);
			String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]";
			Debug.logError(errorInfo, module);
			throw new Throwable(errorInfo);
		} catch (IllegalAccessException ex) {
			String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]";
			Debug.logError(errorInfo, module);
			Debug.logError("[JdonFramework] method invoke IllegalAccessException: " + ex, module);
			throw new Throwable("access method:" + method + " " + ex, ex);
		} catch (Exception ex) {
			String errorInfo = "Errors happened in your method:[" + targetObj.getClass().getName() + "." + method.getName() + "]";
			Debug.logError(errorInfo, module);
			Debug.logError("[JdonFramework] method invoke error: " + ex, module);
			throw new Throwable(" method invoke error: " + ex);
		}

	}
587324
protected boolean isCorrectMethod(Method method, Object[] args) {
        return (targetMethod != null && proxySignature.equals(method.getName()) && args.length == 1);
    }
565795
public static RmiServiceInvocation create(Object remoteTarget, Method method, Object[] args) {
        RmiServiceInvocation serviceInvocation = new RmiServiceInvocation();

        if (Proxy.isProxyClass(remoteTarget.getClass())) {
            serviceInvocation.setRemote(method.getDeclaringClass().getName());
        } else {
            serviceInvocation.setRemote(remoteTarget.getClass().getName());
        }

        serviceInvocation.setMethod(method.getName());

        if (args != null) {
            serviceInvocation.setArgs(new RmiServiceInvocation.Args());

            for (Object arg : args) {
                MethodArg methodArg = new MethodArg();

                methodArg.setValueObject(arg);
                if (Map.class.isAssignableFrom(arg.getClass())) {
                    methodArg.setType(Map.class.getName());
                } else if (List.class.isAssignableFrom(arg.getClass())) {
                    methodArg.setType(List.class.getName());
                } else {
                    methodArg.setType(arg.getClass().getName());
                }

                serviceInvocation.getArgs().getArgs().add(methodArg);
            }
        }

        return serviceInvocation;
    }
918865
@Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
    {
        if (constructed)
        {

            String methodName = method.getName();
            int params = args.length;

            if (params == 0)
            {
                if (isUninitialized() && method.equals(getIdentifierMethod))
                {
                    return getIdentifier();
                }

                else if ("getKunderaLazyInitializer".equals(methodName))
                {
                    return this;
                }
            }

            Object target = getImplementation();

            String[] strArr = entityName.split("#");
            String fieldName = strArr[1];

            if (owner != null)
            {
                EntityMetadata m = KunderaMetadataManager.getEntityMetadata(persistenceDelegator.getKunderaMetadata(),
                        owner.getClass());
                Relation r = m.getRelation(fieldName);
                if (r != null)
                {
                    PropertyAccessorHelper.set(owner, r.getProperty(), target);
                }
                if (r.getBiDirectionalField() != null && method.getReturnType().equals(m.getEntityClazz()))
                {
                    PropertyAccessorHelper.set(target, r.getBiDirectionalField(), owner);
                }

            }

            try
            {
                final Object returnValue;
                if (method.isAccessible())
                {
                    if (!method.getDeclaringClass().isInstance(target))
                    {
                        throw new ClassCastException(target.getClass().getName());
                    }
                    returnValue = method.invoke(target, args);
                }
                else
                {
                    if (!method.isAccessible())
                    {
                        method.setAccessible(true);
                    }
                    returnValue = method.invoke(target, args);
                }
                return ((returnValue == target) ? proxy : returnValue);
            }
            catch (InvocationTargetException ite)
            {
                throw new LazyInitializationException(ite);
            }
        }
        else
        {
            // while constructor is running
            throw new LazyInitializationException("unexpected case hit, method=" + method.getName());
        }

    }
636294
public InvocationHandler getInvocationHandler(Object proxy) {
        Field field = getInvocationHandlerField();
        try {
            return (InvocationHandler) field.get(proxy);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException("Object is not a proxy of correct type", e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
655696
protected JSONArray callMethod(String method, Object ... args) throws Exception {
        return new QueryBuilder().retrieveResult(storedId).call(method, args).storeResult("LAST_" + getStoredId()).execute();
    }
1306486
public static void proxy(Method method, InvocationHandler invocationHandler) {
		assertInvocationHandlerNotNull(invocationHandler);
		MockRepository.putMethodProxy(method, invocationHandler);
	}
1256129
@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		final String methodName = method.getName();
		// != for perf (strings interned: != is ok)
		if ("include" != methodName && "forward" != methodName) { // NOPMD
			return method.invoke(requestDispatcher, args);
		}
		boolean systemError = false;
		try {
			final String pathWithoutParameters;
			final int indexOf = path.indexOf('?');
			if (indexOf != -1) {
				pathWithoutParameters = path.substring(0, indexOf);
			} else {
				pathWithoutParameters = path;
			}
			JSP_COUNTER.bindContextIncludingCpu(pathWithoutParameters);
			return method.invoke(requestDispatcher, args);
		} catch (final InvocationTargetException e) {
			if (e.getCause() instanceof Error) {
				// on catche Error pour avoir les erreurs systèmes
				// mais pas Exception qui sont fonctionnelles en général
				systemError = true;
			}
			throw e;
		} finally {
			// on enregistre la requête dans les statistiques
			JSP_COUNTER.addRequestForCurrentContext(systemError);
		}
	}
81195
public static Method makeAccessible(Method method) {
        if (method == null) {
            throw new IllegalArgumentException("Method argument method must not be null.");
        }

        if (isInaccessible(method) && !method.isAccessible()) {
            method.setAccessible(true);
        }

        return method;
    }
844402
protected Object invoke(Method method)
    {
        try
        {
            return method.invoke(target);
        }
        catch (Exception e)
        {
            return null;
        }
    }
302681
@Override
  public Description matchMethodInvocation(MethodInvocationTree t, VisitorState state) {
    String arg1;
    String arg2;
    if (instanceEqualsMatcher.matches(t, state)) {
      arg1 = state.getSourceForNode(((JCFieldAccess) t.getMethodSelect()).getExpression());
      arg2 = state.getSourceForNode(t.getArguments().get(0));
    } else if (staticEqualsMatcher.matches(t, state)) {
      arg1 = state.getSourceForNode(t.getArguments().get(0));
      arg2 = state.getSourceForNode(t.getArguments().get(1));
    } else {
      return NO_MATCH;
    }

    Fix fix =
        SuggestedFix.builder()
            .replace(t, "Arrays.equals(" + arg1 + ", " + arg2 + ")")
            .addImport("java.util.Arrays")
            .build();
    return describeMatch(t, fix);
  }