aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595249788 Parameter `-dir` must be specified if bookie has more than one directories for `journalDirectories` while not needed when only one journal directory. So when have multi directories for `journalDirectories` , there will be always `NullPointerException ` if you run the command `shell readjournal`. Key code are ``` if (getJournals(conf).size() > 1) { if (cmd.dir.equals(DEFAULT)) { System.err.println("ERROR: invalid or missing journal directory"); usage(); return false; } File journalDirectory = new File(cmd.dir); for (Journal j : getJournals(conf)) { if (j.getJournalDirectory().equals(journalDirectory)) { journal = j; break; } } if (journal == null) { System.err.println("ERROR: journal directory not found"); usage(); return false; } } else { journal = getJournals(conf).get(0); } ``` The problem cause by `cmd.dir.equals(DEFAULT)` , when `cmd.dir` is null, bookie throws NPE.
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
