On Wed, 16 Sep 2026 15:44:56 GMT, Jaikiran Pai <[email protected]> wrote:

>> Fix typo in LauncherHelper.validateOption
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Hello Kieran, the change looks good to me. Would it be possible to add/update 
> a launcher test which verifies that `java -XshowSettings:` will indeed result 
> in an error? `test/jdk/tools/launcher/Settings.java` seems like a suitable 
> test.

Hi @jaikiran , Settings.java already invokes java -XshowSettings: in 
runTestBadOptions() from lines 312


        // don't allow ":" as an option
        tr = doExec(javaCmd, "-XshowSettings:");
        tr.checkNegative();
        checkContains(tr, ERR_MSG);


the reason why this test case didnt catch the typo is because even with the 
typo, using 'XshowSettings:' at start up still throws the exception, but at the 
second check of validateOption '(component == null)' rather than the first. 
Unlike the first catch, the second prints the optStr so i could update the test 
case to ensure the error message contain the extra ':' after 'Unrecognized 
showSettings option:' seen below if we want to adapt it to catch this 
particular typo.


  Unrecognized showSettings option: :
  Valid values are "all", "locale", "properties", "security", "system"(Linux 
only), "vm"
  Valid "security" suboption values are "all", "properties", "providers", "tls"

-------------

PR Comment: https://git.openjdk.org/jdk/pull/32908#issuecomment-5703335665

Reply via email to