Skip to content

Commit

Permalink
Merge pull request #646 from rosensilva/main
Browse files Browse the repository at this point in the history
Fix runtime backup issue
  • Loading branch information
sajithaliyanage authored Feb 17, 2021
2 parents 8bfdf4a + c2bc9eb commit 6fdc5d4
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,23 @@ public void earlyStartup() {
} else {
internalServerVersionFile = new File(MICRO_ESB_VERSION_PROPERTIES_FILE);
}
if (!internalServerVersionFile.exists()) {
internalServerVersionFile.getParentFile().mkdirs();
internalServerVersionFile.createNewFile();
}
try (InputStream inStream = new FileInputStream(internalServerVersionFile)) {
Properties prop = new Properties();
prop.load(inStream);
Object property = prop.get("version");
if (property == null) {
internalServerVersion = "00";
} else {
internalServerVersion = property.toString();
}
if (internalServerVersionFile.exists()) {
try (InputStream inStream = new FileInputStream(internalServerVersionFile)) {
Properties prop = new Properties();
prop.load(inStream);
Object property = prop.get("version");
if (property == null) {
internalServerVersion = "00";
} else {
internalServerVersion = property.toString();
}

} catch (IOException io) {
log.error("Error occured while trying to retreive server version from the application", io);
} catch (IOException io) {
log.error("Error occured while trying to retreive server version from the application", io);
}
} else {
internalServerVersion = "00";
}

int internalVersion = Integer.parseInt(internalServerVersion);
int pluginVersion = Integer.parseInt(PluginServerVersion);

Expand All @@ -157,7 +156,10 @@ public void earlyStartup() {
esbSeverDestination.renameTo(backupDir);
}
MavenMultiModuleImportUtils.extractZipFile(esbServerZipFromPlugin, esbSeverDestination);

if (!internalServerVersionFile.exists()) {
internalServerVersionFile.getParentFile().mkdirs();
internalServerVersionFile.createNewFile();
}
try (OutputStream output = new FileOutputStream(internalServerVersionFile)) {
Properties prop = new Properties();
prop.setProperty("version", PluginServerVersion);
Expand Down

0 comments on commit 6fdc5d4

Please sign in to comment.