You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2006/12/13 08:32:21 UTC
[jira] Closed: (DIRMINA-321) BufferUnderflowException in
ObjectSerializationInputStream
[ http://issues.apache.org/jira/browse/DIRMINA-321?page=all ]
Trustin Lee closed DIRMINA-321.
-------------------------------
Fix Version/s: 1.0.2
Resolution: Fixed
Fixed thanks to Andrew's nice test case!
> BufferUnderflowException in ObjectSerializationInputStream
> ----------------------------------------------------------
>
> Key: DIRMINA-321
> URL: http://issues.apache.org/jira/browse/DIRMINA-321
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.1
> Reporter: Trustin Lee
> Assigned To: Trustin Lee
> Fix For: 1.0.2
>
>
> Andrew Vokhmin's report:
> MINA 1.0 provides an own object serialization streams. But I have a problem
> with it...
> or may be It's my unawareness.
> Try MINA 1.0.0 and MINA 1.0.1;
> JDK 1.5.0_09
> Windows 2003 Server
> Source:
> import java.io.ByteArrayInputStream;
> import java.io.ByteArrayOutputStream;
> import java.io.ObjectInputStream;
> import java.io.ObjectOutputStream;
> import junit.framework.TestCase;
> import
> org.apache.mina.filter.codec.serialization.ObjectSerializationInputStream;
> import
> org.apache.mina.filter.codec.serialization.ObjectSerializationOutputStream;
> public class ObjectSerializationStreamsTest extends TestCase {
> public ObjectSerializationStreamsTest(String arg0) {
> super(arg0);
> }
> public static void main(String[] args) {
> junit.textui.TestRunner.run(ObjectSerializationStreamsTest.class);
> }
> protected void setUp() throws Exception {
> super.setUp();
> }
> protected void tearDown() throws Exception {
> super.tearDown();
> }
> /*
> * Standart Object streams works - OK...
> */
> public void testObjectStandartStreams() throws Exception {
> ObjectInputStream osis;
> ObjectOutputStream osos;
> //Integer msgA = new Integer(12345);
> String msgA = "Test";
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> osos = new ObjectOutputStream(baos);
> osos.writeObject(msgA);
> osos.flush();
> byte xbA[] = baos.toByteArray();
> osis = new ObjectInputStream(new ByteArrayInputStream(xbA));
> osos.writeObject(msgA);
> Object msg = osis.readObject();
> assertEquals(msgA, msg);
> osos.close();
> osis.close();
> }
> /*
> * MINA Object streams works - FAILED!..
> */
> public void testObjectSerializationStreams() throws Exception {
> ObjectSerializationInputStream osis;
> ObjectSerializationOutputStream osos;
> //Integer msgA = new Integer(12345);
> String msgA = new String("Test");
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> osos = new ObjectSerializationOutputStream(baos);
> osos.writeObject(msgA);
> osos.flush();
> byte xbA[] = baos.toByteArray();
> osis = new ObjectSerializationInputStream(new
> ByteArrayInputStream(xbA));
> osos.writeObject(msgA);
> Object msg = osis.readObject();
> assertEquals(msgA, msg);
> osos.close();
> osis.close();
> }
> }
> Output:
> ..E
> Time: 0,109
> There was 1 error:
> 1)
> testObjectSerializationStreams(ru.territory.telex.mina.test.ObjectSerializat
> ionStreamsTest)java.nio.BufferUnderflowException
> at org.apache.mina.common.ByteBuffer.getObject(ByteBuffer.java:1613)
> at
> org.apache.mina.filter.codec.serialization.ObjectSerializationInputStream.re
> adObject(ObjectSerializationInputStream.java:125)
> at
> ru.territory.telex.mina.test.ObjectSerializationStreamsTest.testObjectSerial
> izationStreams(ObjectSerializationStreamsTest.java:61)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> at
> ru.territory.telex.mina.test.ObjectSerializationStreamsTest.main(ObjectSeria
> lizationStreamsTest.java:20)
> FAILURES!!!
> Tests run: 2, Failures: 0, Errors: 1
--
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