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/05/18 09:42:06 UTC

[GitHub] [pulsar] eolivelli commented on a diff in pull request #15653: [fix][broker] Fix NPE when set `AutoTopicCreationOverride`

eolivelli commented on code in PR #15653:
URL: https://github.com/apache/pulsar/pull/15653#discussion_r875690020


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -834,9 +835,11 @@ protected void internalSetAutoTopicCreation(AsyncResponse asyncResponse,
                         "Invalid configuration for autoTopicCreationOverride. the detail is "
                                 + validateResult.getErrorInfo());
             }
-            if (maxPartitions > 0 && autoTopicCreationOverride.getDefaultNumPartitions() > maxPartitions) {
-                throw new RestException(Status.NOT_ACCEPTABLE,
-                        "Number of partitions should be less than or equal to " + maxPartitions);
+            if (Objects.equals(autoTopicCreationOverride.getTopicType(), TopicType.PARTITIONED.toString())) {
+                if (maxPartitions > 0 && autoTopicCreationOverride.getDefaultNumPartitions() > maxPartitions) {

Review Comment:
   if the problem is that autoTopicCreationOverride.getDefaultNumPartitions() can be null then we have to simply add a null check and fail the request if it is not passed while maxPartitions is > 0



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