Author: struberg
Date: Wed Mar 4 08:38:18 2015
New Revision: 1663887
URL: http://svn.apache.org/r1663887
Log:
OWB-1039 improve error handling at deploy time
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/DuplicateDefinitionException.java
- copied, changed from r1663372,
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/DuplicateDefinitionException.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/InconsistentSpecializationException.java
- copied, changed from r1663372,
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ProxyGenerationException.java
- copied, changed from r1663372,
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyGenerationException.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/DescriptiveException.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ExceptionMessageBuilder.java
Removed:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyGenerationException.java
Modified:
openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractProducerBeanBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BaseProducerFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveService.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorProxyChainTest.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/multiple/MultipleSpecializationTest.java
openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
openwebbeans/trunk/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatWebPlugin.java
Modified:
openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
(original)
+++
openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
Wed Mar 4 08:38:18 2015
@@ -20,7 +20,6 @@ package org.apache.webbeans.arquillian.s
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.config.WebBeansFinder;
-import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.spi.ContainerLifecycle;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.container.spi.client.container.DeploymentException;
@@ -116,14 +115,7 @@ public class OwbStandaloneContainer impl
originalLoader.set(parentLoader);
Thread.currentThread().setContextClassLoader(new
OwbSWClassLoader(parentLoader, archive, useOnlyArchiveResources,
useOnlyArchiveResourcesExcludes));
- try
- {
- lifecycle.startApplication(null);
- }
- catch (WebBeansDeploymentException e)
- {
- throw new DeploymentException(e.getMessage(), e);
- }
+ lifecycle.startApplication(null);
// finally make the BeanManager available to Arquillian, but only if
the boot succeeded
beanManagerProducer.set(lifecycle.getBeanManager());
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
Wed Mar 4 08:38:18 2015
@@ -24,7 +24,6 @@ import org.apache.webbeans.container.Bea
import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
import org.apache.webbeans.exception.WebBeansConfigurationException;
-import javax.enterprise.inject.spi.DefinitionException;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.ArrayUtil;
@@ -811,7 +810,7 @@ public final class AnnotationManager
{
if(AnnotationUtil.hasMethodAnnotation(method, Named.class))
{
- throw new DefinitionException("Specialized method : " +
method.getName() + " in class : "
+ throw new WebBeansConfigurationException("Specialized method :
" + method.getName() + " in class : "
+ component.getReturnType().getName() + " may not
define @Named annotation");
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanBuilder.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanBuilder.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanBuilder.java
Wed Mar 4 08:38:18 2015
@@ -25,7 +25,6 @@ import javax.enterprise.inject.spi.Annot
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.DefinitionException;
import java.util.Collection;
import java.util.Set;
@@ -112,14 +111,14 @@ public abstract class AbstractBeanBuilde
{
if (annotatedMethod.isAnnotationPresent(Produces.class))
{
- throw new DefinitionException("This class must not have a
@Produces method" + annotatedMethod.getJavaMember());
+ throw new WebBeansConfigurationException("This class must not
have a @Produces method" + annotatedMethod.getJavaMember());
}
for (AnnotatedParameter<?> parameter :
annotatedMethod.getParameters())
{
if (parameter.isAnnotationPresent(Observes.class))
{
- throw new DefinitionException("This class must not have a
@Observes method " + annotatedMethod.getJavaMember());
+ throw new WebBeansConfigurationException("This class must
not have a @Observes method " + annotatedMethod.getJavaMember());
}
}
}
@@ -129,7 +128,7 @@ public abstract class AbstractBeanBuilde
{
if (annotatedField.isAnnotationPresent(Produces.class))
{
- throw new DefinitionException("This class must not have a
@Produces field" + annotatedField.getJavaMember());
+ throw new WebBeansConfigurationException("This class must not
have a @Produces field" + annotatedField.getJavaMember());
}
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractProducerBeanBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractProducerBeanBuilder.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractProducerBeanBuilder.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractProducerBeanBuilder.java
Wed Mar 4 08:38:18 2015
@@ -30,6 +30,7 @@ import java.lang.reflect.Type;
import org.apache.webbeans.component.AbstractProducerBean;
import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.ClassUtil;
import org.apache.webbeans.util.GenericsUtil;
@@ -69,13 +70,13 @@ public abstract class AbstractProducerBe
Type type = annotatedMember.getBaseType();
if (type instanceof GenericArrayType)
{
- throw new DefinitionException("Produced Type must not be a
GenericArrayType");
+ throw new WebBeansConfigurationException("Produced Type must not
be a GenericArrayType");
}
else if (ClassUtil.isParametrizedType(type))
{
if (GenericsUtil.containsWildcardType(type))
{
- throw new DefinitionException("Produced type must not be a
WildcardType");
+ throw new WebBeansConfigurationException("Produced type must
not be a WildcardType");
}
else if (!Dependent.class.equals(beanAttributes.getScope()))
{
@@ -83,7 +84,7 @@ public abstract class AbstractProducerBe
ParameterizedType parameterizedType =
GenericsUtil.getParameterizedType(type);
if
(GenericsUtil.containTypeVariable(parameterizedType.getActualTypeArguments()))
{
- throw new DefinitionException("Produced ParametrizedType
must be @Dependent-Scope");
+ throw new WebBeansConfigurationException("Produced
ParametrizedType must be @Dependent-Scope");
}
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BaseProducerFactory.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BaseProducerFactory.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BaseProducerFactory.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BaseProducerFactory.java
Wed Mar 4 08:38:18 2015
@@ -35,7 +35,6 @@ import javax.enterprise.inject.spi.Annot
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.DefinitionException;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.ProducerFactory;
import javax.inject.Inject;
@@ -200,7 +199,7 @@ public abstract class BaseProducerFactor
||
AnnotationUtil.hasAnnotatedMethodParameterAnnotation(annotatedMethod,
Observes.class)
|| annotatedMethod.isAnnotationPresent(Produces.class))
{
- throw new DefinitionException("Error in definining disposal method
of annotated method : " + annotatedMethod
+ throw new WebBeansConfigurationException("Error in definining
disposal method of annotated method : " + annotatedMethod
+ ". Disposal methods can not be annotated with" + "
@Initializer/@Destructor/@Produces annotation or has a parameter annotated with
@Observes.");
}
@@ -210,12 +209,12 @@ public abstract class BaseProducerFactor
if (type.equals(InjectionPoint.class))
{
- throw new DefinitionException("Error in definining disposal
method of annotated method : " + annotatedMethod
+ throw new WebBeansConfigurationException("Error in definining
disposal method of annotated method : " + annotatedMethod
+ ". Disposal methods must not have an InjectionPoint.");
}
else if (Bean.class.isAssignableFrom(ClassUtil.getClass(type)))
{
- throw new DefinitionException("Error in defining disposal
method of annoted method: " + annotatedMethod +
+ throw new WebBeansConfigurationException("Error in defining
disposal method of annoted method: " + annotatedMethod +
". Disposal methods must not have a Bean parameter.");
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
Wed Mar 4 08:38:18 2015
@@ -53,7 +53,6 @@ import org.apache.webbeans.config.OWBLog
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.ExternalScope;
import org.apache.webbeans.exception.WebBeansConfigurationException;
-import javax.enterprise.inject.spi.DefinitionException;
import org.apache.webbeans.inject.AlternativesManager;
import org.apache.webbeans.logger.WebBeansLoggerFacade;
@@ -600,7 +599,7 @@ public abstract class BeanAttributesBuil
Class<? super C> superclass =
annotatedToSpecialize.getJavaClass().getSuperclass();
if (superclass.equals(Object.class))
{
- throw new DefinitionException("@Specialized Class : "
+ getAnnotated().getJavaClass().getName()
+ throw new WebBeansConfigurationException("@Specialized
Class : " + getAnnotated().getJavaClass().getName()
+ " must not directly extend Object.class");
}
annotatedToSpecialize =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(superclass);
@@ -618,7 +617,7 @@ public abstract class BeanAttributesBuil
// TODO XXX We have to check stereotypes here, too
if
(getAnnotated().getJavaClass().isAnnotationPresent(Named.class))
{
- throw new DefinitionException("@Specialized Class : " +
getAnnotated().getJavaClass().getName()
+ throw new WebBeansConfigurationException("@Specialized
Class : " + getAnnotated().getJavaClass().getName()
+ " may not explicitly declare a bean name");
}
}
@@ -740,7 +739,7 @@ public abstract class BeanAttributesBuil
// TODO XXX We have to check stereotypes here, too
if (getAnnotated().isAnnotationPresent(Named.class))
{
- throw new DefinitionException("@Specialized Producer
method : " + getAnnotated().getJavaMember().getName()
+ throw new WebBeansConfigurationException("@Specialized
Producer method : " + getAnnotated().getJavaMember().getName()
+ " may not explicitly declare a bean name");
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
Wed Mar 4 08:38:18 2015
@@ -21,7 +21,6 @@ package org.apache.webbeans.component.cr
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeanAttributes;
-import javax.enterprise.inject.spi.DefinitionException;
import javax.enterprise.inject.spi.InterceptionType;
import java.lang.annotation.Annotation;
@@ -83,7 +82,7 @@ public class CdiInterceptorBeanBuilder<T
Target target = a.annotationType().getAnnotation(Target.class);
if (target == null ||
!asList(target.value()).equals(asList(ElementType.TYPE)))
{
- throw new DefinitionException(
+ throw new WebBeansConfigurationException(
a.annotationType().getName() + " doesn't have
strictly @Target(TYPE) but has lifecycle methods. " +
"Interceptor: " +
annotatedType.getJavaClass().getName());
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
Wed Mar 4 08:38:18 2015
@@ -25,7 +25,6 @@ import javax.enterprise.inject.Alternati
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeanAttributes;
-import javax.enterprise.inject.spi.DefinitionException;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Inject;
@@ -232,8 +231,6 @@ public class DecoratorBeanBuilder<T> ext
/**
* Checks recursive, if the ParameterizedTypes are equal
- *
- * @throws DefinitionException
*/
private void checkParametrizedType()
{
@@ -251,7 +248,7 @@ public class DecoratorBeanBuilder<T> ext
Type[] arguments = ClassUtil.getActualTypeArguments(interfaceType);
if (arguments.length != delegeteTypes.length)
{
- throw new DefinitionException("Decorator: " + toString() + "
Number of TypeArguments must match - Decorated Type: " + arguments.length +
+ throw new WebBeansConfigurationException("Decorator: " +
toString() + " Number of TypeArguments must match - Decorated Type: " +
arguments.length +
" Delegate Type: " +
delegeteTypes.length);
}
@@ -259,7 +256,7 @@ public class DecoratorBeanBuilder<T> ext
{
if (!delegeteTypes[i].equals(arguments[i]))
{
- throw new DefinitionException("Decorator: " + toString() +
" delegate attribute must match decorated type: " + delegeteTypes[i]);
+ throw new WebBeansConfigurationException("Decorator: " +
toString() + " delegate attribute must match decorated type: " +
delegeteTypes[i]);
}
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
Wed Mar 4 08:38:18 2015
@@ -32,7 +32,6 @@ import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.DefinitionException;
import javax.enterprise.inject.spi.EventMetadata;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.ObserverMethod;
@@ -110,7 +109,7 @@ public class ObserverMethodsBuilder<T>
&& qualifiers != null && ip.getQualifiers().size() == 1
&& Default.class ==
qualifiers.iterator().next().annotationType())
{
- throw new DefinitionException(ip + " is not an observer
parameter");
+ throw new WebBeansConfigurationException(ip + " is not an
observer parameter");
}
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
Wed Mar 4 08:38:18 2015
@@ -102,7 +102,7 @@ public class ProducerMethodBeanBuilder<T
if (Bean.class.equals(ClassUtil.getClass(type)) &&
!annotatedMember.getBaseType().equals(ClassUtil.getActualTypeArguments(type)[0]))
{
- throw new DefinitionException("Type parameter of the injected
bean must be the same as the return type. Producer method: " + annotatedMember);
+ throw new WebBeansConfigurationException("Type parameter of
the injected bean must be the same as the return type. Producer method: " +
annotatedMember);
}
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Wed Mar 4 08:38:18 2015
@@ -46,6 +46,7 @@ import org.apache.webbeans.deployment.St
import org.apache.webbeans.deployment.StereoTypeModel;
import org.apache.webbeans.event.ObserverMethodImpl;
import org.apache.webbeans.event.OwbObserverMethod;
+import org.apache.webbeans.exception.helper.DescriptiveException;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.exception.WebBeansException;
@@ -301,13 +302,9 @@ public class BeansDeployer
// the tck expects a DeploymentException, but it really should be
a DefinitionException, see i.e. https://issues.jboss.org/browse/CDITCK-346
throw new DeploymentException(e);
}
- catch (WebBeansConfigurationException e)
- {
- throw new DeploymentException(e);
- }
catch (IllegalArgumentException e)
{
- throw new DefinitionException(e);
+ throw new WebBeansConfigurationException(e);
}
catch (Exception e)
{
@@ -370,7 +367,7 @@ public class BeansDeployer
{
webBeansUtil.validate(disposalIPs, bean);
}
- } // else?
+ }
}
}
}
@@ -385,9 +382,8 @@ public class BeansDeployer
{
if (decorator.getDecoratedTypes().isEmpty())
{
- throw new DefinitionException("Decorator must implement at
least one interface (java.io.Serializeable will be ignored)");
+ throw new WebBeansConfigurationException("Decorator must
implement at least one interface (java.io.Serializeable will be ignored)");
}
-
}
}
@@ -441,7 +437,7 @@ public class BeansDeployer
{
if (!GenericsUtil.isAssignableFrom(true, false,
pt1, pt2))
{
- throw new DefinitionException("Generic error
matching " + api + " and " + t);
+ throw new
WebBeansConfigurationException("Generic error matching " + api + " and " + t);
}
}
}
@@ -637,7 +633,7 @@ public class BeansDeployer
final AfterBeanDiscoveryImpl event = new
AfterBeanDiscoveryImpl(webBeansContext);
manager.fireLifecycleEvent(event);
- webBeansContext.getWebBeansUtil().inspectErrorStack(
+ webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack(
"There are errors that are added by AfterBeanDiscovery event
observers. Look at logs for further details");
event.setStarted();
@@ -669,8 +665,8 @@ public class BeansDeployer
// we do not need to set back the sortedAlternatives to the
AlternativesManager as the API
// and all layers in between use a mutable List. Not very elegant but
spec conform.
- webBeansContext.getWebBeansUtil().inspectErrorStack(
- "There are errors that are added by AfterTypeDiscovery event
observers. Look at logs for further details");
+ webBeansContext.getWebBeansUtil().inspectDeploymentErrorStack(
+ "There are errors that are added by AfterTypeDiscovery event
observers. Look at logs for further details");
return newAt;
}
@@ -684,8 +680,8 @@ public class BeansDeployer
final AfterDeploymentValidationImpl event = new
AfterDeploymentValidationImpl(manager);
manager.fireLifecycleEvent(event);
- webBeansContext.getWebBeansUtil().inspectErrorStack(
- "There are errors that are added by AfterDeploymentValidation
event observers. Look at logs for further details");
+ webBeansContext.getWebBeansUtil().inspectDeploymentErrorStack(
+ "There are errors that are added by AfterDeploymentValidation
event observers. Look at logs for further details");
packageVetoCache.clear(); // no more needed, free the memory
event.setStarted();
@@ -746,81 +742,92 @@ public class BeansDeployer
Stack<String> beanNames = new Stack<String>();
for (Bean<?> bean : beans)
{
- if (bean instanceof OwbBean && !((OwbBean)bean).isEnabled())
+ try
{
- // we skip disabled beans
- continue;
- }
- //don't validate the cdi-api
- if
(bean.getBeanClass().getName().startsWith(JAVAX_ENTERPRISE_PACKAGE))
- {
- if (BuiltInOwbBean.class.isInstance(bean))
+ if (bean instanceof OwbBean && !((OwbBean)
bean).isEnabled())
{
- final Class<?> proxyable =
BuiltInOwbBean.class.cast(bean).proxyableType();
- if (proxyable != null)
- {
- final AbstractProducer producer =
AbstractProducer.class.cast(OwbBean.class.cast(bean).getProducer());
- final AnnotatedType<?> annotatedType =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(proxyable);
- producer.defineInterceptorStack(bean,
annotatedType, webBeansContext);
- }
+ // we skip disabled beans
+ continue;
}
- continue;
- }
-
- String beanName = bean.getName();
- if(beanName != null)
- {
- beanNames.push(beanName);
- }
-
- if (bean instanceof OwbBean && !(bean instanceof Interceptor)
&& !(bean instanceof Decorator))
- {
- AbstractProducer<T> producer = null;
- OwbBean<T> owbBean = (OwbBean<T>)bean;
- if (ManagedBean.class.isInstance(bean)) // in this case
don't use producer which can be wrapped
+ //don't validate the cdi-api
+ if
(bean.getBeanClass().getName().startsWith(JAVAX_ENTERPRISE_PACKAGE))
{
- producer =
ManagedBean.class.cast(bean).getOriginalInjectionTarget();
+ if (BuiltInOwbBean.class.isInstance(bean))
+ {
+ final Class<?> proxyable =
BuiltInOwbBean.class.cast(bean).proxyableType();
+ if (proxyable != null)
+ {
+ final AbstractProducer producer =
AbstractProducer.class.cast(OwbBean.class.cast(bean).getProducer());
+ final AnnotatedType<?> annotatedType =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(proxyable);
+ producer.defineInterceptorStack(bean,
annotatedType, webBeansContext);
+ }
+ }
+ continue;
}
- if (producer == null && owbBean.getProducer() instanceof
AbstractProducer)
+
+ String beanName = bean.getName();
+ if (beanName != null)
{
- producer = (AbstractProducer<T>)owbBean.getProducer();
+ beanNames.push(beanName);
}
- if (producer != null)
+
+ if (bean instanceof OwbBean && !(bean instanceof
Interceptor) && !(bean instanceof Decorator))
{
- AnnotatedType<T> annotatedType;
- if (owbBean instanceof InjectionTargetBean)
+ AbstractProducer<T> producer = null;
+
+ OwbBean<T> owbBean = (OwbBean<T>) bean;
+ if (ManagedBean.class.isInstance(bean)) // in this
case don't use producer which can be wrapped
{
- annotatedType =
((InjectionTargetBean<T>)owbBean).getAnnotatedType();
+ producer =
ManagedBean.class.cast(bean).getOriginalInjectionTarget();
}
- else
+ if (producer == null && owbBean.getProducer()
instanceof AbstractProducer)
{
- annotatedType =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(owbBean.getReturnType());
+ producer = (AbstractProducer<T>)
owbBean.getProducer();
+ }
+ if (producer != null)
+ {
+ AnnotatedType<T> annotatedType;
+ if (owbBean instanceof InjectionTargetBean)
+ {
+ annotatedType = ((InjectionTargetBean<T>)
owbBean).getAnnotatedType();
+ }
+ else
+ {
+ annotatedType =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(owbBean.getReturnType());
+ }
+ producer.defineInterceptorStack(owbBean,
annotatedType, webBeansContext);
}
- producer.defineInterceptorStack(owbBean,
annotatedType, webBeansContext);
+ }
+
+ //Check passivation scope
+ checkPassivationScope(bean);
+
+ //Bean injection points
+ Set<InjectionPoint> injectionPoints =
bean.getInjectionPoints();
+
+ //Check injection points
+ if (injectionPoints != null)
+ {
+
webBeansContext.getWebBeansUtil().validate(injectionPoints, bean);
}
}
-
- //Check passivation scope
- checkPassivationScope(bean);
-
- //Bean injection points
- Set<InjectionPoint> injectionPoints =
bean.getInjectionPoints();
-
- //Check injection points
- if(injectionPoints != null)
+ catch (RuntimeException e)
{
-
webBeansContext.getWebBeansUtil().validate(injectionPoints, bean);
+ if (e instanceof DescriptiveException)
+ {
+ ((DescriptiveException) e).addInformation("Problem
while validating bean " + bean);
+ }
+ throw e;
}
+
}
-
//Validate Bean names
validateBeanNames(beanNames);
-
+
//Clear Names
beanNames.clear();
-
}
}
@@ -875,7 +882,7 @@ public class BeansDeployer
{
if(part.equals(other))
{
- throw new WebBeansConfigurationException("EL
name of one bean is of the form x.y, where y is a valid bean EL name, and " +
+ throw new WebBeansDeploymentException("EL name
of one bean is of the form x.y, where y is a valid bean EL name, and " +
"x is the EL name of the other bean
for the bean name : " + beanName);
}
}
@@ -1196,7 +1203,7 @@ public class BeansDeployer
{
if (alternativesInFile.contains(alternativeName))
{
- throw new
WebBeansConfigurationException(createConfigurationFailedMessage(bdaLocation) +
"Given alternative : " + alternativeName
+ throw new
WebBeansDeploymentException(createConfigurationFailedMessage(bdaLocation) +
"Given alternative : " + alternativeName
+ " is already added as @Alternative" );
}
alternativesInFile.add(alternativeName);
@@ -1205,7 +1212,7 @@ public class BeansDeployer
if (clazz == null)
{
- throw new
WebBeansConfigurationException(createConfigurationFailedMessage(bdaLocation) +
"Alternative: " + alternativeName + " not found");
+ throw new
WebBeansDeploymentException(createConfigurationFailedMessage(bdaLocation) +
"Alternative: " + alternativeName + " not found");
}
else
{
@@ -1233,7 +1240,7 @@ public class BeansDeployer
}
else
{
- throw new
WebBeansConfigurationException("Given alternative class : " + clazz.getName() +
" is not decorated wih @Alternative" );
+ throw new WebBeansDeploymentException("Given
alternative class : " + clazz.getName() + " is not decorated wih @Alternative"
);
}
}
}
@@ -1252,7 +1259,7 @@ public class BeansDeployer
if (clazz == null)
{
- throw new
WebBeansConfigurationException(createConfigurationFailedMessage(bdaLocation) +
"Decorator class : " +
+ throw new
WebBeansDeploymentException(createConfigurationFailedMessage(bdaLocation) +
"Decorator class : " +
decorator + " not found");
}
else
@@ -1260,7 +1267,7 @@ public class BeansDeployer
if ((scannerService.isBDABeansXmlScanningEnabled() &&
!scannerService.getBDABeansXmlScanner().addDecorator(clazz,
bdaLocation.toExternalForm())) ||
decoratorsInFile.contains(clazz))
{
- throw new
WebBeansConfigurationException(createConfigurationFailedMessage(bdaLocation) +
"Decorator class : " +
+ throw new
WebBeansDeploymentException(createConfigurationFailedMessage(bdaLocation) +
"Decorator class : " +
decorator + " is already defined");
}
@@ -1283,7 +1290,7 @@ public class BeansDeployer
if (clazz == null)
{
- throw new
WebBeansConfigurationException(createConfigurationFailedMessage(bdaLocation) +
"Interceptor class : " +
+ throw new
WebBeansDeploymentException(createConfigurationFailedMessage(bdaLocation) +
"Interceptor class : " +
interceptor + " not found");
}
else
@@ -1320,14 +1327,14 @@ public class BeansDeployer
if (AnnotationUtil.hasAnnotation(classAnnotations,
javax.interceptor.Interceptor.class) &&
!webBeansContext.getAnnotationManager().hasInterceptorBindingMetaAnnotation(classAnnotations))
{
- throw new
WebBeansConfigurationException(createConfigurationFailedMessage(bdaLocation) +
"Interceptor class : "
+ throw new
WebBeansDeploymentException(createConfigurationFailedMessage(bdaLocation) +
"Interceptor class : "
+ interceptor + " must have at least one
@InterceptorBinding");
}
// check if the interceptor got defined twice in this beans.xml
if (interceptorsInFile.contains(clazz))
{
- throw new
WebBeansConfigurationException(createConfigurationFailedMessage(bdaLocation) +
"Interceptor class : "
+ throw new
WebBeansDeploymentException(createConfigurationFailedMessage(bdaLocation) +
"Interceptor class : "
+ interceptor + " already defined in this
beans.xml file!");
}
interceptorsInFile.add(clazz);
@@ -1379,7 +1386,7 @@ public class BeansDeployer
{
if(!(beanObj instanceof AbstractProducerBean))
{
- throw new WebBeansConfigurationException("Passivation
scoped defined bean must be passivation capable, " +
+ throw new WebBeansDeploymentException("Passivation scoped
defined bean must be passivation capable, " +
"but bean : " + beanObj.toString() + " is not
passivation capable");
}
}
@@ -1450,8 +1457,8 @@ public class BeansDeployer
{
//Fires ProcessInjectionTarget
webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEventForJavaEeComponents(beanClass).setStarted();
- webBeansContext.getWebBeansUtil().inspectErrorStack(
- "There are errors that are added by ProcessInjectionTarget
event observers. Look at logs for further details");
+ webBeansContext.getWebBeansUtil().inspectDeploymentErrorStack(
+ "There are errors that are added by ProcessInjectionTarget
event observers. Look at logs for further details");
//Checks that not contains @Inject InjectionPoint
webBeansContext.getAnnotationManager().checkInjectionPointForInjectInjectionPoint(beanClass);
@@ -1531,7 +1538,7 @@ public class BeansDeployer
for(ProducerMethodBean<?> producerMethod : producerMethods)
{
AnnotatedMethod<?> method =
webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(producerMethod.getCreatorMethod(),
annotatedType);
- webBeansContext.getWebBeansUtil().inspectErrorStack("There
are errors that are added by ProcessProducer event observers for "
+
webBeansContext.getWebBeansUtil().inspectDeploymentErrorStack("There are errors
that are added by ProcessProducer event observers for "
+ "ProducerMethods. Look at logs for further
details");
annotatedMethods.put(producerMethod, method);
@@ -1542,7 +1549,7 @@ public class BeansDeployer
for(ProducerFieldBean<?> producerField : producerFields)
{
- webBeansContext.getWebBeansUtil().inspectErrorStack("There
are errors that are added by ProcessProducer event observers for"
+
webBeansContext.getWebBeansUtil().inspectDeploymentErrorStack("There are errors
that are added by ProcessProducer event observers for"
+ " ProducerFields. Look at logs for further
details");
annotatedFields.put(producerField,
@@ -1568,22 +1575,22 @@ public class BeansDeployer
ProcessBeanImpl<T> processBeanEvent = new
GProcessManagedBean(managedBean, annotatedType);
beanManager.fireEvent(processBeanEvent, true);
processBeanEvent.setStarted();
- webBeansContext.getWebBeansUtil().inspectErrorStack("There are
errors that are added by ProcessManagedBean event observers for " +
+
webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack("There are errors
that are added by ProcessManagedBean event observers for " +
"managed beans. Look at logs for further details");
//Fires ProcessProducerMethod
webBeansContext.getWebBeansUtil().fireProcessProducerMethodBeanEvent(annotatedMethods,
annotatedType);
- webBeansContext.getWebBeansUtil().inspectErrorStack("There are
errors that are added by ProcessProducerMethod event observers for " +
+
webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack("There are errors
that are added by ProcessProducerMethod event observers for " +
"producer method beans. Look at logs for further
details");
//Fires ProcessProducerField
webBeansContext.getWebBeansUtil().fireProcessProducerFieldBeanEvent(annotatedFields);
- webBeansContext.getWebBeansUtil().inspectErrorStack("There are
errors that are added by ProcessProducerField event observers for " +
+
webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack("There are errors
that are added by ProcessProducerField event observers for " +
"producer field beans. Look at logs for further
details");
//Fire ObservableMethods
webBeansContext.getWebBeansUtil().fireProcessObservableMethodBeanEvent(observerMethodsMap);
- webBeansContext.getWebBeansUtil().inspectErrorStack("There are
errors that are added by ProcessObserverMethod event observers for " +
+
webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack("There are errors
that are added by ProcessObserverMethod event observers for " +
"observer methods. Look at logs for further details");
if(!webBeansContext.getWebBeansUtil().isAnnotatedTypeDecoratorOrInterceptor(annotatedType))
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
Wed Mar 4 08:38:18 2015
@@ -39,7 +39,7 @@ import javax.enterprise.inject.spi.Passi
import org.apache.webbeans.component.EnterpriseBeanMarker;
import org.apache.webbeans.component.OwbBean;
import org.apache.webbeans.component.ProducerMethodBean;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.exception.helper.ViolationMessageBuilder;
import
org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
import org.apache.webbeans.portable.InjectionTargetImpl;
@@ -209,7 +209,7 @@ public class DeploymentValidationService
if (!isPassivationCapable(dependentBean))
{
String type = dependentBean instanceof Interceptor? "Interceptor
": "Decorator ";
- throw new WebBeansConfigurationException(
+ throw new WebBeansDeploymentException(
"Passivation capable beans must satisfy passivation
capable dependencies. " +
"Bean : " + bean.toString() + " does not satisfy. " + type
+ dependentBean.toString() + " is not passivation capable");
}
@@ -229,7 +229,7 @@ public class DeploymentValidationService
{
continue;
}
- throw new WebBeansConfigurationException(
+ throw new WebBeansDeploymentException(
"Passivation capable beans must satisfy
passivation capable dependencies. " +
"Bean : " + bean.toString() + " does not satisfy.
Details about the Injection-point: " +
injectionPoint.toString());
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Wed Mar 4 08:38:18 2015
@@ -78,7 +78,7 @@ import org.apache.webbeans.decorator.Dec
import org.apache.webbeans.event.EventMetadataImpl;
import org.apache.webbeans.event.NotificationManager;
import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.exception.definition.DuplicateDefinitionException;
+import org.apache.webbeans.exception.DuplicateDefinitionException;
import org.apache.webbeans.intercept.InterceptorUtil;
import org.apache.webbeans.plugins.OpenWebBeansJmsPlugin;
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Wed Mar 4 08:38:18 2015
@@ -45,7 +45,6 @@ import javax.enterprise.inject.New;
import javax.enterprise.inject.UnproxyableResolutionException;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.DefinitionException;
import javax.enterprise.inject.spi.DeploymentException;
import javax.enterprise.inject.spi.InjectionPoint;
import java.lang.annotation.Annotation;
@@ -160,7 +159,7 @@ public class InjectionResolver
}
catch (final UnproxyableResolutionException ure)
{
- throw new DeploymentException(ure);
+ throw new WebBeansDeploymentException(ure);
}
}
}
@@ -506,14 +505,14 @@ public class InjectionResolver
/**
* Verify that we have a legal Type at the injection point.
* CDI can basically only handle Class and ParameterizedType injection
points atm.
- * @throws DefinitionException on TypeVariable, WildcardType and
GenericArrayType
+ * @throws WebBeansConfigurationException on TypeVariable, WildcardType
and GenericArrayType
* @throws IllegalArgumentException if the type is not yet supported by
the spec.
*/
private void validateInjectionPointType(Type injectionPointType)
{
if (injectionPointType instanceof TypeVariable || injectionPointType
instanceof WildcardType || injectionPointType instanceof GenericArrayType)
{
- throw new DefinitionException("Injection point cannot define Type
Variable " + injectionPointType);
+ throw new WebBeansConfigurationException("Injection point cannot
define Type Variable " + injectionPointType);
}
if (!(injectionPointType instanceof Class) &&
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
Wed Mar 4 08:38:18 2015
@@ -33,7 +33,7 @@ import javax.enterprise.inject.spi.Decor
import org.apache.webbeans.annotation.DefaultLiteral;
import org.apache.webbeans.component.OwbBean;
import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.GenericsUtil;
@@ -128,7 +128,7 @@ public class DecoratorsManager
//Validate decorator classes
if(!decoratorClazz.isAnnotationPresent(javax.decorator.Decorator.class) &&
!containsCustomDecoratorClass(decoratorClazz))
{
- throw new WebBeansConfigurationException("Given class : " +
decoratorClazz + " is not a decorator class");
+ throw new WebBeansDeploymentException("Given class : " +
decoratorClazz + " is not a decorator class");
}
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java
Wed Mar 4 08:38:18 2015
@@ -19,11 +19,11 @@
package org.apache.webbeans.event;
import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.portable.events.discovery.ExtensionAware;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.DefinitionException;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
import javax.enterprise.inject.spi.WithAnnotations;
import java.lang.reflect.InvocationTargetException;
@@ -52,7 +52,7 @@ public class ContainerEventObserverMetho
}
else
{
- throw new DefinitionException("WithAnnotations must only be
used for ProcessAnnotatedType");
+ throw new WebBeansConfigurationException("WithAnnotations must
only be used for ProcessAnnotatedType");
}
}
else
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
Wed Mar 4 08:38:18 2015
@@ -63,6 +63,7 @@ import org.apache.webbeans.component.Abs
import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.logger.WebBeansLoggerFacade;
import org.apache.webbeans.portable.events.ProcessSessionBeanImpl;
@@ -625,7 +626,14 @@ public final class NotificationManager
if (isLifecycleEvent)
{
- throw new WebBeansConfigurationException("Error while
sending SystemEvent to a CDI Extension! " + event.toString(), e);
+ if (event instanceof AfterDeploymentValidation)
+ {
+ throw new WebBeansDeploymentException("Error while
sending SystemEvent to a CDI Extension! " + event.toString(), e);
+ }
+ else
+ {
+ throw new WebBeansConfigurationException("Error while
sending SystemEvent to a CDI Extension! " + event.toString(), e);
+ }
}
if (!RuntimeException.class.isAssignableFrom(exc.getClass()))
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
Wed Mar 4 08:38:18 2015
@@ -42,7 +42,6 @@ import javax.enterprise.event.Transactio
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.DefinitionException;
import javax.enterprise.inject.spi.EventMetadata;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.WithAnnotations;
@@ -53,6 +52,7 @@ import org.apache.webbeans.config.OWBLog
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.inject.impl.InjectionPointFactory;
import org.apache.webbeans.logger.WebBeansLoggerFacade;
@@ -174,7 +174,7 @@ public class ObserverMethodImpl<T> imple
{
if (annotatedObservesParameter.getAnnotation(WithAnnotations.class) !=
null)
{
- throw new DefinitionException("@WithAnnotations must only be used
for ProcessAnnotatedType events");
+ throw new WebBeansConfigurationException("@WithAnnotations must
only be used for ProcessAnnotatedType events");
}
}
Copied:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/DuplicateDefinitionException.java
(from r1663372,
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/DuplicateDefinitionException.java)
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/DuplicateDefinitionException.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/DuplicateDefinitionException.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/DuplicateDefinitionException.java&r1=1663372&r2=1663887&rev=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/DuplicateDefinitionException.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/DuplicateDefinitionException.java
Wed Mar 4 08:38:18 2015
@@ -16,14 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.webbeans.exception.definition;
+package org.apache.webbeans.exception;
import javax.enterprise.inject.spi.DefinitionException;
+import org.apache.webbeans.exception.helper.DescriptiveException;
+import org.apache.webbeans.exception.helper.ExceptionMessageBuilder;
-public class DuplicateDefinitionException extends DefinitionException
+public class DuplicateDefinitionException extends DefinitionException
implements DescriptiveException
{
private static final long serialVersionUID = 2312285271502063304L;
+ private ExceptionMessageBuilder msg = new ExceptionMessageBuilder();
+
+
public DuplicateDefinitionException(String message)
{
super(message);
@@ -39,4 +44,22 @@ public class DuplicateDefinitionExceptio
super(message, e);
}
+ @Override
+ public void addInformation(String additionalInformation)
+ {
+ msg.addInformation(additionalInformation);
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return msg.getAdditionalInformation(super.getMessage());
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return msg.getAdditionalInformation(super.getLocalizedMessage());
+ }
+
}
Copied:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/InconsistentSpecializationException.java
(from r1663372,
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java)
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/InconsistentSpecializationException.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/InconsistentSpecializationException.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java&r1=1663372&r2=1663887&rev=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/InconsistentSpecializationException.java
Wed Mar 4 08:38:18 2015
@@ -16,14 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.webbeans.exception.inject;
+package org.apache.webbeans.exception;
import javax.enterprise.inject.spi.DefinitionException;
+import org.apache.webbeans.exception.helper.DescriptiveException;
+import org.apache.webbeans.exception.helper.ExceptionMessageBuilder;
-public class InconsistentSpecializationException extends DefinitionException
+public class InconsistentSpecializationException extends DefinitionException
implements DescriptiveException
{
private static final long serialVersionUID = 5398575103682514128L;
+ private ExceptionMessageBuilder msg = new ExceptionMessageBuilder();
+
public InconsistentSpecializationException(String message)
{
super(message);
@@ -39,4 +43,22 @@ public class InconsistentSpecializationE
super(message, e);
}
+ @Override
+ public void addInformation(String additionalInformation)
+ {
+ msg.addInformation(additionalInformation);
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return msg.getAdditionalInformation(super.getMessage());
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return msg.getAdditionalInformation(super.getLocalizedMessage());
+ }
+
}
Copied:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ProxyGenerationException.java
(from r1663372,
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyGenerationException.java)
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ProxyGenerationException.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ProxyGenerationException.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyGenerationException.java&r1=1663372&r2=1663887&rev=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyGenerationException.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ProxyGenerationException.java
Wed Mar 4 08:38:18 2015
@@ -16,13 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.webbeans.proxy;
+package org.apache.webbeans.exception;
+
+import org.apache.webbeans.exception.helper.DescriptiveException;
+import org.apache.webbeans.exception.helper.ExceptionMessageBuilder;
/**
* Exceptions which might happen during proxy creation.
*/
-public class ProxyGenerationException extends RuntimeException
+public class ProxyGenerationException extends RuntimeException implements
DescriptiveException
{
+ private ExceptionMessageBuilder msg = new ExceptionMessageBuilder();
+
public ProxyGenerationException()
{
super();
@@ -42,5 +47,24 @@ public class ProxyGenerationException ex
{
super(message, cause);
}
+
+ @Override
+ public void addInformation(String additionalInformation)
+ {
+ msg.addInformation(additionalInformation);
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return msg.getAdditionalInformation(super.getMessage());
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return msg.getAdditionalInformation(super.getLocalizedMessage());
+ }
+
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java
Wed Mar 4 08:38:18 2015
@@ -19,19 +19,23 @@
package org.apache.webbeans.exception;
import javax.enterprise.inject.spi.DefinitionException;
+import org.apache.webbeans.exception.helper.DescriptiveException;
+import org.apache.webbeans.exception.helper.ExceptionMessageBuilder;
/**
* Exception that is thrown by the web beans container at the intialization
- * time.
+ * time. This is the OWB implementation of the DefinitionException.
*
- * @author <a href="mailto:[email protected]">Gurkan Erdogdu</a>
* @since 1.0
*/
-public class WebBeansConfigurationException extends DefinitionException
+public class WebBeansConfigurationException extends DefinitionException
implements DescriptiveException
{
private static final long serialVersionUID = 1863095663133791175L;
+ private ExceptionMessageBuilder msg = new ExceptionMessageBuilder();
+
+
public WebBeansConfigurationException(String message)
{
super(message);
@@ -47,4 +51,22 @@ public class WebBeansConfigurationExcept
super(message, e);
}
+ @Override
+ public void addInformation(String additionalInformation)
+ {
+ msg.addInformation(additionalInformation);
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return msg.getAdditionalInformation(super.getMessage());
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return msg.getAdditionalInformation(super.getLocalizedMessage());
+ }
+
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java
Wed Mar 4 08:38:18 2015
@@ -18,17 +18,20 @@
*/
package org.apache.webbeans.exception;
+import org.apache.webbeans.exception.helper.DescriptiveException;
+import org.apache.webbeans.exception.helper.ExceptionMessageBuilder;
+
/**
* Exception that is thrown by the web beans container at the deployment time.
*
- * @author <a href="mailto:[email protected]">Gurkan Erdogdu</a>
* @since 1.0
*/
-public class WebBeansCreationException extends WebBeansException
+public class WebBeansCreationException extends WebBeansException implements
DescriptiveException
{
-
private static final long serialVersionUID = 1863095663133791175L;
+ private ExceptionMessageBuilder msg = new ExceptionMessageBuilder();
+
public WebBeansCreationException(Throwable e)
{
super(e);
@@ -38,4 +41,23 @@ public class WebBeansCreationException e
{
super(message);
}
+
+ @Override
+ public void addInformation(String additionalInformation)
+ {
+ msg.addInformation(additionalInformation);
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return msg.getAdditionalInformation(super.getMessage());
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return msg.getAdditionalInformation(super.getLocalizedMessage());
+ }
+
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
Wed Mar 4 08:38:18 2015
@@ -19,18 +19,21 @@
package org.apache.webbeans.exception;
import javax.enterprise.inject.spi.DeploymentException;
+import org.apache.webbeans.exception.helper.DescriptiveException;
+import org.apache.webbeans.exception.helper.ExceptionMessageBuilder;
/**
* Exception that is thrown by the web beans container at the deployment time.
*
- * @author <a href="mailto:[email protected]">Gurkan Erdogdu</a>
* @since 1.0
*/
-public class WebBeansDeploymentException extends DeploymentException
+public class WebBeansDeploymentException extends DeploymentException
implements DescriptiveException
{
private static final long serialVersionUID = 1863095663133791175L;
+ private ExceptionMessageBuilder msg = new ExceptionMessageBuilder();
+
public WebBeansDeploymentException(Throwable e)
{
super(e);
@@ -45,4 +48,23 @@ public class WebBeansDeploymentException
{
super(message, e);
}
+
+ @Override
+ public void addInformation(String additionalInformation)
+ {
+ msg.addInformation(additionalInformation);
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return msg.getAdditionalInformation(super.getMessage());
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return msg.getAdditionalInformation(super.getLocalizedMessage());
+ }
+
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java
Wed Mar 4 08:38:18 2015
@@ -18,11 +18,15 @@
*/
package org.apache.webbeans.exception;
-public class WebBeansException extends RuntimeException
+import org.apache.webbeans.exception.helper.DescriptiveException;
+import org.apache.webbeans.exception.helper.ExceptionMessageBuilder;
+
+public class WebBeansException extends RuntimeException implements
DescriptiveException
{
private static final long serialVersionUID = -3721839220664165557L;
private Throwable cause;
+ private ExceptionMessageBuilder msg = new ExceptionMessageBuilder();
public WebBeansException(String message)
{
@@ -47,4 +51,22 @@ public class WebBeansException extends R
return cause;
}
+ @Override
+ public void addInformation(String additionalInformation)
+ {
+ msg.addInformation(additionalInformation);
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return msg.getAdditionalInformation(super.getMessage());
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return msg.getAdditionalInformation(super.getLocalizedMessage());
+ }
+
}
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/DescriptiveException.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/DescriptiveException.java?rev=1663887&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/DescriptiveException.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/DescriptiveException.java
Wed Mar 4 08:38:18 2015
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.exception.helper;
+
+/**
+ * This interface defines an exception which can later
+ * get catched and an additional description can be added.
+ *
+ * This is useful if you e.g. like to add additional information
+ * on an outer level of processing. That way we do not need to
+ * prepare description information upfront. This saves memory and CPU cycles.
+ */
+public interface DescriptiveException
+{
+ /**
+ * Add some additional information to the message.
+ * @param additionalInformation
+ */
+ public void addInformation(String additionalInformation);
+}
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ExceptionMessageBuilder.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ExceptionMessageBuilder.java?rev=1663887&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ExceptionMessageBuilder.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ExceptionMessageBuilder.java
Wed Mar 4 08:38:18 2015
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.exception.helper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Helper for {@link DescriptiveException}.
+ */
+public class ExceptionMessageBuilder
+{
+ private List<String> additionalInformations;
+
+ public void addInformation(String additionalInformation)
+ {
+ if (additionalInformations == null)
+ {
+ additionalInformations = new ArrayList<String>();
+ }
+ additionalInformations.add(additionalInformation);
+ }
+
+ public String getAdditionalInformation(String msg)
+ {
+ return msg != null ? msg : "" + getAdditionalInformation();
+ }
+
+ private String getAdditionalInformation()
+ {
+ if (additionalInformations == null)
+ {
+ return "";
+ }
+
+ StringBuilder sb = new StringBuilder("\n");
+ for (String additionalInformation : additionalInformations)
+ {
+ sb.append("info: ").append(additionalInformation).append("\n");
+ }
+ return sb.toString();
+ }
+
+}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
Wed Mar 4 08:38:18 2015
@@ -27,6 +27,7 @@ import org.apache.webbeans.config.OpenWe
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.portable.AnnotatedElementFactory;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
@@ -205,7 +206,7 @@ public class InterceptorResolutionServic
if ((interceptedBean || decorators.size() > 0) &&
Modifier.isFinal(annotatedType.getJavaClass().getModifiers()))
{
- throw new WebBeansConfigurationException("Cannot apply Decorators
or Interceptors on a final class: "
+ throw new WebBeansDeploymentException("Cannot apply Decorators or
Interceptors on a final class: "
+
annotatedType.getJavaClass().getName());
}
@@ -225,7 +226,7 @@ public class InterceptorResolutionServic
if (!proxyable)
{
- throw new DeploymentException("Intercepted Bean " +
annotatedType.getBaseType() + " must be proxyable");
+ throw new WebBeansDeploymentException("Intercepted Bean " +
annotatedType.getBaseType() + " must be proxyable");
}
}
@@ -460,7 +461,7 @@ public class InterceptorResolutionServic
{
if (isUnproxyable(annotatedMethod))
{
- throw new WebBeansConfigurationException(annotatedMethod +
" is not proxyable, but an Decorator got defined on it!");
+ throw new WebBeansDeploymentException(annotatedMethod + "
is not proxyable, but an Decorator got defined on it!");
}
appliedDecorators.put(decorator, decoratingMethod);
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
Wed Mar 4 08:38:18 2015
@@ -29,7 +29,7 @@ import javax.enterprise.inject.spi.Annot
import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.util.Asserts;
@@ -111,7 +111,7 @@ public final class InterceptorUtil
//Simple webbeans
if(Modifier.isFinal(clazz.getModifiers()) && hasClassInterceptors)
{
- throw new WebBeansConfigurationException("Final Simple class with
name : " + clazz.getName() + " can not define any InterceptorBindings");
+ throw new WebBeansDeploymentException("Final Simple class with
name : " + clazz.getName() + " can not define any InterceptorBindings");
}
Method[] methods =
webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(clazz);
@@ -123,7 +123,7 @@ public final class InterceptorUtil
{
if (hasClassInterceptors)
{
- throw new WebBeansConfigurationException("Simple web bean
class : " + clazz.getName()
+ throw new WebBeansDeploymentException("Simple web bean
class : " + clazz.getName()
+ " can not
define non-static, non-private final methods. "
+ "Because it is
annotated with at least one @InterceptorBinding");
}
@@ -132,7 +132,7 @@ public final class InterceptorUtil
if (annotationManager.hasInterceptorBindingMetaAnnotation(
method.getDeclaredAnnotations()))
{
- throw new WebBeansConfigurationException("Method : " +
method.getName() + "in simple web bean class : "
+ throw new WebBeansDeploymentException("Method : " +
method.getName() + "in simple web bean class : "
+
clazz.getName()
+ " can not
be defined as non-static, non-private and final. "
+ "Because it
is annotated with at least one @InterceptorBinding");
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
Wed Mar 4 08:38:18 2015
@@ -40,8 +40,9 @@ import org.apache.webbeans.component.cre
import org.apache.webbeans.component.creation.EjbInterceptorBeanBuilder;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.BeanManagerImpl;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
import javax.annotation.Priority;
+
+import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.PriorityClasses;
@@ -352,7 +353,7 @@ public class InterceptorsManager
if(!annotatedType.isAnnotationPresent(javax.interceptor.Interceptor.class) &&
!containsCustomInterceptorClass(interceptorClass))
{
- throw new WebBeansConfigurationException("Given class : " +
interceptorClass + " is not a interceptor class");
+ throw new WebBeansDeploymentException("Given class : " +
interceptorClass + " is not a interceptor class");
}
}
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java?rev=1663887&r1=1663886&r2=1663887&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
Wed Mar 4 08:38:18 2015
@@ -24,7 +24,6 @@ import javax.enterprise.inject.spi.After
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
-import javax.enterprise.inject.spi.DefinitionException;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.Interceptor;
import javax.enterprise.inject.spi.ObserverMethod;
@@ -35,6 +34,7 @@ import org.apache.webbeans.component.Man
import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.intercept.InterceptorsManager;
import org.apache.webbeans.logger.WebBeansLoggerFacade;
import org.apache.webbeans.portable.events.generics.GProcessBean;
@@ -163,7 +163,7 @@ public class AfterBeanDiscoveryImpl impl
}
if (!found)
{
- throw new DefinitionException("Decorators must have a one
@Delegate injection point. " +
+ throw new WebBeansConfigurationException("Decorators must have
a one @Delegate injection point. " +
"But the decorator bean : " + managedBean.toString() +
" has more than one");
}