This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new f0757e9 Issue #1241: Fixed NPE in PerChannelBookieClient
f0757e9 is described below
commit f0757e9ac643d6f36a11be4065d163437180cb7e
Author: Matteo Merli <[email protected]>
AuthorDate: Fri Mar 9 21:06:18 2018 -0800
Issue #1241: Fixed NPE in PerChannelBookieClient
The `CompletionValue` object from the map can be null in some cases and we
need to protect for it.
Fixes #1241
Author: Matteo Merli <[email protected]>
Reviewers: Sijie Guo <[email protected]>
This closes #1242 from merlimat/fix-npe, closes #1241
---
.../bookkeeper/proto/PerChannelBookieClient.java | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
index 5adc7cf..440239f 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
@@ -876,17 +876,18 @@ public class PerChannelBookieClient extends
ChannelInboundHandlerAdapter {
try {
final long startTime = MathUtils.nowInNano();
ChannelFuture future = channel.writeAndFlush(request);
- future.addListener(new ChannelFutureListener() {
- @Override
- public void operationComplete(ChannelFuture future) throws
Exception {
- if (future.isSuccess()) {
-
nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime),
- TimeUnit.NANOSECONDS);
- completionObjects.get(key).setOutstanding();
- } else {
-
nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime),
- TimeUnit.NANOSECONDS);
+ future.addListener(future1 -> {
+ if (future1.isSuccess()) {
+
nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime),
+ TimeUnit.NANOSECONDS);
+ CompletionValue completion = completionObjects.get(key);
+ if (completion != null) {
+ completion.setOutstanding();
}
+
+ } else {
+
nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime),
+ TimeUnit.NANOSECONDS);
}
});
} catch (Throwable e) {
--
To stop receiving notification emails like this one, please contact
[email protected].