Make byte[] to String conversion null-safe.
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
This commit is contained in:
parent
6c250d4656
commit
4617d8d3ba
1 changed files with 3 additions and 1 deletions
|
|
@ -33,6 +33,7 @@ import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import static org.jdrupes.vmoperator.common.Constants.APP_NAME;
|
import static org.jdrupes.vmoperator.common.Constants.APP_NAME;
|
||||||
|
|
@ -180,7 +181,8 @@ public class DisplaySecretMonitor
|
||||||
// Check validity
|
// Check validity
|
||||||
var model = stub.model().get();
|
var model = stub.model().get();
|
||||||
@SuppressWarnings("PMD.StringInstantiation")
|
@SuppressWarnings("PMD.StringInstantiation")
|
||||||
var expiry = new String(model.getData().get(DATA_PASSWORD_EXPIRY));
|
var expiry = Optional.ofNullable(model.getData()
|
||||||
|
.get(DATA_PASSWORD_EXPIRY)).map(b -> new String(b)).orElse(null);
|
||||||
if (model.getData().get(DATA_DISPLAY_PASSWORD) != null
|
if (model.getData().get(DATA_DISPLAY_PASSWORD) != null
|
||||||
&& stillValid(expiry)) {
|
&& stillValid(expiry)) {
|
||||||
event.setResult(
|
event.setResult(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue