Narrow exception handling
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2294 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
1313160af0
commit
4a230abb44
@ -84,9 +84,11 @@ public class ImporterUtilities {
|
|||||||
int value = def;
|
int value = def;
|
||||||
if (options.containsKey(name)) {
|
if (options.containsKey(name)) {
|
||||||
String s = options.getProperty(name);
|
String s = options.getProperty(name);
|
||||||
|
if (s != null) {
|
||||||
try {
|
try {
|
||||||
value = Integer.parseInt(s);
|
value = Integer.parseInt(s);
|
||||||
} catch (Exception e) {
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
@ -96,9 +98,8 @@ public class ImporterUtilities {
|
|||||||
boolean value = def;
|
boolean value = def;
|
||||||
if (options.containsKey(name)) {
|
if (options.containsKey(name)) {
|
||||||
String s = options.getProperty(name);
|
String s = options.getProperty(name);
|
||||||
try {
|
if (s != null) {
|
||||||
value = s.equalsIgnoreCase("on") || s.equals("1") || Boolean.parseBoolean(s);
|
value = "on".equalsIgnoreCase(s) || "1".equals(s) || Boolean.parseBoolean(s);
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
Loading…
Reference in New Issue
Block a user