[logback-dev] [Bug 100] Serialization of objectArray in LoggingEvent does not always work
bugzilla-daemon at pixie.qos.ch
bugzilla-daemon at pixie.qos.ch
Tue Mar 11 22:15:04 CET 2008
http://bugzilla.qos.ch/show_bug.cgi?id=100
------- Comment #9 from joern at huxhorn.de 2008-03-11 22:15 -------
The changes in revision 1641 won't really solve the original problem but
introduces a whole new one instead.
The following test case will always fail:
package ch.qos.logback.classic;
import junit.framework.TestCase;
import java.io.*;
public class WriteUtfTest extends TestCase {
public void testWriteUTF() throws Exception
{
StringBuffer buffer=new StringBuffer();
for(int i=0;i<100000;i++)
{
buffer.append("X");
}
String string=buffer.toString();
ByteArrayOutputStream bos=new ByteArrayOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(bos);
oos.writeUTF(string);
oos.close();
ByteArrayInputStream bis=new
ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois=new ObjectInputStream(bis);
String read=ois.readUTF();
ois.close();
assertEquals(string,read);
}
}
It will always produce the following exception because the String is too long
for writeUTF:
java.io.UTFDataFormatException
at
java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:2125)
at
java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:1968)
at java.io.ObjectOutputStream.writeUTF(ObjectOutputStream.java:841)
at
ch.qos.logback.classic.WriteUtfTest.testWriteUTF(WriteUtfTest.java:21)
Don't worry, I stumbled over this problem in some other project, too.
--
Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the logback-dev
mailing list