Narrow exception handling

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2294 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2011-10-07 18:55:46 +00:00
parent 1313160af0
commit 4a230abb44

View File

@ -84,9 +84,11 @@ public class ImporterUtilities {
int value = def;
if (options.containsKey(name)) {
String s = options.getProperty(name);
try {
value = Integer.parseInt(s);
} catch (Exception e) {
if (s != null) {
try {
value = Integer.parseInt(s);
} catch (NumberFormatException e) {
}
}
}
return value;
@ -96,9 +98,8 @@ public class ImporterUtilities {
boolean value = def;
if (options.containsKey(name)) {
String s = options.getProperty(name);
try {
value = s.equalsIgnoreCase("on") || s.equals("1") || Boolean.parseBoolean(s);
} catch (Exception e) {
if (s != null) {
value = "on".equalsIgnoreCase(s) || "1".equals(s) || Boolean.parseBoolean(s);
}
}
return value;