Skip to content

Commit bdc5dbf

Browse files
authored
Merge pull request #37 from embulk/jackson-2.15.3
Bump the depended Jackson version to 2.15.3
2 parents 71b642b + ecf37c3 commit bdc5dbf

File tree

10 files changed

+38
-54
lines changed

10 files changed

+38
-54
lines changed

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
jacksonVersion: [ "2.6.7", "2.7.9", "2.8.11", "2.9.10", "2.10.5", "2.11.4", "2.12.7", "2.13.5", "2.14.3", "2.15.2" ]
12+
jacksonVersion: [ "2.15.3" ]
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- name: Set up OpenJDK 8
1616
uses: actions/setup-java@v3
1717
with:

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
hash-master: ${{ steps.hash-master.outputs.hash-master }}
1111
hash-main: ${{ steps.hash-main.outputs.hash-main }}
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0
1616
- id: hash-master
@@ -30,7 +30,7 @@ jobs:
3030
if: needs.diff.outputs.hash-master != needs.diff.outputs.hash-main
3131
runs-on: ubuntu-latest
3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434
with:
3535
fetch-depth: 0
3636
- name: Checkout master

.github/workflows/master.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
hash-master: ${{ steps.hash-master.outputs.hash-master }}
1111
hash-main: ${{ steps.hash-main.outputs.hash-main }}
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0
1616
- id: hash-master
@@ -30,7 +30,7 @@ jobs:
3030
if: needs.diff.outputs.hash-master != needs.diff.outputs.hash-main
3131
runs-on: ubuntu-latest
3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434
with:
3535
fetch-depth: 0
3636
- name: Checkout main

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: true
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- name: Set up OpenJDK 8
1616
uses: actions/setup-java@v3
1717
with:

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88

99
ext {
1010
if (!project.hasProperty("jacksonVersionForJacksonTest")) {
11-
jacksonVersionForJacksonTest = "2.6.7"
11+
jacksonVersionForJacksonTest = "2.15.3"
1212
}
1313
}
1414

@@ -44,7 +44,7 @@ dependencies {
4444
compileOnly "org.msgpack:msgpack-core:0.8.24"
4545

4646
// Dependencies should be "api" so that their scope would be "compile" in "pom.xml".
47-
api platform("com.fasterxml.jackson:jackson-bom:2.6.7")
47+
api platform("com.fasterxml.jackson:jackson-bom:2.15.3")
4848
api "com.fasterxml.jackson.core:jackson-core"
4949

5050
testImplementation "org.embulk:embulk-spi:0.11"
@@ -68,7 +68,7 @@ javadoc {
6868
overview = "src/main/html/overview.html"
6969
links "https://docs.oracle.com/javase/8/docs/api/"
7070
links "https://dev.embulk.org/embulk-spi/0.11/javadoc/"
71-
links "https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/2.6.7/"
71+
links "https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/2.15.3/"
7272
links "https://javadoc.io/doc/org.msgpack/msgpack-core/0.8.24/"
7373
}
7474
}

gradle.lockfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This is a Gradle generated file for dependency locking.
22
# Manual edits can break the build and are not advised.
33
# This file is expected to be part of source control.
4-
com.fasterxml.jackson.core:jackson-core:2.6.7=compileClasspath,runtimeClasspath
5-
com.fasterxml.jackson:jackson-bom:2.6.7=compileClasspath,runtimeClasspath
4+
com.fasterxml.jackson.core:jackson-core:2.15.3=compileClasspath,runtimeClasspath
5+
com.fasterxml.jackson:jackson-bom:2.15.3=compileClasspath,runtimeClasspath
66
org.embulk:embulk-spi:0.11=compileClasspath
77
org.msgpack:msgpack-core:0.8.24=compileClasspath
88
org.slf4j:slf4j-api:2.0.7=compileClasspath

src/main/java/org/embulk/util/json/JsonValueParser.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import com.fasterxml.jackson.core.JsonPointer;
2121
import com.fasterxml.jackson.core.filter.FilteringParserDelegate;
2222
import com.fasterxml.jackson.core.filter.JsonPointerBasedFilter;
23+
import com.fasterxml.jackson.core.filter.TokenFilter;
24+
import com.fasterxml.jackson.core.json.PackageVersion;
2325
import java.io.Closeable;
2426
import java.io.IOException;
2527
import java.io.InputStream;
@@ -177,15 +179,15 @@ private com.fasterxml.jackson.core.JsonParser extendJacksonParser(final com.fast
177179
parser = new FilteringParserDelegate(
178180
parser,
179181
new JsonPointerBasedFilter(this.root),
180-
false, // TODO: Use com.fasterxml.jackson.core.filter.TokenFilter.Inclusion since Jackson 2.12.
182+
TokenFilter.Inclusion.ONLY_INCLUDE_ALL,
181183
true // Allow multiple matches
182184
);
183185
}
184186
if (this.depthToFlattenJsonArrays > 0) {
185187
parser = new FilteringParserDelegate(
186188
parser,
187189
new FlattenJsonArrayFilter(this.depthToFlattenJsonArrays),
188-
false, // TODO: Use com.fasterxml.jackson.core.filter.TokenFilter.Inclusion since Jackson 2.12.
190+
TokenFilter.Inclusion.ONLY_INCLUDE_ALL,
189191
true // Allow multiple matches
190192
);
191193
}
@@ -231,6 +233,7 @@ public static Builder builder() {
231233
* @return the new builder
232234
*/
233235
public static Builder builder(final JsonFactory jsonFactory) {
236+
assertJacksonVersion();
234237
return new Builder(jsonFactory);
235238
}
236239

@@ -266,6 +269,17 @@ public final void close() throws IOException {
266269
this.jacksonParser.close();
267270
}
268271

272+
private static void assertJacksonVersion() {
273+
if (PackageVersion.VERSION.getMajorVersion() != 2) {
274+
throw new UnsupportedOperationException("embulk-util-json is not used with Jackson 2.");
275+
}
276+
277+
final int minor = PackageVersion.VERSION.getMinorVersion();
278+
if (minor < 14 || (minor == 15 && PackageVersion.VERSION.getPatchLevel() <= 2)) {
279+
throw new UnsupportedOperationException("embulk-util-json is not used with Jackson 2.15.3 or later.");
280+
}
281+
}
282+
269283
private final com.fasterxml.jackson.core.JsonParser jacksonParser;
270284
private final InternalJsonValueReader valueReader;
271285

src/test/java/org/embulk/util/json/TestFlattenJsonArrayFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.fasterxml.jackson.core.JsonFactory;
2424
import com.fasterxml.jackson.core.JsonToken;
2525
import com.fasterxml.jackson.core.filter.FilteringParserDelegate;
26+
import com.fasterxml.jackson.core.filter.TokenFilter;
2627
import java.io.IOException;
2728
import org.junit.jupiter.api.Test;
2829

@@ -105,7 +106,7 @@ private static com.fasterxml.jackson.core.JsonParser createFilteredParser(
105106
return new FilteringParserDelegate(
106107
factory.createParser(json),
107108
new FlattenJsonArrayFilter(depth),
108-
false, // TODO: Use com.fasterxml.jackson.core.filter.TokenFilter.Inclusion since Jackson 2.12.
109+
TokenFilter.Inclusion.ONLY_INCLUDE_ALL,
109110
true // Allow multiple matches
110111
);
111112
}

src/test/java/org/embulk/util/json/TestJacksonFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.fasterxml.jackson.core.JsonToken;
2525
import com.fasterxml.jackson.core.filter.FilteringParserDelegate;
2626
import com.fasterxml.jackson.core.filter.JsonPointerBasedFilter;
27+
import com.fasterxml.jackson.core.filter.TokenFilter;
2728
import com.fasterxml.jackson.core.json.PackageVersion;
2829
import java.io.IOException;
2930
import org.junit.jupiter.api.BeforeAll;
@@ -65,7 +66,7 @@ private static com.fasterxml.jackson.core.JsonParser createFilteredParser(
6566
return new FilteringParserDelegate(
6667
factory.createParser(json),
6768
new JsonPointerBasedFilter(jsonPointer),
68-
false, // TODO: Use com.fasterxml.jackson.core.filter.TokenFilter.Inclusion since Jackson 2.12.
69+
TokenFilter.Inclusion.ONLY_INCLUDE_ALL,
6970
true // Allow multiple matches
7071
);
7172
}

src/test/java/org/embulk/util/json/TestJacksonJsonPointer.java

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ public class TestJacksonJsonPointer {
3232
public void testEmpty() throws IOException {
3333
final JsonPointer empty = JsonPointer.compile("");
3434
assertEquals("", empty.toString());
35-
if (isBefore2_14_0()) {
36-
assertEquals("", empty.getMatchingProperty());
37-
} else {
38-
assertEquals(null, empty.getMatchingProperty());
39-
}
35+
assertEquals(null, empty.getMatchingProperty());
4036
assertTrue(empty.getMatchingIndex() < 0);
4137
assertEquals(JsonPointer.compile(""), empty);
4238
assertNotEquals(JsonPointer.compile("/"), empty);
@@ -57,11 +53,7 @@ public void testRoot() throws IOException {
5753

5854
final JsonPointer tail = root.tail();
5955
assertEquals("", tail.toString());
60-
if (isBefore2_14_0()) {
61-
assertEquals("", tail.getMatchingProperty());
62-
} else {
63-
assertEquals(null, tail.getMatchingProperty());
64-
}
56+
assertEquals(null, tail.getMatchingProperty());
6557
assertTrue(tail.getMatchingIndex() < 0);
6658
assertEquals(JsonPointer.compile(""), tail);
6759
assertNotEquals(JsonPointer.compile("/"), tail);
@@ -91,11 +83,7 @@ public void testRootDuplicated() throws IOException {
9183

9284
final JsonPointer tail2 = tail1.tail();
9385
assertEquals("", tail2.toString());
94-
if (isBefore2_14_0()) {
95-
assertEquals("", tail2.getMatchingProperty());
96-
} else {
97-
assertEquals(null, tail2.getMatchingProperty());
98-
}
86+
assertEquals(null, tail2.getMatchingProperty());
9987
assertTrue(tail2.getMatchingIndex() < 0);
10088
assertEquals(JsonPointer.compile(""), tail2);
10189
assertNotEquals(JsonPointer.compile("/"), tail2);
@@ -116,11 +104,7 @@ public void testSingleProperty() throws IOException {
116104

117105
final JsonPointer tail = root.tail();
118106
assertEquals("", tail.toString());
119-
if (isBefore2_14_0()) {
120-
assertEquals("", tail.getMatchingProperty());
121-
} else {
122-
assertEquals(null, tail.getMatchingProperty());
123-
}
107+
assertEquals(null, tail.getMatchingProperty());
124108
assertTrue(tail.getMatchingIndex() < 0);
125109
assertEquals(JsonPointer.compile(""), tail);
126110
assertNotEquals(JsonPointer.compile("/"), tail);
@@ -141,11 +125,7 @@ public void testSingleIndex() throws IOException {
141125

142126
final JsonPointer tail = root.tail();
143127
assertEquals("", tail.toString());
144-
if (isBefore2_14_0()) {
145-
assertEquals("", tail.getMatchingProperty());
146-
} else {
147-
assertEquals(null, tail.getMatchingProperty());
148-
}
128+
assertEquals(null, tail.getMatchingProperty());
149129
assertTrue(tail.getMatchingIndex() < 0);
150130
assertEquals(JsonPointer.compile(""), tail);
151131
assertNotEquals(JsonPointer.compile("/"), tail);
@@ -185,11 +165,7 @@ public void testMultipleProperties() throws IOException {
185165

186166
final JsonPointer tail3 = tail2.tail();
187167
assertEquals("", tail3.toString());
188-
if (isBefore2_14_0()) {
189-
assertEquals("", tail3.getMatchingProperty());
190-
} else {
191-
assertEquals(null, tail3.getMatchingProperty());
192-
}
168+
assertEquals(null, tail3.getMatchingProperty());
193169
assertTrue(tail3.getMatchingIndex() < 0);
194170
assertEquals(JsonPointer.compile(""), tail3);
195171
assertNotEquals(JsonPointer.compile("/"), tail3);
@@ -203,12 +179,4 @@ public void testMultipleProperties() throws IOException {
203179
static void printJacksonVersion() {
204180
System.out.println("Tested with Jackson: " + PackageVersion.VERSION.toString());
205181
}
206-
207-
// The behavior of JsonPointer.compile("").tail() is different from Jackson 2.14.0.
208-
//
209-
// https://github.com/FasterXML/jackson-core/issues/788
210-
// https://github.com/FasterXML/jackson-core/commit/b0f6eb9bb2d2d829efb19020e7df4d732066f8cd
211-
private static boolean isBefore2_14_0() {
212-
return PackageVersion.VERSION.getMajorVersion() <= 2 && PackageVersion.VERSION.getMinorVersion() <= 13;
213-
}
214182
}

0 commit comments

Comments
 (0)