From d262e2892203dc74fcd1abc69a9ae7458566b18a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 1 Nov 2012 09:41:52 -0400 Subject: [PATCH] Safer casting in java config parsing Java config parsing, in particular getString and getInt, no longer fail when encountering a number value in the internl JSON->Map object. Java does not allow the following cast: String s = (String) someNumber; Instead, rely on the object's toString() which is safe and guaranteed to exist. Signed-off-by: Bill Erickson Signed-off-by: Jason Stephenson Signed-off-by: Dan Scott --- src/java/org/opensrf/util/Config.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/org/opensrf/util/Config.java b/src/java/org/opensrf/util/Config.java index ddac9c0..526d863 100644 --- a/src/java/org/opensrf/util/Config.java +++ b/src/java/org/opensrf/util/Config.java @@ -78,7 +78,7 @@ public class Config { */ public String getString(String path) throws ConfigException { try { - return (String) get(path); + return get(path).toString(); } catch(Exception e) { throw new ConfigException("No config string found at " + path); -- 2.43.2