private static ExpressionFactory loadExpressionFactoryImpl() { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) { cl = ClassLoader.getSystemClassLoader(); } // check the META-INF/services defintions first ExpressionFactory factory = lookupByServiceEntryURL(cl); if (factory != null) { return factory; } // try resolving using the alternate property lookups (always returns // something, since there is a default return lookupExpressionFactoryImpl(cl); } catch (ClassNotFoundException e) { // can be thrown either as a result of a classloading failure in the service // lookup or a failure to directly load the class throw new ELException("Fail to load implementation class", e); } } }
private static Class<?> loadExpressionFactoryImplClass() { String implClassName = null; try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) { cl = ClassLoader.getSystemClassLoader(); } // check the META-INF/services defintions first Class<?> cls = lookupByServiceEntryURL(cl); if (cls != null) { return cls; } // try resolving using the alternate property lookups (always returns // something, since there is a default implClassName = lookupExpressionFactoryImplClass(); return ProviderLocator.loadClass(implClassName, ExpressionFactory.class, cl); } catch (ClassNotFoundException e) { // can be thrown either as a result of a classloading failure in the service // lookup or a failure to directly load the class if (implClassName != null) { throw new ELException("Fail to load implementation class " + implClassName, e); } else { throw new ELException("Fail to load implementation class", e); } } } }