You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Catherine Hope (JIRA)" <ji...@apache.org> on 2010/04/16 16:58:35 UTC

[jira] Created: (HARMONY-6499) [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases

[classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases
-----------------------------------------------------------------------------------------

                 Key: HARMONY-6499
                 URL: https://issues.apache.org/jira/browse/HARMONY-6499
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Catherine Hope


java.net.URLStreamHandler throws a SecurityException in some situations where the RI will throw a StringIndexOutOfBoundsException.  From experimenting with test cases I think the RI is checking bounds as it parses the URL and not up front, which causes some inconsistent behaviour.  There's already one work-around added to this method in order to make it more compatible (HARMONY-2941)

The following all throw SecurityExceptions on Harmony (when called with a handler that is not the URL's protocol handler) where they throw StringIndexOutOfBoundsExceptions on the RI:
handler.parse(url, "any", 10, Integer.MIN_VALUE);
handler.parse(url, "any", 10, Integer.MIN_VALUE+1);
handler.parse(url, "any", Integer.MIN_VALUE, Integer.MIN_VALUE);
handler.parse(url, "any", Integer.MIN_VALUE, 2);



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

        

[jira] Commented: (HARMONY-6499) [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878972#action_12878972 ] 

Hudson commented on HARMONY-6499:
---------------------------------

Integrated in Harmony-1.5-head-linux-x86_64 #856 (See [http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/856/])
    Apply (slightly reformatted) patch for HARMONY-6499 ([classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases)


> [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6499
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6499
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Catherine Hope
>            Assignee: Tim Ellison
>             Fix For: 5.0M15
>
>         Attachments: 6499-2.patch, 6499.patch
>
>
> java.net.URLStreamHandler throws a SecurityException in some situations where the RI will throw a StringIndexOutOfBoundsException.  From experimenting with test cases I think the RI is checking bounds as it parses the URL and not up front, which causes some inconsistent behaviour.  There's already one work-around added to this method in order to make it more compatible (HARMONY-2941)
> The following all throw SecurityExceptions on Harmony (when called with a handler that is not the URL's protocol handler) where they throw StringIndexOutOfBoundsExceptions on the RI:
> handler.parse(url, "any", 10, Integer.MIN_VALUE);
> handler.parse(url, "any", 10, Integer.MIN_VALUE+1);
> handler.parse(url, "any", Integer.MIN_VALUE, Integer.MIN_VALUE);
> handler.parse(url, "any", Integer.MIN_VALUE, 2);

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


[jira] Closed: (HARMONY-6499) [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases

Posted by "Catherine Hope (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catherine Hope closed HARMONY-6499.
-----------------------------------


Verified, thanks

> [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6499
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6499
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Catherine Hope
>            Assignee: Tim Ellison
>             Fix For: 5.0M15
>
>         Attachments: 6499-2.patch, 6499.patch
>
>
> java.net.URLStreamHandler throws a SecurityException in some situations where the RI will throw a StringIndexOutOfBoundsException.  From experimenting with test cases I think the RI is checking bounds as it parses the URL and not up front, which causes some inconsistent behaviour.  There's already one work-around added to this method in order to make it more compatible (HARMONY-2941)
> The following all throw SecurityExceptions on Harmony (when called with a handler that is not the URL's protocol handler) where they throw StringIndexOutOfBoundsExceptions on the RI:
> handler.parse(url, "any", 10, Integer.MIN_VALUE);
> handler.parse(url, "any", 10, Integer.MIN_VALUE+1);
> handler.parse(url, "any", Integer.MIN_VALUE, Integer.MIN_VALUE);
> handler.parse(url, "any", Integer.MIN_VALUE, 2);

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


[jira] Commented: (HARMONY-6499) [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878959#action_12878959 ] 

Hudson commented on HARMONY-6499:
---------------------------------

Integrated in Harmony-select-1.5-head-linux-x86_64 #35 (See [http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/35/])
    Apply (slightly reformatted) patch for HARMONY-6499 ([classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases)


> [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6499
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6499
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Catherine Hope
>            Assignee: Tim Ellison
>             Fix For: 5.0M15
>
>         Attachments: 6499-2.patch, 6499.patch
>
>
> java.net.URLStreamHandler throws a SecurityException in some situations where the RI will throw a StringIndexOutOfBoundsException.  From experimenting with test cases I think the RI is checking bounds as it parses the URL and not up front, which causes some inconsistent behaviour.  There's already one work-around added to this method in order to make it more compatible (HARMONY-2941)
> The following all throw SecurityExceptions on Harmony (when called with a handler that is not the URL's protocol handler) where they throw StringIndexOutOfBoundsExceptions on the RI:
> handler.parse(url, "any", 10, Integer.MIN_VALUE);
> handler.parse(url, "any", 10, Integer.MIN_VALUE+1);
> handler.parse(url, "any", Integer.MIN_VALUE, Integer.MIN_VALUE);
> handler.parse(url, "any", Integer.MIN_VALUE, 2);

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


[jira] Updated: (HARMONY-6499) [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases

Posted by "Catherine Hope (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catherine Hope updated HARMONY-6499:
------------------------------------

    Attachment: 6499-2.patch

Found another corner case for the parseURL method (when end index is less than 0 don't perform bounds checks), so use this patch instead of the earlier one.

> [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6499
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6499
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Catherine Hope
>         Attachments: 6499-2.patch, 6499.patch
>
>
> java.net.URLStreamHandler throws a SecurityException in some situations where the RI will throw a StringIndexOutOfBoundsException.  From experimenting with test cases I think the RI is checking bounds as it parses the URL and not up front, which causes some inconsistent behaviour.  There's already one work-around added to this method in order to make it more compatible (HARMONY-2941)
> The following all throw SecurityExceptions on Harmony (when called with a handler that is not the URL's protocol handler) where they throw StringIndexOutOfBoundsExceptions on the RI:
> handler.parse(url, "any", 10, Integer.MIN_VALUE);
> handler.parse(url, "any", 10, Integer.MIN_VALUE+1);
> handler.parse(url, "any", Integer.MIN_VALUE, Integer.MIN_VALUE);
> handler.parse(url, "any", Integer.MIN_VALUE, 2);

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


[jira] Updated: (HARMONY-6499) [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases

Posted by "Catherine Hope (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catherine Hope updated HARMONY-6499:
------------------------------------

    Attachment: 6499.patch

Attached patch changes the parseURL method as follows:
- if the end index is less than the start index - make additional compatibility checks and throw StringIndexOufOfBoundsException if required, then make security check
- otherwise call String.substring method and parse the URL

I've moved the existing compatibility check into the first conditional so it's a bit more efficient, though it is still an ugly workaround.  I did try doing the bounds checks as the URL was parsed but it was even harder to match behaviour.

> [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6499
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6499
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Catherine Hope
>         Attachments: 6499.patch
>
>
> java.net.URLStreamHandler throws a SecurityException in some situations where the RI will throw a StringIndexOutOfBoundsException.  From experimenting with test cases I think the RI is checking bounds as it parses the URL and not up front, which causes some inconsistent behaviour.  There's already one work-around added to this method in order to make it more compatible (HARMONY-2941)
> The following all throw SecurityExceptions on Harmony (when called with a handler that is not the URL's protocol handler) where they throw StringIndexOutOfBoundsExceptions on the RI:
> handler.parse(url, "any", 10, Integer.MIN_VALUE);
> handler.parse(url, "any", 10, Integer.MIN_VALUE+1);
> handler.parse(url, "any", Integer.MIN_VALUE, Integer.MIN_VALUE);
> handler.parse(url, "any", Integer.MIN_VALUE, 2);

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

        

[jira] Resolved: (HARMONY-6499) [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison resolved HARMONY-6499.
----------------------------------

         Assignee: Tim Ellison
    Fix Version/s: 5.0M15
       Resolution: Fixed

Thanks Cath,

I applied a slightly reformatted version of the patch to the LUNI module at repo revision r954849.

I think we are pushing the bounds of RI compatibility here.  I applied it since it is a small change to the compatibility changes already in place, but am left wondering how far this might go ;-/

Please verify it was applied as you expected.



> [classlib][luni] URLStreamHandler.parseURL throws different exception to RI in some cases
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6499
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6499
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Catherine Hope
>            Assignee: Tim Ellison
>             Fix For: 5.0M15
>
>         Attachments: 6499-2.patch, 6499.patch
>
>
> java.net.URLStreamHandler throws a SecurityException in some situations where the RI will throw a StringIndexOutOfBoundsException.  From experimenting with test cases I think the RI is checking bounds as it parses the URL and not up front, which causes some inconsistent behaviour.  There's already one work-around added to this method in order to make it more compatible (HARMONY-2941)
> The following all throw SecurityExceptions on Harmony (when called with a handler that is not the URL's protocol handler) where they throw StringIndexOutOfBoundsExceptions on the RI:
> handler.parse(url, "any", 10, Integer.MIN_VALUE);
> handler.parse(url, "any", 10, Integer.MIN_VALUE+1);
> handler.parse(url, "any", Integer.MIN_VALUE, Integer.MIN_VALUE);
> handler.parse(url, "any", Integer.MIN_VALUE, 2);

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