zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eolivelli <...@git.apache.org>
Subject [GitHub] zookeeper pull request #669: ZOOKEEPER-3152: Port ZK netty stack to netty4
Date Fri, 19 Oct 2018 15:38:52 GMT
Github user eolivelli commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/669#discussion_r226684843
  
    --- Diff: zookeeper-common/src/main/java/org/apache/zookeeper/ClientCnxnSocketNetty.java
---
    @@ -439,13 +466,34 @@ public void messageReceived(ChannelHandlerContext ctx,
                     }
                 }
                 wakeupCnxn();
    +            // Note: SimpleChannelInboundHandler releases the ByteBuf for us
    +            // so we don't need to do it.
             }
     
             @Override
    -        public void exceptionCaught(ChannelHandlerContext ctx,
    -                                    ExceptionEvent e) throws Exception {
    -            LOG.warn("Exception caught: {}", e, e.getCause());
    +        public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
    +            LOG.warn("Exception caught", cause);
                 cleanup();
             }
         }
    +
    +    /**
    +     * Sets the test ByteBufAllocator. This allocator will be used by all
    +     * future instances of this class.
    +     * It is not recommended to use this method outside of testing.
    +     * @param allocator the ByteBufAllocator to use for all netty buffer
    +     *                  allocations.
    +     */
    +    public static void setTestAllocator(ByteBufAllocator allocator) {
    +        TEST_ALLOCATOR.set(allocator);
    --- End diff --
    
    I think this is a security hole. We are in the client, so untrusted code may call this
public method.
    We should use mockito/powermock for this stuff.
    Is there are another way?


---

Mime
View raw message