Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,9 @@ private int completeImageBuild() {
}

Optional<ArgumentEntry> lastImageName = getHostedOptionArgument(imageBuilderArgs, oHName);
if (!lastImageName.isEmpty()) {
validateImageName(lastImageName.get().value());
}

if (!jarOptionMode) {
mainClassModule = getHostedOptionArgumentValue(imageBuilderArgs, oHModule);
Expand Down Expand Up @@ -1333,7 +1336,7 @@ private int completeImageBuild() {
boolean extraNameIsLast = lastImageName.isEmpty() || lastImageName.get().index < extraImageName.index;
if (extraNameIsLast) {
/* extraImageArg that comes after lastImageName wins */
imageBuilderArgs.add(oH(SubstrateOptions.Name, "explicit image name") + extraImageName.value);
imageBuilderArgs.add(oH(SubstrateOptions.Name, "explicit image name") + validateImageName(extraImageName.value));
}
}
} else { /* jarOptionMode */
Expand Down Expand Up @@ -1455,6 +1458,13 @@ private int completeImageBuild() {
}
}

private static String validateImageName(String imageName) {
if (imageName.startsWith("-")) {
LogUtils.warning("Image name ('" + imageName + "') start with a dash. Is another option wrongly interpreted as image name? (see --help)");
}
return imageName;
}

private static void updateArgumentEntryValue(List<String> argList, ArgumentEntry listEntry, String newValue) {
APIOptionHandler.BuilderArgumentParts argParts = APIOptionHandler.BuilderArgumentParts.from(argList.get(listEntry.index));
argParts.optionValue = newValue;
Expand Down
Loading