harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svetlana Samoilenko (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-402) java.beans.Beans.InstanceOf(Object bean,Class targetType) method works incorrectly
Date Mon, 24 Apr 2006 12:43:06 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-402?page=all ]

Svetlana Samoilenko updated HARMONY-402:
----------------------------------------

    Attachment: Beans.diffs

Unit test is coming.

> java.beans.Beans.InstanceOf(Object bean,Class targetType) method works incorrectly
> ----------------------------------------------------------------------------------
>
>          Key: HARMONY-402
>          URL: http://issues.apache.org/jira/browse/HARMONY-402
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Svetlana Samoilenko
>  Attachments: Beans.diffs
>
> Accodring to java 1.4.2 and 1.5 specifications  java.beans.Beans.InstanceOf(Object bean,Class
targetType) method returns "true" if the given bean supports the given targetType.
> As a result  isInstanceOf(Object bean, null) should return false.
> Harmony throws NPE in this case and returns false for correct non-null targetType.
>  
> Code for reproduce: 
> Put ObjectBean class in the same directory as the test.
> import java.beans.Beans; 
> import java.io.*; 
>  
> public class test { 
>     public static void main(String[] args) { 
>              ObjectBean bean = new ObjectBean();
>  
>              try {
>                  Class targetType = Externalizable.class;
>                  //correct non-null targetType
>                  System.out.println("***"+Beans.isInstanceOf(bean, targetType));    
               
>              } catch (Exception e) {
>                  e.printStackTrace();   
>              }
>              
>              try {
>                  Class targetType = null;
>                  // null targetType
>                  System.out.println("***"+Beans.isInstanceOf(bean, targetType));
>              } catch (Exception e) {
>                  e.printStackTrace();   
>              } 
>        } 
> } 
>  
> class ObjectBean implements Externalizable {
>     public void writeExternal(ObjectOutput out) {}; 
>     public void readExternal(ObjectInput in){};
> }
> Harmony output: 
> ***false
> java.lang.NullPointerException
>         at java.lang.Class.isAssignableFrom(Native Method)
>         at java.beans.Beans.isInstanceOf(Beans.java:147)
>         at test.main(test.java:18)
> BEA optput: 
> ***true
> ***false
>  

-- 
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