[jboss-jira] [JBoss JIRA] (AS7-5168) IllegalArgumentException when using tab-completion with a wildcard in the path

Jeff Mesnil (JIRA) jira-events at lists.jboss.org
Fri Jul 13 05:40:12 EDT 2012


    [ https://issues.jboss.org/browse/AS7-5168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12705842#comment-12705842 ] 

Jeff Mesnil edited comment on AS7-5168 at 7/13/12 5:39 AM:
-----------------------------------------------------------

I did a bit of debugging and it seems the code crashes because the read-resource-description structure differs whether there is a wildcard in the address path but the CLI expects only the single resource case

without a wildcard
{noformat}

[standalone at localhost:9999 /] /subsystem=messaging/hornetq-server=default/jms-queue=myQueue:read-resource-description
{
    "outcome" => "success",
    "result" => {
        "description" => "Defines a JMS queue.",
        "attributes" => {
            "entries" => {
                "type" => LIST,
                "description" => "The jndi names the queue will be bound to.",
                "expressions-allowed" => false,
                "nillable" => false,
                "value-type" => STRING,
                "access-type" => "read-write",
                "storage" => "configuration",
                "restart-required" => "all-services"
            },
            ...
        },
        "operations" => undefined,
        "children" => {}
    }
}
{noformat}

with a wildcard
{noformat}

[standalone at localhost:9999 /] /subsystem=messaging/hornetq-server=default/jms-queue=*:read-resource-description(inherited=false)
{
    "outcome" => "success",
    "result" => [{
        "address" => [
            ("subsystem" => "messaging"),
            ("hornetq-server" => "default"),
            ("jms-queue" => "*")
        ],
        "outcome" => "success",
        "result" => {
            "description" => "Defines a JMS queue.",
            "attributes" => {
                "entries" => {
                    "type" => LIST,
                    "description" => "The jndi names the queue will be bound to.",
                    "expressions-allowed" => false,
                    "nillable" => false,
                    "value-type" => STRING,
                    "access-type" => "read-write",
                    "storage" => "configuration",
                    "restart-required" => "all-services"
                },
                ...
            },
            "operations" => undefined,
            "children" => {}
        }
    }]
}
{noformat}

                
      was (Author: jmesnil):
    I did a bit of debugging and it seems the code crashes because the response's result from the server is a an array (of 1 element) when I pass a wildcard in the path while the code expect a single element (which is the case when there is no wildcard)

{noformat}
{
    "outcome" : "success",
    "result" : [{
        "address" : [
            {
                "subsystem" : "messaging"
            },
            {
                "hornetq-server" : "default"
            },
            {
                "jms-queue" : "*"
            }
        ],
        "outcome" : "success",
        "result" : {
            "description" : "Defines a JMS queue.",
            "attributes" : {
                "entries" : {
                    "type" : {
                        "TYPE_MODEL_VALUE" : "LIST"
                    },
                    "description" : "The jndi names the queue will be bound to.",
                    "expressions-allowed" : false,
                    "nillable" : false,
                    "value-type" : {
                        "TYPE_MODEL_VALUE" : "STRING"
                    },
                    "access-type" : "read-write",
                    "storage" : "configuration",
                    "restart-required" : "all-services"
                },
                "selector" : {
                    "type" : {
                        "TYPE_MODEL_VALUE" : "STRING"
                    },
                    "description" : "The queue selector.",
                    "expressions-allowed" : false,
                    "nillable" : true,
                    "min-length" : 1,
                    "max-length" : 2147483647,
                    "access-type" : "read-write",
                    "storage" : "configuration",
                    "restart-required" : "all-services"
                },
                "durable" : {
                    "type" : {
                        "TYPE_MODEL_VALUE" : "BOOLEAN"
                    },
                    "description" : "Whether the queue is durable or not.",
                    "expressions-allowed" : false,
                    "nillable" : true,
                    "default" : true,
                    "access-type" : "read-write",
                    "storage" : "configuration",
                    "restart-required" : "all-services"
                },
                "queue-address" : {
                    "description" : "The queue address defines what address is used for routing messages.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "STRING"
                    },
                    "nillable" : false,
                    "access-type" : "read-only",
                    "storage" : "runtime"
                },
                "expiry-address" : {
                    "description" : "The address to send expired messages to.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "STRING"
                    },
                    "nillable" : true,
                    "access-type" : "read-only",
                    "storage" : "runtime"
                },
                "dead-letter-address" : {
                    "description" : "The address to send dead messages to.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "STRING"
                    },
                    "nillable" : true,
                    "access-type" : "read-only",
                    "storage" : "runtime"
                },
                "paused" : {
                    "description" : "Whether the queue is paused.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "BOOLEAN"
                    },
                    "nillable" : false,
                    "access-type" : "read-only",
                    "storage" : "runtime"
                },
                "temporary" : {
                    "description" : "Whether the queue is temporary.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "BOOLEAN"
                    },
                    "nillable" : false,
                    "access-type" : "read-only",
                    "storage" : "runtime"
                },
                "message-count" : {
                    "description" : "The number of messages currently in this queue.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "LONG"
                    },
                    "nillable" : false,
                    "unit" : "NONE",
                    "access-type" : "metric",
                    "storage" : "runtime"
                },
                "scheduled-count" : {
                    "description" : "The number of scheduled messages in this queue.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "LONG"
                    },
                    "nillable" : false,
                    "unit" : "NONE",
                    "access-type" : "metric",
                    "storage" : "runtime"
                },
                "consumer-count" : {
                    "description" : "The number of consumers consuming messages from this queue.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "INT"
                    },
                    "nillable" : false,
                    "unit" : "NONE",
                    "access-type" : "metric",
                    "storage" : "runtime"
                },
                "delivering-count" : {
                    "description" : "The number of messages that this queue is currently delivering to its consumers.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "INT"
                    },
                    "nillable" : false,
                    "unit" : "NONE",
                    "access-type" : "metric",
                    "storage" : "runtime"
                },
                "messages-added" : {
                    "description" : "The number of messages added to this queue since it was created.",
                    "type" : {
                        "TYPE_MODEL_VALUE" : "LONG"
                    },
                    "nillable" : false,
                    "unit" : "NONE",
                    "access-type" : "metric",
                    "storage" : "runtime"
                }
            },
            "operations" : null,
            "children" : {}
        }
    }]
}
{noformat}


                  
> IllegalArgumentException when using tab-completion with a wildcard in the path
> ------------------------------------------------------------------------------
>
>                 Key: AS7-5168
>                 URL: https://issues.jboss.org/browse/AS7-5168
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: Console
>         Environment: AS7 master branch
>            Reporter: Jeff Mesnil
>            Assignee: Heiko Braun
>
> I wanted to get all the values of jms-queues' attribute core-address from the CLI and it works as expected:
> {noformat}
> [standalone at localhost:9999 /] /subsystem=messaging/hornetq-server=default/jms-queue=*:read-attribute(name="queue-address")
> {
>     "outcome" => "success",
>     "result" => [
>         {
>             "address" => [
>                 ("subsystem" => "messaging"),
>                 ("hornetq-server" => "default"),
>                 ("jms-queue" => "myQueue")
>             ],
>             "outcome" => "success",
>             "result" => "jms.queue.myQueue"
>         },
>         {
>             "address" => [
>                 ("subsystem" => "messaging"),
>                 ("hornetq-server" => "default"),
>                 ("jms-queue" => "HELLOWORLDMDBQueue2")
>             ],
>             "outcome" => "success",
>             "result" => "jms.queue.HELLOWORLDMDBQueue2"
>         }
>     ]
> }
> {noformat}
> However when I tried to tab-complete the name of the attribute, I got an IllegalArgumentException and the console exited.
> {noformat}
> [standalone at localhost:9999 /] /subsystem=messaging/hornetq-server=default/jms-queue=*:read-attribute(name=java.lang.IllegalArgumentException
>         at org.jboss.dmr.ModelValue.getChild(ModelValue.java:108)
>         at org.jboss.dmr.ModelNode.get(ModelNode.java:798)
>         at org.jboss.as.cli.operation.impl.PropertyNameCompleter$1.getAllCandidates(PropertyNameCompleter.java:62)
>         at org.jboss.as.cli.impl.DefaultCompleter.complete(DefaultCompleter.java:64)
>         at org.jboss.as.cli.operation.OperationRequestCompleter.complete(OperationRequestCompleter.java:222)
>         at org.jboss.as.cli.CommandCompleter.complete(CommandCompleter.java:93)
>         at org.jboss.as.cli.impl.Console$Factory$1$1.complete(Console.java:96)
>         at org.jboss.jreadline.console.Console.complete(Console.java:809)
>         at org.jboss.jreadline.console.Console.read(Console.java:383)
>         at org.jboss.jreadline.console.Console.read(Console.java:221)
>         at org.jboss.as.cli.impl.Console$Factory$1.readLine(Console.java:166)
>         at org.jboss.as.cli.impl.CommandContextImpl.interact(CommandContextImpl.java:1140)
>         at org.jboss.as.cli.impl.CliLauncher.main(CliLauncher.java:243)
>         at org.jboss.as.cli.CommandLineMain.main(CommandLineMain.java:34)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at org.jboss.modules.Module.run(Module.java:270)
>         at org.jboss.modules.Main.main(Main.java:294)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list