Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-2941

[classlib][luni]No exception was thrown when parseURL with limit = Integer.MIN_VALUE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • Classlib
    • None
    • Patch Available

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

      }

      }

      Attachments

        1. harmony-2941.diff
          3 kB
          Tony Wu

        Activity

          People

            tellison Tim Ellison
            tony.wu Tony Wu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: