Open GoogleCodeExporter opened 9 years ago
Ok this seems quite fundamental so I'm assuming it's my lack of Java knowledge
and is known, if strange, behaviour, rather than a bug. But as far as I can
see, SpyMemcached uses an ObjectInputStream/OutputStream to
serialize/deserialize any java objects it is sent (I'm looking in
BaseSerializingTranscoder.java, lines 95-144).
So I tried serializing a java.util.HashMap containing a boolean value using an
ObjectInputStream, then deserialized it using an ObjectOutputStream, and got
the same problem - a new instance of java.lang.Boolean is created. Here's my
REPL session (again, apologies for the non-Java):
user=> (def bos (ByteArrayOutputStream.))
#'user/bos
user=> (def os (ObjectOutputStream. bos))
#'user/os
user=> (def hm (HashMap.))
#'user/hm
user=> (.put hm "abc" false)
nil
user=> (.get hm "abc")
false
user=> (identical? false (.get hm "abc"))
true
user=> (.writeObject os hm)
nil
user=> (def ba (.toByteArray bos))
#'user/ba
user=> ba
#<byte[] [B@737e2e57>
user=> (def bis (ByteArrayInputStream. ba))
#'user/bis
user=> (def is (ObjectInputStream. bis))
#'user/is
user=> (def newhm (.readObject is))
#'user/newhm
user=> (.get newhm "abc")
false
user=> (identical? false (.get newhm "abc"))
false
Original comment by russ...@russelldunphy.com
on 14 Apr 2015 at 5:59
Original issue reported on code.google.com by
russ...@russelldunphy.com
on 14 Apr 2015 at 5:00