mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-08-13 04:51:03 +00:00
Fix null pointer
This commit is contained in:
@@ -8,7 +8,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public class SimpleTupleNode extends TupleNode {
|
||||
|
||||
private final List<String> names;
|
||||
@@ -68,11 +67,10 @@ public class SimpleTupleNode extends TupleNode {
|
||||
@Override
|
||||
public DataStructureNode clear() {
|
||||
nodes.clear();
|
||||
names.clear();
|
||||
if (names != null) names.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return nodes.size();
|
||||
@@ -90,13 +88,14 @@ public class SimpleTupleNode extends TupleNode {
|
||||
public List<KeyValue> getKeyValuePairs() {
|
||||
var l = new ArrayList<KeyValue>(size());
|
||||
for (int i = 0; i < size(); i++) {
|
||||
l.add(new KeyValue(names != null ? getKeyNames().get(i) : null, getNodes().get(i)));
|
||||
l.add(new KeyValue(
|
||||
names != null ? getKeyNames().get(i) : null, getNodes().get(i)));
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
public List<String> getKeyNames() {
|
||||
return Collections.unmodifiableList(names);
|
||||
return names != null ? Collections.unmodifiableList(names) : Collections.nCopies(size(), null);
|
||||
}
|
||||
|
||||
public List<DataStructureNode> getNodes() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class JacksonMapper {
|
||||
|
||||
@@ -37,6 +38,10 @@ public class JacksonMapper {
|
||||
DEFAULT = BASE.copy();
|
||||
}
|
||||
|
||||
public static synchronized void configure(Consumer<ObjectMapper> mapper) {
|
||||
mapper.accept(INSTANCE);
|
||||
}
|
||||
|
||||
public static synchronized void initClassBased() {
|
||||
initModularized(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user