MINA
  1. MINA
  2. DIRMINA-627

ByteBuffer.getObject() doesn't support Class objects for non-serializable classes

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.7
    • Fix Version/s: 2.0.3
    • Component/s: Core
    • Labels:
      None

      Description

      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.

      1. tests.patch
        3 kB
        Owen Jacobson
      2. fix.patch
        3 kB
        Owen Jacobson
      3. AbstractIoBuffer.java
        1 kB
        wangzhenghang
      4. IoBufferTest.java
        3 kB
        wangzhenghang

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Owen Jacobson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development