You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Will Scheidegger (JIRA)" <ji...@apache.org> on 2011/08/22 12:45:29 UTC

[jira] [Updated] (OCM-45) ReflectionUtils.implementsInterface() only checks one interface and returns

     [ https://issues.apache.org/jira/browse/OCM-45?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will Scheidegger updated OCM-45:
--------------------------------

    Description: 
When checking the interface of the provided class the method always returns after checking the first interface. The loop which should run over all interfaces has an fixed "return" statement. The attached patch has fixed the problem for me.

Hm... can't see how to attach the patch file, so here goes copy&paste:


# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -219,10 +219,9 @@
 		if (clazz.getInterfaces() != null  )
 		{
 		   for ( Class foundInterface : clazz.getInterfaces() ) {
-			   if ( foundInterface == interfaceClass ) {
+			   if ( foundInterface == interfaceClass || implementsInterface(foundInterface, interfaceClass)) {
 				  return true;
 			   }
-			   return implementsInterface(foundInterface, interfaceClass) ;
 		   }
 		}
 		// Try to find from the ancestors


  was:When checking the interface of the provided class the method always returns after checking the first interface. The loop which should run over all interfaces has an fixed "return" statement. The attached patch has fixed the problem for me.


> ReflectionUtils.implementsInterface() only checks one interface and returns
> ---------------------------------------------------------------------------
>
>                 Key: OCM-45
>                 URL: https://issues.apache.org/jira/browse/OCM-45
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>    Affects Versions: 1.6.0
>            Reporter: Will Scheidegger
>              Labels: patch, reflection
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> When checking the interface of the provided class the method always returns after checking the first interface. The loop which should run over all interfaces has an fixed "return" statement. The attached patch has fixed the problem for me.
> Hm... can't see how to attach the patch file, so here goes copy&paste:
> # This patch file was generated by NetBeans IDE
> # It uses platform neutral UTF-8 encoding and \n newlines.
> --- Base (BASE)
> +++ Locally Modified (Based On LOCAL)
> @@ -219,10 +219,9 @@
>  		if (clazz.getInterfaces() != null  )
>  		{
>  		   for ( Class foundInterface : clazz.getInterfaces() ) {
> -			   if ( foundInterface == interfaceClass ) {
> +			   if ( foundInterface == interfaceClass || implementsInterface(foundInterface, interfaceClass)) {
>  				  return true;
>  			   }
> -			   return implementsInterface(foundInterface, interfaceClass) ;
>  		   }
>  		}
>  		// Try to find from the ancestors

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira