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/24 07:58:41 UTC

[jira] Created: (HARMONY-124) java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.

java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.
-------------------------------------------------------------------------------------------------------------------------

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


public final CoderResult decode(ByteBuffer in, CharBuffer out, boolean endOfInput)
As spec says, the method throws CoderMalfunctionError if an invocation of the decodeLoop method threw an unexpected exception.

However, Harmony doesn't throws CoderMalfunctionError when decodeLoop method threw an unexpected exception. 

The following test cases pass on RI , but fail on Harmony.

	/*
	 * Test malfunction decode(ByteBuffer) 
	 */
	public void testDecode_CoderMalfunctionError() throws Exception {
		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
		try{
			cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
		       .onUnmappableCharacter(CodingErrorAction.REPLACE).decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
			fail("should throw CoderMalfunctionError");//NON-NLS-1$
		}catch(CoderMalfunctionError e){
			//expected
		}
	}

	/*
	 * Test malfunction decode(ByteBuffer) 
	 */
	public void testDecode_NoCoderMalfunctionError() throws Exception {
		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
		try{
			cs.decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
		}catch(CoderMalfunctionError e){
			fail("Charset.decode should return silently");//NON-NLS-1
		}
	}
	/*
	 * Mock charset class with malfunction decode & encode.
	 */
	static final class MockMalfunctionCharset extends Charset {

		public MockMalfunctionCharset(String canonicalName, String[] aliases) {
			super(canonicalName, aliases);
		}

		public boolean contains(Charset cs) {
			return false;
		}

		public CharsetDecoder newDecoder() {
			return new MockMalfunctionDecoder(this);
		}

		public CharsetEncoder newEncoder() {
			return new MockMalfunctionEncoder(this);
		}
	}
	/*
	 * Mock decoder. decodeLoop always throws unexpected exception.
	 */
	static class MockMalfunctionDecoder extends java.nio.charset.CharsetDecoder {

		public MockMalfunctionDecoder(Charset cs) {
			super(cs, 1, 10);
		}

		protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
			throw new BufferOverflowException();
		}
	}
	/*
	 * Mock encoder. encodeLoop always throws unexpected exception.
	 */
	static class MockMalfunctionEncoder extends java.nio.charset.CharsetEncoder {

		public MockMalfunctionEncoder(Charset cs) {
			super(cs, 1, 3, new byte[] { (byte) '?' });
		}

		protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
			throw new BufferOverflowException();
		}
	}


-- 
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-124) java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.

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

    Resolution: Fixed

Richard,

The code has been fixed in NIO_CHAR java.nio.CharsetDecoder at repo revision 381665.

Please check that the fix fully resolves your problem.


> java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.
> -------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-124
>          URL: http://issues.apache.org/jira/browse/HARMONY-124
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: CharsetDecoder_patch.txt, Charset_patch.txt
>
> public final CoderResult decode(ByteBuffer in, CharBuffer out, boolean endOfInput)
> As spec says, the method throws CoderMalfunctionError if an invocation of the decodeLoop method threw an unexpected exception.
> However, Harmony doesn't throws CoderMalfunctionError when decodeLoop method threw an unexpected exception. 
> The following test cases pass on RI , but fail on Harmony.
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_CoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
> 		       .onUnmappableCharacter(CodingErrorAction.REPLACE).decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 			fail("should throw CoderMalfunctionError");//NON-NLS-1$
> 		}catch(CoderMalfunctionError e){
> 			//expected
> 		}
> 	}
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_NoCoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 		}catch(CoderMalfunctionError e){
> 			fail("Charset.decode should return silently");//NON-NLS-1
> 		}
> 	}
> 	/*
> 	 * Mock charset class with malfunction decode & encode.
> 	 */
> 	static final class MockMalfunctionCharset extends Charset {
> 		public MockMalfunctionCharset(String canonicalName, String[] aliases) {
> 			super(canonicalName, aliases);
> 		}
> 		public boolean contains(Charset cs) {
> 			return false;
> 		}
> 		public CharsetDecoder newDecoder() {
> 			return new MockMalfunctionDecoder(this);
> 		}
> 		public CharsetEncoder newEncoder() {
> 			return new MockMalfunctionEncoder(this);
> 		}
> 	}
> 	/*
> 	 * Mock decoder. decodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionDecoder extends java.nio.charset.CharsetDecoder {
> 		public MockMalfunctionDecoder(Charset cs) {
> 			super(cs, 1, 10);
> 		}
> 		protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}
> 	/*
> 	 * Mock encoder. encodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionEncoder extends java.nio.charset.CharsetEncoder {
> 		public MockMalfunctionEncoder(Charset cs) {
> 			super(cs, 1, 3, new byte[] { (byte) '?' });
> 		}
> 		protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}

-- 
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-124) java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.

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

Richard Liang commented on HARMONY-124:
---------------------------------------

Sorry, there are bugs in my test cases and patches.

1. Refined test cases (the three Mock class are the same)

    /*
     * Test malfunction decode(ByteBuffer)
     */
    public void testDecode_CoderMalfunctionError() throws Exception {
        MockMalfunctionCharset cs = new MockMalfunctionCharset("Harmony-124-1", null);
        try {
            cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
                    .onUnmappableCharacter(CodingErrorAction.REPLACE).decode(
                            ByteBuffer.wrap(new byte[] { 0x00, 0x11 }));
            fail("should throw CoderMalfunctionError");// NON-NLS-1$
        } catch (CoderMalfunctionError e) {
            // expected
        }
    }

    /*
     * Test malfunction decode(ByteBuffer)
     */
    public void testDecode_NoCoderMalfunctionError() throws Exception {
        MockMalfunctionCharset cs = new MockMalfunctionCharset("Harmony-124-2", null); //$NON-NLS-1$
        try {
            cs.decode(ByteBuffer.wrap(new byte[] { 0x00, 0x11 }));
            fail("Charset.decode should throw CoderMalfunctionError");// NON-NLS-1
        } catch (CoderMalfunctionError e) {
            //expected
        }
    }

2.  The Charset_patch.txt is unnecessary, please just apply CharsetDecoder_patch.txt.

> java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.
> -------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-124
>          URL: http://issues.apache.org/jira/browse/HARMONY-124
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: CharsetDecoder_patch.txt, Charset_patch.txt
>
> public final CoderResult decode(ByteBuffer in, CharBuffer out, boolean endOfInput)
> As spec says, the method throws CoderMalfunctionError if an invocation of the decodeLoop method threw an unexpected exception.
> However, Harmony doesn't throws CoderMalfunctionError when decodeLoop method threw an unexpected exception. 
> The following test cases pass on RI , but fail on Harmony.
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_CoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
> 		       .onUnmappableCharacter(CodingErrorAction.REPLACE).decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 			fail("should throw CoderMalfunctionError");//NON-NLS-1$
> 		}catch(CoderMalfunctionError e){
> 			//expected
> 		}
> 	}
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_NoCoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 		}catch(CoderMalfunctionError e){
> 			fail("Charset.decode should return silently");//NON-NLS-1
> 		}
> 	}
> 	/*
> 	 * Mock charset class with malfunction decode & encode.
> 	 */
> 	static final class MockMalfunctionCharset extends Charset {
> 		public MockMalfunctionCharset(String canonicalName, String[] aliases) {
> 			super(canonicalName, aliases);
> 		}
> 		public boolean contains(Charset cs) {
> 			return false;
> 		}
> 		public CharsetDecoder newDecoder() {
> 			return new MockMalfunctionDecoder(this);
> 		}
> 		public CharsetEncoder newEncoder() {
> 			return new MockMalfunctionEncoder(this);
> 		}
> 	}
> 	/*
> 	 * Mock decoder. decodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionDecoder extends java.nio.charset.CharsetDecoder {
> 		public MockMalfunctionDecoder(Charset cs) {
> 			super(cs, 1, 10);
> 		}
> 		protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}
> 	/*
> 	 * Mock encoder. encodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionEncoder extends java.nio.charset.CharsetEncoder {
> 		public MockMalfunctionEncoder(Charset cs) {
> 			super(cs, 1, 3, new byte[] { (byte) '?' });
> 		}
> 		protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}

-- 
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-124) java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.

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


Verified by Richard

> java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.
> -------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-124
>          URL: http://issues.apache.org/jira/browse/HARMONY-124
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: CharsetDecoder_patch.txt, Charset_patch.txt
>
> public final CoderResult decode(ByteBuffer in, CharBuffer out, boolean endOfInput)
> As spec says, the method throws CoderMalfunctionError if an invocation of the decodeLoop method threw an unexpected exception.
> However, Harmony doesn't throws CoderMalfunctionError when decodeLoop method threw an unexpected exception. 
> The following test cases pass on RI , but fail on Harmony.
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_CoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
> 		       .onUnmappableCharacter(CodingErrorAction.REPLACE).decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 			fail("should throw CoderMalfunctionError");//NON-NLS-1$
> 		}catch(CoderMalfunctionError e){
> 			//expected
> 		}
> 	}
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_NoCoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 		}catch(CoderMalfunctionError e){
> 			fail("Charset.decode should return silently");//NON-NLS-1
> 		}
> 	}
> 	/*
> 	 * Mock charset class with malfunction decode & encode.
> 	 */
> 	static final class MockMalfunctionCharset extends Charset {
> 		public MockMalfunctionCharset(String canonicalName, String[] aliases) {
> 			super(canonicalName, aliases);
> 		}
> 		public boolean contains(Charset cs) {
> 			return false;
> 		}
> 		public CharsetDecoder newDecoder() {
> 			return new MockMalfunctionDecoder(this);
> 		}
> 		public CharsetEncoder newEncoder() {
> 			return new MockMalfunctionEncoder(this);
> 		}
> 	}
> 	/*
> 	 * Mock decoder. decodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionDecoder extends java.nio.charset.CharsetDecoder {
> 		public MockMalfunctionDecoder(Charset cs) {
> 			super(cs, 1, 10);
> 		}
> 		protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}
> 	/*
> 	 * Mock encoder. encodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionEncoder extends java.nio.charset.CharsetEncoder {
> 		public MockMalfunctionEncoder(Charset cs) {
> 			super(cs, 1, 3, new byte[] { (byte) '?' });
> 		}
> 		protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}

-- 
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-124) java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.

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

Richard Liang updated HARMONY-124:
----------------------------------

    Attachment: Charset_patch.txt
                CharsetDecoder_patch.txt

The patches are attached. 
java.nio.charset.Charset.java and java.nio.charset.CharsetDecoder.java are modified.
Could you please take a try to apply patches ? 
Charset_patch.txt is for java.nio.charset.Charset.java , and CharsetDecoder_patch.txt is for java.nio.charset.CharsetDecoder.java.
You could simply click "team"->"apply patch" to apply these patches.

Java spec doesn't point out clearly which expections are unexpected. To be compatible with RI, "BufferOverflowException" and "BufferUnderflowException" are treated as "unexpected exception" currently. 

Thank you!

> java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.
> -------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-124
>          URL: http://issues.apache.org/jira/browse/HARMONY-124
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: CharsetDecoder_patch.txt, Charset_patch.txt
>
> public final CoderResult decode(ByteBuffer in, CharBuffer out, boolean endOfInput)
> As spec says, the method throws CoderMalfunctionError if an invocation of the decodeLoop method threw an unexpected exception.
> However, Harmony doesn't throws CoderMalfunctionError when decodeLoop method threw an unexpected exception. 
> The following test cases pass on RI , but fail on Harmony.
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_CoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
> 		       .onUnmappableCharacter(CodingErrorAction.REPLACE).decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 			fail("should throw CoderMalfunctionError");//NON-NLS-1$
> 		}catch(CoderMalfunctionError e){
> 			//expected
> 		}
> 	}
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_NoCoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 		}catch(CoderMalfunctionError e){
> 			fail("Charset.decode should return silently");//NON-NLS-1
> 		}
> 	}
> 	/*
> 	 * Mock charset class with malfunction decode & encode.
> 	 */
> 	static final class MockMalfunctionCharset extends Charset {
> 		public MockMalfunctionCharset(String canonicalName, String[] aliases) {
> 			super(canonicalName, aliases);
> 		}
> 		public boolean contains(Charset cs) {
> 			return false;
> 		}
> 		public CharsetDecoder newDecoder() {
> 			return new MockMalfunctionDecoder(this);
> 		}
> 		public CharsetEncoder newEncoder() {
> 			return new MockMalfunctionEncoder(this);
> 		}
> 	}
> 	/*
> 	 * Mock decoder. decodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionDecoder extends java.nio.charset.CharsetDecoder {
> 		public MockMalfunctionDecoder(Charset cs) {
> 			super(cs, 1, 10);
> 		}
> 		protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}
> 	/*
> 	 * Mock encoder. encodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionEncoder extends java.nio.charset.CharsetEncoder {
> 		public MockMalfunctionEncoder(Charset cs) {
> 			super(cs, 1, 3, new byte[] { (byte) '?' });
> 		}
> 		protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}

-- 
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-124) java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.

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

Richard Liang commented on HARMONY-124:
---------------------------------------

Yes, Tim. The fix looks good. Please close this issue. 
Thanks a lot.

> java.nio.charset.CharsetDecoder doesn't throw CoderMalfunctionError exception when decodeLoop threw unexpected exception.
> -------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-124
>          URL: http://issues.apache.org/jira/browse/HARMONY-124
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: CharsetDecoder_patch.txt, Charset_patch.txt
>
> public final CoderResult decode(ByteBuffer in, CharBuffer out, boolean endOfInput)
> As spec says, the method throws CoderMalfunctionError if an invocation of the decodeLoop method threw an unexpected exception.
> However, Harmony doesn't throws CoderMalfunctionError when decodeLoop method threw an unexpected exception. 
> The following test cases pass on RI , but fail on Harmony.
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_CoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
> 		       .onUnmappableCharacter(CodingErrorAction.REPLACE).decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 			fail("should throw CoderMalfunctionError");//NON-NLS-1$
> 		}catch(CoderMalfunctionError e){
> 			//expected
> 		}
> 	}
> 	/*
> 	 * Test malfunction decode(ByteBuffer) 
> 	 */
> 	public void testDecode_NoCoderMalfunctionError() throws Exception {
> 		MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
> 		try{
> 			cs.decode(ByteBuffer.wrap(new byte[]{0x00,0x11}));
> 		}catch(CoderMalfunctionError e){
> 			fail("Charset.decode should return silently");//NON-NLS-1
> 		}
> 	}
> 	/*
> 	 * Mock charset class with malfunction decode & encode.
> 	 */
> 	static final class MockMalfunctionCharset extends Charset {
> 		public MockMalfunctionCharset(String canonicalName, String[] aliases) {
> 			super(canonicalName, aliases);
> 		}
> 		public boolean contains(Charset cs) {
> 			return false;
> 		}
> 		public CharsetDecoder newDecoder() {
> 			return new MockMalfunctionDecoder(this);
> 		}
> 		public CharsetEncoder newEncoder() {
> 			return new MockMalfunctionEncoder(this);
> 		}
> 	}
> 	/*
> 	 * Mock decoder. decodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionDecoder extends java.nio.charset.CharsetDecoder {
> 		public MockMalfunctionDecoder(Charset cs) {
> 			super(cs, 1, 10);
> 		}
> 		protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}
> 	/*
> 	 * Mock encoder. encodeLoop always throws unexpected exception.
> 	 */
> 	static class MockMalfunctionEncoder extends java.nio.charset.CharsetEncoder {
> 		public MockMalfunctionEncoder(Charset cs) {
> 			super(cs, 1, 3, new byte[] { (byte) '?' });
> 		}
> 		protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
> 			throw new BufferOverflowException();
> 		}
> 	}

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