You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Ulrich Kreher <U....@aristaflow.com> on 2011/03/10 17:00:31 UTC
NPE (ProtocolDecoderException) in AbstractIoBuffer
Hi,
we have obviously the same issue as some other guy back in November 2010
(ProtocolDecoderException on android). I stumbled across this when
switching from Mina 1.1.7 to Mina 2.0.2. Apparently Mina 1.1.7 does not
have the problem.
Unfortunately there has not been a solution yet, but I can provide some
more information on the issue:
The problem is the usage of ObjectStreamClass.lookup(Class) at
AbstractIoBuffer:1964. ObjectStreamClass.lookup(Class) returns null for
classes that are not serialisable. This leads to the following issue:
public class PDETest
{
static class Field
{ }
static class SerialisableField implements Serializable
{ }
static class Transferred
{
Field notWorking;
SerialisableField working;
}
}
You can set notWorking to either an instance of SerialisableField or
even to null. Deserialisation of an instance of Transferred will always
fail due to ObjectStreamClass.lookup(Class) returning null for the
Field-class (which does not implement Serializable).
I think this is a bug, since it is completely legal to transfer a field
of a non-serialisable type as long as the value of the field is
serialisable. Using a non-serialisable value is not a problem when
deserialising since this will raise an exception when serialising.
Using ObjectStreamClass.lookup(Class, true) instead of
ObjectStreamClass.lookup(Class) would solve this issue, but it may have
some consequences I cannot see yet.
Ulrich
Re: NPE (ProtocolDecoderException) in AbstractIoBuffer
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 3/10/11 5:00 PM, Ulrich Kreher wrote:
> Hi,
Hi,
you are most certainly right Can you fill a JIRA issue ?
>
> we have obviously the same issue as some other guy back in November
> 2010 (ProtocolDecoderException on android). I stumbled across this
> when switching from Mina 1.1.7 to Mina 2.0.2. Apparently Mina 1.1.7
> does not have the problem.
>
> Unfortunately there has not been a solution yet, but I can provide
> some more information on the issue:
>
> The problem is the usage of ObjectStreamClass.lookup(Class) at
> AbstractIoBuffer:1964. ObjectStreamClass.lookup(Class) returns null
> for classes that are not serialisable. This leads to the following issue:
>
> public class PDETest
> {
> static class Field
> { }
>
> static class SerialisableField implements Serializable
> { }
>
> static class Transferred
> {
> Field notWorking;
> SerialisableField working;
> }
> }
>
> You can set notWorking to either an instance of SerialisableField or
> even to null. Deserialisation of an instance of Transferred will
> always fail due to ObjectStreamClass.lookup(Class) returning null for
> the Field-class (which does not implement Serializable).
>
> I think this is a bug, since it is completely legal to transfer a
> field of a non-serialisable type as long as the value of the field is
> serialisable. Using a non-serialisable value is not a problem when
> deserialising since this will raise an exception when serialising.
> Using ObjectStreamClass.lookup(Class, true) instead of
> ObjectStreamClass.lookup(Class) would solve this issue, but it may
> have some consequences I cannot see yet.
>
>
> Ulrich
>
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com