-
Bug
-
Resolution: Done
-
Major
-
12.1.0.Final
-
None
protostream-types includes proto schema definitions for well-known proto types like google.protobuf.Timestamp, and they are different from the definitions of the same types in protobuf-java, because ProtoStream still uses proto2 and protobuf-java uses proto3.
This means when protobuf-java is on the classpath before protostream-types, ProtoStream loads the wrong proto schema and fails to parse it:
Caused by: org.infinispan.protostream.DescriptorParserException: java.lang.IllegalStateException: Syntax error in timestamp.proto at 128:8: unexpected label: int64 at org.infinispan.protostream.impl.parser.SquareProtoParser.parse(SquareProtoParser.java:62) at org.infinispan.protostream.impl.SerializationContextImpl.registerProtoFiles(SerializationContextImpl.java:113) at org.infinispan.protostream.types.protobuf.TimestampSchemaImpl.registerSchema(TimestampSchemaImpl.java:45) at org.infinispan.marshall.protostream.impl.SerializationContextRegistryImpl.register(SerializationContextRegistryImpl.java:120) at org.infinispan.marshall.protostream.impl.SerializationContextRegistryImpl.lambda$start$0(SerializationContextRegistryImpl.java:56) at java.base/java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608) at org.infinispan.marshall.protostream.impl.SerializationContextRegistryImpl.start(SerializationContextRegistryImpl.java:56) at org.infinispan.marshall.protostream.impl.CorePackageImpl$2.start(CorePackageImpl.java:51) at org.infinispan.marshall.protostream.impl.CorePackageImpl$2.start(CorePackageImpl.java:44) at org.infinispan.factories.impl.BasicComponentRegistryImpl.invokeStart(BasicComponentRegistryImpl.java:604) at org.infinispan.factories.impl.BasicComponentRegistryImpl.doStartWrapper(BasicComponentRegistryImpl.java:595) at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:564) ... 79 more Caused by: java.lang.IllegalStateException: Syntax error in timestamp.proto at 128:8: unexpected label: int64 at protostream.com.squareup.protoparser.ProtoParser.unexpected(ProtoParser.java:948) at protostream.com.squareup.protoparser.ProtoParser.readDeclaration(ProtoParser.java:197) at protostream.com.squareup.protoparser.ProtoParser.readMessage(ProtoParser.java:219) at protostream.com.squareup.protoparser.ProtoParser.readDeclaration(ProtoParser.java:153) at protostream.com.squareup.protoparser.ProtoParser.readProtoFile(ProtoParser.java:92) at protostream.com.squareup.protoparser.ProtoParser.parse(ProtoParser.java:56) at org.infinispan.protostream.impl.parser.SquareProtoParser.parse(SquareProtoParser.java:54) ... 90 more
We can work around this by adding an explicit dependency on protostream-types and forcing it to be in the classpath before protobuf-java.