diff --git a/modules/api/pom.xml b/modules/api/pom.xml index d0fca00..a461f50 100644 --- a/modules/api/pom.xml +++ b/modules/api/pom.xml @@ -35,6 +35,7 @@ Odysseus Software GmbH de.odysseus javax.el + de.odysseus.el;resolution:=optional Odysseus.de ${project.version} Expression Language API diff --git a/modules/api/src/main/java/javax/el/ExpressionFactory.java b/modules/api/src/main/java/javax/el/ExpressionFactory.java index f42742f..7957ed5 100644 --- a/modules/api/src/main/java/javax/el/ExpressionFactory.java +++ b/modules/api/src/main/java/javax/el/ExpressionFactory.java @@ -107,13 +107,35 @@ public static ExpressionFactory newInstance() { * if a factory class cannot be found or instantiation fails. */ public static ExpressionFactory newInstance(Properties properties) { - ClassLoader classLoader; try { - classLoader = Thread.currentThread().getContextClassLoader(); + return newInstance(properties, Thread.currentThread().getContextClassLoader()); } catch (SecurityException e) { - classLoader = ExpressionFactory.class.getClassLoader(); + } catch (ClassNotFoundException e) { + } + + try { + return newInstance(properties, ExpressionFactory.class.getClassLoader()); + } catch (ClassNotFoundException e) { + throw new ELException("Could not find expression factory class", e); } + } + + /** + * Create an ExpressionFactory instance. + * + * @param properties + * Properties passed to the constructor of the implementation. + * @param classLoader + * The class loader to be used to load the class. + * @return An instance of ExpressionFactory. + * @throws ClassNotFoundException + * if the ExpressionFactory implementation class is not found + * @throws ELException + * if the class could not be found or if it is not a subclass of ExpressionFactory + * or if the class could not be instantiated. + */ + private static ExpressionFactory newInstance ( Properties properties, ClassLoader classLoader) throws ClassNotFoundException { String className = null; String serviceId = "META-INF/services/" + ExpressionFactory.class.getName(); diff --git a/modules/impl/pom.xml b/modules/impl/pom.xml index 176add4..5855923 100644 --- a/modules/impl/pom.xml +++ b/modules/impl/pom.xml @@ -36,7 +36,7 @@ de.odysseus de.odysseus.el.tree.impl.Builder javax.el - de.odysseus.el,de.odysseus.el.util + de.odysseus.el,de.odysseus.el.util,de.odysseus.el.tree,de.odysseus.el.tree.impl,de.odysseus.el.misc Odysseus.de ${project.version} Expression Language Implementation