8324126: Error message for mistyping -XX:+Unlock...Options is not helpful
Reviewed-by: dholmes, stuefe
This commit is contained in:
parent
9ee9f28849
commit
542b0b6656
@ -1119,18 +1119,7 @@ bool Arguments::process_argument(const char* arg,
|
|||||||
if (found_flag != nullptr) {
|
if (found_flag != nullptr) {
|
||||||
char locked_message_buf[BUFLEN];
|
char locked_message_buf[BUFLEN];
|
||||||
JVMFlag::MsgType msg_type = found_flag->get_locked_message(locked_message_buf, BUFLEN);
|
JVMFlag::MsgType msg_type = found_flag->get_locked_message(locked_message_buf, BUFLEN);
|
||||||
if (strlen(locked_message_buf) == 0) {
|
if (strlen(locked_message_buf) != 0) {
|
||||||
if (found_flag->is_bool() && !has_plus_minus) {
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Missing +/- setting for VM option '%s'\n", argname);
|
|
||||||
} else if (!found_flag->is_bool() && has_plus_minus) {
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Unexpected +/- setting in VM option '%s'\n", argname);
|
|
||||||
} else {
|
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
|
||||||
"Improperly specified VM option '%s'\n", argname);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#ifdef PRODUCT
|
#ifdef PRODUCT
|
||||||
bool mismatched = ((msg_type == JVMFlag::NOTPRODUCT_FLAG_BUT_PRODUCT_BUILD) ||
|
bool mismatched = ((msg_type == JVMFlag::NOTPRODUCT_FLAG_BUT_PRODUCT_BUILD) ||
|
||||||
(msg_type == JVMFlag::DEVELOPER_FLAG_BUT_PRODUCT_BUILD));
|
(msg_type == JVMFlag::DEVELOPER_FLAG_BUT_PRODUCT_BUILD));
|
||||||
@ -1140,6 +1129,16 @@ bool Arguments::process_argument(const char* arg,
|
|||||||
#endif
|
#endif
|
||||||
jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
|
jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
|
||||||
}
|
}
|
||||||
|
if (found_flag->is_bool() && !has_plus_minus) {
|
||||||
|
jio_fprintf(defaultStream::error_stream(),
|
||||||
|
"Missing +/- setting for VM option '%s'\n", argname);
|
||||||
|
} else if (!found_flag->is_bool() && has_plus_minus) {
|
||||||
|
jio_fprintf(defaultStream::error_stream(),
|
||||||
|
"Unexpected +/- setting in VM option '%s'\n", argname);
|
||||||
|
} else {
|
||||||
|
jio_fprintf(defaultStream::error_stream(),
|
||||||
|
"Improperly specified VM option '%s'\n", argname);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ignore_unrecognized) {
|
if (ignore_unrecognized) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -59,5 +59,11 @@ public class TestVMOptions {
|
|||||||
output = new OutputAnalyzer(pb.start());
|
output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldNotHaveExitValue(0);
|
output.shouldNotHaveExitValue(0);
|
||||||
output.shouldContain("VM option '-IgnoreUnrecognizedVMOptions'");
|
output.shouldContain("VM option '-IgnoreUnrecognizedVMOptions'");
|
||||||
|
|
||||||
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
|
"-XX:UnlockExperimentalVMOptions");
|
||||||
|
output = new OutputAnalyzer(pb.start());
|
||||||
|
output.stderrShouldContain("VM option 'UnlockExperimentalVMOptions' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.");
|
||||||
|
output.stderrShouldContain("Missing +/- setting for VM option 'UnlockExperimentalVMOptions'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user