You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/17 10:13:22 UTC

[GitHub] [pulsar] Technoboy- commented on a change in pull request #14317: [pulsar-client] Fix send to deadLetterTopic not working when reach maxRedeliverCount

Technoboy- commented on a change in pull request #14317:
URL: https://github.com/apache/pulsar/pull/14317#discussion_r808883245



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AbstractSchema.java
##########
@@ -74,14 +74,13 @@ public T decode(ByteBuf byteBuf, byte[] schemaVersion) {
      * @param schemaVersion the version
      * @return the schema at that specific version
      * @throws SchemaSerializationException in case of unknown schema version
-     * @throws NullPointerException in case of null schemaVersion
+     * @throws NullPointerException in case of null schemaVersion and supportSchemaVersioning is true
      */
     public Schema<?> atSchemaVersion(byte[] schemaVersion) throws SchemaSerializationException {
-        Objects.requireNonNull(schemaVersion);
         if (!supportSchemaVersioning()) {
             return this;
-        } else {
-            throw new SchemaSerializationException("Not implemented for " + this.getClass());
         }
+        Objects.requireNonNull(schemaVersion);

Review comment:
       Why do we need to check null for `schemaVersion` ?  It's very strange here and outside return Optional.
   ```
   else if (schema instanceof AbstractSchema) {
               byte[] schemaVersion = getSchemaVersion();
               return Optional.of(((AbstractSchema<?>) schema)
                       .atSchemaVersion(schemaVersion));          
           }
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org