harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Beyer (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6464) [classlib][luni]URLEncoder.encode(String) should same as URLEncoder.encode(String, defaultEncoding)
Date Thu, 11 Mar 2010 04:27:27 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843901#action_12843901
] 

Nathan Beyer commented on HARMONY-6464:
---------------------------------------

I don't quite understand why the original method is left at all.

+        try {
+            return encode(s, defaultEncoding);
+        } catch (UnsupportedEncodingException e) {
+            return doDefaultEncode(s);
+        }
+    }
+
+    private static String doDefaultEncode(String s) {

The catch can't happen - if the platform's default encoding (file.encoding) was unsupported,
I'd be surprised if the runtime lasted long enough to invoke this. This seems like a case
where a 'throws AssertionError(e)' idiom would be used to define a system assert.

> [classlib][luni]URLEncoder.encode(String) should same as URLEncoder.encode(String, defaultEncoding)
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6464
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6464
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ray Chen
>            Priority: Minor
>         Attachments: Harmony-6464.diff
>
>
> Although URLEncoder.encode(String) is deprecated, but its behavior should be as same
as URLEncoder.encode(String, defaultEncoding)
> In which defaultEncoding = System.getProperty("file.encoding");

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


Mime
View raw message