You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Vladimir Strigun (JIRA)" <ji...@apache.org> on 2005/12/15 15:04:47 UTC

[jira] Created: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException

java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
------------------------------------------------------------------------------------

         Key: HARMONY-23
         URL: http://issues.apache.org/jira/browse/HARMONY-23
     Project: Harmony
        Type: Bug
  Components: Classlib  
    Reporter: Vladimir Strigun
 Assigned to: Geir Magnusson Jr 
    Priority: Minor


When I use URI(String) constructor with invalid escaped characters I get IllegalArgumentException instead of URISyntaxException. 
Small testcase for reproducing this issue:

import java.net.*; 

public class URIBug{
   public static void main(String[] args) {
        try {   
            new URI("%3");  
        } catch (URISyntaxException e) {
           System.out.println("PASSED");     
        } catch (Exception e) {
           System.out.println("FAILED: illegal exception occured: "+e);     
        }
   } 
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException

Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-23?page=comments#action_12363266 ] 

Vladimir Strigun commented on HARMONY-23:
-----------------------------------------

it's ok.

> java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
> ------------------------------------------------------------------------------------
>
>          Key: HARMONY-23
>          URL: http://issues.apache.org/jira/browse/HARMONY-23
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Strigun
>     Assignee: Tim Ellison
>     Priority: Minor

>
> When I use URI(String) constructor with invalid escaped characters I get IllegalArgumentException instead of URISyntaxException. 
> Small testcase for reproducing this issue:
> import java.net.*; 
> public class URIBug{
>    public static void main(String[] args) {
>         try {   
>             new URI("%3");  
>         } catch (URISyntaxException e) {
>            System.out.println("PASSED");     
>         } catch (Exception e) {
>            System.out.println("FAILED: illegal exception occured: "+e);     
>         }
>    } 
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-23?page=all ]
     
Tim Ellison resolved HARMONY-23:
--------------------------------

    Resolution: Fixed

 Fixed in luni java/net/URI.java at repo revision 360450.

Vladimir,  please try the latest version of the code to ensure it works for you.  I didn't use your fix but have put the test case into the regression test suite.

> java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
> ------------------------------------------------------------------------------------
>
>          Key: HARMONY-23
>          URL: http://issues.apache.org/jira/browse/HARMONY-23
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Strigun
>     Assignee: Tim Ellison
>     Priority: Minor

>
> When I use URI(String) constructor with invalid escaped characters I get IllegalArgumentException instead of URISyntaxException. 
> Small testcase for reproducing this issue:
> import java.net.*; 
> public class URIBug{
>    public static void main(String[] args) {
>         try {   
>             new URI("%3");  
>         } catch (URISyntaxException e) {
>            System.out.println("PASSED");     
>         } catch (Exception e) {
>            System.out.println("FAILED: illegal exception occured: "+e);     
>         }
>    } 
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-23?page=all ]

Tim Ellison reassigned HARMONY-23:
----------------------------------

    Assign To: Tim Ellison  (was: Geir Magnusson Jr)

> java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
> ------------------------------------------------------------------------------------
>
>          Key: HARMONY-23
>          URL: http://issues.apache.org/jira/browse/HARMONY-23
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Strigun
>     Assignee: Tim Ellison
>     Priority: Minor

>
> When I use URI(String) constructor with invalid escaped characters I get IllegalArgumentException instead of URISyntaxException. 
> Small testcase for reproducing this issue:
> import java.net.*; 
> public class URIBug{
>    public static void main(String[] args) {
>         try {   
>             new URI("%3");  
>         } catch (URISyntaxException e) {
>            System.out.println("PASSED");     
>         } catch (Exception e) {
>            System.out.println("FAILED: illegal exception occured: "+e);     
>         }
>    } 
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException

Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-23?page=comments#action_12360570 ] 

Vladimir Strigun commented on HARMONY-23:
-----------------------------------------

The cause of the IllegalArgument exception is creating of URISyntaxException with index = -2.
Here is a part of spec for URISyntaxException: "IllegalArgumentException - If the error index is less than -1"
So, we need just check if the index variable >=-1 .
Fix for the issue is very simple (file URI.java):
326a327
>                                 if(index + e.getIndex() < -1) index = 0;


> java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
> ------------------------------------------------------------------------------------
>
>          Key: HARMONY-23
>          URL: http://issues.apache.org/jira/browse/HARMONY-23
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Strigun
>     Assignee: Geir Magnusson Jr
>     Priority: Minor

>
> When I use URI(String) constructor with invalid escaped characters I get IllegalArgumentException instead of URISyntaxException. 
> Small testcase for reproducing this issue:
> import java.net.*; 
> public class URIBug{
>    public static void main(String[] args) {
>         try {   
>             new URI("%3");  
>         } catch (URISyntaxException e) {
>            System.out.println("PASSED");     
>         } catch (Exception e) {
>            System.out.println("FAILED: illegal exception occured: "+e);     
>         }
>    } 
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-23?page=all ]
     
Tim Ellison closed HARMONY-23:
------------------------------


No response from Vladimir.  Assuming it is ok -- closing.

> java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
> ------------------------------------------------------------------------------------
>
>          Key: HARMONY-23
>          URL: http://issues.apache.org/jira/browse/HARMONY-23
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Strigun
>     Assignee: Tim Ellison
>     Priority: Minor

>
> When I use URI(String) constructor with invalid escaped characters I get IllegalArgumentException instead of URISyntaxException. 
> Small testcase for reproducing this issue:
> import java.net.*; 
> public class URIBug{
>    public static void main(String[] args) {
>         try {   
>             new URI("%3");  
>         } catch (URISyntaxException e) {
>            System.out.println("PASSED");     
>         } catch (Exception e) {
>            System.out.println("FAILED: illegal exception occured: "+e);     
>         }
>    } 
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira