diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java index f10d32acbd54f..1d0d64ec3b0b8 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java @@ -1007,7 +1007,7 @@ protected void handleProducer(final CommandProducer cmdProducer) { ServerError error = null; if(!existingProducerFuture.isDone()) { error = ServerError.ServiceNotReady; - }else { + } else { error = getErrorCode(existingProducerFuture); // remove producer with producerId as it's already completed with exception producers.remove(producerId); @@ -1091,7 +1091,7 @@ protected void handleProducer(final CommandProducer cmdProducer) { producerFuture.completeExceptionally( new IllegalStateException("Producer created after connection was closed")); } - } catch (BrokerServiceException ise) { + } catch (Exception ise) { log.error("[{}] Failed to add producer to topic {}: {}", remoteAddress, topicName, ise.getMessage()); ctx.writeAndFlush(Commands.newError(requestId,