only:better error message

This commit is contained in:
rusefillc 2024-12-18 22:18:13 -05:00
parent 164bd90d61
commit db96fbecf7
2 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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);