Skip to content

Serialization broken on class org.xbill.DNS.Zone since version 3.6.0 #391

@serial389

Description

@serial389

In version 3.6.0 ReentrantReadWriteLock objects where added to the Zone class.
These ReentrantReadWriteLock objects are final and transient at the same time which is root cause of the problem.
Please keep in mind when an objects gets deserialized the consturctor are never called.

When an object was deserialized all fields of this class where setup to the serialized values when not marked as transient.
transient fields are setup to there default values. In this case to a null pointer.
And because these three ReentrantReadWriteLock fields are also marked as final there is no way to change the null pointer later.
So you end up with a NullPoinetrException.

When I look at the class ReentrantReadWriteLock I see that the class also implements Serializable.

So my proposal is simply to drop transient on these three fields.
In my test it works and the Zone object where successfuly deserialized.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions