Ticket #2726
If I serialise a nested Map:
val := [6:[6:6]] str := StrBuf() { it.out.writeObj(val) }.toStr // -> [sys::Int:[sys::Int:sys::Int]][6:[sys::Int:sys::Int][6:6]]
But if I then attempt to de-serialise it:
str.in.readObj sys::IOErr: Expected type signature, not '[' [Line 1] fanx.serial.ObjDecoder.err (ObjDecoder.java:666) fanx.serial.ObjDecoder.err (ObjDecoder.java:663) fanx.serial.ObjDecoder.err (ObjDecoder.java:674) fanx.serial.ObjDecoder.verify (ObjDecoder.java:720) fanx.serial.ObjDecoder.consumeId (ObjDecoder.java:686) fanx.serial.ObjDecoder.readSimpleType (ObjDecoder.java:603) fanx.serial.ObjDecoder.readType (ObjDecoder.java:572) fanx.serial.ObjDecoder.readType (ObjDecoder.java:569) fanx.serial.ObjDecoder.readType (ObjDecoder.java:581) fanx.serial.ObjDecoder.readCollection (ObjDecoder.java:395) fanx.serial.ObjDecoder.readObj (ObjDecoder.java:127) fanx.serial.ObjDecoder.readObj (ObjDecoder.java:55) fan.sys.InStream.readObj (InStream.java:641) fan.sys.InStream.readObj (InStream.java:638) acme::Example.main (Example.fan:XX)
I also get exactly the same error in Javascript too (where I was originally attempting to inflate objects) - so bonus points for being consistent!
Ticket promoted to #2726 and assigned to brian
Ticket resolved in 1.0.72
This patch copies commit (72ed31) over to the JS code base:
diff --git a/src/sys/js/fanx/ObjDecoder.js b/src/sys/js/fanx/ObjDecoder.js index 15ceba0..c13c263 100644 --- a/src/sys/js/fanx/ObjDecoder.js +++ b/src/sys/js/fanx/ObjDecoder.js @@ -545,7 +545,10 @@ fanx_ObjDecoder.prototype.readType = function(lbracket) if (this.curt == fanx_Token.COLON) { this.consume(); - t = new fan.sys.MapType(t, this.readType()); + var lbracket2 = this.curt == afPickle_Token.LBRACKET; + if (lbracket2) this.consume(); + t = new fan.sys.MapType(t, this.readType(lbracket2)); + if (lbracket2) this.consume(afPickle_Token.RBRACKET, "Expected closing ]"); } while (this.curt == fanx_Token.LRBRACKET) {
testSys::SerializationTest.testMisc2726 should then pass in JS too.
testSys::SerializationTest.testMisc2726
Ticket promoted to #2726 and assigned to matthew
Ticket resolved in 1.0.75
The JS implementation is now fixed too.
Login or Signup to reply.
SlimerDude Fri 11 Jan 2019
If I serialise a nested Map:
But if I then attempt to de-serialise it:
I also get exactly the same error in Javascript too (where I was originally attempting to inflate objects) - so bonus points for being consistent!
brian Mon 14 Jan 2019
Ticket promoted to #2726 and assigned to brian
brian Thu 14 Mar 2019
Ticket resolved in 1.0.72
SlimerDude Thu 23 Jul 2020
This patch copies commit (72ed31) over to the JS code base:
testSys::SerializationTest.testMisc2726
should then pass in JS too.matthew Mon 27 Jul 2020
Ticket promoted to #2726 and assigned to matthew
matthew Mon 27 Jul 2020
Ticket resolved in 1.0.75
The JS implementation is now fixed too.