harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6206) [classlib][beans] java.beans.EventSetDescriptor(String, Class<?> , MethodDescriptor[], Method, Method) throws a NullPointerException while RI doesn't
Date Tue, 12 May 2009 13:55:45 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708439#action_12708439
] 

Tim Ellison commented on HARMONY-6206:
--------------------------------------

What is the purpose of EventSetDescriptor.java:180 (the line where the exception is thrown)?

It looks like a deliberate attempt to force a NullPointerException since the return value
is ignored...

179: for (MethodDescriptor element : listenerMethodDescriptors) {
180: element.getMethod();
181: this.listenerMethodDescriptors.add(element);
182: }

yet it appears that the RI stores the nulls...

    public static void main(String[] args) throws Exception {
        EventSetDescriptor eventSetDescriptor = new EventSetDescriptor(
                (String) null, (Class<?>) null, new MethodDescriptor[] { null,
                        null }, (Method) null, (Method) null);
  
        System.out.println(eventSetDescriptor.getListenerMethodDescriptors());
        for (MethodDescriptor md : eventSetDescriptor.getListenerMethodDescriptors()) {
            System.out.println(md);
        }
    }

I propose we just remove line 180. What do you think?

> [classlib][beans] java.beans.EventSetDescriptor(String, Class<?> , MethodDescriptor[],
Method, Method) throws a NullPointerException while RI doesn't

> -------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6206
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6206
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M9
>            Reporter: Kevin Zhou
>             Fix For: 5.0M10
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Given a test case [1], it throws a java.lang.NullPointerException on HARMONY but successfully
creates a EventSetDescriptor object on RI.
> [1] Test Case:
> public void test_EventSetDescriptor_Constructor() throws Exception {
>     EventSetDescriptor eventSetDescriptor = new EventSetDescriptor((String) null, (Class<?>)
null, new MethodDescriptor[] { null, null }, (Method) null, (Method) null);
> }
> [2] 
> java.lang.NullPointerException
> at java.beans.EventSetDescriptor.<init>(EventSetDescriptor.java:180)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message