From 464327cc431196a1903a6105f745a379d3f3f32b Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 23 Dec 2002 03:36:47 +0000 Subject: [PATCH] MirConfig.getProp throws an exception if the config value is not present which kind of makes the getConfigPropertyWithDefault method useless, so add a try/catch block to deal with gracefully and set a default. Still a hack, Global config stuff should be in a separate class and/or merged with MirConfig --- source/mircoders/global/MirGlobal.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/mircoders/global/MirGlobal.java b/source/mircoders/global/MirGlobal.java index f56b47d1..578c94d6 100755 --- a/source/mircoders/global/MirGlobal.java +++ b/source/mircoders/global/MirGlobal.java @@ -90,7 +90,15 @@ public class MirGlobal { public static String getConfigPropertyWithDefault(String aPropertyName, String aDefault) { String result; - result = config().getProp(aPropertyName); + //this try-catch is sort of a hack, if we make everything use MirGlobal + //instead of MirConfig, we can get rid of the Runtime exception we through + //in getProp, and deal with it here.. needs more thinking.. -mh + try { + result = config().getProp(aPropertyName); + } catch (Throwable t) { + result = aDefault; + } + if (result==null) result = aDefault; -- 2.11.0