Skip to content

Commit a6de259

Browse files
committed
Merge branch '2.18' into deser-lock
2 parents 3bcdd55 + 588b21e commit a6de259

File tree

148 files changed

+2190
-973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+2190
-973
lines changed

.github/workflows/codeql-analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727

2828
# Initializes the CodeQL tools for scanning.
2929
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
30+
uses: github/codeql-action/init@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
3131
with:
3232
languages: ${{ matrix.language }}
3333

3434
- name: Autobuild
35-
uses: github/codeql-action/autobuild@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
35+
uses: github/codeql-action/autobuild@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
3636

3737
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
38+
uses: github/codeql-action/analyze@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9

.github/workflows/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches:
55
- master
66
- "3.0"
7+
- "2.18"
78
- "2.17"
89
paths-ignore:
910
- "README.md"
@@ -12,6 +13,7 @@ on:
1213
branches:
1314
- master
1415
- "3.0"
16+
- "2.18"
1517
- "2.17"
1618
paths-ignore:
1719
- "README.md"

pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
<parent>
1010
<groupId>com.fasterxml.jackson</groupId>
1111
<artifactId>jackson-base</artifactId>
12-
<version>2.17.1-SNAPSHOT</version>
12+
<version>2.18.0-SNAPSHOT</version>
1313
</parent>
1414
<groupId>com.fasterxml.jackson.core</groupId>
1515
<artifactId>jackson-databind</artifactId>
16-
<version>2.17.1-SNAPSHOT</version>
16+
<version>2.18.0-SNAPSHOT</version>
1717
<name>jackson-databind</name>
1818
<packaging>jar</packaging>
1919
<description>General data-binding functionality for Jackson: works on core streaming API</description>
@@ -68,7 +68,7 @@
6868
<version.powermock>2.0.9</version.powermock>
6969

7070
<!-- for Reproducible Builds -->
71-
<project.build.outputTimestamp>2024-03-12T21:52:43Z</project.build.outputTimestamp>
71+
<project.build.outputTimestamp>2024-02-27T01:47:51Z</project.build.outputTimestamp>
7272
</properties>
7373

7474
<dependencies>

src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java

-18
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,6 @@ public String toString() {
125125
}
126126
}
127127

128-
/*
129-
/**********************************************************
130-
/* Shared serializers
131-
/**********************************************************
132-
*/
133-
134-
@SuppressWarnings("serial")
135-
public static class UpperCasingSerializer extends StdScalarSerializer<String>
136-
{
137-
public UpperCasingSerializer() { super(String.class); }
138-
139-
@Override
140-
public void serialize(String value, JsonGenerator gen,
141-
SerializerProvider provider) throws IOException {
142-
gen.writeString(value.toUpperCase());
143-
}
144-
}
145-
146128
/*
147129
/**********************************************************
148130
/* Construction

src/test/java/com/fasterxml/jackson/databind/seq/PolyMapWriter827Test.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
import java.util.Map;
66

77
import org.junit.Assert;
8+
import org.junit.jupiter.api.Test;
89

910
import com.fasterxml.jackson.core.JsonGenerator;
1011
import com.fasterxml.jackson.core.type.TypeReference;
1112
import com.fasterxml.jackson.databind.*;
1213
import com.fasterxml.jackson.databind.module.SimpleModule;
14+
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
1315
import com.fasterxml.jackson.databind.testutil.NoCheckSubTypeValidator;
1416

17+
import static org.junit.jupiter.api.Assertions.assertEquals;
18+
1519
// for [databind#827]
16-
public class PolyMapWriter827Test extends BaseMapTest
20+
public class PolyMapWriter827Test extends DatabindTestUtil
1721
{
1822
static class CustomKey {
1923
String a;
@@ -30,9 +34,10 @@ public void serialize(CustomKey key, JsonGenerator jsonGenerator, SerializerProv
3034
}
3135
}
3236

37+
@Test
3338
public void testPolyCustomKeySerializer() throws Exception
3439
{
35-
ObjectMapper mapper = new ObjectMapper();
40+
ObjectMapper mapper = newJsonMapper();
3641
mapper.activateDefaultTyping(NoCheckSubTypeValidator.instance,
3742
ObjectMapper.DefaultTyping.NON_FINAL);
3843

src/test/java/com/fasterxml/jackson/databind/seq/ReadRecoveryTest.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
package com.fasterxml.jackson.databind.seq;
22

3+
import org.junit.jupiter.api.Test;
4+
35
import com.fasterxml.jackson.databind.*;
6+
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
7+
8+
import static org.junit.jupiter.api.Assertions.*;
49

510
/**
611
* Tests to verify aspects of error recover for reading using
712
* iterator.
813
*/
9-
public class ReadRecoveryTest extends BaseMapTest
14+
public class ReadRecoveryTest extends DatabindTestUtil
1015
{
1116
static class Bean {
1217
public int a, b;
@@ -20,8 +25,9 @@ static class Bean {
2025
/**********************************************************
2126
*/
2227

23-
private final ObjectMapper MAPPER = new ObjectMapper();
28+
private final ObjectMapper MAPPER = newJsonMapper();
2429

30+
@Test
2531
public void testRootBeans() throws Exception
2632
{
2733
final String JSON = a2q("{'a':3} {'x':5}");
@@ -46,6 +52,7 @@ public void testRootBeans() throws Exception
4652
// for [databind#734]
4753
// Simple test for verifying that basic recover works for a case of
4854
// unknown structured value
55+
@Test
4956
public void testSimpleRootRecovery() throws Exception
5057
{
5158
final String JSON = a2q("{'a':3}{'a':27,'foo':[1,2],'b':{'x':3}} {'a':1,'b':2} ");
@@ -75,6 +82,7 @@ public void testSimpleRootRecovery() throws Exception
7582
}
7683

7784
// Similar to "raw" root-level Object sequence, but in array
85+
@Test
7886
public void testSimpleArrayRecovery() throws Exception
7987
{
8088
final String JSON = a2q("[{'a':3},{'a':27,'foo':[1,2],'b':{'x':3}} ,{'a':1,'b':2} ]");

src/test/java/com/fasterxml/jackson/databind/seq/ReadTreesTest.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22

33
import java.util.List;
44

5+
import org.junit.jupiter.api.Test;
6+
57
import com.fasterxml.jackson.databind.*;
68
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
9+
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
10+
11+
import static org.junit.jupiter.api.Assertions.*;
712

8-
public class ReadTreesTest extends BaseMapTest
13+
public class ReadTreesTest extends DatabindTestUtil
914
{
1015
private final ObjectMapper MAPPER = newJsonMapper();
1116

@@ -19,6 +24,7 @@ static class IdValue {
1924
/**********************************************************
2025
*/
2126

27+
@Test
2228
public void testReadTreeSequence() throws Exception
2329
{
2430
final String INPUT = a2q(
@@ -59,6 +65,7 @@ public void testReadTreeSequence() throws Exception
5965
/**********************************************************
6066
*/
6167

68+
@Test
6269
public void testReadPOJOHandleFail() throws Exception
6370
{
6471
final String INPUT = a2q(

src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java

+22-2
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
import java.io.*;
44
import java.util.*;
55

6+
import org.junit.jupiter.api.Test;
7+
68
import com.fasterxml.jackson.core.*;
79
import com.fasterxml.jackson.core.type.TypeReference;
810

9-
import com.fasterxml.jackson.databind.BaseMapTest;
1011
import com.fasterxml.jackson.databind.MappingIterator;
1112
import com.fasterxml.jackson.databind.ObjectMapper;
1213
import com.fasterxml.jackson.databind.ObjectReader;
1314
import com.fasterxml.jackson.databind.json.JsonMapper;
15+
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
16+
17+
import static org.junit.jupiter.api.Assertions.*;
1418

1519
@SuppressWarnings("resource")
16-
public class ReadValuesTest extends BaseMapTest
20+
public class ReadValuesTest extends DatabindTestUtil
1721
{
1822
static class Bean {
1923
public int a;
@@ -44,6 +48,7 @@ private enum Source {
4448

4549
private final ObjectMapper MAPPER = newJsonMapper();
4650

51+
@Test
4752
public void testRootBeans() throws Exception
4853
{
4954
for (Source src : Source.values()) {
@@ -111,6 +116,7 @@ private void _testRootBeans(Source srcType) throws Exception
111116
it.close();
112117
}
113118

119+
@Test
114120
public void testRootBeansInArray() throws Exception
115121
{
116122
final String JSON = "[{\"a\":6}, {\"a\":-7}]";
@@ -140,6 +146,7 @@ public void testRootBeansInArray() throws Exception
140146
assertEquals(4, set.iterator().next().a);
141147
}
142148

149+
@Test
143150
public void testRootMaps() throws Exception
144151
{
145152
final String JSON = "{\"a\":3}{\"a\":27} ";
@@ -164,6 +171,7 @@ public void testRootMaps() throws Exception
164171
/**********************************************************
165172
*/
166173

174+
@Test
167175
public void testRootBeansWithParser() throws Exception
168176
{
169177
final String JSON = "{\"a\":3}{\"a\":27} ";
@@ -180,6 +188,7 @@ public void testRootBeansWithParser() throws Exception
180188
assertFalse(it.hasNext());
181189
}
182190

191+
@Test
183192
public void testRootArraysWithParser() throws Exception
184193
{
185194
final String JSON = "[1][3]";
@@ -201,6 +210,7 @@ public void testRootArraysWithParser() throws Exception
201210
assertFalse(it.hasNext());
202211
}
203212

213+
@Test
204214
public void testHasNextWithEndArray() throws Exception {
205215
final String JSON = "[1,3]";
206216
JsonParser jp = MAPPER.createParser(JSON);
@@ -221,6 +231,7 @@ public void testHasNextWithEndArray() throws Exception {
221231
assertFalse(it.hasNext());
222232
}
223233

234+
@Test
224235
public void testHasNextWithEndArrayManagedParser() throws Exception {
225236
final String JSON = "[1,3]";
226237

@@ -241,6 +252,7 @@ public void testHasNextWithEndArrayManagedParser() throws Exception {
241252
/**********************************************************
242253
*/
243254

255+
@Test
244256
public void testNonRootBeans() throws Exception
245257
{
246258
final String JSON = "{\"leaf\":[{\"a\":3},{\"a\":27}]}";
@@ -265,6 +277,7 @@ public void testNonRootBeans() throws Exception
265277
jp.close();
266278
}
267279

280+
@Test
268281
public void testNonRootMapsWithParser() throws Exception
269282
{
270283
final String JSON = "[{\"a\":3},{\"a\":27}]";
@@ -290,6 +303,7 @@ public void testNonRootMapsWithParser() throws Exception
290303
jp.close();
291304
}
292305

306+
@Test
293307
public void testNonRootMapsWithObjectReader() throws Exception
294308
{
295309
String JSON = "[{ \"hi\": \"ho\", \"neighbor\": \"Joe\" },\n"
@@ -309,26 +323,31 @@ public void testNonRootMapsWithObjectReader() throws Exception
309323
assertFalse(iterator.hasNext());
310324
}
311325

326+
@Test
312327
public void testObjectReaderWithJsonParserFastDoubleParser() throws Exception
313328
{
314329
testObjectReaderWithFastDoubleParser(true);
315330
}
316331

332+
@Test
317333
public void testObjectReaderWithJsonReadFeatureFastDoubleParser() throws Exception
318334
{
319335
testObjectReaderWithFastDoubleParser(false);
320336
}
321337

338+
@Test
322339
public void testObjectReaderWithJsonParserFastFloatParser() throws Exception
323340
{
324341
testObjectReaderWithFastFloatParser(true);
325342
}
326343

344+
@Test
327345
public void testObjectReaderWithJsonReadFeatureFastFloatParser() throws Exception
328346
{
329347
testObjectReaderWithFastFloatParser(false);
330348
}
331349

350+
@Test
332351
public void testNonRootArraysUsingParser() throws Exception
333352
{
334353
final String JSON = "[[1],[3]]";
@@ -354,6 +373,7 @@ public void testNonRootArraysUsingParser() throws Exception
354373
p.close();
355374
}
356375

376+
@Test
357377
public void testEmptyIterator() throws Exception
358378
{
359379
MappingIterator<Object> empty = MappingIterator.emptyIterator();

src/test/java/com/fasterxml/jackson/databind/seq/SequenceWriterTest.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import java.io.StringWriter;
66
import java.util.*;
77

8+
import org.junit.jupiter.api.Test;
9+
810
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
911
import com.fasterxml.jackson.annotation.JsonTypeInfo;
1012
import com.fasterxml.jackson.annotation.JsonTypeName;
@@ -14,8 +16,11 @@
1416

1517
import com.fasterxml.jackson.databind.*;
1618
import com.fasterxml.jackson.databind.json.JsonMapper;
19+
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
20+
21+
import static org.junit.jupiter.api.Assertions.*;
1722

18-
public class SequenceWriterTest extends BaseMapTest
23+
public class SequenceWriterTest extends DatabindTestUtil
1924
{
2025
static class Bean {
2126
public int a;
@@ -89,10 +94,11 @@ public void close() throws IOException {
8994
/**********************************************************
9095
*/
9196

92-
private final ObjectMapper MAPPER = new ObjectMapper();
97+
private final ObjectMapper MAPPER = newJsonMapper();
9398
private final ObjectWriter WRITER = MAPPER.writer()
9499
.withRootValueSeparator("\n");
95100

101+
@Test
96102
public void testSimpleNonArray() throws Exception
97103
{
98104
StringWriter strw = new StringWriter();
@@ -121,6 +127,7 @@ public void testSimpleNonArray() throws Exception
121127
strw.toString());
122128
}
123129

130+
@Test
124131
public void testSimpleNonArrayNoSeparator() throws Exception
125132
{
126133
final String EXP = a2q("{'a':1}{'a':2}");
@@ -228,6 +235,7 @@ public void testSimpleCloseable() throws Exception
228235
assertEquals(a2q("{'closed':false,'x':0}"), out.toString());
229236
}
230237

238+
@Test
231239
public void testWithExplicitType() throws Exception
232240
{
233241
ObjectWriter w = MAPPER.writer()

0 commit comments

Comments
 (0)