RFR: JDK-8227641: java-options values with spaces are processed incorrectly

Andy Herrick andy.herrick at oracle.com
Fri Aug 9 13:47:41 UTC 2019

I don't think we should put these examples in help text of 
--java-options, and that we we should just close this bug as "not a bug".

The necessity of escaping option values with spaces and embedded quotes 
applies to many other jpackage options as well.

The examples here don't really require escaping (could be accomplished 
by using both forms of quoting) but more complex forms would require 

Any description or examples of how and when to do it belongs in the user 
documentation (which does not yet exist).

There are "Additional Notes" in the CSR 
(https://bugs.openjdk.java.net/browse/JDK-8213087) where we previously 
put explanations that eventually need to be in user documentation.


On 8/9/2019 12:26 AM, Alexander Matveev wrote:
> Please review the jpackage fix for bug [1] at [2].
> This is a fix for the JDK-8200758-branch branch of the open sandbox 
> repository (jpackage).
> - There are no know bugs in how we handle java options with spaces. 
> However, it might be complicated to figure out how to provide such 
> options. Added several examples to help to show most common cases.
>   --java-options <java options>
>           Options to pass to the Java runtime
>           This option can be used multiple times.
>           Example 1: To specify [-DOption1=My Great App] use
>            [--java-options "-DOption1=\"My Great App\""]
>           Example 2: To specify [-DOption2="My Great App in quotes"] use
>            [--java-options "-DOption2=\"\\\"My Great App in 
> quotes\\\"\""]
>           Example 3: To specify [-DOption3=Value "with" quotes] use
>            [--java-options "-DOption3=\"Value \\\"with\\\" quotes\""]
> Application will read them back as:
> -DOption1=My Great App
> -DOption2="My Great App in quotes"
> -DOption3=Value "with" quotes
> [1] https://bugs.openjdk.java.net/browse/JDK-8227641
> [2] http://cr.openjdk.java.net/~almatvee/8227641/webrev.00/
> Thanks,
> Alexander

More information about the core-libs-dev mailing list