myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Marinschek (JIRA)" <myfaces-...@incubator.apache.org>
Subject [jira] Closed: (MYFACES-576) NPE in PropertyResolverImpl.getType if the array is initilized without values
Date Sat, 17 Sep 2005 20:27:59 GMT
     [ http://issues.apache.org/jira/browse/MYFACES-576?page=all ]
     
Martin Marinschek closed MYFACES-576:
-------------------------------------

    Resolution: Fixed

Thanks to Udo Schnurpfeil for this patch

> NPE in PropertyResolverImpl.getType if the array is initilized without values
> -----------------------------------------------------------------------------
>
>          Key: MYFACES-576
>          URL: http://issues.apache.org/jira/browse/MYFACES-576
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: Nightly Build
>  Environment: e.g. svn reversion 289586
>     Reporter: Udo Schnurpfeil
>     Assignee: Martin Marinschek
>     Priority: Minor

>
> In the current version I get a NullPointerException in line 311
> when I have a String[] which is initilized, but has no values
> like: String[] base = new String[5];
> current:
>     if (base.getClass().isArray())
>     {
>         if (base instanceof Object[]) {
>             Object[] array = (Object[]) base;
>             return array[index].getClass().getComponentType();
>         } else {
>             return base.getClass().getComponentType();
>         }
>     }
> my proposal:
>     if (base.getClass().isArray())
>     {
>         if (base instanceof Object[] && ((Object[])base)[index] != null) {
>             Object[] array = (Object[]) base;
>             return array[index].getClass().getComponentType();
>         } else {
>             return base.getClass().getComponentType();
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message