Skip to content

Commit

Permalink
Use String.join for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
mcalmer committed Aug 21, 2024
1 parent e79fa21 commit abd9f9e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions java/code/src/com/suse/manager/utils/SaltUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -912,20 +912,19 @@ private String parseDryRunMessage(JsonElement jsonResult) {
DistUpgradeDryRunSlsResult distUpgradeSlsResult = Json.GSON.fromJson(
jsonResult, DistUpgradeDryRunSlsResult.class);
if (distUpgradeSlsResult.getSpmigration() != null) {
return distUpgradeSlsResult.getSpmigration()
.getChanges().getRetOpt()
.orElse("") + " " + distUpgradeSlsResult
.getSpmigration().getComment();
return String.join(" ",
distUpgradeSlsResult.getSpmigration().getChanges().getRetOpt().orElse(""),
distUpgradeSlsResult.getSpmigration().getComment());
}
}
catch (JsonSyntaxException e) {
try {
DistUpgradeOldSlsResult distUpgradeSlsResult = Json.GSON.fromJson(
jsonResult, DistUpgradeOldSlsResult.class);
return distUpgradeSlsResult.getSpmigration()
.getChanges().getRetOpt().map(ModuleRun::getComment)
.orElse("") + " " + distUpgradeSlsResult
.getSpmigration().getComment();
return String.join(" ",
distUpgradeSlsResult.getSpmigration().getChanges().getRetOpt()
.map(ModuleRun::getComment).orElse(""),
distUpgradeSlsResult.getSpmigration().getComment());
}
catch (JsonSyntaxException ex) {
LOG.error("Unable to parse dry run result", ex);
Expand Down

0 comments on commit abd9f9e

Please sign in to comment.