[weld-commits] Weld SVN: r4781 - in core/trunk/impl/src/main: java/org/jboss/weld/bean and 2 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Sun Nov 8 10:55:43 EST 2009
Author: dallen6
Date: 2009-11-08 10:55:42 -0500 (Sun, 08 Nov 2009)
New Revision: 4781
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java
core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
Log:
Added new localized message constructors to DeploymentException and converted all exceptions in AbstractClassBean.
Modified: core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2009-11-08 14:59:39 UTC (rev 4780)
+++ core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2009-11-08 15:55:42 UTC (rev 4781)
@@ -16,6 +16,9 @@
*/
package org.jboss.weld;
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
/**
* Thrown if an deployment exception occurs.
*
@@ -25,11 +28,24 @@
{
private static final long serialVersionUID = 8014646336322875707L;
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
public DeploymentException()
{
super();
}
+ public <E extends Enum<?>> DeploymentException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
+ public <E extends Enum<?>> DeploymentException(E key, Throwable throwable, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args), throwable);
+ }
+
public DeploymentException(String message, Throwable throwable)
{
super(message, throwable);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2009-11-08 14:59:39 UTC (rev 4780)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2009-11-08 15:55:42 UTC (rev 4781)
@@ -18,9 +18,13 @@
import static org.jboss.weld.logging.Category.BEAN;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import static org.jboss.weld.logging.messages.BeanMessage.CONFLICTING_INTERCEPTOR_BINDINGS;
+import static org.jboss.weld.logging.messages.BeanMessage.INVOCATION_ERROR;
import static org.jboss.weld.logging.messages.BeanMessage.NON_CONTAINER_DECORATOR;
+import static org.jboss.weld.logging.messages.BeanMessage.ONLY_ONE_SCOPE_ALLOWED;
import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_BEAN_ACCESS_FAILED;
import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_FAILED;
+import static org.jboss.weld.logging.messages.BeanMessage.SPECIALIZING_BEAN_MUST_EXTEND_A_BEAN;
import static org.jboss.weld.logging.messages.BeanMessage.USING_DEFAULT_SCOPE;
import static org.jboss.weld.logging.messages.BeanMessage.USING_SCOPE;
@@ -57,9 +61,6 @@
import org.jboss.weld.bean.proxy.DecoratorProxyMethodHandler;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.context.SerializableContextualImpl;
-import org.jboss.weld.bean.proxy.DecoratorProxyMethodHandler;
-import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
-import org.jboss.weld.context.SerializableContextualImpl;
import org.jboss.weld.context.SerializableContextualInstanceImpl;
import org.jboss.weld.ejb.EJBApiAbstraction;
import org.jboss.weld.injection.FieldInjectionPoint;
@@ -293,7 +294,7 @@
}
else if (scopeTypes.size() > 1)
{
- throw new DefinitionException("At most one scope may be specified on " + getAnnotatedItem());
+ throw new DefinitionException(ONLY_ONE_SCOPE_ALLOWED, getAnnotatedItem());
}
}
@@ -320,7 +321,7 @@
super.preSpecialize(environment);
if (getAnnotatedItem().getWeldSuperclass() == null || getAnnotatedItem().getWeldSuperclass().getJavaClass().equals(Object.class))
{
- throw new DefinitionException("Specializing bean must extend another bean " + toString());
+ throw new DefinitionException(SPECIALIZING_BEAN_MUST_EXTEND_A_BEAN, this);
}
}
@@ -441,7 +442,7 @@
if (classBindingAnnotations.size() > 0)
{
if (Beans.findInterceptorBindingConflicts(manager, classBindingAnnotations))
- throw new DeploymentException("Conflicting interceptor bindings found on " + getType());
+ throw new DeploymentException(CONFLICTING_INTERCEPTOR_BINDINGS, getType());
Annotation[] classBindingAnnotationsArray = classBindingAnnotations.toArray(new Annotation[0]);
@@ -466,7 +467,7 @@
if (methodBindingAnnotations.size() > 0)
{
if (Beans.findInterceptorBindingConflicts(manager, classBindingAnnotations))
- throw new DeploymentException("Conflicting interceptor bindings found on " + getType() + "." + method.getName() + "()");
+ throw new DeploymentException(CONFLICTING_INTERCEPTOR_BINDINGS, getType() + "." + method.getName() + "()");
if (method.isAnnotationPresent(manager.getServices().get(EJBApiAbstraction.class).TIMEOUT_ANNOTATION_CLASS))
{
@@ -517,7 +518,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Unable to invoke " + preDestroy + " on " + instance, e);
+ throw new WeldException(INVOCATION_ERROR, e, preDestroy, instance);
}
}
}
@@ -533,7 +534,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Unable to invoke " + postConstruct + " on " + instance, e);
+ throw new WeldException(INVOCATION_ERROR, e, postConstruct, instance);
}
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java 2009-11-08 14:59:39 UTC (rev 4780)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java 2009-11-08 15:55:42 UTC (rev 4781)
@@ -63,6 +63,10 @@
@MessageId("000042") NON_CONTAINER_DECORATOR,
@MessageId("000043") BEAN_NOT_EE_RESOURCE_PRODUCER,
@MessageId("000044") NULL_INSTANCE,
- @MessageId("000045") PROXY_REQUIRED
+ @MessageId("000045") PROXY_REQUIRED,
+ @MessageId("000046") ONLY_ONE_SCOPE_ALLOWED,
+ @MessageId("000047") SPECIALIZING_BEAN_MUST_EXTEND_A_BEAN,
+ @MessageId("000048") CONFLICTING_INTERCEPTOR_BINDINGS,
+ @MessageId("000049") INVOCATION_ERROR
}
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties 2009-11-08 14:59:39 UTC (rev 4780)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties 2009-11-08 15:55:42 UTC (rev 4781)
@@ -44,3 +44,7 @@
NAME_NOT_ALLOWED_ON_SPECIALIZATION=Cannot put name on specializing and specialized class {0}
INTERCEPTION_TYPE_NOT_LIFECYCLE=InterceptionType must be lifecycle, but it is {0}
PROXY_REQUIRED=Proxy required
+ONLY_ONE_SCOPE_ALLOWED=At most one scope may be specified on {0}
+SPECIALIZING_BEAN_MUST_EXTEND_A_BEAN=Specializing bean must extend another bean\: {0}
+CONFLICTING_INTERCEPTOR_BINDINGS=Conflicting interceptor bindings found on {0}
+INVOCATION_ERROR=Unable to invoke {0} on {1}
More information about the weld-commits
mailing list