Index: D:/harmony/HarmonyCodeBase/org.apache.harmony.nio_char/src/main/java/java/nio/charset/CharsetEncoder.java =================================================================== --- D:/harmony/HarmonyCodeBase/org.apache.harmony.nio_char/src/main/java/java/nio/charset/CharsetEncoder.java (revision 378452) +++ D:/harmony/HarmonyCodeBase/org.apache.harmony.nio_char/src/main/java/java/nio/charset/CharsetEncoder.java (working copy) @@ -184,6 +184,10 @@ throw new IllegalArgumentException( "Bytes number for one character must be positive."); //$NON-NLS-1$ } + if (averageBytesPerChar > maxBytesPerChar) { + throw new IllegalArgumentException( + "averageBytesPerChar is greater than maxBytesPerChar."); //$NON-NLS-1$ + } this.cs = cs; averBytes = averageBytesPerChar; maxBytes = maxBytesPerChar;