Bug 1020510 - (6.4.0) CommandContext not properly handling special text
Summary: (6.4.0) CommandContext not properly handling special text
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CLI
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: EAP 6.4.0
Assignee: jboss-set
QA Contact: Petr Kremensky
URL:
Whiteboard:
Depends On:
Blocks: 1134303 1134309
TreeView+ depends on / blocked
 
Reported: 2013-10-17 19:47 UTC by Miles Tjandrawidjaja
Modified: 2019-08-19 12:46 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1134303 (view as bug list)
Environment:
Last Closed: 2019-08-19 12:46:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker DMR-10 0 Major Open support for local characters parsing values from strings 2017-02-20 11:44:40 UTC

Description Miles Tjandrawidjaja 2013-10-17 19:47:32 UTC
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:
Always

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
Ex.
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\"";

context.handle(line);

Actual results:
Request contains
jdbc:h2:file:${jboss.server.data.dir}/?/h2/soa;mvcc=true

Expected results:
Request to contain
jdbc:h2:file:${jboss.server.data.dir}/ô/h2/soa;mvcc=true

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

into
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 11:11:46 UTC
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 16:02:49 UTC
And this was fixed as https://issues.jboss.org/browse/DMR-8.

Comment 3 Alexey Loubyansky 2013-11-19 16:26:59 UTC
(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 17:17:46 UTC
I have tried without quotes for the --connection url.
Result:
<connection-url>true</connection-url>
Expected:
<connection-url>jdbc:h2:file:${jboss.server.data.dir}/ô/h2/soa;mvcc=true</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">
    <connection-url>jdbc:h2:file:${jboss.server.data.dir}/?/h2/soa;mvcc=true</connection-url>
    <driver>h2</driver>
    <security>
        <user-name>soa</user-name>
        <password>soa</password>
    </security>
</datasource>


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">
    <connection-url>true</connection-url>
    <driver>h2</driver>
    <security>
        <user-name>soa</user-name>
        <password>soa</password>
    </security>
</datasource>

Comment 6 Joe Wertz 2015-04-29 07:12:02 UTC
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.