BTW there is a Java VM parameter:
-Dsun.io.serialization.extendedDebugInfo=true
which turns on a more verbose exception information inside
NotSerializableException. It displays all fields and objects from root
object to non-serialized object and field.

--
Daniel

On Wed, Aug 6, 2014 at 5:50 PM, Martin Grigorov <[email protected]> wrote:
> It should
> rethrow 
> org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.ObjectCheckException
> without the extra massaging.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Wed, Aug 6, 2014 at 5:32 PM, Martin Grigorov <[email protected]>
> wrote:
>
>> ---
>> i/wicket-core/src/main/java/org/apache/wicket/serialize/java/JavaSerializer.java
>> +++
>> w/wicket-core/src/main/java/org/apache/wicket/serialize/java/JavaSerializer.java
>> @@ -263,9 +263,14 @@ public class JavaSerializer implements ISerializer
>>                         {
>>                                 if
>> (CheckingObjectOutputStream.isAvailable())
>>                                 {
>> -                                       // trigger serialization again,
>> but this time gather
>> -                                       // some more info
>> -                                       new
>> SerializableChecker(outputStream, nsx).writeObject(obj);
>> +                                       try
>> +                                       {
>> +                                               // trigger serialization
>> again, but this time gather some more info
>> +                                               new
>> SerializableChecker(outputStream, nsx).writeObject(obj);
>> +                                       } catch (Exception x) {
>> +                                               x.initCause(nsx);
>> +                                               throw new
>> WicketRuntimeException("A problem occurred while trying to collect debug
>> information about not serializable object", x);
>> +                                       }
>>                                         // if we get here, we didn't fail,
>> while we
>>                                         // should;
>>                                         throw nsx;
>>
>> does this look better ?
>>
>>
>>  Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>>
>> On Wed, Aug 6, 2014 at 4:43 PM, Daniel Stoch <[email protected]>
>> wrote:
>>
>>> Hi,
>>>
>>> I have a not serializable object X stored in a page. It leads to an
>>> NotSerializableException during page storing. The problem is that this
>>> page contains also a DetachableArrayList (from WicketStuff minis)
>>> which raises an exception when is stored as attached.
>>>
>>> 1. JavaSerializer tries to serialize page and calls:
>>> SerializationCheckerObjectOutputStream.writeObjectOverride(...)
>>> 2. NotSerializableException is catched for object X and
>>> SerializableChecker is called:
>>> new SerializableChecker(outputStream, nsx).writeObject(obj);
>>> 3. During that call exception is raised from
>>> AbstractDetachableCollection.writeObject and this new exception is
>>> logged.
>>>
>>> The original NotSerializableException from step 2 is lost and we don't
>>> know what really causes problem.
>>>
>>>
>>> Wicket 6.15
>>>
>>> --
>>> Daniel
>>>
>>
>>

Reply via email to