Refine search
@Override public final DeploymentException injectionPointHasNonProxyableDependencies(final Object param1, final Object stackElement, final Throwable cause) { final DeploymentException result = new DeploymentException(java.text.MessageFormat.format(injectionPointHasNonProxyableDependencies$str(), param1, stackElement), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String injectionPointHasNonSerializableDependency = "WELD-001413: The bean {0} declares a passivating scope but has a non-passivation-capable dependency {1}";
@Override public String getLocalizedMessage() { return getMessage(); }
@Override public void validate(InjectionPoint ij) { try { getServices().get(Validator.class).validateInjectionPoint(ij, this); } catch (DeploymentException e) { throw new InjectionException(e.getLocalizedMessage(), e.getCause()); } }
if (mergedBeanBindings.containsKey(bindingAnnotation.annotationType())) { throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(clazz.getJavaClass())); && !beanManager.getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingAnnotationType) .isEqual(previousValue, bindingAnnotation, true)) { throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(clazz.getJavaClass()));
public void init() { initTargetClassInterceptors(); businessMethods = Beans.getInterceptableMethods(annotatedType); initEjbInterceptors(); initCdiInterceptors(); InterceptionModel interceptionModel = builder.build(); if (interceptionModel.getAllInterceptors().size() > 0 || hasSerializationOrInvocationInterceptorMethods) { if (annotatedType.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithInterceptorsNotAllowed(annotatedType.getJavaClass()); } if (Reflections.isPrivate(constructor.getJavaMember())) { throw new DeploymentException(ValidatorLogger.LOG.notProxyablePrivateConstructor(annotatedType.getJavaClass().getName(), constructor, annotatedType.getJavaClass())); } manager.getInterceptorModelRegistry().put(annotatedType.slim(), interceptionModel); } }
private void initMethodDeclaredEjbInterceptors(AnnotatedMethod<?> method) { Method javaMethod = method.getJavaMember(); boolean excludeClassInterceptors = method.isAnnotationPresent(interceptorsApi.getExcludeClassInterceptorsAnnotationClass()); if (excludeClassInterceptors) { builder.addMethodIgnoringGlobalInterceptors(javaMethod); } Class<?>[] methodDeclaredInterceptors = interceptorsApi.extractInterceptorClasses(method); if (methodDeclaredInterceptors != null && methodDeclaredInterceptors.length > 0) { if (Reflections.isFinal(method.getJavaMember())) { throw new DeploymentException(BeanLogger.LOG.finalInterceptedBeanMethodNotAllowed(method, methodDeclaredInterceptors[0].getName())); } InterceptionType interceptionType = isTimeoutAnnotationPresentOn(method) ? InterceptionType.AROUND_TIMEOUT : InterceptionType.AROUND_INVOKE; builder.interceptMethod(interceptionType, javaMethod, getMethodDeclaredInterceptorMetadatas(methodDeclaredInterceptors), null); } }
/** * Merges bean interceptor bindings (including inherited ones) with method interceptor bindings. Method interceptor bindings * override bean interceptor bindings. The bean binding map is not modified - a copy is used. */ protected Map<Class<? extends Annotation>, Annotation> mergeMethodInterceptorBindings(Map<Class<? extends Annotation>, Annotation> beanBindings, Set<Annotation> methodBindingAnnotations) { Map<Class<? extends Annotation>, Annotation> mergedBeanBindings = new HashMap<Class<? extends Annotation>, Annotation>(beanBindings); // conflict detection Set<Class<? extends Annotation>> processedBindingTypes = new HashSet<Class<? extends Annotation>>(); for (Annotation methodBinding : methodBindingAnnotations) { Class<? extends Annotation> methodBindingType = methodBinding.annotationType(); if (processedBindingTypes.contains(methodBindingType)) { throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(annotatedType)); } processedBindingTypes.add(methodBindingType); // override bean interceptor binding mergedBeanBindings.put(methodBindingType, methodBinding); } return mergedBeanBindings; }
/** * Creates a new exception based on a list of throwables. The throwables are not * used as the cause, but the message from each throwable is included as the message * for this exception. * * @param errors A list of throwables to use in the message */ public DeploymentException(List<? extends Throwable> errors) { super(DeploymentException.class.getName()); // the no-args constructor is missing this.message = new WeldExceptionListMessage(errors); for (Throwable error : errors) { addSuppressed(error); } }
@Override public void validate(InjectionPoint ij) { try { getServices().get(Validator.class).validateInjectionPoint(ij, this); } catch (DeploymentException e) { throw new InjectionException(e.getLocalizedMessage(), e.getCause()); } }
MetaAnnotationStore metaAnnotationStore = beanManager.getServices().get(MetaAnnotationStore.class); throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(clazz.getJavaClass())); for (Annotation inheritedBinding : inheritedBindings) { if (!metaAnnotationStore.getInterceptorBindingModel(annotationType).isEqual(binding, inheritedBinding, false)) { throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(clazz.getJavaClass()));
public void init() { initTargetClassInterceptors(); businessMethods = Beans.getInterceptableMethods(annotatedType); initEjbInterceptors(); initCdiInterceptors(); InterceptionModel interceptionModel = builder.build(); if (interceptionModel.getAllInterceptors().size() > 0 || hasSerializationOrInvocationInterceptorMethods) { if (annotatedType.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithInterceptorsNotAllowed(annotatedType.getJavaClass()); } if (constructor != null && Reflections.isPrivate(constructor.getJavaMember())) { throw new DeploymentException(ValidatorLogger.LOG.notProxyablePrivateConstructor(annotatedType.getJavaClass().getName(), constructor, annotatedType.getJavaClass())); } manager.getInterceptorModelRegistry().put(annotatedType.slim(), interceptionModel); } }
private void initMethodDeclaredEjbInterceptors(AnnotatedMethod<?> method) { Method javaMethod = method.getJavaMember(); boolean excludeClassInterceptors = method.isAnnotationPresent(interceptorsApi.getExcludeClassInterceptorsAnnotationClass()); if (excludeClassInterceptors) { builder.addMethodIgnoringGlobalInterceptors(javaMethod); } Class<?>[] methodDeclaredInterceptors = interceptorsApi.extractInterceptorClasses(method); if (methodDeclaredInterceptors != null && methodDeclaredInterceptors.length > 0) { if (Reflections.isFinal(method.getJavaMember())) { throw new DeploymentException(BeanLogger.LOG.finalInterceptedBeanMethodNotAllowed(method, methodDeclaredInterceptors[0].getName())); } InterceptionType interceptionType = isTimeoutAnnotationPresentOn(method) ? InterceptionType.AROUND_TIMEOUT : InterceptionType.AROUND_INVOKE; builder.interceptMethod(interceptionType, javaMethod, getMethodDeclaredInterceptorMetadatas(methodDeclaredInterceptors), null); } }
protected InterceptorImpl(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { super(attributes, type, new StringBeanIdentifier(forInterceptor(type)), beanManager); this.interceptorMetadata = initInterceptorMetadata(); this.serializable = type.isSerializable(); this.interceptorBindingTypes = Collections.unmodifiableSet(new HashSet<Annotation>(Interceptors.mergeBeanInterceptorBindings(beanManager, getEnhancedAnnotated(), getStereotypes()).values())); if (Beans.findInterceptorBindingConflicts(beanManager, interceptorBindingTypes)) { throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(getType())); } }
/** * Creates a new exception based on a list of throwables. The throwables are not * used as the cause, but the message from each throwable is included as the message * for this exception. * * @param errors A list of throwables to use in the message */ public DeploymentException(List<? extends Throwable> errors) { super(DeploymentException.class.getName()); // the no-args constructor is missing this.message = new WeldExceptionListMessage(errors); for (Throwable error : errors) { addSuppressed(error); } }
@Override public final DeploymentException beanWithPassivatingScopeNotPassivationCapable(final Object param1) { final DeploymentException result = new DeploymentException(java.text.MessageFormat.format(beanWithPassivatingScopeNotPassivationCapable$str(), param1)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String builtinBeanWithNonserializableDecorator = "WELD-001465: {0} for a built-in bean {1} must be passivation capable.";
@Override public void validate(InjectionPoint ij) { try { getServices().get(Validator.class).validateInjectionPoint(ij, this); } catch (DeploymentException e) { throw new InjectionException(e.getLocalizedMessage(), e.getCause()); } }
MetaAnnotationStore metaAnnotationStore = beanManager.getServices().get(MetaAnnotationStore.class); throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(clazz.getJavaClass())); for (Annotation inheritedBinding : inheritedBindings) { if (!metaAnnotationStore.getInterceptorBindingModel(annotationType).isEqual(binding, inheritedBinding, false)) { throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(clazz.getJavaClass()));
public void init() { initTargetClassInterceptors(); businessMethods = Beans.getInterceptableMethods(annotatedType); initEjbInterceptors(); initCdiInterceptors(); InterceptionModel interceptionModel = builder.build(); if (interceptionModel.getAllInterceptors().size() > 0 || hasSerializationOrInvocationInterceptorMethods) { if (annotatedType.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithInterceptorsNotAllowed(annotatedType.getJavaClass()); } if (constructor != null && Reflections.isPrivate(constructor.getJavaMember())) { throw new DeploymentException(ValidatorLogger.LOG.notProxyablePrivateConstructor(annotatedType.getJavaClass().getName(), constructor, annotatedType.getJavaClass())); } manager.getInterceptorModelRegistry().put(annotatedType.slim(), interceptionModel); } }
private void initMethodDeclaredEjbInterceptors(AnnotatedMethod<?> method) { Method javaMethod = method.getJavaMember(); boolean excludeClassInterceptors = method.isAnnotationPresent(interceptorsApi.getExcludeClassInterceptorsAnnotationClass()); if (excludeClassInterceptors) { builder.addMethodIgnoringGlobalInterceptors(javaMethod); } Class<?>[] methodDeclaredInterceptors = interceptorsApi.extractInterceptorClasses(method); if (methodDeclaredInterceptors != null && methodDeclaredInterceptors.length > 0) { if (Reflections.isFinal(method.getJavaMember())) { throw new DeploymentException(BeanLogger.LOG.finalInterceptedBeanMethodNotAllowed(method, methodDeclaredInterceptors[0].getName())); } InterceptionType interceptionType = isTimeoutAnnotationPresentOn(method) ? InterceptionType.AROUND_TIMEOUT : InterceptionType.AROUND_INVOKE; builder.interceptMethod(interceptionType, javaMethod, getMethodDeclaredInterceptorMetadatas(methodDeclaredInterceptors), null); } }
@Override public String getLocalizedMessage() { return getMessage(); }