gapic-generator-java icon indicating copy to clipboard operation
gapic-generator-java copied to clipboard

Any type throwing NPE within HttpJson server streaming calls.

Open baeminbo opened this issue 11 months ago • 1 comments

The HttpJson server streaming callable causes a NullPointerException (NPE) when processing responses containing Any type values. This is because the TypeRegistry in CallOptions is typically null, which is passed to ProtoMessageResponseParser.parse() within HttpJsonClientCallImpl, resulting in NPE.

For example, Spanner's BatchWriteResponse includes a Status field with an Any type details value. Consequently, when the server returns an error, the response parsing results in NPE.

Please take a look at a concrete example in https://github.com/googleapis/java-spanner/issues/3640 for detailed reproduction steps.

baeminbo avatar Feb 22 '25 14:02 baeminbo

FYI. I created a fix for: https://github.com/googleapis/sdk-platform-java/pull/3640.

This issue was discussed with @blakeli0 in https://github.com/googleapis/java-spanner/issues/3640 regarding:

  1. this issue not present in other streaming types
  2. even with the fix, InvalidProtocolBufferException still thrown because the default TypeRegistry doesn't include the types for Status.

baeminbo avatar Feb 22 '25 14:02 baeminbo