Fix NPE with invalid placeholders (#1856)

Cache task was using Objects.requireNonNull which threw an NPE if an invalid placeholder was given. If this is the case, refrain from storing the value in the cache.
This commit is contained in:
Antti Koponen 2021-04-21 07:58:30 +03:00 committed by GitHub
parent 91ea079e28
commit 5216e854f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,7 +123,11 @@ public class PlanPlaceholderExtension extends PlaceholderExpansion {
if (!currentlyProcessing.contains(key)) {
currentlyProcessing.add(key);
processing.submitNonCritical(() -> {
cache.put(key, Objects.requireNonNull(getPlaceholderValue(params, uuid)));
String value = getPlaceholderValue(params, uuid);
if (value != null) {
cache.put(key, value);
}
currentlyProcessing.remove(key);
});
}