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

ASF GitHub Bot commented on KAFKA-7813:
---------------------------------------

ewencp commented on pull request #6139: KAFKA-7813: JmxTool throws NPE when 
--object-name is omitted
URL: https://github.com/apache/kafka/pull/6139
 
 
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> JmxTool throws NPE when --object-name is omitted
> ------------------------------------------------
>
>                 Key: KAFKA-7813
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7813
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Attila Sasvari
>            Assignee: huxihx
>            Priority: Minor
>             Fix For: 2.3.0
>
>
> Running the JMX tool without --object-name parameter, results in a 
> NullPointerException:
> {code}
> $ bin/kafka-run-class.sh kafka.tools.JmxTool  --jmx-url 
> service:jmx:rmi:///jndi/rmi://127.0.0.1:9999/jmxrmi
> ...
> Exception in thread "main" java.lang.NullPointerException
>       at kafka.tools.JmxTool$$anonfun$3.apply(JmxTool.scala:143)
>       at kafka.tools.JmxTool$$anonfun$3.apply(JmxTool.scala:143)
>       at 
> scala.collection.LinearSeqOptimized$class.exists(LinearSeqOptimized.scala:93)
>       at scala.collection.immutable.List.exists(List.scala:84)
>       at kafka.tools.JmxTool$.main(JmxTool.scala:143)
>       at kafka.tools.JmxTool.main(JmxTool.scala)
> {code} 
> Documentation of the tool says:
> {code}
> --object-name <String: name>             A JMX object name to use as a query. 
>  
>                                            This can contain wild cards, and   
>  
>                                            this option can be given multiple  
>  
>                                            times to specify more than one     
>  
>                                            query. If no objects are specified 
>  
>                                            all objects will be queried.
> {code}
> Running the tool with {{--object-name ''}}, also results in an NPE:
> {code}
> $ bin/kafka-run-class.sh kafka.tools.JmxTool  --jmx-url 
> service:jmx:rmi:///jndi/rmi://127.0.0.1:9999/jmxrmi --object-name ''
> ...
> Exception in thread "main" java.lang.NullPointerException
>       at kafka.tools.JmxTool$.main(JmxTool.scala:197)
>       at kafka.tools.JmxTool.main(JmxTool.scala)
> {code}
> Runnig the tool with --object-name without an argument, the tool with 
> OptionMissingRequiredArgumentException:
> {code}
> $ bin/kafka-run-class.sh kafka.tools.JmxTool  --jmx-url 
> service:jmx:rmi:///jndi/rmi://127.0.0.1:9999/jmxrmi --object-name 
> Exception in thread "main" joptsimple.OptionMissingRequiredArgumentException: 
> Option object-name requires an argument
>       at 
> joptsimple.RequiredArgumentOptionSpec.detectOptionArgument(RequiredArgumentOptionSpec.java:48)
>       at 
> joptsimple.ArgumentAcceptingOptionSpec.handleOption(ArgumentAcceptingOptionSpec.java:257)
>       at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:513)
>       at 
> joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56)
>       at joptsimple.OptionParser.parse(OptionParser.java:396)
>       at kafka.tools.JmxTool$.main(JmxTool.scala:104)
>       at kafka.tools.JmxTool.main(JmxTool.scala)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to