@Override public T newInstance(CreationalContext<T> ctx, BeanManagerImpl manager) { try { T instance = AccessController.doPrivileged(NewInstanceAction.of(proxyClass)); if (!bean.getScope().equals(Dependent.class)) { ctx.push(instance); } ProxyFactory.setBeanInstance(bean.getBeanManager().getContextId(), instance, createEnterpriseTargetBeanInstance(), bean); return instance; } catch (PrivilegedActionException e) { if (e.getCause() instanceof InstantiationException) { throw new WeldException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } else if (e.getCause() instanceof IllegalAccessException) { throw new WeldException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } else { throw new WeldException(e.getCause()); } } catch (Exception e) { throw BeanLogger.LOG.sessionBeanProxyInstantiationFailed(bean, proxyClass, e); } }
@Override public T newInstance(CreationalContext<T> ctx, BeanManagerImpl manager) { try { T instance = AccessController.doPrivileged(NewInstanceAction.of(proxyClass)); if (!bean.getScope().equals(Dependent.class)) { ctx.push(instance); } ProxyFactory.setBeanInstance(bean.getBeanManager().getContextId(), instance, createEnterpriseTargetBeanInstance(), bean); return instance; } catch (PrivilegedActionException e) { if (e.getCause() instanceof InstantiationException) { throw new WeldException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } else if (e.getCause() instanceof IllegalAccessException) { throw new WeldException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } else { throw new WeldException(e.getCause()); } } catch (Exception e) { throw BeanLogger.LOG.sessionBeanProxyInstantiationFailed(bean, proxyClass, e); } }
@Override public T run() { try { return instantiator.newInstance(proxyClassForDecorator); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { return instantiator.newInstance(proxyClassForDecorator); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { return instantiator.newInstance(proxyClassForDecorator); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { return instantiator.newInstance(proxyClassForDecorator); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { return instantiator.newInstance(proxyClassForDecorator); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { return instantiator.newInstance(proxyClassForDecorator); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { Class<T> proxyClass = getProxyClass(); boolean hasConstrutedField = SecurityActions.hasDeclaredField(proxyClass, CONSTRUCTED_FLAG_NAME); if (hasConstrutedField != useConstructedFlag()) { // The proxy class was created with a different type of ProxyInstantiator ProxyInstantiator newInstantiator = ProxyInstantiator.Factory.create(!hasConstrutedField); BeanLogger.LOG.creatingProxyInstanceUsingDifferentInstantiator(proxyClass, newInstantiator, proxyInstantiator); return newInstantiator.newInstance(proxyClass); } return proxyInstantiator.newInstance(proxyClass); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { Class<T> proxyClass = getProxyClass(); boolean hasConstrutedField = SecurityActions.hasDeclaredField(proxyClass, CONSTRUCTED_FLAG_NAME); if (hasConstrutedField != useConstructedFlag()) { // The proxy class was created with a different type of ProxyInstantiator ProxyInstantiator newInstantiator = ProxyInstantiator.Factory.create(!hasConstrutedField); BeanLogger.LOG.creatingProxyInstanceUsingDifferentInstantiator(proxyClass, newInstantiator, proxyInstantiator); return newInstantiator.newInstance(proxyClass); } return proxyInstantiator.newInstance(proxyClass); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { Class<T> proxyClass = getProxyClass(); boolean hasConstrutedField = SecurityActions.hasDeclaredField(proxyClass, CONSTRUCTED_FLAG_NAME); if (hasConstrutedField != useConstructedFlag()) { // The proxy class was created with a different type of ProxyInstantiator ProxyInstantiator newInstantiator = ProxyInstantiator.Factory.create(!hasConstrutedField); BeanLogger.LOG.creatingProxyInstanceUsingDifferentInstantiator(proxyClass, newInstantiator, proxyInstantiator); return newInstantiator.newInstance(proxyClass); } return proxyInstantiator.newInstance(proxyClass); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { Class<T> proxyClass = getProxyClass(); boolean hasConstrutedField = SecurityActions.hasDeclaredField(proxyClass, CONSTRUCTED_FLAG_NAME); if (hasConstrutedField != useConstructedFlag()) { // The proxy class was created with a different type of ProxyInstantiator ProxyInstantiator newInstantiator = ProxyInstantiator.Factory.create(!hasConstrutedField); BeanLogger.LOG.creatingProxyInstanceUsingDifferentInstantiator(proxyClass, newInstantiator, proxyInstantiator); return newInstantiator.newInstance(proxyClass); } return proxyInstantiator.newInstance(proxyClass); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { Class<T> proxyClass = getProxyClass(); boolean hasConstrutedField = SecurityActions.hasDeclaredField(proxyClass, CONSTRUCTED_FLAG_NAME); if (hasConstrutedField != useConstructedFlag()) { // The proxy class was created with a different type of ProxyInstantiator ProxyInstantiator newInstantiator = ProxyInstantiator.Factory.create(!hasConstrutedField); BeanLogger.LOG.creatingProxyInstanceUsingDifferentInstantiator(proxyClass, newInstantiator, proxyInstantiator); return newInstantiator.newInstance(proxyClass); } return proxyInstantiator.newInstance(proxyClass); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }
@Override public T run() { try { Class<T> proxyClass = getProxyClass(); boolean hasConstrutedField = SecurityActions.hasDeclaredField(proxyClass, CONSTRUCTED_FLAG_NAME); if (hasConstrutedField != useConstructedFlag()) { // The proxy class was created with a different type of ProxyInstantiator ProxyInstantiator newInstantiator = ProxyInstantiator.Factory.create(!hasConstrutedField); BeanLogger.LOG.creatingProxyInstanceUsingDifferentInstantiator(proxyClass, newInstantiator, proxyInstantiator); return newInstantiator.newInstance(proxyClass); } return proxyInstantiator.newInstance(proxyClass); } catch (InstantiationException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause()); } catch (IllegalAccessException e) { throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause()); } }