/** * 将一个JavaBean对象的所有属性封装在Map中并返回, * 注意只能将拥有Getter方法的属性才能取出并封装到Map中 * * @param bean 需要转换的Bean对象 * @return 返回一个Map , 失败返回null */ public static <T extends Object> Map<String, Object> toMap(T bean) { Map<String, Object> map = null; try { map = PropertyUtils.describe(bean); map.remove("class"); StringBuilder methodName = new StringBuilder("get"); for (String property : map.keySet()) { methodName.delete(3, methodName.length()).append(property.substring(0, 1).toUpperCase()) .append(property.substring(1)); Object o = MethodUtils.invokeMethod(bean, methodName.toString(), null); map.put(property, o); } } catch (Exception e) { throw new RuntimeException(e); } return map; }
public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setCharacterEncoding("UTF-8"); response.setContentType("text/xml;charset=utf8"); PrintWriter pw = response.getWriter(); String beanId = (String) request.getParameter("beanId"); String methodName = (String) request.getParameter("methodName"); String parameter = (String) request.getParameter("parameter"); if (StringUtils.isNotEmpty(beanId) && StringUtils.isNotEmpty(methodName)) { try { Object object = DoradoContext.getAttachedWebApplicationContext().getBean(beanId); Object[] arguments = null; if (StringUtils.isNotEmpty(parameter)) { arguments = (Object[]) SerializationUtils.deserialize(new Base64(true).decode(parameter)); } MethodUtils.invokeMethod(object, methodName, arguments); log.info("invoke refreshCache method [" + beanId + "#" + methodName + "] success"); pw.print("ok"); } catch (Exception e) { log.error("invoke refreshCache method [" + beanId + "#" + methodName + "] error," + e.getMessage()); pw.print("error"); } } }
private static Object executeMethod(Object o, String methodName) { Object newObject = null; try { if (o instanceof RepositoryItem) { RepositoryItem repositoryItem = (RepositoryItem) o; if (repositoryItem.getItemDescriptor().hasProperty(methodName)) { newObject = repositoryItem.getPropertyValue(methodName); } } else if (o instanceof Map) { Map map = (Map) o; newObject = map.get(methodName); } else { methodName = "get" + upperCaseFirstLetter(methodName); newObject = MethodUtils.invokeMethod(o, methodName, null); } } catch (Exception e) { // dont care } return newObject; }
/** * This method is deprecated and won't do anything if the database repository file paths are null or empty. * * We use reflection here to avoid having to reference PersistenceService directly since it may or may not be on * our classpath depending on whether or not KSB is in use. */ @Deprecated protected void loadOjbRepositoryFiles() { String persistenceServiceOjbName = "persistenceServiceOjb"; if (getDatabaseRepositoryFilePaths() != null) { for (String repositoryLocation : getDatabaseRepositoryFilePaths()) { // Need the OJB persistence service because it is the only one ever using the database repository files if (getPersistenceService() == null) { setPersistenceService(GlobalResourceLoader.getService(persistenceServiceOjbName)); } if (persistenceService == null) { setPersistenceService(applicationContext.getBean(persistenceServiceOjbName)); } LOG.warn("Loading OJB Configuration in " + getNamespaceCode() + " module. OJB is deprecated as of Rice 2.4: " + repositoryLocation); try { MethodUtils.invokeExactMethod(persistenceService, "loadRepositoryDescriptor", repositoryLocation); } catch (Exception e) { throw new RuntimeException(e); } } } }
private static <T extends Number> List<T> getProperty(Collection<?> values, String property, T rawValue) { if (values == null || values.isEmpty()) { return Collections.<T> emptyList(); } List<T> result = new ArrayList<T>(values.size()); for (Object value : values) { try { String propertyValue = value.toString(); if (property != null) { propertyValue = BeanUtils.getProperty(value, property); } Object key = MethodUtils.invokeExactMethod(rawValue, "valueOf", propertyValue); result.add((T) key); } catch (Exception e) { logger.error(e.getMessage(), e); continue; } } return result; }
/** * Retrieves the current platform status. The object returned will be created using the current (webapp) classlaoder, * preventing casting issues. * @return the current status of the platform, for safe use with the webapp classloader */ public PlatformStatus getCurrentStatus() { Object mgr = getStatusManager(); if (mgr == null) { LOGGER.debug("Status manager unavailable"); return new PlatformStatus(); } else { try { Object status = MethodUtils.invokeExactMethod(mgr, "getCurrentStatus", new Object[0]); return convertStatusBetweenClassLoaders(status); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw new StatusProxyException("Unable to retrieve status from the manager instance", e); } } }
@Override public Vfs.Dir createDir(URL url) { try { File tmpFile = File.createTempFile("vfs-jndi-bundle", ".jar"); // we need to load this resource from the server context using the server ClassLoader // we use reflections to call the service exposed by the server BundleContext bundleContext = FrameworkUtil.getBundle(JndiUrlType.class).getBundleContext(); Object jndiService = OSGiServiceUtils.findService(bundleContext, JNDI_SERVICE); // copy to the resource to the temp file MethodUtils.invokeMethod(jndiService, WRITE_TO_FILE_METHOD, new Object[] {url.toString(), tmpFile.getAbsolutePath()}); return new TmpDir(tmpFile); } catch (IOException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw new IllegalArgumentException("Unable to create mvn url for " + url, e); } }
public List getHandlers() { List handlerAccessors = new ArrayList(); try { Object handlers[] = (Object[]) MethodUtils.invokeMethod(getTarget(), "getHandlers", null); for (int h = 0; h < handlers.length; h++) { Object handler = handlers[h]; Jdk14HandlerAccessor handlerAccessor = wrapHandler(handler, h); if (handlerAccessor != null) { handlerAccessors.add(handlerAccessor); } } } catch (Exception e) { log.error(getTarget().getClass().getName() + "#handlers inaccessible", e); } return handlerAccessors; }
public String getLevel() { try { Object level = null; Object target = getTarget(); while (level == null && target != null) { level = getLevelInternal(target); target = MethodUtils.invokeMethod(target, "getParent", null); } if (level == null && isJuliRoot()) { return "INFO"; } else { return (String) MethodUtils.invokeMethod(level, "getName", null); } } catch (Exception e) { log.error(getTarget().getClass().getName() + "#getLevel() failed", e); } return null; }
/** * Returns all appenders of this logger. * * @return a list of {@link LogbackAppenderAccessor}s */ public List getAppenders() { List appenders = new ArrayList(); try { Iterator it = (Iterator) MethodUtils.invokeMethod(getTarget(), "iteratorForAppenders", null); while (it.hasNext()) { Object appender = it.next(); List siftedAppenders = getSiftedAppenders(appender); if (siftedAppenders != null) { for (int i = 0; i < siftedAppenders.size(); i++) { Object siftedAppender = siftedAppenders.get(i); wrapAndAddAppender(siftedAppender, appenders); } } else { wrapAndAddAppender(appender, appenders); } } } catch (Exception e) { log.error(getTarget().getClass().getName() + "#getAppenders() failed", e); } return appenders; }
/** * Returns the appender of this logger with the given name. * * @param name the name of the appender to return * @return the appender with the given name, or null if no such * appender exists for this logger */ public LogbackAppenderAccessor getAppender(String name) { try { Object appender = MethodUtils.invokeMethod(getTarget(), "getAppender", name); if (appender == null) { List appenders = getAppenders(); for (int i = 0; i < appenders.size(); i++) { LogbackAppenderAccessor wrappedAppender = (LogbackAppenderAccessor) appenders.get(i); if (wrappedAppender.getIndex().equals(name)) { return wrappedAppender; } } } return wrapAppender(appender); } catch (Exception e) { log.error(getTarget().getClass().getName() + "#getAppender() failed", e); } return null; }
/** * Attempts to initialize a Logback logger factory via the given class loader. * * @param cl the ClassLoader to use when fetching the factory */ public LogbackFactoryAccessor(ClassLoader cl) throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { // Get the singleton SLF4J binding, which may or may not be Logback, depending on the // binding. Class clazz = cl.loadClass("org.slf4j.impl.StaticLoggerBinder"); Method m1 = MethodUtils.getAccessibleMethod(clazz, "getSingleton", new Class[]{}); Object singleton = m1.invoke(null, null); Method m = MethodUtils.getAccessibleMethod(clazz, "getLoggerFactory", new Class[]{}); Object loggerFactory = m.invoke(singleton, null); // Check if the binding is indeed Logback Class loggerFactoryClass = cl.loadClass("ch.qos.logback.classic.LoggerContext"); if (!loggerFactoryClass.isInstance(loggerFactory)) { throw new RuntimeException("The singleton SLF4J binding was not Logback"); } setTarget(loggerFactory); }
/** * Returns the Logback logger with a given name. * * @return the Logger with the given name */ public LogbackLoggerAccessor getLogger(String name) { try { Class clazz = getTarget().getClass(); Method m = MethodUtils.getAccessibleMethod(clazz, "getLogger", new Class[] {String.class}); Object logger = m.invoke(getTarget(), new Object[] {name}); if (logger == null) { throw new NullPointerException(getTarget() + ".getLogger(\"" + name + "\") returned null"); } LogbackLoggerAccessor accessor = new LogbackLoggerAccessor(); accessor.setTarget(logger); accessor.setApplication(getApplication()); return accessor; } catch (Exception e) { log.error(getTarget() + ".getLogger(\"" + name + "\") failed", e); } return null; }
/** * Returns a list of wrappers for all Logback appenders that have an * associated logger. * * @return a list of {@link LogbackAppenderAccessor}s representing all * appenders that are in use */ public List getAppenders() { List appenders = new ArrayList(); try { Class clazz = getTarget().getClass(); Method m = MethodUtils.getAccessibleMethod(clazz, "getLoggerList", new Class[]{}); List loggers = (List) m.invoke(getTarget(), null); Iterator it = loggers.iterator(); while (it.hasNext()) { LogbackLoggerAccessor accessor = new LogbackLoggerAccessor(); accessor.setTarget(it.next()); accessor.setApplication(getApplication()); appenders.addAll(accessor.getAppenders()); } } catch (Exception e) { log.error(getTarget() + ".getLoggerList() failed", e); } return appenders; }
public Log4JLoggerAccessor getRootLogger() { try { Class clazz = (Class) getTarget(); Method m = MethodUtils.getAccessibleMethod(clazz, "getRootLogger", new Class[]{}); Object logger = m.invoke(null, null); if (logger == null) { throw new NullPointerException(getTarget().getClass().getName() + "#getRootLogger() returned null"); } Log4JLoggerAccessor accessor = new Log4JLoggerAccessor(); accessor.setTarget(logger); accessor.setApplication(getApplication()); return accessor; } catch (Exception e) { log.error(getTarget().getClass().getName() + "#getRootLogger() failed", e); } return null; }
public Log4JLoggerAccessor getLogger(String name) { try { Class clazz = (Class) getTarget(); Method m = MethodUtils.getAccessibleMethod(clazz, "getLogger", new Class[] {String.class}); Object logger = m.invoke(null, new Object[] {name}); if (logger == null) { throw new NullPointerException(getTarget().getClass().getName() + "#getLogger(\"" + name + "\") returned null"); } Log4JLoggerAccessor accessor = new Log4JLoggerAccessor(); accessor.setTarget(logger); accessor.setApplication(getApplication()); return accessor; } catch (Exception e) { log.error(getTarget().getClass().getName() + "#getLogger(\"" + name + "\") failed", e); } return null; }
@Override public Object provide(Object source, Object currentValue) { ExecutionYear executionYear; try { executionYear = (ExecutionYear) MethodUtils.invokeMethod(source, "getExecutionYear", null); } catch (Exception e) { throw new RuntimeException(e); } List<ExecutionSemester> periods = new ArrayList<ExecutionSemester>(); if (executionYear != null) { periods.addAll(executionYear.getExecutionPeriodsSet()); } return periods; }
/** * 将protobuf字节流转换为对应的message对象。 * * @param messageClass * @return */ @SuppressWarnings("unchecked") protected <T extends Message> T parseFrom(Class<T> messageClass, byte[] bytes) throws SystemException { T message = null; try { message = (T) MethodUtils.invokeStaticMethod(messageClass, "parseFrom", bytes); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { SystemException ex = new SystemException(); ex.setErrorCode(500); ex.setMessage(e.getMessage()); throw ex; } return message; }
@SuppressWarnings("unchecked") protected T invokeFactoryMethod(Object factory) { try { return (T) MethodUtils.invokeMethod(factory, getMethodName(), getArgs()); } catch( Exception e ) { throw new RuntimeException(e); } }
@Override @Deprecated public List<ProductOptionValue> getProductOptionValues() { //Changing this API to Set is ill-advised (especially in a patch release). The tendrils are widespread. Instead //we just migrate the call from the List to the internal Set representation. This is in response //to https://github.com/BroadleafCommerce/BroadleafCommerce/issues/917. return (List<ProductOptionValue>) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[]{List.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return MethodUtils.invokeMethod(productOptionValues, method.getName(), args, method.getParameterTypes()); } }); }
protected void setTestName(final Object test, final Method testMethod) throws Exception { String name = testMethod == null ? "" : testMethod.getName(); final Method setNameMethod = MethodUtils.getAccessibleMethod(test.getClass(), "setName", new Class[]{String.class}); if (setNameMethod != null) { setNameMethod.invoke(test, name); } }
public static void replaceField(Customer current, Customer to) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Field[] fields = Customer.class.getFields(); for (Field field : fields) { if (!"id".equalsIgnoreCase(field.getName())) { String getter = "get" + StringUtils.capitalize(field.getName()); String setter = "set" + StringUtils.capitalize(field.getName()); Object value = MethodUtils.invokeMethod(to, getter, ArrayUtils.EMPTY_OBJECT_ARRAY); if (value != null) { MethodUtils.invokeMethod(current, setter, new Object[]{value}); } } } }
@Override @Deprecated public List<ProductOptionValue> getProductOptionValues() { //Changing this API to Set is ill-advised (especially in a patch release). The tendrils are widespread. Instead //we just migrate the call from the List to the internal Set representation. This is in response //to https://github.com/SparkCommerce/SparkCommerce/issues/917. return (List<ProductOptionValue>) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[]{List.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return MethodUtils.invokeMethod(productOptionValues, method.getName(), args, method.getParameterTypes()); } }); }
@Override public boolean testBeanClass(Class<?> klass, Object[] constructorArgs) { this.setFailureReason(null); Object bean = InstantiationUtils.safeNewInstance(klass, constructorArgs); if (bean instanceof Serializable) { InjectionUtils.injectValues(bean, valueGeneratorFactory, false); Serializable sBean = (Serializable)bean; Serializable sBeanReconstituted = null; byte[] serializedObj; try { serializedObj = SerializationUtils.serialize(sBean); sBeanReconstituted = SerializationUtils.deserialize(serializedObj); } catch (Throwable e) { this.setFailureReason("Error serializing bean that implements serializable"); throw new BeanTesterException("Error serializing bean that implements serializable", e) .addContextValue("class", klass.getName()); } /* * An equals() test is only valid if the bean isn't relying on Object.equals(). */ Method equalsMethod = MethodUtils.getAccessibleMethod(klass, "equals", Object.class); if ( !equalsMethod.getDeclaringClass().equals(Object.class) && !sBean.equals(sBeanReconstituted)) { this.setFailureReason("Bean implements serializable, but the reconstituted bean doesn't equal it's original"); throw new BeanTesterException("Bean implements serializable, but the reconstituted bean doesn't equal it's original") .addContextValue("class", klass.getName()); } } return true; }
/** * Invoca un metodo sobre un objeto * @param obj El objeto sobre el que se invoca el metodo (si es null se intenta llamar a un m�todo est�tico) * @param methodName nombre del metodo a invocar * @param argsTypes tipos de los argumentos a invocar * @param argsValues valores de los argumentos * @return El objeto devuelto tras la invocacion del metodo * @throws ReflectionException si ocurre algun error */ @SuppressWarnings("unchecked") public static <T> T invokeMethod(final Object obj, final String methodName,final Class<?>[] argsTypes,final Object[] argsValues) { if (obj == null || methodName == null) throw new IllegalArgumentException(Throwables.message("Cannot invoke {} method on null object instance", (methodName != null ? methodName : "null"), (obj != null ? obj.getClass() : "null"))); try { return (T)MethodUtils.invokeMethod(obj,methodName,argsValues,argsTypes); } catch (Throwable th) { throw ReflectionException.of(th); } }
/** * Invoca un metodo ESTATICO sobre un objeto * @param type La definici�n de la clase que contiene el metodo estatico * @param method el metodo a invocar * @param argsValues valores de los argumentos * @return El objeto devuelto tras la invocacion del metodo * @throws ReflectionException si ocurre algun error */ @SuppressWarnings("unchecked") public static <T> T invokeStaticMethod(final Class<?> type, final Method method,final Object... argsValues) { if (type == null || method == null) throw new IllegalArgumentException(Throwables.message("Cannot invoke {} method on null object instance", (method != null ? method : "null"), (type != null ? type : "null"))); try { return (T)MethodUtils.invokeStaticMethod(type, method.getName(), argsValues,method.getParameterTypes()); } catch (Throwable th) { throw ReflectionException.of(th); } }
/** * Calls the objects destroy method is it exists. */ private static void destroy(Object o) throws IllegalAccessException, InvocationTargetException { if (o == null) return; log.info("Destroying " + o + "..."); try { log.info("Check if there is a destroy method..."); MethodUtils.invokeExactMethod(o, "destroy", (Object[])null); log.info("destroy method invoked..."); } catch (NoSuchMethodException e) { log.info("No destroy method..."); } }
/** * Creates the FileSystemHandler and set all its properties. * Will also call the init method if it exists. */ private static FileSystemHandler getFileSystemHandler(Properties p, String fileSystemHandlerName) throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException{ String clazz = p.getProperty(fileSystemHandlerName); log.info("Building FileSystemHandler: " + clazz); Class<? extends FileSystemHandler> fshClass = Class.forName(clazz).asSubclass(FileSystemHandler.class); FileSystemHandler fsh = fshClass.newInstance(); Enumeration<String> propertyNames = (Enumeration<String>) p.propertyNames(); while (propertyNames.hasMoreElements()) { String fullProperty = propertyNames.nextElement(); if (fullProperty.startsWith(fileSystemHandlerName + ".")) { String property = fullProperty.substring(fullProperty.indexOf(".")+1); log.info("Setting property: " + property); BeanUtils.setProperty(fsh, property, p.getProperty(fullProperty)); } } try { log.info("Check if there is a init method..."); MethodUtils.invokeExactMethod(fsh, "init", (Object[])null); log.info("init method invoked..."); } catch (NoSuchMethodException e) { log.info("No init method..."); } log.info("Done with FileSystemHandler: " + clazz); return fsh; }
@Override @Deprecated public List<ProductOptionValue> getProductOptionValues() { //Changing this API to Set is ill-advised (especially in a patch release). The tendrils are widespread. Instead //we just migrate the call from the List to the internal Set representation. This is in response //to https://github.com/BroadleafCommerce/BroadleafCommerce/issues/917. return (List<ProductOptionValue>) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[]{List.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return MethodUtils.invokeMethod(getProductOptionValuesCollection(), method.getName(), args, method.getParameterTypes()); } }); }
@Override @Transactional public void moveToTrash(Object instance, Long entityVersion) { Class<?> trashClass = HistoryTrashClassHelper.getClass(instance, EntityType.TRASH, getBundleContext()); if (null != trashClass) { LOGGER.debug("Moving {} to trash", instance); // create and save a trash instance LOGGER.debug("Creating trash instance for: {}", instance); Object trash = create(trashClass, instance, null); LOGGER.debug("Created trash instance for: {}", instance); try { MethodUtils.invokeMethod(trash, "setSchemaVersion", entityVersion); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { LOGGER.error("Failed to set schema version of the trash instance."); } PersistenceManager manager = getPersistenceManagerFactory().getPersistenceManager(); manager.makePersistent(trash); } else { throw new IllegalStateException( "Not found the trash class for " + instance.getClass().getName() ); } }
private void verifyCsvImport() throws Exception { getLogger().info("Verifying CSV Import"); CsvImportExportService csvImportExportService = ServiceRetriever.getService(bundleContext, CsvImportExportService.class); try (InputStream in = new ClassPathResource("csv/import.csv").getInputStream()) { Reader reader = new InputStreamReader(in); CsvImportResults results = csvImportExportService.importCsv(FOO_CLASS, reader, "import.csv", false); assertNotNull(results); assertEquals(2, results.totalNumberOfImportedInstances()); assertEquals(2, results.newInstanceCount()); assertEquals(0, results.updatedInstanceCount()); } assertEquals(7, service.count()); // get the imported instances through a lookup QueryParams queryParams = new QueryParams(new Order("someTime", Order.Direction.DESC)); List list = (List) MethodUtils.invokeExactMethod(service, "matchesOperator", new Object[] {"fromCsv", queryParams}); assertNotNull(list); assertEquals(2, list.size()); assertInstance(list.get(0), false, "fromCsv2", "Capital CSV", Collections.emptyList(), null, new LocalDate(2012, 10, 14), null, new Period(2, 0, 0, 0, 0, 0, 0, 0), null, new DateTime(2014, 12, 2, 16, 13, 40, 0, DateTimeZone.UTC).toDate(), null, new Time(20, 20), null, null, null, null); assertInstance(list.get(1), true, "fromCsv1", "Capital CSV", new ArrayList(asList("one", "two")), new DateTime(2014, 12, 2, 13, 10, 40, 0, DateTimeZone.UTC).withZone(DateTimeZone.getDefault()), new LocalDate(2012, 10, 15), null, new Period(1, 0, 0, 0, 0, 0, 0, 0), null, new DateTime(2014, 12, 2, 13, 13, 40, 0, DateTimeZone.UTC).toDate(), null, new Time(10, 30), null, null, null, null); }
public <T> boolean isPk(ManagedType<T> mt, SingularAttribute<? super T, ?> attr) { try { Method m = MethodUtils.getAccessibleMethod(mt.getJavaType(), "get" + WordUtils.capitalize(attr.getName()), (Class<?>) null); if (m != null && m.getAnnotation(Id.class) != null) { return true; } Field field = mt.getJavaType().getField(attr.getName()); return field.getAnnotation(Id.class) != null; } catch (Exception e) { return false; } }
public Jdk14ManagerAccessor(ClassLoader cl) throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Class clazz = cl.loadClass("java.util.logging.LogManager"); Method getManager = MethodUtils.getAccessibleMethod(clazz, "getLogManager", new Class[]{}); Object manager = getManager.invoke(null, null); if (manager == null) { throw new NullPointerException(clazz.getName() + ".getLogManager() returned null"); } setTarget(manager); }
public Jdk14LoggerAccessor getLogger(String name) { try { Object logger = MethodUtils.invokeMethod(getTarget(), "getLogger", name); if (logger == null) { throw new NullPointerException(getTarget().getClass().getName() + "#getLogger(\"" + name + "\") returned null"); } Jdk14LoggerAccessor accessor = new Jdk14LoggerAccessor(); accessor.setTarget(logger); accessor.setApplication(getApplication()); return accessor; } catch (Exception e) { log.error(getTarget().getClass().getName() + "#getLogger(\"" + name + "\") failed", e); } return null; }
public void setLevel(String newLevelStr) { try { Object level = MethodUtils.invokeMethod(getTarget(), "getLevel", null); Object newLevel = MethodUtils.invokeMethod(level, "parse", newLevelStr); MethodUtils.invokeMethod(getTarget(), "setLevel", newLevel); } catch (Exception e) { log.error(getTarget().getClass().getName() + "#setLevel(\"" + newLevelStr + "\") failed", e); } }
public Jdk14HandlerAccessor getHandler(int index) { try { Object handlers[] = (Object[]) MethodUtils.invokeMethod(getTarget(), "getHandlers", null); return wrapHandler(handlers[index], index); } catch (Exception e) { log.error(getTarget().getClass().getName() + "#handlers inaccessible", e); } return null; }