[
https://issues.apache.org/jira/browse/WICKET-6704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16940922#comment-16940922
]
Martin Tzvetanov Grigorov commented on WICKET-6704:
---------------------------------------------------
The problem is in
`java.beans.PropertyChangeSupport#writeObject(ObjectOutputStream)`. It does:
{code:java}
ObjectOutputStream.PutField fields = s.putFields();
fields.put("children", children);
fields.put("source", this.source);
fields.put("propertyChangeSupportSerializedDataVersion", 2);
{code}
and this later confuses
`org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream#GET_NUM_OBJ_FIELDS_METHOD`.
FutureTask is not special. Any non-serializable class would lead to the same.
Here is what happens:
1) normal Java serialization is executed
2) PropertyChangeSupport#writeObject() is executed and the new fields are added
3) normal Java serialization fails with NotSerializableException
4) Wicket tries to find the problem with CheckingObjectOutputStream to
construct the exception debug messages
5) `vals[offsets[i]] = unsafe.getObject(obj, readKeys[i]);` at
`java.io.ObjectStreamClass.FieldReflector#getObjFieldValues(Object, Object[])`
fails in native code because `readKeys[i]` is `-1`.
> JavaSerializer.serialize causes the JVM crash !
> -----------------------------------------------
>
> Key: WICKET-6704
> URL: https://issues.apache.org/jira/browse/WICKET-6704
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 8.5.0
> Environment: Windows 7, but probably it's NOT OS dependant
> Reporter: Joe K
> Assignee: Martin Tzvetanov Grigorov
> Priority: Major
> Attachments: jvm-crash_from_wicket.zip
>
>
> * when trying to serialize my custom object with a non-serializable field by
> JavaSerializer.serialize the JVM crashes instead of throwing the regular
> NotSerializableException !
> * when trying to serialize THE SAME object by java ObjectOutputStream then
> it's handled correctly and NotSerializableException is thrown
> * I'm attaching the very simple source code (Maven project), 1st test
> simulates the wicket issue (JVM crash) and 2nd test simulates the correct
> handling by java ObjectOutputStream
> * the attached example is just the simplification of very large project
> which is massively used by the users, so in fact it's critical for us
>
> * java: 1.8 (probably doesn't matter, tested on 1.8.0_162 and 1.8.0_221)
> * wicket: 8.5.0 (probably the problem is also in other versions)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)