Jon Hall

Avoid NPE in cfg command

    - Avoid NPE when a component has no configurable property or doesn't exist
    - Specificly use a numeric value for SharedExecutors.DEFAULT_POOL_SIZE so
      the value appears in cfg command
    - Also use print instead of system.err since it is being redirected
      away from the console

Change-Id: Ib73016b1a9282493f0c5c8c217dd33292eac4ba4
......@@ -95,7 +95,9 @@ public class ComponentConfigCommand extends AbstractShellCommand {
private void listComponentProperties(String component) {
Set<ConfigProperty> props = service.getProperties(component);
print("%s", component);
if (shortOnly) {
if (props == null) {
print("No properties for component " + component + " found");
} else if (shortOnly) {
props.forEach(p -> print(SHORT_FMT, p.name(), p.value()));
} else {
props.forEach(p -> print(FMT, p.name(), p.type().toString().toLowerCase(),
......@@ -108,7 +110,7 @@ public class ComponentConfigCommand extends AbstractShellCommand {
Optional<ConfigProperty> property = props.stream()
.filter(p -> p.name().equals(name)).findFirst();
if (!property.isPresent()) {
System.err.println("Property " + name + " for component " + component + " not found");
print("Property " + name + " for component " + component + " not found");
return;
}
ConfigProperty p = property.get();
......
......@@ -64,9 +64,9 @@ public class CoreManager implements CoreService {
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ComponentConfigService cfgService;
@Property(name = "sharedThreadPoolSize", intValue = SharedExecutors.DEFAULT_POOL_SIZE,
@Property(name = "sharedThreadPoolSize", intValue = 30,
label = "Configure shared pool maximum size ")
private int sharedThreadPoolSize = SharedExecutors.DEFAULT_POOL_SIZE;
private int sharedThreadPoolSize = 30;
@Activate
public void activate() {
......