diff --git a/src/main/java/org/embulk/util/json/JsonValueParser.java b/src/main/java/org/embulk/util/json/JsonValueParser.java index 5408b4d..bdc1bcd 100644 --- a/src/main/java/org/embulk/util/json/JsonValueParser.java +++ b/src/main/java/org/embulk/util/json/JsonValueParser.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.core.filter.FilteringParserDelegate; import com.fasterxml.jackson.core.filter.JsonPointerBasedFilter; import com.fasterxml.jackson.core.filter.TokenFilter; +import com.fasterxml.jackson.core.json.PackageVersion; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; @@ -232,6 +233,7 @@ public static Builder builder() { * @return the new builder */ public static Builder builder(final JsonFactory jsonFactory) { + assertJacksonVersion(); return new Builder(jsonFactory); } @@ -267,6 +269,17 @@ public final void close() throws IOException { this.jacksonParser.close(); } + private static void assertJacksonVersion() { + if (PackageVersion.VERSION.getMajorVersion() != 2) { + throw new UnsupportedOperationException("embulk-util-json is not used with Jackson 2."); + } + + final int minor = PackageVersion.VERSION.getMinorVersion(); + if (minor < 14 || (minor == 15 && PackageVersion.VERSION.getPatchLevel() <= 2)) { + throw new UnsupportedOperationException("embulk-util-json is not used with Jackson 2.15.3 or later."); + } + } + private final com.fasterxml.jackson.core.JsonParser jacksonParser; private final InternalJsonValueReader valueReader;