Make sure null description is handled gracefully
@@ -20,6 +20,7 @@ package org.apache.felix.systemready;
import static java.util.stream.Collectors.minBy;
+import java.util.Objects;
import java.util.stream.Stream;
public final class CheckStatus {
@@ -45,17 +46,16 @@ public final class CheckStatus {
private final String details;
public CheckStatus(String checkName, StateType type, State state, String details) {
- this.checkName = checkName;
- this.type = type;
- this.state = state;
- this.details = details;
+ this.checkName = Objects.requireNonNull(checkName);
+ this.type = Objects.requireNonNull(type);
+ this.state = Objects.requireNonNull(state);
+ this.details = Objects.toString(details, "");
}
public String getCheckName() {
return checkName;
}
-
public StateType getType() {
return type;
}
@@ -70,11 +70,7 @@ public final class CheckStatus {
@Override
public String toString() {
- return "CheckStatus{" +
- "state=" + state +
- ", details='" + details + '\'' +
- '}';
+ return "CheckStatus{" + "state=" + state + ", details='" + details + '\'' + '}';
}
-
}
