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] Resolved: (HARMONY-2478) [classlib][net]ContentHandler.getContent(Class[]) determines returned object incorrectly
Date Thu, 11 Jan 2007 22:04:27 GMT

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

Tim Ellison resolved HARMONY-2478.
----------------------------------

    Resolution: Fixed

Cool, thanks Mikhail / Tony.

Patch applied to LUNI module at repo revision r495398.

Please verify.



> [classlib][net]ContentHandler.getContent(Class[]) determines returned object incorrectly
> ----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2478
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2478
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Nikolay Kuznetsov
>         Assigned To: Tim Ellison
>         Attachments: ContentHandler.patch, harmony-2478.diff, test.java
>
>
> The attached test(which queries new URL("http://www.intel.com").getContent({ Object.class
})) fails to return content type properly as RI does:
> RI:
> java test
> content= sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@1b65ab
> Harmony:
> ./java test
> content= null
> Content is null
> While getContent(_void_) method returns org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection$LimitedInputStream@2061b4bc
> The problem here is that in HARMONY implmentation of ContentHandler.getContent(Class[])
uses reference equality to determine returned object instead of instanceof operator, while
specification reads that:
> "The instanceof operator should be used to determine the specific kind of object returned".
> see code sample from ContentHandlers below.
> public Object getContent(URLConnection uConn, Class[] types)
>             throws IOException {
>         Object content = getContent(uConn);
>         Class<?> cl = content.getClass();
>         for (int i = 0; i < types.length; i++) {
>             if (cl == types[i]) { //ERROR HERE isInstance should be used !!!
>                 return content;
>             }
>         }
>         return null;
>     }

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

        

Mime
View raw message