You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2007/01/02 13:46:27 UTC
[jira] Assigned: (HARMONY-2478)
[classlib][net]ContentHandler.getContent(Class[]) determines returned
object incorrectly
[ http://issues.apache.org/jira/browse/HARMONY-2478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison reassigned HARMONY-2478:
------------------------------------
Assignee: Tim Ellison
> [classlib][net]ContentHandler.getContent(Class[]) determines returned object incorrectly
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-2478
> URL: http://issues.apache.org/jira/browse/HARMONY-2478
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Nikolay Kuznetsov
> Assigned To: Tim Ellison
> Attachments: 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: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira