-
1. Re: Escaping double quotes in WildFly CLI system parameter configuration values
mchoma Oct 31, 2017 2:44 AM (in response to platapapin)I can't reproduce based on your description. Can you reproduce on WildFly 11 Final?
Can you describe reproducer steps in detail?
-
2. Re: Escaping double quotes in WildFly CLI system parameter configuration values
platapapin Nov 3, 2017 4:35 PM (in response to mchoma)I can reproduce this on WildFly 11 Final.
I am attempting to set a system property with the following CLI command:
/system-property=com.example.type.list:add(value="[{\"code\":\"\",\"description\":\"\"},{\"code\":\"20R\",\"description\":\"20R\"},{\"code\":\"28R\",\"description\":\"28R\"},{\"code\":\"35R\",\"description\":\"35R\"},{\"code\":\"40R\",\"description\":\"40R\"},{\"code\":\"45R\",\"description\":\"45R\"},{\"code\":\"48R\",\"description\":\"48R\"},{\"code\":\"53R\",\"description\":\"53R\"},{\"code\":\"20V\",\"description\":\"20V\"},{\"code\":\"28V\",\"description\":\"28V\"},{\"code\":\"35V\",\"description\":\"35V\"},{\"code\":\"40V\",\"description\":\"40V\"},{\"code\":\"45V\",\"description\":\"45V\"},{\"code\":\"48V\",\"description\":\"48V\"},{\"code\":\"53V\",\"description\":\"53V\"},{\"code\":\"20000\",\"description\":\"20000\"},{\"code\":\"28000\",\"description\":\"28000\"},{\"code\":\"40000\",\"description\":\"40000\"},{\"code\":\"45000\",\"description\":\"45000\"},{\"code\":\"48000\",\"description\":\"48000\"},{\"code\":\"53000\",\"description\":\"53000\"}]")
This is the string that is written to the standalone.xml file, and subsequently set in the JVM system property com.example.type.list:
<property name="com.example.type.list" value="[{"code":"","description":""},{"code":"20R","description":"20R"},{"code":"28R","description":"28R"},{"code":"35R","description":"35R"},{"code":"40R","description":"40R"},{"code":"45R","description":"45R"},{"code":"48R","description":"48R"},{"code":"53R","description":"53R"},{"code":"20V","description":"20V"},{"code":"28V","description":"28V"},{"code":"35V","description":"35V"},{"code":"40V","description":"40V"},{"code":"45V","description":"45V"},{"code":"48V","description":"48V"},{"code":"53V","description":"53V"},{"code":"20000","description":"20000"},{"code":"28000","description":"28000"},{"code":"40000","description":"40000"},{"code":"45000","description":"45000"},{"code":"48000","description":"48000"},{"code":"53000","description":"53000"}]"/>
Let me know what you think.
-
3. Re: Escaping double quotes in WildFly CLI system parameter configuration values
mchoma Nov 6, 2017 5:36 AM (in response to platapapin)And how do you "consume" system property value? I have tried jsp scriptlet <%=System.getProperty("com.example.type.list")%> and it renders ok.
Or what is your problem?
-
4. Re: Escaping double quotes in WildFly CLI system parameter configuration values
platapapin Nov 6, 2017 8:12 AM (in response to mchoma)We retrieve the property the same way, i.e System.getProperty("com.example.type.list"), but from within a stateless session bean, not a JSP.
Since the system property contains HTML compatible escape sequences, I suspect that your browser is un-escaping the content when rendering the JSP, so you see the un-escaped version. In our case we are reading the property value (which is a JSON string) and are expecting to find actual double quote characters, not the escape sequence.
Our problem is that the WildFly CLI is converting the double quotes to escape sequences in order to write them to the server configuration file, but not un-escaping them when it puts the values in the JVM runtime system properties. So we effectively cannot put double quotes in <system-property> configuration elements.
Maybe this is the intended behavior? If so, should there be an optional parameter in the <system-properties> element to tell it to un-escape XML before setting the system property?
-
5. Re: Escaping double quotes in WildFly CLI system parameter configuration values
mchoma Nov 6, 2017 8:51 AM (in response to platapapin)It is also correctly in html source code - that is how it comes from server. Also when I use wget or curl. Also I see it properly in jconsole.
-
6. Re: Escaping double quotes in WildFly CLI system parameter configuration values
platapapin Nov 6, 2017 11:50 AM (in response to mchoma)Can you please post the the CLI command you are using to set the property with?
-
7. Re: Escaping double quotes in WildFly CLI system parameter configuration values
mchoma Nov 6, 2017 3:12 PM (in response to platapapin)I used your CLI command.
-
8. Re: Escaping double quotes in WildFly CLI system parameter configuration values
jaikiran Nov 7, 2017 7:19 AM (in response to platapapin)Just like Martin, I can't reproduce this either. I'm on WildFly 11.0.0.Final with Java 8. I added the exact same system property plus a few others just to make sure they are stored and parsed correctly. I then just used System.getProperty to print it out in one of the server side classes. All works fine and the value correctly contains the double quote character instead of the escape literal.
In our case we are reading the property value (which is a JSON string) and are expecting to find actual double quote characters, not the escape sequence.
Can you paste the relevant code? Furthermore, please include few other details like what operating system and Java vendor and version (java -version should give you that) you are using and how exactly are you finding that the escape sequence is being returned to you by a call to System.getProperty?
-
9. Re: Escaping double quotes in WildFly CLI system parameter configuration values
platapapin Nov 7, 2017 11:31 AM (in response to jaikiran)After deleting and recreating the system-property entry via the CLI and running the test again, we found that the problem does not in fact occur on WildFly 11 final. The value read from the system property contains properly un-escaped double quotes.
We will continue to test and post additional information if we can manage create the problem again on WildFly 11, but for now I think the issue is resolved.