Skip to content

Commit a7c2b1c

Browse files
Davide Melfidarklight3it
authored andcommitted
build: upgrading junit-jupiter everywhere
1 parent 06831a9 commit a7c2b1c

9 files changed

Lines changed: 112 additions & 3 deletions

File tree

aws-lambda-java-events-sdk-transformer/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@
3838
<maven.compiler.target>1.8</maven.compiler.target>
3939
<sdk.v1.version>1.11.914</sdk.v1.version>
4040
<sdk.v2.version>2.15.40</sdk.v2.version>
41+
<<<<<<< HEAD
4142
<junit-jupiter.version>5.12.2</junit-jupiter.version>
4243
<maven-surefire-plugin.version>3.5.4</maven-surefire-plugin.version>
44+
=======
45+
<junit-jupiter.version>5.14.3</junit-jupiter.version>
46+
>>>>>>> 7946ec4 (build: upgrading junit-jupiter everywhere)
4347
</properties>
4448

4549
<distributionManagement>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<factorypath>
2+
<factorypathentry kind="VARJAR" id="M2_REPO/joda-time/joda-time/2.10.8/joda-time-2.10.8.jar" enabled="true" runInBatchMode="false"/>
3+
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.22/lombok-1.18.22.jar" enabled="true" runInBatchMode="false"/>
4+
</factorypath>

aws-lambda-java-events/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
4040
<jackson.version>2.20.1</jackson.version>
4141
<json.unit>2.40.1</json.unit>
42+
<<<<<<< HEAD
4243
<junit-jupiter.version>5.12.2</junit-jupiter.version>
44+
=======
45+
<junit-jupiter.version>5.14.3</junit-jupiter.version>
46+
>>>>>>> 7946ec4 (build: upgrading junit-jupiter everywhere)
4347
</properties>
4448

4549
<distributionManagement>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<factorypath>
2+
<factorypathentry kind="VARJAR" id="M2_REPO/com/amazonaws/aws-lambda-java-core/1.2.3/aws-lambda-java-core-1.2.3.jar" enabled="true" runInBatchMode="false"/>
3+
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-core/2.25.3/log4j-core-2.25.3.jar" enabled="true" runInBatchMode="false"/>
4+
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-api/2.25.3/log4j-api-2.25.3.jar" enabled="true" runInBatchMode="false"/>
5+
</factorypath>

aws-lambda-java-runtime-interface-client/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
<jacoco.maven.plugin.version>0.8.12</jacoco.maven.plugin.version>
3838
<maven-install-plugin.version>2.4</maven-install-plugin.version>
3939
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
40+
<<<<<<< HEAD
4041
<junit-jupiter.version>5.12.2</junit-jupiter.version>
42+
=======
43+
<junit-jupiter.version>5.14.3</junit-jupiter.version>
44+
>>>>>>> 7946ec4 (build: upgrading junit-jupiter everywhere)
4145
<maven-checkstyle-plugin.version>3.4.0</maven-checkstyle-plugin.version>
4246
<maven-surefire-plugin.version>3.5.4</maven-surefire-plugin.version>
4347
<!--

aws-lambda-java-tests/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@
3333
<maven.compiler.source>1.8</maven.compiler.source>
3434
<maven.compiler.target>1.8</maven.compiler.target>
3535
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36+
<<<<<<< HEAD
3637
<!--
3738
JUnit is a compile-scope transitive dependency for consumers of this module.
3839
Upgrading it requires a version bump of aws-lambda-java-tests to avoid
3940
breaking customers who don't pin their own JUnit version.
4041
-->
4142
<junit.version>5.9.2</junit.version>
43+
=======
44+
<junit.version>5.14.3</junit.version>
45+
>>>>>>> 7946ec4 (build: upgrading junit-jupiter everywhere)
4246
<jacoco.maven.plugin.version>0.8.7</jacoco.maven.plugin.version>
4347
<aws-lambda-java-serialization.version>1.4.0</aws-lambda-java-serialization.version>
4448
<aws-lambda-java-events.version>3.16.1</aws-lambda-java-events.version>

experimental/aws-lambda-java-profiler/examples/cdk/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1212
<cdk.version>2.155.0</cdk.version>
1313
<constructs.version>[10.0.0,11.0.0)</constructs.version>
14+
<<<<<<< HEAD
1415
<junit.version>5.12.2</junit.version>
16+
=======
17+
<junit.version>5.14.3</junit.version>
18+
>>>>>>> 7946ec4 (build: upgrading junit-jupiter everywhere)
1519
</properties>
1620

1721
<build>

jackson-datetime-regression.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Jackson 2.18 – `joda.time.DateTime` Deserialization Regression
2+
3+
## Symptom
4+
5+
After upgrading Jackson from **2.15.4 → 2.18.6**, deserializing `joda.time.DateTime` throws:
6+
7+
```
8+
com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.exc.MismatchedInputException:
9+
Cannot construct instance of `org.joda.time.DateTime` (although at least one Creator exists):
10+
no String-argument constructor/factory method to deserialize from String value ('2016-01-01T23:59:59.000+0000')
11+
```
12+
13+
Reproduced by: `EventLoaderTest.testLoadCodeCommitEvent``CodeCommitEvent.Record.eventTime` is of type `org.joda.time.DateTime`.
14+
15+
## Root Cause
16+
17+
### Background: how `DateTime` deserialization is supposed to work
18+
19+
`LambdaEventSerializers.serializerFor()` registers a `DateTimeModule` (which extends `JodaModule`) on the mapper before returning the serializer:
20+
21+
```java
22+
// LambdaEventSerializers.java line 262
23+
factory.getMapper().registerModules(new DateModule(), new DateTimeModule(classLoader));
24+
```
25+
26+
`DateTimeModule` registers a custom deserializer for `org.joda.time.DateTime` (the customer's unshaded class, via the pom reverse-transform workaround). This deserializer simply calls `DateTime.parse(jsonParser.getValueAsString())` and handles any String input correctly.
27+
28+
### What broke in Jackson 2.18
29+
30+
`JacksonFactory` disables creator auto-detection:
31+
32+
```java
33+
// JacksonFactory.java line 68
34+
.disable(MapperFeature.AUTO_DETECT_CREATORS)
35+
```
36+
37+
Jackson 2.18 shipped a complete rewrite of `POJOPropertiesCollector` ([databind #4515](https://github.com/FasterXML/jackson-databind/issues/4515)), which moved creator detection logic from `BasicDeserializerFactory` into `POJOPropertiesCollector` and changed when it runs.
38+
39+
With `AUTO_DETECT_CREATORS` disabled, no creators are found for `DateTime` during bean property collection. In Jackson 2.18's rewritten code path, when no creators are detected for a type, `_findCustomDeserializer()` — the lookup that would find `DateTimeModule`'s registered deserializer — is bypassed. Jackson falls straight through to building a `BeanDeserializer` for `DateTime`.
40+
41+
The `BeanDeserializer` finds `DateTime()`'s no-arg constructor (which is not gated by `AUTO_DETECT_CREATORS`), so it reports "at least one Creator exists" — but that creator doesn't accept a String, hence the error.
42+
43+
### Why it worked in 2.15.4
44+
45+
In Jackson 2.15.4, `_findCustomDeserializer()` was called **unconditionally**, regardless of whether creator detection found anything. So `DateTimeModule`'s registered deserializer was always found and used. That unconditional call was the fallback that 2.18 removed as part of the `#4515` rewrite.
46+
47+
## Fix Options
48+
49+
### Option 1 — Remove `.disable(MapperFeature.AUTO_DETECT_CREATORS)` from `JacksonFactory`
50+
51+
Simplest fix. Jackson's default is enabled, so this aligns with standard behaviour. Risk: could enable constructor-based creator detection for customer POJOs, potentially changing deserialization semantics for handler inputs that have multi-arg constructors. The original intent behind disabling it is undocumented (present since the initial commit), so the blast radius is unknown.
52+
53+
To confirm this is the cause: remove the line and run `testLoadCodeCommitEvent`.
54+
55+
### Option 2 — Use `BeanDeserializerModifier` in `DateTimeModule` ✅ Recommended
56+
57+
More targeted. Since Jackson 2.18 IS reaching `BeanDeserializer` for `DateTime` (confirmed by the error), `BeanDeserializerModifier.modifyDeserializer()` is called at that point. We can intercept it there and swap in the custom deserializer — without touching `AUTO_DETECT_CREATORS` at all.
58+
59+
Add the following to the `DateTimeModule` constructor, after the existing `addDeserializer` call:
60+
61+
```java
62+
this.setDeserializerModifier(new BeanDeserializerModifier() {
63+
@Override
64+
public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config,
65+
BeanDescription beanDesc, JsonDeserializer<?> deserializer) {
66+
if (beanDesc.getBeanClass() == dateTimeClass) {
67+
return getDeserializer(dateTimeClass);
68+
}
69+
return deserializer;
70+
}
71+
});
72+
```
73+
74+
This is scoped only to `DateTime`, leaves `AUTO_DETECT_CREATORS` untouched, and fixes exactly the broken code path without risk of side effects elsewhere.
75+
76+
## Related Issues
77+
78+
| Issue | Description |
79+
|-------|-------------|
80+
| [databind #4515](https://github.com/FasterXML/jackson-databind/issues/4515) | Rewrite of `POJOPropertiesCollector` — root cause of the behaviour change |
81+
| [databind #4920](https://github.com/FasterXML/jackson-databind/issues/4920) | Regression introduced by #4515: custom module deserializers bypassed when creator detection finds nothing |
82+
| [databind #4982](https://github.com/FasterXML/jackson-databind/pull/4982) | Partial fix in 2.18.3, does not cover the `AUTO_DETECT_CREATORS = false` case |

samples/kinesis-firehose-event-handler/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
<maven.compiler.source>1.8</maven.compiler.source>
3636
<maven.compiler.target>1.8</maven.compiler.target>
3737
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
38-
<junit-jupiter.version>5.12.2</junit-jupiter.version>
39-
<maven-surefire-plugin.version>3.5.4</maven-surefire-plugin.version>
40-
38+
<junit-jupiter.version>5.14.3</junit-jupiter.version>
4139
</properties>
4240

4341
<dependencies>

0 commit comments

Comments
 (0)