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:
[email protected]


With regards,
Apache Git Services

Reply via email to