[vlma-devel] commit: Ensure a correct value for transient fields of deserialized objects . (Adrien Grand )

git version control git at videolan.org
Sat Feb 14 21:38:06 CET 2009


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Feb 14 21:37:23 2009 +0100| [f982e8379486a0a50acdccad51d79f52ad586376] | committer: Adrien Grand 

Ensure a correct value for transient fields of deserialized objects.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=f982e8379486a0a50acdccad51d79f52ad586376
---

 .../main/java/org/videolan/vlma/model/Adapter.java |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java b/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
index c54e8b6..bc60321 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
@@ -20,6 +20,8 @@
 
 package org.videolan.vlma.model;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 
 /**
@@ -206,4 +208,11 @@ public abstract class Adapter implements Serializable {
         return name.hashCode() + server.hashCode();
     }
 
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        // Since score is transient, ensure the default value that
+        // will be used during deserialization is 0.
+        this.score = 0;
+    }
+
 }



More information about the vlma-devel mailing list