gaoran10 opened a new pull request #10811:
URL: https://github.com/apache/pulsar/pull/10811
### Motivation
Currently, the AutoConsumeSchema decode messages which has a null schema
version will cause the NPE problem.
```
java.lang.NullPointerException: null
at
java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
~[?:1.8.0_181]
at
java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:964)
~[?:1.8.0_181]
at
org.apache.pulsar.client.impl.schema.AutoConsumeSchema.ensureSchemaInitialized(AutoConsumeSchema.java:73)
~[io.streamnative-pulsar-client-original-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at
org.apache.pulsar.client.impl.schema.AutoConsumeSchema.decode(AutoConsumeSchema.java:110)
~[io.streamnative-pulsar-client-original-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at
org.apache.pulsar.client.impl.schema.AutoConsumeSchema.decode(AutoConsumeSchema.java:45)
~[io.streamnative-pulsar-client-original-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at org.apache.pulsar.client.api.Schema.decode(Schema.java:107)
~[io.streamnative-pulsar-client-api-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at
org.apache.pulsar.client.impl.MessageImpl.decode(MessageImpl.java:469)
~[io.streamnative-pulsar-client-original-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at
org.apache.pulsar.client.impl.MessageImpl.getValue(MessageImpl.java:449)
~[io.streamnative-pulsar-client-original-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at
org.apache.pulsar.functions.source.PulsarRecord.getValue(PulsarRecord.java:81)
~[io.streamnative-pulsar-functions-instance-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at
org.apache.pulsar.functions.instance.JavaInstanceRunnable.readInput(JavaInstanceRunnable.java:386)
~[io.streamnative-pulsar-functions-instance-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at
org.apache.pulsar.functions.instance.JavaInstanceRunnable.run(JavaInstanceRunnable.java:248)
~[io.streamnative-pulsar-functions-instance-2.8.0-rc-202105291235.jar:2.8.0-rc-202105291235]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_181]
```
### Modifications
Check the schema version, if the schema version is null, fallback uses the
BYTES schema to decode.
### Verifying this change
Test decode message data which has a null schema version.
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (no)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (no)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]