Permalink
Browse files

BOOKKEEPER-217: NPE in hedwig client when enable DEBUG (sijie via ivank)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk@1329886 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 4e9ee8d commit 7f9005baadbbf312db857be6c3d3c095fe800c54 @ivankelly ivankelly committed Apr 24, 2012
Showing with 26 additions and 8 deletions.
  1. +4 −0 CHANGES.txt
  2. +22 −8 hedwig-client/src/main/java/org/apache/hedwig/client/netty/HedwigSubscriber.java
View
@@ -90,6 +90,10 @@ Trunk (unreleased changes)
BOOKKEEPER-213: PerChannelBookieClient calls the wrong errorOut function when encountering an exception (Aniruddha via sijie)
+ hedwig-client/
+
+ BOOKKEEPER-217: NPE in hedwig client when enable DEBUG (sijie via ivank)
+
hedwig-server/
BOOKKEEPER-140: Hub server doesn't subscribe remote region correctly when a region is down. (Sijie Gou via ivank)
@@ -90,10 +90,17 @@ private void subUnsub(ByteString topic, ByteString subscriberId, OperationType o
SubscriptionOptions options)
throws CouldNotConnectException, ClientAlreadySubscribedException,
ClientNotSubscribedException, ServiceDownException {
- if (logger.isDebugEnabled())
- logger.debug("Calling a sync subUnsub request for topic: " + topic.toStringUtf8() + ", subscriberId: "
- + subscriberId.toStringUtf8() + ", operationType: " + operationType + ", createOrAttach: "
- + options.getCreateOrAttach() + ", messageBound: " + options.getMessageBound());
+ if (logger.isDebugEnabled()) {
+ StringBuilder debugMsg = new StringBuilder().append("Calling a sync subUnsub request for topic: ")
+ .append(topic.toStringUtf8()).append(", subscriberId: ")
+ .append(subscriberId.toStringUtf8()).append(", operationType: ")
+ .append(operationType);
+ if (null != options) {
+ debugMsg.append(", createOrAttach: ").append(options.getCreateOrAttach())
+ .append(", messageBound: ").append(options.getMessageBound());
+ }
+ logger.debug(debugMsg.toString());
+ }
PubSubData pubSubData = new PubSubData(topic, null, subscriberId, operationType, options, null, null);
synchronized (pubSubData) {
PubSubCallback pubSubCallback = new PubSubCallback(pubSubData);
@@ -142,10 +149,17 @@ else if (failureException instanceof ServiceDownException)
// either SUBSCRIBE or UNSUBSCRIBE.
private void asyncSubUnsub(ByteString topic, ByteString subscriberId, Callback<Void> callback, Object context,
OperationType operationType, SubscriptionOptions options) {
- if (logger.isDebugEnabled())
- logger.debug("Calling an async subUnsub request for topic: " + topic.toStringUtf8() + ", subscriberId: "
- + subscriberId.toStringUtf8() + ", operationType: " + operationType + ", createOrAttach: "
- + options.getCreateOrAttach() + ", messageBound: " + options.getMessageBound());
+ if (logger.isDebugEnabled()) {
+ StringBuilder debugMsg = new StringBuilder().append("Calling a async subUnsub request for topic: ")
+ .append(topic.toStringUtf8()).append(", subscriberId: ")
+ .append(subscriberId.toStringUtf8()).append(", operationType: ")
+ .append(operationType);
+ if (null != options) {
+ debugMsg.append(", createOrAttach: ").append(options.getCreateOrAttach())
+ .append(", messageBound: ").append(options.getMessageBound());
+ }
+ logger.debug(debugMsg.toString());
+ }
// Check if we know which server host is the master for the topic we are
// subscribing to.
PubSubData pubSubData = new PubSubData(topic, null, subscriberId, operationType, options, callback,

0 comments on commit 7f9005b

Please sign in to comment.