[Pki-devel] [PATCH] 273/274 Add FeatureClient and FeatureCLI

Endi Sukma Dewata edewata at redhat.com
Thu Oct 1 16:56:02 UTC 2015


On 10/1/2015 11:17 AM, Ade Lee wrote:
> Added feature client and CLI.  Also fixed a compilation error in
> eclipse due to recent subCA changes to the caMap representation.
>
> Please review,
> Ade

Some comments:

1. The code in FeatureShowCLI could be simplified as follows:

   if (cmdArgs.length > 1) {
       System.err.println("Error: too many arguments.");
       printHelp();
       System.exit(-1);
   }

   if (cmdArgs.length == 0) {
      System.err.println("Error: No ID specified.");
       printHelp();
       System.exit(-1);
   }

   String featureID = cmdArgs[0];

2. In FeatureService the following code:

   feature.setEnabled(props.getOrDefault("enabled", 
"false").equalsIgnoreCase("true"));
   feature.setDescription(props.getOrDefault("description", ""));
   feature.setVersion(props.getOrDefault("version", ""));

can be simplified into:

   feature.setEnabled(Boolean.parseBoolean(props.get("enabled")));
   feature.setDescription(props.get("description"));
   feature.setVersion(props.get("version"));

I think we should return a null if the field doesn't have a value. The 
XML/JSON output will be simpler. The CLI is already checking for null.

ACK with the above changes.

-- 
Endi S. Dewata




More information about the Pki-devel mailing list