harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Liang (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-142) java.nio.charset.CharsetDecoder constructor doesn't throw IllegalArgumentException when averageCharsPerByte is greater than maxCharsPerByte.
Date Wed, 01 Mar 2006 02:47:44 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-142?page=comments#action_12368204 ] 

Richard Liang commented on HARMONY-142:
---------------------------------------

Here is the testcases which pass on RI 5.0 and fail on both Haromny and RI 1.4.2

Thanks a lot.

    /*
     * test constructor: averBytesPerChar > maxBytesPerChar
     */
    public void testConstructorIlegalAverageBytesPerChar() {
        try {
            Charset cs = Charset.forName("UTF-8"); //$NON-NLS-1$
            CharsetDecoder decoder = new MockCharsetDecoderForHarmony142(cs,
                    1.1f, 1);
            fail("Should throw IllegalArgumentException."); //$NON-NLS-1$
        } catch (IllegalArgumentException e) {
            // expected
        }
    }

    /*
     * MockCharsetDecoderForHarmony142: for constructor test
     */
    static class MockCharsetDecoderForHarmony142 extends CharsetDecoder {
        protected MockCharsetDecoderForHarmony142(Charset cs,
                float averageBytesPerChar, float maxBytesPerChar) {
            super(cs, averageBytesPerChar, maxBytesPerChar);
        }

        protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
            return null;
        }
    }

> java.nio.charset.CharsetDecoder constructor doesn't throw IllegalArgumentException when
averageCharsPerByte is greater than maxCharsPerByte.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-142
>          URL: http://issues.apache.org/jira/browse/HARMONY-142
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Richard Liang

>
> As spec says, constructor throws IllegalArgumentException when parameters are illegal.
It should be considered as illegal parameters when averageCharsPerByte is greater than maxCharsPerByte.

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