Skip to content

Commit 15b1dbb

Browse files
ddsharpejshum2479
authored andcommitted
Fail CREATE operation when bad argument is provided (#11)
* fail when invalid parameter supplied to CLI * added additional logging for
1 parent 6ffbb80 commit 15b1dbb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/model/AbstractFile.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88

99
import java.nio.file.Files;
1010
import java.nio.file.Paths;
11+
import java.util.logging.Logger;
1112

1213
/**
1314
* Base class to represent either an installer or a patch file
1415
*/
1516
public abstract class AbstractFile implements FileResolver {
1617

18+
private final Logger logger = Logger.getLogger(AbstractFile.class.getName());
19+
1720
protected String key;
1821
protected CachePolicy cachePolicy;
1922
protected String userId;
@@ -24,6 +27,7 @@ public AbstractFile(String key, CachePolicy cachePolicy, String userId, String p
2427
this.cachePolicy = cachePolicy;
2528
this.userId = userId;
2629
this.password = password;
30+
logger.finer("Exiting AbstractFile construction: key=" + key);
2731
}
2832

2933
protected boolean isFileOnDisk(String filePath) {

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/WLSCommandLine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static <C extends Callable<T>, T> T call(C callable, PrintStream out, Pri
3232
}
3333
cmd.setCaseInsensitiveEnumValuesAllowed(ignoreCaseForEnums);
3434
cmd.setToggleBooleanFlags(false);
35-
cmd.setUnmatchedArgumentsAllowed(true);
35+
cmd.setUnmatchedArgumentsAllowed(false);
3636
//cmd.registerConverter(CacheStore.class, x -> new CacheStoreFactory().getCacheStore(x));
3737

3838
List<Object> results = cmd.parseWithHandlers(new CommandLine.RunLast().useOut(out).useAnsi(ansi),

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CreateImage.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ private List<InstallerFile> gatherRequiredInstallers() throws Exception {
285285
retVal.add(new InstallerFile(useCache, InstallerType.fromValue(installerType.toString()), installerVersion,
286286
userId, password));
287287
retVal.add(new InstallerFile(useCache, InstallerType.JDK, jdkVersion, userId, password));
288-
logger.finer("Exiting CreateImage.gatherRequiredInstallers: ");
288+
logger.finer("Exiting CreateImage.gatherRequiredInstallers: "
289+
+ installerType.toString() + ":" + installerVersion + ", "
290+
+ InstallerType.JDK + ":" + jdkVersion);
289291
return retVal;
290292
}
291293

0 commit comments

Comments
 (0)