Closed Bug 157196 Opened 23 years ago Closed 23 years ago

ScriptableObject needs custom serialization implementation

Categories

(Rhino Graveyard :: Core, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: igor, Assigned: norrisboyd)

Details

Attachments

(2 files)

Currently ScriptableObject uses the standard Java support for serialization of
its data structures from hashtable implementation. But this does not work
properly as long as the slots array contains deleted entries marked with the
REMOVED slot tag. The standard Java de-serialization restores such entries to a
reference to a newly allocated object which != REMOVED. Such entries will stick
with hashtable forever and at some point will violate internal sanity checks.

In addition, the standard serialization waists storage as it takes room to store
empty/deleted slots.
The patch marks slots array as transient and adds writeObject/readObject that
write/read only existing slots in the hashtable. I had also to change
implementation of sealObject to set count to -1 - count so it would be possible
to know amount of existing slots without searching throw the slots array even
in the sealed object.
Save it as SerTest.java
Fixed: I commited the patch as it passes the above stress test.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Verified FIXED. Before the patch, the above testcase failed as follows:

Exception in thread "main" java.lang.RuntimeException: FAILED!
        at SerTest.test(SerTest.java:36)
        at SerTest.main(SerTest.java:12)



After the patch:

PASSED
Status: RESOLVED → VERIFIED
Targeting as resolved against 1.5R4
Target Milestone: --- → 1.5R4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: