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] Created: (HARMONY-6254) [classlib][luni] URLStreamHandler throws NPE when creating external form
Date Wed, 01 Jul 2009 14:19:47 GMT
[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


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.


Mime
View raw message