mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2026-10-04 13:46:44 -05:00
fix NPE when binding has undefined value
This commit is contained in:
1 parent
510746b7ef
commit
06edfcc944
1 file changed
+19
-3
+19
-3
@@ -17,11 +17,16 @@
|
|||||||
|
|
||||||
package io.nosqlbench.engine.api.activityconfig.rawyaml;
|
package io.nosqlbench.engine.api.activityconfig.rawyaml;
|
||||||
|
|
||||||
|
import io.nosqlbench.nb.api.errors.BasicError;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class RawStmtFields extends Tags {
|
public class RawStmtFields extends Tags {
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(RawStmtFields.class);
|
||||||
|
|
||||||
private String name = "";
|
private String name = "";
|
||||||
private String desc = "";
|
private String desc = "";
|
||||||
@@ -98,8 +103,19 @@ public class RawStmtFields extends Tags {
|
|||||||
Object bindingsObject = propsmap.remove("bindings");
|
Object bindingsObject = propsmap.remove("bindings");
|
||||||
if (bindingsObject!=null) {
|
if (bindingsObject!=null) {
|
||||||
if (bindingsObject instanceof Map) {
|
if (bindingsObject instanceof Map) {
|
||||||
Map<Object,Object> bindingsMap = (Map<Object,Object>) bindingsObject;
|
Map<Object, Object> bindingsMap = (Map<Object, Object>) bindingsObject;
|
||||||
bindingsMap.forEach((ko,vo) -> bindings.put(ko.toString(), vo.toString()));
|
if (bindingsMap != null) {
|
||||||
|
for (Object bkey : bindingsMap.keySet()) {
|
||||||
|
Object bval = bindingsMap.get(bkey);
|
||||||
|
if (bval != null) {
|
||||||
|
bindings.put(bkey.toString(), bval.toString());
|
||||||
|
} else {
|
||||||
|
logger.warn("empty bindings entry for " + bkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new BasicError("Empty bindings map");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Invalid type for bindings object: " + bindingsObject.getClass().getCanonicalName());
|
throw new RuntimeException("Invalid type for bindings object: " + bindingsObject.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
@@ -123,4 +139,4 @@ public class RawStmtFields extends Tags {
|
|||||||
|
|
||||||
super.setFieldsByReflection(propsmap);
|
super.setFieldsByReflection(propsmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user