[ 
https://issues.apache.org/jira/browse/STORM-1532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15143376#comment-15143376
 ] 

ASF GitHub Bot commented on STORM-1532:
---------------------------------------

Github user revans2 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1094#discussion_r52656968
  
    --- Diff: storm-core/src/jvm/org/apache/storm/utils/Utils.java ---
    @@ -330,7 +330,11 @@ public static Map readCommandLineOpts() {
             Map ret = new HashMap();
             String commandOptions = System.getProperty("storm.options");
             if (commandOptions != null) {
    -            String[] configs = commandOptions.split(",");
    +            /*
    +             below regex uses negative lookahead to not split in the 
middle of
    +             json objects '{}' or json arrays '[]'
    +              */
    +            String[] configs = 
commandOptions.split(",(?![^\\[\\]{}]*(]|}))");
    --- End diff --
    
    Sorry about the long pause.  I thought I had replied already, but I guess I 
didn't hit the merge comment button.  I forgot that the python was escaping all 
of the JSON characters, so like you said this works.
    
    I am OK with merging this in, but I would like an explanation by the REGEX 
explaining about the escaping in most cases and that this is not perfect for 
windows.
    
    It would also be good to have a follow on JIRA to solve this correctly with 
url encoding the parameters, but I don't know enough about windows to suggest 
how to do that.


> Fix readCommandLineOpts to parse JSON correctly
> -----------------------------------------------
>
>                 Key: STORM-1532
>                 URL: https://issues.apache.org/jira/browse/STORM-1532
>             Project: Apache Storm
>          Issue Type: Bug
>            Reporter: Arun Mahadevan
>            Assignee: Arun Mahadevan
>
> Utils.readCommandLineOpts does a split on "," so it does not correctly parse 
> values passed as json object or json arrays.
> Tested by passing 
> -c drpc.servers=[\"host1\", \"host2\"]  in storm jar command and it fails 
> with an exception,
> Exception in thread "main" java.lang.IllegalArgumentException: Field 
> DRPC_SERVERS must be an Iterable but was a class java.lang.String



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to