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 2019/03/29 21:17:48 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #3946: [issue #3935] Bugfix an unload non-existent topic

sijie commented on a change in pull request #3946: [issue #3935] Bugfix an unload non-existent topic
URL: https://github.com/apache/pulsar/pull/3946#discussion_r270576429
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
 ##########
 @@ -1314,13 +1314,10 @@ private Topic getTopicReference(TopicName topicName) {
                         TopicName partitionTopicName = TopicName.get(topicName.getPartitionedTopicName());
                         PartitionedTopicMetadata partitionedTopicMetadata = getPartitionedTopicMetadata(partitionTopicName, false);
                         if (partitionedTopicMetadata == null || partitionedTopicMetadata.partitions == 0) {
-                        	final String errSrc;
-                        	if (partitionedTopicMetadata != null) {
-                        		errSrc = " has zero partitions";
-                        	} else {
-                        		errSrc = " has no metadata";
-                        	}
-                            return new RestException(Status.NOT_FOUND, "Partitioned Topic not found: " + topicName.toString() + errSrc);
+                            final String errSrc = partitionedTopicMetadata != null ?
+                                    "has zero partitions" : "has no metadata";
+                            return new RestException(Status.NOT_FOUND, String.format(
+                                    "Partitioned Topic not found: %s - %s", topicName.toString(), errSrc));
 
 Review comment:
   nit: the error message here can also be improved. if `partitionedTopicMetadata == null`, then it is `Topic not found`, otherwise it is `Partitioned Topic not found`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services