Closed honzastrnads1 closed 5 months ago
Assuming the message also contains Status status = 7
above.
Confirming the behavior you are seeing. There isn't a straightforward fix because as far as I can tell there's no public method in the Java protobuf API to instantiate an EnumValueDescriptor
that represents an unknown enum. Is it possible for your code to use getField
instead of getFieldByNumber
at least for enums?
Assuming the message also contains
Status status = 7
above.
Yes, sorry for that.
Confirming the behavior you are seeing. There isn't a straightforward fix because as far as I can tell there's no public method in the Java protobuf API to instantiate an
EnumValueDescriptor
that represents an unknown enum. Is it possible for your code to usegetField
instead ofgetFieldByNumber
at least for enums?
No, it's not easily possible to substitute and I don't think it would help either. We would race into the same issue, just on a different place, specifically here.
Unrecognized enums override scalaValueDescriptor
to give a descriptor that represents the unknown value, see here
Since the original issue (on getFieldByNumber
) doesn't have a reasonable fix there isn't much that can be done to address it (I consider deprecating the method in a future release as it predates the PValue
API used by getField
). I wanted to check in if getField
provides a reasonable alternative or you have any other suggestion.
Unfortunately migrating to getField
would require quite a few changes on our side, so it's a no go for us at the moment.
An
ArrayIndexOutOfBoundsException
is thrown whengetFieldByNumber
is invoked on a field that represents unrecognized enum value.The stack trace is:
Following protobuf definiton should be enough to reproduce:
... and the code that triggers the exception:
Version used:
0.11.12
.