Skip to content

Commit bbab38c

Browse files
Bump the gradle-minor-patch group across 1 directory with 5 updates (#27)
* Bump the gradle-minor-patch group across 1 directory with 5 updates Bumps the gradle-minor-patch group with 4 updates in the / directory: [com.diffplug.spotless:spotless-plugin-gradle](https://github.com/diffplug/spotless), [org.openapitools:jackson-databind-nullable](https://github.com/OpenAPITools/jackson-databind-nullable), [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit-framework) and [org.mockito:mockito-core](https://github.com/mockito/mockito). Updates `com.diffplug.spotless:spotless-plugin-gradle` from 7.0.3 to 7.2.1 - [Release notes](https://github.com/diffplug/spotless/releases) - [Changelog](https://github.com/diffplug/spotless/blob/main/CHANGES.md) - [Commits](diffplug/spotless@gradle/7.0.3...gradle/7.2.1) Updates `org.openapitools:jackson-databind-nullable` from 0.2.8 to 0.2.9 - [Release notes](https://github.com/OpenAPITools/jackson-databind-nullable/releases) - [Commits](OpenAPITools/jackson-databind-nullable@v0.2.8...v0.2.9) Updates `org.junit.jupiter:junit-jupiter-api` from 5.11.4 to 5.14.3 - [Release notes](https://github.com/junit-team/junit-framework/releases) - [Commits](junit-team/junit-framework@r5.11.4...r5.14.3) Updates `org.mockito:mockito-core` from 5.21.0 to 5.22.0 - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](mockito/mockito@v5.21.0...v5.22.0) Updates `org.junit.jupiter:junit-jupiter-engine` from 5.11.4 to 5.14.3 - [Release notes](https://github.com/junit-team/junit-framework/releases) - [Commits](junit-team/junit-framework@r5.11.4...r5.14.3) --- updated-dependencies: - dependency-name: com.diffplug.spotless:spotless-plugin-gradle dependency-version: 7.2.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: gradle-minor-patch - dependency-name: org.openapitools:jackson-databind-nullable dependency-version: 0.2.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: gradle-minor-patch - dependency-name: org.junit.jupiter:junit-jupiter-api dependency-version: 5.14.3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: gradle-minor-patch - dependency-name: org.mockito:mockito-core dependency-version: 5.22.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: gradle-minor-patch - dependency-name: org.junit.jupiter:junit-jupiter-engine dependency-version: 5.14.3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: gradle-minor-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Fix test failures from dependency upgrades - Replace removed ISO8601Utils (gone in Gson 2.13.x) with java.time.Instant - Add junit-platform-launcher dep to align with JUnit 5.14.x - Add post-generation sed steps in Makefile to apply ISO8601Utils fix on regeneration --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Quentin Rousseau <contact@quent.in>
1 parent a4a832f commit bbab38c

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ build-docker:
2424
@echo "Removing problematic validateJsonElement calls..."
2525
find ./src/main/java ./src/test/java -type f -name '*.java' -exec sed -i '' '/Object\.validateJsonElement/d' {} + 2>/dev/null || true
2626
find ./src/main/java ./src/test/java -type f -name '*.java' -exec sed -i '' '/UUID\.validateJsonElement/d' {} + 2>/dev/null || true
27+
@echo "Replacing removed ISO8601Utils with java.time equivalents..."
28+
sed -i '' 's/import com.google.gson.internal.bind.util.ISO8601Utils;/import java.time.Instant;\nimport java.time.ZoneOffset;/' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
29+
sed -i '' 's/ISO8601Utils.format(date, true)/DateTimeFormatter.ISO_INSTANT.format(date.toInstant())/' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
30+
sed -i '' 's/ISO8601Utils.parse(date, new ParsePosition(0))/Date.from(Instant.parse(date))/' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
31+
sed -i '' 's/catch (ParseException e)/catch (ParseException | java.time.format.DateTimeParseException e)/' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
32+
sed -i '' '/import java.text.ParsePosition;/d' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
2733
@echo "✓ Client generation complete!"
2834

2935
# Generate client using local openapi-generator (requires Java and openapi-generator installed)
@@ -41,6 +47,12 @@ build-local:
4147
@echo "Removing problematic validateJsonElement calls..."
4248
find ./src/main/java ./src/test/java -type f -name '*.java' -exec sed -i '' '/Object\.validateJsonElement/d' {} + 2>/dev/null || true
4349
find ./src/main/java ./src/test/java -type f -name '*.java' -exec sed -i '' '/UUID\.validateJsonElement/d' {} + 2>/dev/null || true
50+
@echo "Replacing removed ISO8601Utils with java.time equivalents..."
51+
sed -i '' 's/import com.google.gson.internal.bind.util.ISO8601Utils;/import java.time.Instant;\nimport java.time.ZoneOffset;/' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
52+
sed -i '' 's/ISO8601Utils.format(date, true)/DateTimeFormatter.ISO_INSTANT.format(date.toInstant())/' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
53+
sed -i '' 's/ISO8601Utils.parse(date, new ParsePosition(0))/Date.from(Instant.parse(date))/' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
54+
sed -i '' 's/catch (ParseException e)/catch (ParseException | java.time.format.DateTimeParseException e)/' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
55+
sed -i '' '/import java.text.ParsePosition;/d' src/main/java/com/rootly/client/JSON.java 2>/dev/null || true
4456
@echo "✓ Client generation complete!"
4557

4658
# Upgrade all dependencies to latest versions

build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ buildscript {
1313
dependencies {
1414
classpath 'com.android.tools.build:gradle:2.3.+'
1515
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
16-
classpath 'com.diffplug.spotless:spotless-plugin-gradle:7.0.3'
16+
classpath 'com.diffplug.spotless:spotless-plugin-gradle:7.2.1'
1717
}
1818
}
1919

@@ -113,12 +113,13 @@ dependencies {
113113
implementation 'com.google.code.gson:gson:2.13.2'
114114
implementation 'io.gsonfire:gson-fire:1.9.0'
115115
implementation 'jakarta.ws.rs:jakarta.ws.rs-api:4.0.0'
116-
implementation 'org.openapitools:jackson-databind-nullable:0.2.8'
116+
implementation 'org.openapitools:jackson-databind-nullable:0.2.9'
117117
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.20.0'
118118
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
119-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4'
120-
testImplementation 'org.mockito:mockito-core:5.21.0'
121-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
119+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.14.3'
120+
testImplementation 'org.mockito:mockito-core:5.22.0'
121+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.14.3'
122+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.14.3'
122123
}
123124

124125
javadoc {

src/main/java/com/rootly/client/JSON.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.google.gson.GsonBuilder;
1818
import com.google.gson.JsonParseException;
1919
import com.google.gson.TypeAdapter;
20-
import com.google.gson.internal.bind.util.ISO8601Utils;
2120
import com.google.gson.stream.JsonReader;
2221
import com.google.gson.stream.JsonWriter;
2322
import com.google.gson.JsonElement;
@@ -34,9 +33,10 @@
3433
import java.nio.charset.StandardCharsets;
3534
import java.text.DateFormat;
3635
import java.text.ParseException;
37-
import java.text.ParsePosition;
36+
import java.time.Instant;
3837
import java.time.LocalDate;
3938
import java.time.OffsetDateTime;
39+
import java.time.ZoneOffset;
4040
import java.time.format.DateTimeFormatter;
4141
import java.util.Date;
4242
import java.util.Locale;
@@ -1619,8 +1619,8 @@ public java.sql.Date read(JsonReader in) throws IOException {
16191619
if (dateFormat != null) {
16201620
return new java.sql.Date(dateFormat.parse(date).getTime());
16211621
}
1622-
return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
1623-
} catch (ParseException e) {
1622+
return new java.sql.Date(Date.from(Instant.parse(date)).getTime());
1623+
} catch (ParseException | java.time.format.DateTimeParseException e) {
16241624
throw new JsonParseException(e);
16251625
}
16261626
}
@@ -1654,7 +1654,7 @@ public void write(JsonWriter out, Date date) throws IOException {
16541654
if (dateFormat != null) {
16551655
value = dateFormat.format(date);
16561656
} else {
1657-
value = ISO8601Utils.format(date, true);
1657+
value = DateTimeFormatter.ISO_INSTANT.format(date.toInstant());
16581658
}
16591659
out.value(value);
16601660
}
@@ -1673,8 +1673,8 @@ public Date read(JsonReader in) throws IOException {
16731673
if (dateFormat != null) {
16741674
return dateFormat.parse(date);
16751675
}
1676-
return ISO8601Utils.parse(date, new ParsePosition(0));
1677-
} catch (ParseException e) {
1676+
return Date.from(Instant.parse(date));
1677+
} catch (ParseException | java.time.format.DateTimeParseException e) {
16781678
throw new JsonParseException(e);
16791679
}
16801680
}

0 commit comments

Comments
 (0)