harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Wu (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2941) [classlib][luni]No exception was thrown when parseURL with limit = Integer.MIN_VALUE
Date Fri, 05 Jan 2007 05:16:27 GMT
[classlib][luni]No exception was thrown when parseURL with limit = Integer.MIN_VALUE
------------------------------------------------------------------------------------

                 Key: HARMONY-2941
                 URL: https://issues.apache.org/jira/browse/HARMONY-2941
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Tony Wu


RI throws exception in following testcase whereas harmony return silently

public class URLStreamHandlerTest  extends TestCase

static class MyURLStreamHandler extends URLStreamHandler {

        @Override
        protected URLConnection openConnection(URL arg0) throws IOException {
            return null;
        }

        public void parse(URL url, String spec, int start, int end) {
            parseURL(url, spec, start, end);
            // setURL(url, "http", "www.intel.com", 100, "a", "b", "/path",
            // "par",
            // "ref");
        }
    }

    static class MyURLStreamHandlerFactory implements URLStreamHandlerFactory {

        public static MyURLStreamHandler handler = new MyURLStreamHandler();

        public URLStreamHandler createURLStreamHandler(String arg0) {
            handler = new MyURLStreamHandler();
            return handler;
        }

    }

    public void test_parseURL() throws MalformedURLException {
        URL.setURLStreamHandlerFactory(new MyURLStreamHandlerFactory());
        URL url = new URL("http://localhost");
        MyURLStreamHandler handler = MyURLStreamHandlerFactory.handler;
        try {
            handler.parse(url, "//", 0, Integer.MIN_VALUE);
            fail("Should throw SIOOBE.");
        } catch (StringIndexOutOfBoundsException e) {
            // expected;
        }
    }

}

-- 
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