[ https://issues.apache.org/jira/browse/HARMONY-2941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tony Wu updated HARMONY-2941:
-----------------------------
Description:
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);
}
}
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;
}
}
}
was:
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;
}
}
}
> [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);
> }
> }
> 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
|