You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Li Jing Qin (JIRA)" <ji...@apache.org> on 2009/07/21 07:44:14 UTC

[jira] Created: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

[classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
-------------------------------------------------------------------------

                 Key: HARMONY-6279
                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
             Project: Harmony
          Issue Type: Bug
            Reporter: Li Jing Qin


Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


Re: [jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

Posted by Charles Lee <li...@gmail.com>.
Thanks Alexey. I have tested on the Ubuntu 8.04 and windows xp sp3.

On Fri, Jul 31, 2009 at 8:32 PM, Alexey Varlamov (JIRA) <ji...@apache.org>wrote:

>
>    [
> https://issues.apache.org/jira/browse/HARMONY-6279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12737510#action_12737510]
>
> Alexey Varlamov commented on HARMONY-6279:
> ------------------------------------------
>
> Excellent! I assume you've tested it actually works on both OSes - then the
> patch is ready for commit.
> Nathan, could you please take it - I have no env set up now.
>
> > [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> > -------------------------------------------------------------------------
> >
> >                 Key: HARMONY-6279
> >                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
> >             Project: Harmony
> >          Issue Type: Bug
> >            Reporter: Li Jing Qin
> >         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff,
> HARMONY-6279.v3.diff, HARMONY-6279.v4.diff
> >
> >
> > Our file.encoding in the system property is always set 8859-1 if we using
> drlvm.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
Yours sincerely,
Charles Lee

[jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Nathan Beyer commented on HARMONY-6279:
---------------------------------------

The default value on Windows should be "Windows-1252" none can be determined.

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Alexey Varlamov commented on HARMONY-6279:
------------------------------------------

2) Both approaches are feasible as long as statically sized buffer is used, just go whichever you prefer.
4) You will need to copy a static string to temporary buffer if you free the return value afterwards.
5) No problem to have several columns, I meant tabulate columns to better visualize
6) That's right. Moreover, as Nathan suggested, default value can be platform specific so we can require (document) that the function never returns NULL (and verify this with assert in luniglob).

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

Posted by "Li Jing Qin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739888#action_12739888 ] 

Li Jing Qin commented on HARMONY-6279:
--------------------------------------

Verified. Thanks Regis.

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>            Assignee: Regis Xu
>             Fix For: 5.0M11
>
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff, HARMONY-6279.v3.diff, HARMONY-6279.v4.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

Posted by "Li Jing Qin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12733996#action_12733996 ] 

Li Jing Qin commented on HARMONY-6279:
--------------------------------------

Thanks Alexey !
1. Sure. I will change it.
2. I would like to refactor the code. Move the memory allocation to the
luniglob, let the luniglob to care about the memory. Since it is the
luniglob where to free the memory. What do you think about this?
3. Sure. I will change it.
4. strdup? Would you please give some details?
5. I have done this at first. But I feel it will be too many lines in that
file, I merge 3 or 4 in one line.
6. Sure. There seems we have the agreement that file.encoding can not be
null if we use System.getProperty("file.encoding"). Maybe we can remove the
null check code in java.




-- 
Yours sincerely,
Charles Lee


> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Updated: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Li Jing Qin updated HARMONY-6279:
---------------------------------

    Attachment: HARMONY-6279.diff

1. On linux, got charset from the locale
2. On windows, got code page identifier from locale and map it to the name, which is in the added file charset.h

Would anyone want to try this?

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Closed: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Regis Xu closed HARMONY-6279.
-----------------------------


> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>            Assignee: Regis Xu
>             Fix For: 5.0M11
>
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff, HARMONY-6279.v3.diff, HARMONY-6279.v4.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Alexey Varlamov commented on HARMONY-6279:
------------------------------------------

Looks better now. Few issues remained:
1) such code does not work the way you might have intended:
locale = "8859_1";
It should be like:
strcpy(locale, "8859_1");
2) strcpy would be more elegant than memcpy
3) For consistency, windows function could also check buffer size - didn't you get "unused" warning btw?
4) No sense to free(propVal); as it is null anyway

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff, HARMONY-6279.v3.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Updated: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Li Jing Qin updated HARMONY-6279:
---------------------------------

    Attachment: HARMONY-6279.v3.diff

Thank all of your suggestions :)
Here is a new patch. Would you like to try it?

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff, HARMONY-6279.v3.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Resolved: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Regis Xu resolved HARMONY-6279.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 5.0M11

Thanks Li Jing Qin,

Patch HARMONY-6279.v4.diff applied at r801484, please verify.

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>            Assignee: Regis Xu
>             Fix For: 5.0M11
>
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff, HARMONY-6279.v3.diff, HARMONY-6279.v4.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Alexey Varlamov commented on HARMONY-6279:
------------------------------------------

Please ensure there is no memory leaks - seems the function returns malloc'ed memory on linux and static string on windows.

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Alexey Varlamov commented on HARMONY-6279:
------------------------------------------

Charles, I wonder what happens on Windows when you free static memory? ;)
Ok, let's brush it:
1) I would suggest more descriptive function name than charset() - say, like "getOSCharset()"
2) in linux file, variable definition is in the middle of a code block:
+  // get codeset from language[_territory][.codeset][@modifier]
+  char * locale = malloc(MAXBUFF * sizeof(char));
BTW, isn't sizeof(char) == 1 by definition? 
Also, might be reasonable to check for allocation result and for buffer overrun in the cycle.
3) in linux file, confusing check for return value - instead should be "if (!strlen(locale))" I guess?
+  if (!locale) {
+    ret = NULL;
+  } else {
+    ret = locale;
+  }
4) in windows, strdup the return value for safe free
5) in windows file, would be nice to align the static map by pairs of columns, to improve readability
6) in luniglob, it is wise to check the returned value for NULL and fallback to dummy default like "8859_1"


> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Updated: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Li Jing Qin updated HARMONY-6279:
---------------------------------

    Attachment: HARMONY-6279.v4.diff

Thanks Alexey. What about this one?
1. Remove the unused free
2. change int to the size_t
3. use strcpy instead of =
4. add the size compare in the windows.

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff, HARMONY-6279.v3.diff, HARMONY-6279.v4.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Assigned: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Regis Xu reassigned HARMONY-6279:
---------------------------------

    Assignee: Regis Xu

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>            Assignee: Regis Xu
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff, HARMONY-6279.v3.diff, HARMONY-6279.v4.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Commented: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Alexey Varlamov commented on HARMONY-6279:
------------------------------------------

Excellent! I assume you've tested it actually works on both OSes - then the patch is ready for commit. 
Nathan, could you please take it - I have no env set up now.

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff, HARMONY-6279.v3.diff, HARMONY-6279.v4.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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


[jira] Updated: (HARMONY-6279) [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm

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

Li Jing Qin updated HARMONY-6279:
---------------------------------

    Attachment: HARMONY-6279.v2.diff

Thanks Alexey. What about this patch?

> [classlib][luni] file.encoding is always set to ISO-9959-1 if using drlvm
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6279
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6279
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6279.diff, HARMONY-6279.v2.diff
>
>
> Our file.encoding in the system property is always set 8859-1 if we using drlvm.

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