Author: simonetripodi
Date: Tue Jan 26 11:00:17 2010
New Revision: 903167

URL: http://svn.apache.org/viewvc?rev=903167&view=rev
Log:
runtime errors are now handled by custom DigesterLoadingException

Modified:
    
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
    
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java
    
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/utils/AnnotationRuleProviderUtils.java

Modified: 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java?rev=903167&r1=903166&r2=903167&view=diff
==============================================================================
--- 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
 (original)
+++ 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
 Tue Jan 26 11:00:17 2010
@@ -197,7 +197,7 @@
                     handler = (DigesterLoaderHandler<Annotation, 
AnnotatedElement>) digesterRule.handledBy().newInstance();
                     CACHED_HANDLERS.put(digesterRule.handledBy(), handler);
                 } catch (Throwable t) {
-                    throw new RuntimeException("Impossible to instance handler 
of type '"
+                    throw new DigesterLoadingException("Impossible to instance 
handler of type '"
                             + digesterRule.handledBy().getName()
                             + "', see nested exceptions", t);
                 }

Modified: 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java?rev=903167&r1=903166&r2=903167&view=diff
==============================================================================
--- 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java
 (original)
+++ 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java
 Tue Jan 26 11:00:17 2010
@@ -23,6 +23,7 @@
 import org.apache.commons.digester.annotations.CreationRule;
 import org.apache.commons.digester.annotations.DigesterLoader;
 import org.apache.commons.digester.annotations.DigesterLoaderHandler;
+import org.apache.commons.digester.annotations.DigesterLoadingException;
 import org.apache.commons.digester.annotations.DigesterRule;
 import org.apache.commons.digester.annotations.DigesterRuleList;
 import org.apache.commons.digester.annotations.FromAnnotationsRuleSet;
@@ -52,7 +53,7 @@
         if (SUPPORTED_ARGS != element.getParameterTypes().length) {
             DigesterRule rule = 
annotation.annotationType().getAnnotation(DigesterRule.class);
 
-            throw new IllegalArgumentException("Methods annotated with 
digester annotation rule @"
+            throw new DigesterLoadingException("Methods annotated with 
digester annotation rule @"
                     + rule.reflectsRule().getName()
                     + " must have just one argument");
         }
@@ -61,7 +62,7 @@
         if (explicitTypesObject == null
                 || !explicitTypesObject.getClass().isArray()
                 || Class.class != 
explicitTypesObject.getClass().getComponentType()) {
-            throw new IllegalArgumentException("Impossible to apply this 
handler, @"
+            throw new DigesterLoadingException("Impossible to apply this 
handler, @"
                     + annotation.getClass().getName()
                     + ".value() has to be of type 'Class<?>[]'");
         }
@@ -72,7 +73,7 @@
         if (explicitTypes.length > 0) {
             for (Class<?> explicitType : explicitTypes) {
                 if (!paramType.isAssignableFrom(explicitType)) {
-                    throw new IllegalArgumentException("Impossible to handle 
annotation "
+                    throw new DigesterLoadingException("Impossible to handle 
annotation "
                             + annotation
                             + " on method "
                             + element.toGenericString()
@@ -92,7 +93,7 @@
     private void doHandle(Annotation methodAnnotation, Method method, Class<?> 
type, FromAnnotationsRuleSet ruleSet) {
         if (type.isInterface()
                 && Modifier.isAbstract(type.getModifiers())) {
-            throw new IllegalArgumentException("Impossible to proceed 
analyzing "
+            throw new DigesterLoadingException("Impossible to proceed 
analyzing "
                     + methodAnnotation
                     + ", specified type '"
                     + type.getName()

Modified: 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/utils/AnnotationRuleProviderUtils.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/utils/AnnotationRuleProviderUtils.java?rev=903167&r1=903166&r2=903167&view=diff
==============================================================================
--- 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/utils/AnnotationRuleProviderUtils.java
 (original)
+++ 
commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/utils/AnnotationRuleProviderUtils.java
 Tue Jan 26 11:00:17 2010
@@ -22,6 +22,7 @@
 import org.apache.commons.beanutils.ConstructorUtils;
 import org.apache.commons.digester.Rule;
 import org.apache.commons.digester.annotations.AnnotationRuleProvider;
+import org.apache.commons.digester.annotations.DigesterLoadingException;
 
 /**
  * Utilities class to manipulate the {...@link AnnotationRuleProvider} 
instances.
@@ -59,7 +60,7 @@
                     parameterTypes);
             return klass.cast(o);
         } catch (Throwable t) {
-            throw new RuntimeException("Impossible to instantiate provider of 
type '"
+            throw new DigesterLoadingException("Impossible to instantiate 
provider of type '"
                     + klass.getName()
                     + "', see nested exceptions", t);
         }


Reply via email to