Bug 1134303 - (6.3.x) CommandContext not properly handling special text
Summary: (6.3.x) CommandContext not properly handling special text
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CLI
Version: 6.3.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Alexey Loubyansky
QA Contact: Petr Kremensky
Russell Dickenson
URL:
Whiteboard:
Depends On: 1020510
Blocks: 1134310
TreeView+ depends on / blocked
 
Reported: 2014-08-27 09:21 UTC by baranowb
Modified: 2014-10-13 17:14 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1020510
Environment:
Last Closed: 2014-10-13 17:12:10 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 2015-04-28 06:48:35 UTC

Description baranowb 2014-08-27 09:21:03 UTC
+++ This bug was initially created as a clone of Bug #1020510 +++

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

--- Additional comment from Alexey Loubyansky on 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.

--- Additional comment from Alexey Loubyansky on 2013-11-19 11:02:49 EST ---

And this was fixed as https://issues.jboss.org/browse/DMR-8.

--- Additional comment from Alexey Loubyansky on 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

--- Additional comment from Miles Tjandrawidjaja on 2013-11-26 12:17:46 EST ---

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>


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