You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Donald <pe...@realityforge.org> on 2002/12/03 11:02:51 UTC

Re: cvs commit: jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/handler ProxyHelper.java

oops - thanks. Should actually test the code before I send patch - eh ? :)

On Tue, 3 Dec 2002 13:21, proyal@apache.org wrote:
> proyal      2002/12/02 18:21:02
>
>   Modified:    fortress/src/java/org/apache/excalibur/fortress/handler
>                         ProxyHelper.java
>   Log:
>   Fix NPE in unit tests. Class.getSuperClass() can return null in
>   some instances
>
>   Revision  Changes    Path
>   1.4       +19 -16   
> jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/ha
>ndler/ProxyHelper.java
>
>   Index: ProxyHelper.java
>   ===================================================================
>   RCS file:
> /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/f
>ortress/handler/ProxyHelper.java,v retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- ProxyHelper.java	3 Dec 2002 01:34:09 -0000	1.3
>   +++ ProxyHelper.java	3 Dec 2002 02:21:02 -0000	1.4
>   @@ -169,32 +169,35 @@
>         * (as defined in {@link #INVALID_INTERFACES}).
>         *
>         * @param clazz the class
>   -     * @param list the list of current work interfaces
>   +     * @param list the list of current work interfaces
>         */
>        private static void guessWorkInterfaces( final Class clazz,
>                                                 final ArrayList list )
>        {
>   -        final Class[] interfaces = clazz.getInterfaces();
>   -
>   -        boolean skip = false;
>   -        for( int i = 0; i < interfaces.length; i++ )
>   +        if( null != clazz )
>            {
>   -            skip = false;
>   -            for( int j = 0; j < INVALID_INTERFACES.length; j++ )
>   +            final Class[] interfaces = clazz.getInterfaces();
>   +
>   +            boolean skip = false;
>   +            for( int i = 0; i < interfaces.length; i++ )
>                {
>   -                if( interfaces[ i ] == INVALID_INTERFACES[ j ] )
>   +                skip = false;
>   +                for( int j = 0; j < INVALID_INTERFACES.length; j++ )
>                    {
>   -                    skip = true;
>   -                    continue;
>   +                    if( interfaces[ i ] == INVALID_INTERFACES[ j ] )
>   +                    {
>   +                        skip = true;
>   +                        continue;
>   +                    }
>                    }
>   -            }
>
>   -            if( !skip )
>   -            {
>   -                list.add( interfaces[ i ] );
>   +                if( !skip )
>   +                {
>   +                    list.add( interfaces[ i ] );
>   +                }
>                }
>   -        }
>
>   -        guessWorkInterfaces( clazz.getSuperclass(),list );
>   +            guessWorkInterfaces( clazz.getSuperclass(), list );
>   +        }
>        }
>    }

-- 
Cheers,

Peter Donald
-------------------------------------------------------------
|  Egoism is the drug that soothes the pain of stupidity.   |
------------------------------------------------------------- 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>