Skip to content

Commit 12c358d

Browse files
Merge branch 'master' into copyrights-and-licenses
2 parents a69676f + f27d79d commit 12c358d

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/main/java/com/oracle/weblogicx/imagebuilder/cli/CLIDriver.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,10 @@ public static void main(String[] args) {
5353
CommandResponse response = WLSCommandLine.call(cliDriver, true, args);
5454

5555
if (response != null) {
56-
57-
String message = String.format("Response code: %d, message: %s", response.getStatus(),
58-
response.getMessage());
5956
if (response.getStatus() != 0) {
57+
String message = String.format("Response code: %d, message: %s", response.getStatus(),
58+
response.getMessage());
6059
logger.severe(message);
61-
} else {
62-
logger.info(message);
6360
}
6461
System.exit(response.getStatus());
6562
}

src/main/java/com/oracle/weblogicx/imagebuilder/cli/cache/AddInstallerEntry.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.oracle.weblogicx.imagebuilder.api.model.CommandResponse;
88
import com.oracle.weblogicx.imagebuilder.api.model.InstallerType;
99
import com.oracle.weblogicx.imagebuilder.util.Constants;
10+
import com.oracle.weblogicx.imagebuilder.util.Utils;
1011
import picocli.CommandLine.Command;
1112
import picocli.CommandLine.Option;
1213

@@ -31,7 +32,7 @@ public AddInstallerEntry(boolean isCLIMode) {
3132

3233
@Override
3334
public CommandResponse call() {
34-
if (location != null && Files.isRegularFile(location)) {
35+
if (location != null && Files.isRegularFile(location) && !Utils.isEmptyString(version)) {
3536
String key = String.format("%s%s%s", type, CACHE_KEY_SEPARATOR, version);
3637
cacheStore.addToCache(key, location.toAbsolutePath().toString());
3738
return new CommandResponse(0, String.format("Successfully added to cache. %s=%s", key,
@@ -51,8 +52,7 @@ public CommandResponse call() {
5152
@Option(
5253
names = {"--version"},
5354
description = "Installer version. Ex: For WLS|FMW use 12.2.1.3.0 For jdk, use 8u201",
54-
required = true,
55-
defaultValue = Constants.DEFAULT_WLS_VERSION
55+
required = true
5656
)
5757
private String version;
5858

src/main/java/com/oracle/weblogicx/imagebuilder/cli/cache/ListCacheItems.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
package com.oracle.weblogicx.imagebuilder.cli.cache;
66

77
import com.oracle.weblogicx.imagebuilder.api.model.CommandResponse;
8+
import com.oracle.weblogicx.imagebuilder.util.Utils;
89
import picocli.CommandLine.Command;
910

1011
import java.util.Collections;
1112
import java.util.Map;
1213

14+
import static com.oracle.weblogicx.imagebuilder.util.Constants.CACHE_DIR_KEY;
15+
1316
@Command(
1417
name = "listItems",
1518
description = "List cache contents"
@@ -34,9 +37,12 @@ public CommandResponse call() {
3437
} else {
3538
if (isCLIMode) {
3639
System.out.println("Cache contents");
37-
resultMap.forEach((key, value) -> {
38-
System.out.println(key + "=" + value);
39-
});
40+
String cacheDir = resultMap.getOrDefault(CACHE_DIR_KEY, null);
41+
if (!Utils.isEmptyString(cacheDir)) {
42+
System.out.println(CACHE_DIR_KEY + "=" + cacheDir);
43+
resultMap.remove(CACHE_DIR_KEY);
44+
}
45+
resultMap.forEach((key, value) -> System.out.println(key + "=" + value));
4046
}
4147
return new CommandResponse(0, "Cache contents", resultMap);
4248
}

0 commit comments

Comments
 (0)