chrisdchristo / capsule-maven-plugin

Capsule Maven Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect handling of system properties with empty values

ldcasillas-progreso opened this issue · comments

I'm using version 0.10.8 of the pluging. I'm trying to set up JMX inside a capsule, so I'm trying to make a capsule that replicates this command line:

java -jar my.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1098 [...]

Note that first argument, Dcom.sun.management.jmxremote. That's not being handled gracefully by the plugin right now. First thing I tried is this:

<configuration>
    <appClass>my.app.Main</appClass>
    <types>fat</types>
    <properties>
        <property>
            <key>com.sun.management.jmxremote</key>
        </property>
        <property>
            <key>com.sun.management.jmxremote.ssl</key>
            <value>false</value>
        </property>
        <property>
            <key>com.sun.management.jmxremote.authenticate</key>
            <value>false</value>
        </property>
        <property>
            <key>com.sun.management.jmxremote.port</key>
            <value>1098</value>
        </property>
    </properties>
</configuration>

But that produces the following in the manifest, skipping the empty property completely:

System-Properties: com.sun.management.jmxremote.ssl=false com.sun.management.jmxremote.authenticate=false com.sun.management.jmxremote.port=1098 

And if I try this:

<property>
  <key>com.sun.management.jmxremote</key>
  <value></value>
</property>

...that produces the following:

System-Properties: com.sun.management.jmxremote=java.lang.Object@7b78ce2d com.sun.management.jmxremote.ssl=false com.sun.management.jmxremote.authenticate=false com.sun.management.jmxremote.port=1098 

If the initial value of the system property is null, what different does it make if you try and specifically set it to null?

In release 1.0.0, you fill find that the following both work:

<property>
  <key>com.sun.management.jmxremote</key>
  <value></value>
</property>
<property>
  <key>com.sun.management.jmxremote</key>
</property>

and will result in a manifest like so:

System-Properties: com.sun.management.jmxremote com.sun.management.jmxremote.ssl=false com.sun.management.jmxremote.authenticate=false com.sun.management.jmxremote.port=1098 

Note that there is no equals sign after the first property.

Then in java com.sun.management.jmxremote will be in the System.getProperties as a listed name.