Skip to content

Commit

Permalink
Handling inputstream (#563)
Browse files Browse the repository at this point in the history
Co-authored-by: M1044292 <[email protected]>
  • Loading branch information
HimajaDhanyamraju2 and M1044292 authored Jun 8, 2023
1 parent 4ef4bdc commit 05a1559
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,21 +442,21 @@ private String setupPreviousVersion(String version, Map<String, VersionMappings>
}
Map<Integer, String> backupVersions = new TreeMap<>(Collections.reverseOrder());
for (File backUpFolder : file.listFiles()) {
try {
File localManifestFile = new File(backUpFolder.getAbsolutePath() + RegistrationConstants.MANIFEST_PATH);
if (localManifestFile.exists()) {
Manifest manifest = new Manifest(new FileInputStream(localManifestFile));
File localManifestFile = new File(backUpFolder.getAbsolutePath() + RegistrationConstants.MANIFEST_PATH);
if (localManifestFile.exists()) {
try (FileInputStream inputStream = new FileInputStream(localManifestFile)) {
Manifest manifest = new Manifest(inputStream);
String backupVersion = manifest.getMainAttributes().getValue(Attributes.Name.MANIFEST_VERSION);
// Looping through all the available manifest versions in backup folder and
// preparing a map with key as releaseOrder from version-mappings and value as
// manifest version
if (versionMappings.containsKey(backupVersion)) {
backupVersions.put(versionMappings.get(backupVersion).getReleaseOrder(), backupVersion);
}
}
} catch (IOException exception) {
LOGGER.error(LoggerConstants.LOG_REG_LOGIN, APPLICATION_NAME, APPLICATION_ID,
"Exception while reading backed up manifest file: " + exception.getMessage() + ExceptionUtils.getStackTrace(exception));
} catch (IOException exception) {
LOGGER.error(LoggerConstants.LOG_REG_LOGIN, APPLICATION_NAME, APPLICATION_ID,
"Exception while reading backed up manifest file: " + exception.getMessage() + ExceptionUtils.getStackTrace(exception));
}
}
}
if (!backupVersions.isEmpty()) {
Expand Down

0 comments on commit 05a1559

Please sign in to comment.