Skip to content

Commit 59a5f68

Browse files
authored
fix: Fixing build on Java 25. (#329)
Tests are failing on Java 25 because of a classloading issue if uwing vertx json codec instead of Jackson object mapper. Signed-off-by: Emmanuel Hugonnet <[email protected]>
1 parent 71c56ea commit 59a5f68

File tree

7 files changed

+17
-43
lines changed

7 files changed

+17
-43
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
java-version: ['17', '21']
19+
java-version: ['17', '21', '25']
2020
steps:
2121
- uses: actions/checkout@v4
2222
- name: Set up JDK ${{ matrix.java-version }}

extras/push-notification-config-store-database-jpa/pom.xml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -104,31 +104,4 @@
104104
<scope>test</scope>
105105
</dependency>
106106
</dependencies>
107-
108-
<profiles>
109-
<profile>
110-
<id>java24-exclude-vertx-incompatible-tests</id>
111-
<activation>
112-
<jdk>[24,)</jdk>
113-
</activation>
114-
<build>
115-
<plugins>
116-
<plugin>
117-
<artifactId>maven-surefire-plugin</artifactId>
118-
<configuration>
119-
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
120-
<excludes>
121-
<!-- TODO: Remove this profile when Quarkus is updated to a version using Vert.x 4.6.0+.
122-
This test is excluded on Java 24+ due to a Vert.x ServiceLoader incompatibility with SSE streaming.
123-
Current Quarkus versions (e.g., 3.25.x, 2.28.1) use Vert.x 4.5.x, which is not compatible with Java 24. -->
124-
<exclude>**/JpaDatabasePushNotificationConfigStoreIntegrationTest.java</exclude>
125-
</excludes>
126-
</configuration>
127-
</plugin>
128-
</plugins>
129-
</build>
130-
</profile>
131-
</profiles>
132-
133-
134107
</project>

extras/push-notification-config-store-database-jpa/src/test/java/io/a2a/extras/pushnotificationconfigstore/database/jpa/JpaDatabasePushNotificationConfigStoreIntegrationTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import io.a2a.spec.AgentCard;
2424
import io.a2a.spec.DeleteTaskPushNotificationConfigParams;
2525
import io.a2a.spec.GetTaskPushNotificationConfigParams;
26-
import io.a2a.spec.ListTaskPushNotificationConfigParams;
2726
import io.a2a.spec.Message;
2827
import io.a2a.spec.PushNotificationConfig;
2928
import io.a2a.spec.Task;

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<os-maven-plugin.version>1.7.1</os-maven-plugin.version>
6161
<protobuf.version>4.31.1</protobuf.version>
6262
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
63-
<quarkus.platform.version>3.28.1</quarkus.platform.version>
63+
<quarkus.platform.version>3.28.2</quarkus.platform.version>
6464
<rest-assured.version>5.5.1</rest-assured.version>
6565
<slf4j.version>2.0.17</slf4j.version>
6666
<logback.version>1.5.18</logback.version>

reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import io.vertx.core.MultiMap;
6565
import io.vertx.core.buffer.Buffer;
6666
import io.vertx.core.http.HttpServerResponse;
67-
import io.vertx.core.json.Json;
6867
import io.vertx.ext.web.RoutingContext;
6968

7069
@Singleton
@@ -111,19 +110,19 @@ public void invokeJSONRPCHandler(@Body String body, RoutingContext rc) {
111110
rc.response()
112111
.setStatusCode(200)
113112
.putHeader(CONTENT_TYPE, APPLICATION_JSON)
114-
.end(Json.encodeToBuffer(error));
113+
.end(Utils.toJsonString(error));
115114
} else if (streaming) {
116115
final Multi<? extends JSONRPCResponse<?>> finalStreamingResponse = streamingResponse;
117116
executor.execute(() -> {
118-
MultiSseSupport.subscribeObject(
119-
finalStreamingResponse.map(i -> (Object)i), rc);
117+
MultiSseSupport.subscribeObject(
118+
finalStreamingResponse.map(i -> (Object) i), rc);
120119
});
121120

122121
} else {
123122
rc.response()
124123
.setStatusCode(200)
125124
.putHeader(CONTENT_TYPE, APPLICATION_JSON)
126-
.end(Json.encodeToBuffer(nonStreamingResponse));
125+
.end(Utils.toJsonString(nonStreamingResponse));
127126
}
128127
}
129128
}
@@ -151,7 +150,7 @@ private JSONRPCErrorResponse handleError(JsonProcessingException exception) {
151150
}
152151

153152
/**
154-
/**
153+
* /**
155154
* Handles incoming GET requests to the agent card endpoint.
156155
* Returns the agent card in JSON format.
157156
*
@@ -331,10 +330,9 @@ public Buffer apply(Object o) {
331330
ReactiveRoutes.ServerSentEvent<?> ev = (ReactiveRoutes.ServerSentEvent<?>) o;
332331
long id = ev.id() != -1 ? ev.id() : count.getAndIncrement();
333332
String e = ev.event() == null ? "" : "event: " + ev.event() + "\n";
334-
return Buffer.buffer(e + "data: " + Json.encodeToBuffer(ev.data()) + "\nid: " + id + "\n\n");
335-
} else {
336-
return Buffer.buffer("data: " + Json.encodeToBuffer(o) + "\nid: " + count.getAndIncrement() + "\n\n");
333+
return Buffer.buffer(e + "data: " + Utils.toJsonString(ev.data()) + "\nid: " + id + "\n\n");
337334
}
335+
return Buffer.buffer("data: " + Utils.toJsonString(o) + "\nid: " + count.getAndIncrement() + "\n\n");
338336
}
339337
}), rc);
340338
}
@@ -350,4 +348,3 @@ private static void endOfStream(HttpServerResponse response) {
350348
}
351349
}
352350
}
353-

spec/src/main/java/io/a2a/spec/SendStreamingMessageResponse.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package io.a2a.spec;
22

3-
import static io.a2a.util.Utils.defaultIfNull;
43

54
import com.fasterxml.jackson.annotation.JsonCreator;
65
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
76
import com.fasterxml.jackson.annotation.JsonInclude;
87
import com.fasterxml.jackson.annotation.JsonProperty;
9-
import io.a2a.util.Assert;
108

119
/**
1210
* The response after receiving a request to initiate a task with streaming.

spec/src/main/java/io/a2a/util/Utils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,12 @@ public static Task appendArtifactToTask(Task task, TaskArtifactUpdateEvent event
9494

9595
}
9696

97-
97+
public static String toJsonString(Object o) {
98+
try {
99+
return OBJECT_MAPPER.writeValueAsString(o);
100+
} catch (JsonProcessingException ex) {
101+
throw new RuntimeException(ex);
102+
}
103+
}
104+
98105
}

0 commit comments

Comments
 (0)