Skip to content

Commit 3387efd

Browse files
jshum2479ddsharpe
authored andcommitted
Change to fail the cache addInstaller if it already exists. (#40)
1 parent c462c76 commit 3387efd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/cache/AddInstallerEntry.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public AddInstallerEntry(boolean isCLIMode) {
3131
public CommandResponse call() {
3232
if (location != null && Files.isRegularFile(location) && !Utils.isEmptyString(version)) {
3333
String key = String.format("%s%s%s", type, CacheStore.CACHE_KEY_SEPARATOR, version);
34+
if (cacheStore.getValueFromCache(key) != null) {
35+
return new CommandResponse(-1, String.format("Installer already exists %s=%s. Try removing it "
36+
+ "using the deleteEntry command before adding it again.",
37+
key,
38+
cacheStore.getValueFromCache(key)));
39+
}
3440
cacheStore.addToCache(key, location.toAbsolutePath().toString());
3541
return new CommandResponse(0, String.format("Successfully added to cache. %s=%s", key,
3642
cacheStore.getValueFromCache(key)));

0 commit comments

Comments
 (0)