only:better error message
This commit is contained in:
parent
164bd90d61
commit
db96fbecf7
|
@ -24,8 +24,8 @@ public class IniFileMetaInfoImpl implements IniFileMetaInfo {
|
|||
|
||||
public IniFileMetaInfoImpl(RawIniFile file) {
|
||||
|
||||
nPages = file.getSimpleIntegerProperty("nPages", 1);
|
||||
try {
|
||||
nPages = file.getSimpleIntegerProperty("nPages", 1);
|
||||
ochBlockSize = file.getSimpleIntegerProperty("ochBlockSize");
|
||||
|
||||
blockingFactor = file.getSimpleIntegerProperty("blockingFactor", DEFAULT_BLOCKING_FACTOR);
|
||||
|
|
|
@ -58,15 +58,15 @@ public class RawIniFile {
|
|||
return lines;
|
||||
}
|
||||
|
||||
public int getSimpleIntegerProperty(String key) {
|
||||
public int getSimpleIntegerProperty(String key) throws MandatoryLineMissing {
|
||||
Line line = asSet.get(key);
|
||||
if (line == null)
|
||||
throw new IllegalStateException("Line not found: " + key);
|
||||
throw new MandatoryLineMissing("Line not found: " + key);
|
||||
String value = line.getTokens()[1];
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
|
||||
public int getSimpleIntegerProperty(String key, int defaultValue) {
|
||||
public int getSimpleIntegerProperty(String key, int defaultValue) throws MandatoryLineMissing {
|
||||
if (!asSet.containsKey(key))
|
||||
return defaultValue;
|
||||
return getSimpleIntegerProperty(key);
|
||||
|
|
Loading…
Reference in New Issue