You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Richard Liang (JIRA)" <ji...@apache.org> on 2006/02/16 09:46:00 UTC

[jira] Created: (HARMONY-96) Two new methods need to be implemented by java.nio.charset.Charset

Two new methods need to be implemented by java.nio.charset.Charset
------------------------------------------------------------------

         Key: HARMONY-96
         URL: http://issues.apache.org/jira/browse/HARMONY-96
     Project: Harmony
        Type: Improvement
  Components: Classlib  
    Reporter: Richard Liang


There are two new methods added since Java 5.0
1. public static Charset defaultCharset()
2. public final int compareTo(Charset that)

I'd like to implement the two methods and attach my code soon :-)

-- 
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-96) Two new methods need to be implemented by java.nio.charset.Charset

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


Verified by Richard

> Two new methods need to be implemented by java.nio.charset.Charset
> ------------------------------------------------------------------
>
>          Key: HARMONY-96
>          URL: http://issues.apache.org/jira/browse/HARMONY-96
>      Project: Harmony
>         Type: Improvement
>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: charset_patch.txt
>
> There are two new methods added since Java 5.0
> 1. public static Charset defaultCharset()
> 2. public final int compareTo(Charset that)
> I'd like to implement the two methods and attach my code soon :-)

-- 
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] Updated: (HARMONY-96) Two new methods need to be implemented by java.nio.charset.Charset

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

Richard Liang updated HARMONY-96:
---------------------------------

    Attachment: charset_patch.txt

Here is the test cases:

    /*
     * Test method defaultCharset()
     */
    public void testDefaultCharset_Normal(){
        String charsetName = null; 
        String defaultCharsetName = null;
        Properties oldProps = (Properties)System.getProperties().clone();   
        try{
            charsetName = "UTF-8"; //$NON-NLS-1$
            System.setProperty("file.encoding",charsetName);//$NON-NLS-1$
            defaultCharsetName = Charset.defaultCharset().name();
            assertEquals(charsetName,defaultCharsetName);
            
            charsetName = "ISO-8859-1"; //$NON-NLS-1$
            System.setProperty("file.encoding",charsetName);//$NON-NLS-1$
            defaultCharsetName = Charset.defaultCharset().name();
            assertEquals(charsetName,defaultCharsetName);
        }finally{
            System.setProperties(oldProps);
        }
    }
    
    /*
     * Test method defaultCharset()
     */
    public void testDefaultCharset_Unsupported(){
        String charsetName = null; 
        String defaultCharsetName = null;
        Properties oldProps = (Properties)System.getProperties().clone();   
        try{
            charsetName = "IMPOSSIBLE-8"; //$NON-NLS-1$
            System.setProperty("file.encoding",charsetName);//$NON-NLS-1$
            defaultCharsetName = Charset.defaultCharset().name();
            assertEquals("UTF-8",defaultCharsetName);
        }finally{
            System.setProperties(oldProps);
        }
    }
    
    /*
     * Test method defaultCharset()
     */
    public void testDefaultCharset_Null(){
        Properties currentProps = System.getProperties();
        Properties oldProps = (Properties)currentProps.clone(); 
        try{
            currentProps.remove("file.encoding");//$NON-NLS-1$
            Charset.defaultCharset().name();
            fail("Should throw illegal IllegalArgumentException");//$NON-NLS-1$
        }catch(IllegalArgumentException e){
            // expected 
        }finally{
            System.setProperties(oldProps);
        }
    }
    
    /*
     * Test method defaultCharset()
     */
    public void testDefaultCharset_IllegalCharsetName(){
        String charsetName = null; 
        Properties oldProps = (Properties)System.getProperties().clone();   
        try{
            charsetName = "IMP~~OSSIBLE-8"; //$NON-NLS-1$
            System.setProperty("file.encoding",charsetName);//$NON-NLS-1$
            Charset.defaultCharset().name();
            fail("Should throw IllegalCharsetNameException");//$NON-NLS-1$
        }catch(IllegalCharsetNameException e){
            // expected
        }finally{
            System.setProperties(oldProps);
        }
    }

> Two new methods need to be implemented by java.nio.charset.Charset
> ------------------------------------------------------------------
>
>          Key: HARMONY-96
>          URL: http://issues.apache.org/jira/browse/HARMONY-96
>      Project: Harmony
>         Type: Improvement
>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: charset_patch.txt
>
> There are two new methods added since Java 5.0
> 1. public static Charset defaultCharset()
> 2. public final int compareTo(Charset that)
> I'd like to implement the two methods and attach my code soon :-)

-- 
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-96) Two new methods need to be implemented by java.nio.charset.Charset

Posted by "Richard Liang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-96?page=comments#action_12367894 ] 

Richard Liang commented on HARMONY-96:
--------------------------------------

Tim,
Looks good. Thanks a lot.

> Two new methods need to be implemented by java.nio.charset.Charset
> ------------------------------------------------------------------
>
>          Key: HARMONY-96
>          URL: http://issues.apache.org/jira/browse/HARMONY-96
>      Project: Harmony
>         Type: Improvement
>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: charset_patch.txt
>
> There are two new methods added since Java 5.0
> 1. public static Charset defaultCharset()
> 2. public final int compareTo(Charset that)
> I'd like to implement the two methods and attach my code soon :-)

-- 
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-96) Two new methods need to be implemented by java.nio.charset.Charset

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

Tim Ellison reassigned HARMONY-96:
----------------------------------

    Assign To: Tim Ellison

> Two new methods need to be implemented by java.nio.charset.Charset
> ------------------------------------------------------------------
>
>          Key: HARMONY-96
>          URL: http://issues.apache.org/jira/browse/HARMONY-96
>      Project: Harmony
>         Type: Improvement
>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: charset_patch.txt
>
> There are two new methods added since Java 5.0
> 1. public static Charset defaultCharset()
> 2. public final int compareTo(Charset that)
> I'd like to implement the two methods and attach my code soon :-)

-- 
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-96) Two new methods need to be implemented by java.nio.charset.Charset

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

    Resolution: Fixed

Thanks for the patch Richard.

Applied in NIO_CHAR module java.nio.charset.Charset at repo revision 380639.

Please check that the patch was applied as you expected.

> Two new methods need to be implemented by java.nio.charset.Charset
> ------------------------------------------------------------------
>
>          Key: HARMONY-96
>          URL: http://issues.apache.org/jira/browse/HARMONY-96
>      Project: Harmony
>         Type: Improvement
>   Components: Classlib
>     Reporter: Richard Liang
>     Assignee: Tim Ellison
>  Attachments: charset_patch.txt
>
> There are two new methods added since Java 5.0
> 1. public static Charset defaultCharset()
> 2. public final int compareTo(Charset that)
> I'd like to implement the two methods and attach my code soon :-)

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