harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Liang <richard.lian...@gmail.com>
Subject Re: [jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments
Date Fri, 03 Mar 2006 00:50:23 GMT
Agree ;-)

Richard Liang
China Software Development Lab, IBM



Geir Magnusson Jr wrote:
> maybe we should reject things not in patch format, as it puts 
> unnecessary load on the committers.
>
> Feel free to drop the code into comment or email so that we can 
> discuss, but patch is much easier for everyone involved....
>
>
> Tim Ellison wrote:
>> p.s.  I accept test cases in patch format too ;-)
>>
>> Regards,
>> Tim
>>
>> Richard Liang (JIRA) wrote:
>>>     [ 
>>> http://issues.apache.org/jira/browse/HARMONY-141?page=comments#action_12368097

>>> ]
>>> Richard Liang commented on HARMONY-141:
>>> ---------------------------------------
>>>
>>> Here are the test cases which will pass on RI but fail on Harmony.
>>>
>>>     public void testConstructorIlegalAverageBytesPerChar() {
>>>         try {
>>>             Charset cs = Charset.forName("UTF-8"); //$NON-NLS-1$
>>>             CharsetEncoder encoder = new 
>>> MockCharsetEncoderForHarmony141(cs, 1.1f, 1);
>>>             fail("Should throw IllegalArgumentException."); 
>>> //$NON-NLS-1$
>>>         } catch (IllegalArgumentException e) {
>>>             // expected
>>>         }
>>>     }
>>>
>>>     public void testConstructorIlegalAverageBytesPerChar2() {
>>>         try {
>>>             Charset cs = Charset.forName("ISO8859-1"); //$NON-NLS-1$
>>>             CharsetEncoder encoder = new 
>>> MockCharsetEncoderForHarmony141(cs, 1.1f, 1,
>>>                     new byte[] { 0x1a});
>>>             fail("Should throw IllegalArgumentException."); 
>>> //$NON-NLS-1$
>>>         } catch (IllegalArgumentException e) {
>>>             // expected
>>>         }
>>>     }
>>>
>>>     public static class MockCharsetEncoderForHarmony141 extends 
>>> CharsetEncoder {
>>>
>>>         protected MockCharsetEncoderForHarmony141(Charset cs, float 
>>> averageBytesPerChar,
>>>                 float maxBytesPerChar) {
>>>             super(cs, averageBytesPerChar, maxBytesPerChar);
>>>         }
>>>
>>>         public MockCharsetEncoderForHarmony141(Charset cs, float 
>>> averageBytesPerChar,
>>>                 float maxBytesPerChar, byte[] replacement) {
>>>             super(cs, averageBytesPerChar, maxBytesPerChar, 
>>> replacement);
>>>         }
>>>
>>>         protected CoderResult encodeLoop(CharBuffer in, ByteBuffer 
>>> out) {
>>>             return null;
>>>         }
>>>
>>>     }
>>>
>>>
>>>> Constructors of java.nio.charset.CharsetEncoder do not validate 
>>>> arguments
>>>> -------------------------------------------------------------------------

>>>>
>>>>
>>>>          Key: HARMONY-141
>>>>          URL: http://issues.apache.org/jira/browse/HARMONY-141
>>>>      Project: Harmony
>>>>         Type: Bug
>>>>     Reporter: Richard Liang
>>>> Constructors of java.nio.charset.CharsetEncoder should throw 
>>>> IllegalArgumentException when averageBytesPerChar exceeds 
>>>> maxBytesPerChar.
>>
>


Mime
View raw message