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/28 14:24:58 UTC

[jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments

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

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


Re: [jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments

Posted by Richard Liang <ri...@gmail.com>.
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.
>>
>


contribution format (was: Re: [jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments)

Posted by Tim Ellison <t....@gmail.com>.
Paulex Yang wrote:
> 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....
> Agree, I suggest to still paste the test codes when raising JIRA issue
> so that others can easily review the test, try and discuss, while the
> patch provided should include both implementation fix and merged
> regression tests.

If you like, but again, a patch to the test suite is the ideal way to
get it into the code base.

Regards,
Tim

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

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

Re: [jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments

Posted by Geir Magnusson Jr <ge...@pobox.com>.

Paulex Yang wrote:
> 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....
> Agree, I suggest to still paste the test codes when raising JIRA issue 
> so that others can easily review the test, try and discuss, while the 
> patch provided should include both implementation fix and merged 
> regression tests.

Yes - exactly.  There's no problem when putting code in for discussion 
purposes, as you suggest.

geir

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

Re: [jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments

Posted by Paulex Yang <pa...@gmail.com>.
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....
Agree, I suggest to still paste the test codes when raising JIRA issue 
so that others can easily review the test, try and discuss, while the 
patch provided should include both implementation fix and merged 
regression tests.
>
>
> 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.
>>
>


-- 
Paulex Yang
China Software Development Lab
IBM



contribution format (was: Re: [jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments)

Posted by Tim Ellison <t....@gmail.com>.
Geir Magnusson Jr wrote:
> maybe we should reject things not in patch format, as it puts
> unnecessary load on the committers.

No need to be quite so draconian, especially if it is something we are
desperate for ;-)  However, the chances are simple fixes will drop down
the list of things to do if they require fix-ups compared to applying a
patch.

Regards,
Tim

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

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

Re: [jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments

Posted by Geir Magnusson Jr <ge...@pobox.com>.
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.
> 

Re: [jira] Commented: (HARMONY-141) Constructors of java.nio.charset.CharsetEncoder do not validate arguments

Posted by Tim Ellison <t....@gmail.com>.
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.
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.