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-24) java.net.URLEncoder.encode(String s, String enc) doesn't throw UnsupportedEncodingException
Date Thu, 19 Jan 2006 16:44:46 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-24?page=comments#action_12363269 ] 

Vladimir Strigun commented on HARMONY-24:
-----------------------------------------

Current implementation of encode(String, String) method use getBytes(encoding) method for
encoding "special" characters. My testcase haven't some "special" characters, thatswhy we
can't see exception. To fix it, we can add check that charset is supported:
19a20
> import java.nio.charset.Charset;
93a95,96
>                 if(!Charset.isSupported(enc))
>                     throw new UnsupportedEncodingException(enc);


> java.net.URLEncoder.encode(String s, String enc) doesn't throw UnsupportedEncodingException
> -------------------------------------------------------------------------------------------
>
>          Key: HARMONY-24
>          URL: http://issues.apache.org/jira/browse/HARMONY-24
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Strigun
>     Assignee: Geir Magnusson Jr

>
> Corresponding to API specification method encode(String, String) of java.net.URLEncoder
should throw "UnsupportedEncodingException - If the named encoding is not supported".   But
the test shows that Harmony implementation doesn't throw an exception.
> import java.io.UnsupportedEncodingException;
> import java.net.URLEncoder;
> public class Test {       
>     public static void main(String[] args) {  
>         try { 
>             System.out.println("URLEncoder.encode="+URLEncoder.encode("str","unknown_enc"));
      
>         } catch (UnsupportedEncodingException e) {
>             e.printStackTrace(); 
>         }
>     } 
> }

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