[ https://issues.apache.org/jira/browse/DIRMINA-627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Owen Jacobson updated DIRMINA-627: ---------------------------------- Attachment: fix.patch I've attached a (trivial) fix for the problem. I'm a little dubious of the value of the "optimization" to OOS/OIS' protocols. I did a few ad-hoc tests with it and never got more than a 5% saving on byte size. Wouldn't it be a better idea, if we're concerned about data size, to use a normal OOS/OIS pair plus a GzipStream or similar? Less risk of introducing protocol quirks like this issue and DIRMINA-481... Protocol optimizations should be left up to things in the ProtocolCodec or filter stack. > ByteBuffer.getObject() doesn't support Class objects for non-serializable > classes > --------------------------------------------------------------------------------- > > Key: DIRMINA-627 > URL: https://issues.apache.org/jira/browse/DIRMINA-627 > Project: MINA > Issue Type: Bug > Components: Core > Affects Versions: 1.1.7 > Reporter: Owen Jacobson > Attachments: fix.patch, tests.patch > > > Instances of java.lang.Class are serializable, whether or not the class they > represent is serializable. However, org.apache.mina.common.ByteBuffer's > optimizations prevent it from unserializing Class instances representing > classes that are not serializable. For example, given > public interface NotSerializable {} > /*...*/ > ObjectOutputStream o = /*...*/; > o.writeObject (NotSerializable.class); > /*...*/ > ObjectInputStream i = /*..bytes written by o, above..*/; > Object read = i.readObject(); > The 'read' object will be NotSerializable.class. > Trying the same thing with buffer.putObject (NotSerializable.class); > buffer.flip(); buffer.getObject() throws a NullPointerException. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.