harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Strigun (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-23) java.net.URI(String s) for invalid escaped characters throw IllegalArgumentException
Date Fri, 16 Dec 2005 10:47:47 GMT
    [ 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


Mime
View raw message