#1087 Null pointer exception in key-recover CLI
Closed: Fixed Opened by edewata.

Running key-recover CLI without parameters generates an exception:

[root@vm-084 scripts]# pki key-recover
NullPointerException: null

It looks like the CLI is trying to parse a missing key ID:

[root@vm-084 scripts]# pki -v key-recover
Server URI: http://vm-084.idm.lab.bos.redhat.com:8080
Security database: /root/.dogtag/nssdb
Message format: null
Command: key-recover
Module: key
Module: recover
java.lang.NullPointerException
    at com.netscape.certsrv.dbs.keydb.KeyId.toString(KeyId.java:95)
    at com.netscape.certsrv.key.KeyRecoveryRequest.setKeyId(KeyRecoveryRequest.java:85)
    at com.netscape.certsrv.key.KeyClient.recoverKey(KeyClient.java:284)
    at com.netscape.cmstools.key.KeyRecoverCLI.execute(KeyRecoverCLI.java:101)
    at com.netscape.cmstools.cli.CLI.execute(CLI.java:265)
    at com.netscape.cmstools.key.KeyCLI.execute(KeyCLI.java:86)
    at com.netscape.cmstools.cli.ProxyCLI.execute(ProxyCLI.java:119)
    at com.netscape.cmstools.cli.CLI.execute(CLI.java:265)
    at com.netscape.cmstools.cli.MainCLI.execute(MainCLI.java:345)
    at com.netscape.cmstools.cli.MainCLI.main(MainCLI.java:357)

Right now key ID is an optional parameter:

[root@vm-084 scripts]# pki key-recover --help
usage: key-recover [OPTIONS...]
    --help                      Show help options
    --input <Input file path>   Location of the request template file.
    --keyID <Key Identifier>    Key Identifier for the secret to be
                                recovered.

The parameter should have been required, but it'll probably make more sense to make key ID a required argument instead:

usage: key-recover <key ID> [OPTIONS...]

The key ID specified as an argument should override any key ID specified in the input template file.

Proposed milestone: 10.2 August


Fixed and pushed to master in a7f8076a5f20812eceac31f7230e4156adf74471

Metadata Update from @edewata:
- Issue assigned to kaskahn
- Issue set to the milestone: 10.2 - 08/14 (August)

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/1650

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Metadata