From b0cb08e49a12cdae0413ecc38662baa4d3983ad8 Mon Sep 17 00:00:00 2001 From: "J.C. Jones" Date: Thu, 11 Jun 2015 11:37:59 -0500 Subject: [PATCH] Issue #252: Remove the hack from Type Converter --- sa/type-converter.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sa/type-converter.go b/sa/type-converter.go index 090bd7202..98c4a179b 100644 --- a/sa/type-converter.go +++ b/sa/type-converter.go @@ -59,17 +59,12 @@ func (tc BoulderTypeConverter) FromDb(target interface{}) (gorp.CustomScanner, b if !ok { return errors.New("FromDb: Unable to convert *string") } + if *s == "" { + return errors.New("FromDb: Empty JWK field.") + } b := []byte(*s) k := target.(*jose.JsonWebKey) - if *s != "" { - return k.UnmarshalJSON(b) - } else { - // HACK: Sometimes we can have an empty string the in the DB where a - // key should be. We should fix that (see HACK above). In the meantime, - // return the default JsonWebKey in such situations. - // https://github.com/letsencrypt/boulder/issues/181 - return nil - } + return k.UnmarshalJSON(b) } return gorp.CustomScanner{Holder: new(string), Target: target, Binder: binder}, true case *core.AcmeStatus: