X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/701328b8c26d6ad4f98cf8213dd57e4b06aa1281..35c72f692f13b12594ecdbe8f59f31d3b396d356:/src/main/java/org/asamk/signal/util/Util.java diff --git a/src/main/java/org/asamk/signal/util/Util.java b/src/main/java/org/asamk/signal/util/Util.java index eec7d2f7..93a595d1 100644 --- a/src/main/java/org/asamk/signal/util/Util.java +++ b/src/main/java/org/asamk/signal/util/Util.java @@ -1,5 +1,8 @@ package org.asamk.signal.util; +import com.fasterxml.jackson.databind.JsonNode; + +import java.io.InvalidObjectException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.HashMap; @@ -53,4 +56,13 @@ public class Util { return buf.toString(); } + + public static JsonNode getNotNullNode(JsonNode parent, String name) throws InvalidObjectException { + JsonNode node = parent.get(name); + if (node == null) { + throw new InvalidObjectException(String.format("Incorrect file format: expected parameter %s not found ", name)); + } + + return node; + } }