From 6692b6d072d16bef2d9483830835a01f3cd6e866 Mon Sep 17 00:00:00 2001 From: Jana Radhakrishnan Date: Mon, 6 Jul 2015 11:25:42 -0700 Subject: [PATCH] BitSequence should unmarshal data during get When bit sequence is trying to get key/value from the data store it should always unmarshall the json data before using it, as the data is JSON marshalled before storing it in the data store. Signed-off-by: Jana Radhakrishnan --- libnetwork/bitseq/store.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libnetwork/bitseq/store.go b/libnetwork/bitseq/store.go index 84868a030c..b5b3f23142 100644 --- a/libnetwork/bitseq/store.go +++ b/libnetwork/bitseq/store.go @@ -40,7 +40,12 @@ func (h *Handle) Value() []byte { // SetValue unmarshals the data from the KV store func (h *Handle) SetValue(value []byte) error { - return h.FromByteArray(value) + var b []byte + if err := json.Unmarshal(value, &b); err != nil { + return err + } + + return h.FromByteArray(b) } // Index returns the latest DB Index as seen by this object