@Override public Object compile(String expression, Map<String, Object> parameters) { logger.debug("About to compile mvel expression {}", expression); ClassLoader classLoader = (ClassLoader) parameters.get("classloader"); if (classLoader == null) { classLoader = this.getClass().getClassLoader(); } ParserConfiguration config = new ParserConfiguration(); config.setClassLoader(classLoader); ParserContext context = new ParserContext(config); if (parameters != null) { @SuppressWarnings("unchecked") Set<String> imports = (Set<String>)parameters.get("imports"); if (imports != null) { for(String clazz : imports) { try { Class<?> cl = Class.forName(clazz, true, classLoader); context.addImport(cl.getSimpleName(), cl); } catch (ClassNotFoundException e) { logger.warn("Unable to load class {} due to {}", clazz, e.getException()); }; } } } return MVEL.compileExpression(expression, context); }
public static Class<?> forName(String name, Class<?> caller) throws ClassNotFoundException { ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader(); if (threadClassLoader != null) { try { return Class.forName(name, true, threadClassLoader) ; } catch (ClassNotFoundException cnfe) { if (cnfe.getException() != null) { throw cnfe; } } } ClassLoader callerClassLoader = caller.getClassLoader(); if (callerClassLoader != null) { try { return Class.forName(name, true, callerClassLoader) ; } catch (final ClassNotFoundException cnfe) { if (cnfe.getException() != null) { throw cnfe ; } } } return Class.forName(name, true, ClassLoader.getSystemClassLoader()) ; }
public static Class<?> forName(String name, Class<?> caller) throws ClassNotFoundException { ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader(); if (threadClassLoader != null) { try { return Class.forName(name, true, threadClassLoader) ; } catch (ClassNotFoundException cnfe) { if (cnfe.getException() != null) { throw cnfe; } } } ClassLoader callerClassLoader = caller.getClassLoader(); if (callerClassLoader != null) { try { return Class.forName(name, true, callerClassLoader) ; } catch (final ClassNotFoundException cnfe) { if (cnfe.getException() != null) { throw cnfe ; } } } return Class.forName(name, true, ClassLoader.getSystemClassLoader()) ; }
public static Class<?> forName(String name, Class<?> caller) throws ClassNotFoundException { ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader(); if (threadClassLoader != null) { try { return Class.forName(name, true, threadClassLoader) ; } catch (ClassNotFoundException cnfe) { if (cnfe.getException() != null) { throw cnfe; } } } ClassLoader callerClassLoader = caller.getClassLoader(); if (callerClassLoader != null) { try { return Class.forName(name, true, callerClassLoader) ; } catch (final ClassNotFoundException cnfe) { if (cnfe.getException() != null) { throw cnfe ; } } } return Class.forName(name, true, ClassLoader.getSystemClassLoader()) ; }
if (cnfe.getException() != null) if (cnfe.getException() != null)
if (cnfe.getException() != null) if (cnfe.getException() != null)
if (cnfe.getException() != null) if (cnfe.getException() != null)
next = ((InvocationTargetException) current).getTargetException(); } else if (current instanceof ClassNotFoundException) { next = ((ClassNotFoundException) current).getException(); } else if (current instanceof ExceptionInInitializerError) { next = ((ExceptionInInitializerError) current).getException();
@Override public Object compile(String expression, Map<String, Object> parameters) { logger.debug("About to compile mvel expression {}", expression); ClassLoader classLoader = (ClassLoader) parameters.get("classloader"); if (classLoader == null) { classLoader = this.getClass().getClassLoader(); } ParserConfiguration config = new ParserConfiguration(); config.setClassLoader(classLoader); ParserContext context = new ParserContext(config); if (parameters != null) { @SuppressWarnings("unchecked") Set<String> imports = (Set<String>)parameters.get("imports"); if (imports != null) { for(String clazz : imports) { try { Class<?> cl = Class.forName(clazz, true, classLoader); context.addImport(cl.getSimpleName(), cl); } catch (ClassNotFoundException e) { logger.warn("Unable to load class {} due to {}", clazz, e.getException()); }; } } } return MVEL.compileExpression(expression, context); }
throw (IOException) var19.getException();