99import java .util .concurrent .atomic .AtomicReference ;
1010import java .util .function .Consumer ;
1111
12- import com . fasterxml . jackson . core .JsonProcessingException ;
12+ import io . a2a . json .JsonProcessingException ;
1313import com .google .protobuf .MessageOrBuilder ;
1414import io .a2a .client .http .A2ACardResolver ;
1515import io .a2a .client .http .A2AHttpClient ;
@@ -100,7 +100,7 @@ public EventKind sendMessage(MessageSendParams request, @Nullable ClientCallCont
100100 return response .getResult ();
101101 } catch (A2AClientException e ) {
102102 throw e ;
103- } catch (IOException | InterruptedException e ) {
103+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
104104 throw new A2AClientException ("Failed to send message: " + e , e );
105105 }
106106 }
@@ -129,6 +129,8 @@ public void sendMessageStreaming(MessageSendParams request, Consumer<StreamingEv
129129 throw new A2AClientException ("Failed to send streaming message request: " + e , e );
130130 } catch (InterruptedException e ) {
131131 throw new A2AClientException ("Send streaming message request timed out: " + e , e );
132+ } catch (JsonProcessingException e ) {
133+ throw new A2AClientException ("Failed to process JSON for streaming message request: " + e , e );
132134 }
133135 }
134136
@@ -144,7 +146,7 @@ public Task getTask(TaskQueryParams request, @Nullable ClientCallContext context
144146 return response .getResult ();
145147 } catch (A2AClientException e ) {
146148 throw e ;
147- } catch (IOException | InterruptedException e ) {
149+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
148150 throw new A2AClientException ("Failed to get task: " + e , e );
149151 }
150152 }
@@ -161,7 +163,7 @@ public Task cancelTask(TaskIdParams request, @Nullable ClientCallContext context
161163 return response .getResult ();
162164 } catch (A2AClientException e ) {
163165 throw e ;
164- } catch (IOException | InterruptedException e ) {
166+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
165167 throw new A2AClientException ("Failed to cancel task: " + e , e );
166168 }
167169 }
@@ -175,7 +177,7 @@ public ListTasksResult listTasks(ListTasksParams request, @Nullable ClientCallCo
175177 String httpResponseBody = sendPostRequest (payloadAndHeaders , ListTasksRequest .METHOD );
176178 ListTasksResponse response = unmarshalResponse (httpResponseBody , ListTasksRequest .METHOD );
177179 return response .getResult ();
178- } catch (IOException | InterruptedException e ) {
180+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
179181 throw new A2AClientException ("Failed to list tasks: " + e , e );
180182 }
181183 }
@@ -194,7 +196,7 @@ public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushN
194196 return response .getResult ();
195197 } catch (A2AClientException e ) {
196198 throw e ;
197- } catch (IOException | InterruptedException e ) {
199+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
198200 throw new A2AClientException ("Failed to set task push notification config: " + e , e );
199201 }
200202 }
@@ -213,7 +215,7 @@ public TaskPushNotificationConfig getTaskPushNotificationConfiguration(GetTaskPu
213215 return response .getResult ();
214216 } catch (A2AClientException e ) {
215217 throw e ;
216- } catch (IOException | InterruptedException e ) {
218+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
217219 throw new A2AClientException ("Failed to get task push notification config: " + e , e );
218220 }
219221 }
@@ -233,7 +235,7 @@ public List<TaskPushNotificationConfig> listTaskPushNotificationConfigurations(
233235 return response .getResult ();
234236 } catch (A2AClientException e ) {
235237 throw e ;
236- } catch (IOException | InterruptedException e ) {
238+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
237239 throw new A2AClientException ("Failed to list task push notification configs: " + e , e );
238240 }
239241 }
@@ -251,7 +253,7 @@ public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationC
251253 // Response validated (no error), but no result to return
252254 } catch (A2AClientException e ) {
253255 throw e ;
254- } catch (IOException | InterruptedException e ) {
256+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
255257 throw new A2AClientException ("Failed to delete task push notification configs: " + e , e );
256258 }
257259 }
@@ -281,6 +283,8 @@ public void resubscribe(TaskIdParams request, Consumer<StreamingEventKind> event
281283 throw new A2AClientException ("Failed to send task resubscription request: " + e , e );
282284 } catch (InterruptedException e ) {
283285 throw new A2AClientException ("Task resubscription request timed out: " + e , e );
286+ } catch (JsonProcessingException e ) {
287+ throw new A2AClientException ("Failed to process JSON for task resubscription request: " + e , e );
284288 }
285289 }
286290
@@ -312,7 +316,7 @@ public AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2ACli
312316 agentCard = response .getResult ();
313317 needsExtendedCard = false ;
314318 return agentCard ;
315- } catch (IOException | InterruptedException e ) {
319+ } catch (IOException | InterruptedException | JsonProcessingException e ) {
316320 throw new A2AClientException ("Failed to get authenticated extended agent card: " + e , e );
317321 }
318322 } catch (A2AClientError e ){
@@ -337,7 +341,7 @@ private PayloadAndHeaders applyInterceptors(String methodName, @Nullable Object
337341 return payloadAndHeaders ;
338342 }
339343
340- private String sendPostRequest (PayloadAndHeaders payloadAndHeaders , String method ) throws IOException , InterruptedException {
344+ private String sendPostRequest (PayloadAndHeaders payloadAndHeaders , String method ) throws IOException , InterruptedException , JsonProcessingException {
341345 A2AHttpClient .PostBuilder builder = createPostBuilder (payloadAndHeaders ,method );
342346 A2AHttpResponse response = builder .post ();
343347 if (!response .success ()) {
0 commit comments