Bug 1020510 - (6.4.0) CommandContext not properly handling special text
(6.4.0) CommandContext not properly handling special text
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CLI (Show other bugs)
Unspecified Unspecified
unspecified Severity medium
: ---
: EAP 6.4.0
Assigned To: jboss-set
Petr Kremensky
Depends On:
Blocks: 1134303 1134309
  Show dependency treegraph
Reported: 2013-10-17 15:47 EDT by Miles Tjandrawidjaja
Modified: 2017-10-09 20:11 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1134303 (view as bug list)
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker DMR-10 Major Open support for local characters parsing values from strings 2017-02-20 06:44 EST

  None (edit)
Description Miles Tjandrawidjaja 2013-10-17 15:47:32 EDT
Description of problem:
Method "handle" from class "CommandContext" does not parse special characters like "ô" properly. This is related to https://bugzilla.redhat.com/show_bug.cgi?id=1017264.

Version-Release number of selected component (if applicable):
Was testing on jboss-as-dist-7.3.0.Final-redhat-6.zip
But I think also applicable to jboss-as-dist-7.2.0.Final-redhat-8.zip

How reproducible:

Steps to Reproduce:
1. Start up standalone server ./standalone.sh
2. Initialize CommandContext through CommandContextFactory
3. Connect CommandContext through controller via method connectController()
4. Run your command via handle method
String line = "data-source add --name=jbpmDS --jndi-name=java:jboss/datasources/jbpmDS --driver-name=h2 --user-name=soa --password=\"soa\" --connection-url=\"jdbc:h2:file:${jboss.server.data.dir}/ô/h2/soa;mvcc=true\"";


Actual results:
Request contains

Expected results:
Request to contain

Additional info:
Seems like in file: GenericTypeOperationHandler.java
Within method: ModelNode buildRequest(CommandContext ctx)

Around line below:
ModelNode nodeValue = arg.getValueConverter().fromString(ctx, valueString);

Transforms valueString of
valueString = jdbc:h2:file:${jboss.server.data.dir}/ô/h2/soa;mvcc=true

nodeValue = "jdbc:h2:file:${jboss.server.data.dir}/?/h2/soa;mvcc=true"

This causes .xml file to contain "?" rather than the special character "ô"

This is related to https://bugzilla.redhat.com/show_bug.cgi?id=1019782
Comment 1 Alexey Loubyansky 2013-11-08 06:11:46 EST
AFAICS, it's in the jboss-dmr ModelNode.fromString(str) parser. If you try

data-source add --name=jbpmDS --jndi-name=java:jboss/datasources/jbpmDS --driver-name=h2 --user-name=soa --password=\"soa\" --connection-url=jdbc:h2:file:${jboss.server.data.dir}/ô/h2/soa;mvcc=true

i.e. w/o quotes then it'll be parsed by the CLI parser and it'll work.

Every value is first parsed with the DMR parser if that fails then the CLI is trying its own parser. Usually, a (simple) quoted string will be parsed by the DMR parser successfully and the result will used for the operation request.
Comment 2 Alexey Loubyansky 2013-11-19 11:02:49 EST
And this was fixed as https://issues.jboss.org/browse/DMR-8.
Comment 3 Alexey Loubyansky 2013-11-19 11:26:59 EST
(In reply to Alexey Loubyansky from comment #2)
> And this was fixed as https://issues.jboss.org/browse/DMR-8.

Actually, that issue is a bit different and targets more JSON strings. To make sure this issue is covered I created https://issues.jboss.org/browse/DMR-10
Comment 4 Miles Tjandrawidjaja 2013-11-26 12:17:46 EST
I have tried without quotes for the --connection url.

With Quotes
String line = "data-source add --name=jbpmDS --jndi-name=java:jboss/datasources/jbpmDS --driver-name=h2 --user-name=soa --password=\"soa\" --connection-url=\"jdbc:h2:file:${jboss.server.data.dir}/ô/h2/soa;mvcc=true\"";
<datasource jndi-name="java:jboss/datasources/jbpmDS" pool-name="jbpmDS" enabled="false">

Without Quotes
String line = "data-source add --name=jbpmDS  --jndi-name=java:jboss/datasources/jbpmDS --driver-name=h2 --user-name=soa --password=\"soa\" --connection-url=jdbc:h2:file:${jboss.server.data.dir}/ô/h2/soa;mvcc=true";
<datasource jndi-name="java:jboss/datasources/jbpmDS" pool-name="jbpmDS" enabled="false">
Comment 6 Joe Wertz 2015-04-29 03:12:02 EDT
For future evaluation purposes, this is cased in the DMR at the ModelNode.fromString(str) method. The existing string-to-byte-array conversion is limited to the 'us-ascii' character set for use in the cookcc parsing library.

Lloyd is working on a refactor that removes the cookcc library, but I don't know the expected release for it.

Note You need to log in before you can comment on or make changes to this bug.