Console should get much smarter around compatibility with older units #6845

only:cleaner error messages
This commit is contained in:
Andrey 2024-09-08 08:24:15 -04:00
parent 3c2d5bd347
commit 10d41c338d
2 changed files with 6 additions and 10 deletions

View File

@ -56,15 +56,9 @@ public class IniFileModel {
}
public IniFileModel readIniFile(String fileName) {
File input = null;
if (fileName != null)
input = new File(fileName);
if (fileName == null || !input.exists()) {
log.error("No such file: " + fileName);
return null;
}
Objects.requireNonNull(fileName, "fileName");
log.info("Reading " + fileName);
File input = new File(fileName);
RawIniFile content = IniFileReader.read(input);
metaInfo = new IniFileMetaInfo(content);

View File

@ -178,11 +178,13 @@ public class BinaryProtocol {
try {
signature = getSignature(stream);
log.info("Got [" + signature + "] signature");
String localIniFile = SignatureHelper.downloadIfNotAvailable(SignatureHelper.getUrl(signature));
iniFile = new IniFileModel().readIniFile(localIniFile);
} catch (IOException e) {
return "Failed to read signature " + e;
}
String localIniFile = SignatureHelper.downloadIfNotAvailable(SignatureHelper.getUrl(signature));
if (localIniFile == null)
throw new IllegalStateException("Failed to download for " + signature);
iniFile = new IniFileModel().readIniFile(localIniFile);
String errorMessage = validateConfigVersion();
if (errorMessage != null)