a2a-java icon indicating copy to clipboard operation
a2a-java copied to clipboard

[Bug]: Null metadata values cause NPEs when converting parts between v1.0 and v0.3

Open pandudu opened this issue 1 month ago • 5 comments

What happened?

org.a2aproject.sdk.compat03.spec.TextPart_v0_3 类中。 v1.0和v0.3相互转换时,如果parts中的metadata中的值为null,会抛NPE异常.实际上A2A协议中可以允许medata的value为空.

Image

同样的,在org.a2aproject.sdk.compat03.spec.DataPart_v0_3中也有这个问题. Image

Relevant log output


Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

pandudu avatar Nov 03 '26 06:11 pandudu

Hi, would you be able to put the text into English? Thanks!

kabir avatar Nov 03 '26 11:11 kabir

Hi, I'd like to investigate this bug and contribute a fix. My understanding of the report is that converting between v1.0 and v0.3 throws a NullPointerException when a part's metadata contains a null value, affecting both TextPart_v0_3 and DataPart_v0_3. I'll first reproduce this and add regression tests for both part types and conversion directions before proposing a minimal fix. Please let me know if I've misunderstood the report or if someone is already working on it.

Orcus01 avatar Nov 04 '26 03:11 Orcus01

@Orcus01 Yes, feel free. Just make sure that the behaviour is in line with the specs

kabir avatar Nov 04 '26 11:11 kabir

Also, if you are able to translate the header that would be great :-D

kabir avatar Nov 04 '26 11:11 kabir

Closing as I believe this was fixed by https://github.com/a2aproject/a2a-java/pull/1289 and https://github.com/a2aproject/a2a-java/pull/1261

kabir avatar Nov 04 '26 13:11 kabir