merlimat closed pull request #2779: fix: unsafe cast of schema to JSONSchema
URL: https://github.com/apache/pulsar/pull/2779
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
index 855151012b..621c86ccd0 100644
--- 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
+++ 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
@@ -896,9 +896,11 @@ public void connectionOpened(final ClientCnx cnx) {
                     // but now we have standardized on every schema to 
generate an Avro based schema
                     if 
(Commands.peerSupportJsonSchemaAvroFormat(cnx.getRemoteEndpointProtocolVersion()))
 {
                         schemaInfo = schema.getSchemaInfo();
-                    } else {
+                    } else if (schema instanceof JSONSchema){
                         JSONSchema jsonSchema = (JSONSchema) schema;
                         schemaInfo = 
jsonSchema.getBackwardsCompatibleJsonSchemaInfo();
+                    } else {
+                        schemaInfo = schema.getSchemaInfo();
                     }
                 } else if (schema.getSchemaInfo().getType() == 
SchemaType.BYTES) {
                     // don't set schema info for Schema.BYTES


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to