You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@onami.apache.org by ma...@apache.org on 2013/01/03 00:53:48 UTC
svn commit: r1428115 -
/incubator/onami/trunk/test/src/main/java/org/apache/onami/test/handler/GuiceProvidedModuleHandler.java
Author: marcosperanza
Date: Wed Jan 2 23:53:48 2013
New Revision: 1428115
URL: http://svn.apache.org/viewvc?rev=1428115&view=rev
Log:
[ONAMI-35] Incomplete logging message in GuiceProvidedModuleHandler#handle()
Added throw ClassCastException if there is an incompatible return type.
Modified:
incubator/onami/trunk/test/src/main/java/org/apache/onami/test/handler/GuiceProvidedModuleHandler.java
Modified: incubator/onami/trunk/test/src/main/java/org/apache/onami/test/handler/GuiceProvidedModuleHandler.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/test/src/main/java/org/apache/onami/test/handler/GuiceProvidedModuleHandler.java?rev=1428115&r1=1428114&r2=1428115&view=diff
==============================================================================
--- incubator/onami/trunk/test/src/main/java/org/apache/onami/test/handler/GuiceProvidedModuleHandler.java (original)
+++ incubator/onami/trunk/test/src/main/java/org/apache/onami/test/handler/GuiceProvidedModuleHandler.java Wed Jan 2 23:53:48 2013
@@ -69,7 +69,14 @@ public final class GuiceProvidedModuleHa
if ( logger.isLoggable( Level.FINER ) )
{
logger.finer( " Found " + GuiceProvidedModules.class.getSimpleName()
- + " annotated method, checking if return type '" + returnType.getName() + "' is one of (''|''|'')..." );
+ + " annotated method, checking if return type '" + returnType.getName() + "' is one of "
+ + " ('"
+ + Module.class.getName()
+ + "' | '"
+ + "Iterable<" + Module.class.getName() + ">"
+ + "' | '"
+ + Module.class.getName() + "[]" +
+ "' )");
}
if ( !Modifier.isPublic( method.getModifiers() ) || !Modifier.isStatic( method.getModifiers() ) )
@@ -97,16 +104,27 @@ public final class GuiceProvidedModuleHa
{
addModules( (Module[]) method.invoke( type ) );
}
+ else
+ {
+ throw new ClassCastException("Incompatible return type: '" + returnType.getName() + "' of method '"
+ + method.getName() + "'. \nThe return type must be one of "
+ + " ('"
+ + Module.class.getName()
+ + "' | '"
+ + "Iterable<" + Module.class.getName() + ">"
+ + "' | '"
+ + Module.class.getName() + "[]" +
+ "' )" );
+ }
+
+ if ( logger.isLoggable( Level.FINER ) )
+ {
+ logger.finer( " Invoked method: " + method.toGenericString() );
+ }
}
catch ( Exception e )
{
- throw new HandleException( "Error invoking method: " + method + "please make sure it is static and public",
- e );
- }
-
- if ( logger.isLoggable( Level.FINER ) )
- {
- logger.finer( " Invoked method: " + method.toGenericString() );
+ throw new HandleException( e );
}
}
@@ -125,5 +143,4 @@ public final class GuiceProvidedModuleHa
this.modules.add( module );
}
}
-
}