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

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

huxihx commented on pull request #6139: KAFKA-7813: JmxTool throws NPE when 
--object-name is omitted
URL: https://github.com/apache/kafka/pull/6139
 
 
   https://issues.apache.org/jira/browse/KAFKA-7813
   
   Running the JMX tool without --object-name parameter, results in a 
NullPointerException.
   
   *More detailed description of your change,
   if necessary. The PR title and PR message become
   the squashed commit message, so use a separate
   comment to ping reviewers.*
   
   *Summary of testing strategy (including rationale)
   for the feature or bug fix. Unit and/or integration
   tests are expected for any behaviour change and
   system tests should be considered for larger changes.*
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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
>
> 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