Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
Ubuntu 6.10 Edgy Eft + Groovy r4630
Description
Serialization appears to work fine but deserialization fails to work at all.
The script;
import java.io.FileInputStream import java.io.FileOutputStream import java.io.ObjectInputStream import java.io.ObjectOutputStream import java.io.Serializable class Blah implements Serializable { def x def y public Blah ( x , y ) { this.x = x this.y = y } } def fileName = 'thingy.txt' def data = [ new Blah ( 1 , 2 ) , new Blah ( 'flob' , 'adob' ) ] def file = new ObjectOutputStream ( new FileOutputStream ( fileName ) ) file.writeObject ( data ) file.close ( ) file = new ObjectInputStream ( new FileInputStream ( fileName ) ) def newData = file.readObject ( ) // ClassNotFoundException here. assert data == newData
results in the output:
Caught: java.lang.ClassNotFoundException: Blah
at serialization.run(serialization.groovy:22)
at serialization.main(serialization.groovy)