You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2020/03/05 11:38:07 UTC

[GitHub] [bookkeeper] aloyszhang opened a new issue #2279: NullPointerException when execute `bin/bookkeeper shell readjournal`

aloyszhang opened a new issue #2279: NullPointerException when execute `bin/bookkeeper shell readjournal`
URL: https://github.com/apache/bookkeeper/issues/2279
 
 
   **BUG REPORT**
   
   ***Describe the bug***
   When read jounral by 
   `./bin/bookkeeper shell readjournal -msg /data1/bookkeeper/journal/current/1709f92d291.txn   -dir /data1/bookkeeper/journal`
   
   It throws exception
   ```
   Exception in thread "main" java.lang.NullPointerException
           at org.apache.bookkeeper.tools.cli.commands.bookie.ReadJournalCommand.handler(ReadJournalCommand.java:127)
           at org.apache.bookkeeper.tools.cli.commands.bookie.ReadJournalCommand.apply(ReadJournalCommand.java:105)
           at org.apache.bookkeeper.bookie.BookieShell$ReadJournalCmd.runCmd(BookieShell.java:1046)
           at org.apache.bookkeeper.bookie.BookieShell$MyCommand.runCmd(BookieShell.java:223)
           at org.apache.bookkeeper.bookie.BookieShell.run(BookieShell.java:1976)
           at org.apache.bookkeeper.bookie.BookieShell.main(BookieShell.java:2067)
   ```
   When  `ReadJournalCmd` initialized,  the "dir " `Option`  added with `hasArg` flag is false. So, we can't get the option's value of ”dir“ from shell command parameters.
   Here is the related code
      ```
   ReadJournalCmd() {
               super(CMD_READJOURNAL);
               rjOpts.addOption("dir", false, "Journal directory (needed if more than one journal configured)");
               rjOpts.addOption("m", "msg", false, "Print message body");
           }
   ```
   
   ```
   ReadJournalCommand.ReadJournalFlags flags = new ReadJournalCommand.ReadJournalFlags().msg(printMsg)
                                                               .fileName(filename).journalId(journalId)
                                                               .dir(cmdLine.getOptionValue("dir"));
   ```
   
   I think we should set the `hasArg`  to true, and take care the  build of `ReadJournalFlags`
   
   ***To Reproduce***
   Just run `bin/bookkeeper shell readjournal ` 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [bookkeeper] sijie commented on issue #2279: NullPointerException when execute `bin/bookkeeper shell readjournal`

Posted by GitBox <gi...@apache.org>.
sijie commented on issue #2279: NullPointerException when execute `bin/bookkeeper shell readjournal`
URL: https://github.com/apache/bookkeeper/issues/2279#issuecomment-611774440
 
 
   This is fixed by #2280

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [bookkeeper] sijie closed issue #2279: NullPointerException when execute `bin/bookkeeper shell readjournal`

Posted by GitBox <gi...@apache.org>.
sijie closed issue #2279: NullPointerException when execute `bin/bookkeeper shell readjournal`
URL: https://github.com/apache/bookkeeper/issues/2279
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services