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 12:11:10 UTC

[GitHub] [bookkeeper] aloyszhang opened a new pull request #2280: #2279 fix NPE when exec readjournal command

aloyszhang opened a new pull request #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280
 
 
   Descriptions of the changes in this PR:
   This PR fix NullPointerException when exec readjournal command
   See issue #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

[GitHub] [bookkeeper] aloyszhang commented on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang commented 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 when bookie has more than one directories for `journalDirectories` while not need when only one journal directory. 

----------------------------------------------------------------
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] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
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 ` when 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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [bookkeeper] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   @eolivelli , I think maybe we has different understand on the `hasArg`  flag.
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   
   I think this means if run command with `-dir`, there must be a argument following it like `-dir /data/bookkeeper/journal`, while without the `-dir` option, command still runs well.
   
   Run the command without  `-dir`  opiton like this for  journal directory bookie
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and it works as expected.

----------------------------------------------------------------
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 merged pull request #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
sijie merged pull request #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/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] aloyszhang commented on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang commented on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   We still can run the command without the parameter `-dir` like this 
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and this command runs well.
   

----------------------------------------------------------------
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] eolivelli commented on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595302776
 
 
   I am sorry.
   I clicked on 'close and comment' instead of 'comment'

----------------------------------------------------------------
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] eolivelli closed pull request #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
eolivelli closed pull request #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/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] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [bookkeeper] aloyszhang opened a new pull request #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang opened a new pull request #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280
 
 
   Descriptions of the changes in this PR:
   This PR fix NullPointerException when exec readjournal command
   See issue #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

[GitHub] [bookkeeper] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   @eolivelli   
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   We still can run the command without  `-dir`  opiton like this for single journal directory bookie
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and this command runs well.
   

----------------------------------------------------------------
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] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   @eolivelli   
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   We still can run the command without the parameter `-dir` like this for single journal directory bookie
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and this command runs well.
   

----------------------------------------------------------------
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] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [bookkeeper] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   @eolivelli   
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   We still can run the command without the parameter `-dir` like this 
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and this command runs well.
   

----------------------------------------------------------------
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] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   @eolivelli , I think maybe we has different understand on the `hasArg`  flag.
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   
   I think this means if run command with `-dir`, there must be a argument following it like `-dir /data/bookkeeper/journal`, while without the `-dir` option, command still runs well.
   
   I try to run the command without  `-dir`  opiton like this for  journal directory bookie
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and it works as expected.

----------------------------------------------------------------
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] aloyszhang commented on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang commented on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595254317
 
 
   cc @eolivelli 

----------------------------------------------------------------
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] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   @eolivelli , 
   I think maybe we has different understand on the `hasArg`  flag in `org.apache.commons.cli.Options#addOption`.
   
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   
   I think this means if run command with `-dir`, there must be a argument following it like `-dir /data/bookkeeper/journal`, while without the `-dir` option, command still runs well.
   
   I try to run the command without  `-dir`  opiton like this for one journal directory bookie
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and it works as expected.

----------------------------------------------------------------
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] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   @eolivelli , 
   I think maybe we had different understand on the `hasArg`  flag in `org.apache.commons.cli.Options#addOption`.
   
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   
   I think this means if run command with `-dir`, there must be a argument following it like `-dir /data/bookkeeper/journal`, while without the `-dir` option, command still runs well.
   
   I try to run the command without  `-dir`  opiton like this for one journal directory bookie
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and it works as expected.

----------------------------------------------------------------
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] eolivelli commented on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595259596
 
 
   Yes but if you only have one directory the parameter is not required.
   With this patch you are making it always required.

----------------------------------------------------------------
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] aloyszhang commented on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang commented on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595296333
 
 
   cc @eolivelli please have a look.

----------------------------------------------------------------
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] aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command

Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2280: #2279 fix NPE when exec readjournal command
URL: https://github.com/apache/bookkeeper/pull/2280#issuecomment-595279073
 
 
   @eolivelli , 
   I think maybe we has different understand on the `hasArg`  flag in `org.apache.commons.cli.Options#addOption`.
   
   As I understand, if `hasArg` of an `Option`  set to true,  it means that an argument is required after this option other than this `Option`  is must be specified.
   
   I think this means if run command with `-dir`, there must be a argument following it like `-dir /data/bookkeeper/journal`, while without the `-dir` option, command still runs well.
   
   I try to run the command without  `-dir`  opiton like this for  journal directory bookie
    ```
   ./bin/bookkeeper shell readjournal /data1/bookkeeper/journal/current/170ab39159f.txn 
   ```
   and it works as expected.

----------------------------------------------------------------
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