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 2009/07/01 17:13:47 UTC

[jira] Closed: (HARMONY-6254) [classlib][luni] URLStreamHandler throws NPE when creating external form

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

Tim Ellison closed HARMONY-6254.
--------------------------------


> [classlib][luni] URLStreamHandler throws NPE when creating external form
> ------------------------------------------------------------------------
>
>                 Key: HARMONY-6254
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6254
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M10
>            Reporter: Tim Ellison
>            Assignee: Tim Ellison
>             Fix For: 5.0M11
>
>         Attachments: harmony-6254.patch
>
>
> The following test fails on Harmony M10 but passes on the RI
> public class URLTest {
>     // Bogus handler forces file part of URL to be null
>     static class MyHandler extends URLStreamHandler {
>         @Override
>         protected URLConnection openConnection(URL arg0) throws IOException {
>             return null;
>         }
>         @Override
>         protected void setURL(URL u, String protocol, String host, int port,
>                 String authority, String userInfo, String file, String query,
>                 String ref) {
>             super.setURL(u, protocol, host, port, authority, userInfo,
>                     (String) null, query, ref);
>         }
>     }
>     public static void main(String[] args) throws IOException {
>         URLStreamHandler myHandler = new MyHandler();
>         URL url = new URL(null, "foobar://example.com/foobar", myHandler);
>         String s = url.toExternalForm();
>         System.out.println(s);
>     }
> }
> The RI prints out:
> foobar://example.com
> but Harmony M10 prints out:
> Uncaught exception in main:
> Caused by: java.lang.NullPointerException
>         at java.net.URLStreamHandler.toExternalForm(URLStreamHandler.java:309)
>         at java.net.URL.toExternalForm(URL.java:728)
>         at URLTest.main(URLTest.java:28)
>         at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
>         ... 2 more

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