{
interceptorHandlerClass = (Class<? extends InterceptorHandler>) Class.forName(className, true, WebBeansUtil.getCurrentClassLoader());
}
catch (ClassNotFoundException e)
{
throw new WebBeansConfigurationException("Configured InterceptorHandler "
+ className
+" cannot be found",
e);
}
}
else
{
// we need to explicitely store a class because ConcurrentHashMap will throw a NPE if value == null
interceptorHandlerClass = NormalScopedBeanInterceptorHandler.class;
}
interceptorHandlerClasses.put(scopeClassName, interceptorHandlerClass);
}
else
{
interceptorHandlerClass = interceptorHandlerClasses.get(scopeClassName);
}
if (interceptorHandlerClass.equals(NormalScopedBeanInterceptorHandler.class))
{
// this is faster that way...
interceptorHandler = new NormalScopedBeanInterceptorHandler(bean, creationalContext);
}
else
{
try
{
Constructor ct = interceptorHandlerClass.getConstructor(OwbBean.class, CreationalContext.class);
interceptorHandler = (InterceptorHandler) ct.newInstance(bean, creationalContext);
}
catch (NoSuchMethodException e)
{
throw new WebBeansConfigurationException("Configured InterceptorHandler "
+ interceptorHandlerClass.getName()
+" has the wrong contructor",
e);
}
catch (InvocationTargetException e)
{
throw new WebBeansConfigurationException("Configured InterceptorHandler "
+ interceptorHandlerClass.getName()
+" has the wrong contructor",
e);
}
catch (InstantiationException e)
{
throw new WebBeansConfigurationException("Configured InterceptorHandler "
+ interceptorHandlerClass.getName()
+" has the wrong contructor",
e);
}
catch (IllegalAccessException e)
{
throw new WebBeansConfigurationException("Configured InterceptorHandler "
+ interceptorHandlerClass.getName()
+" has the wrong contructor",
e);
}
}