Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in HexDumpProxyInboundHandler example #274

Closed
paulcager opened this issue Apr 19, 2012 · 3 comments
Closed

NPE in HexDumpProxyInboundHandler example #274

paulcager opened this issue Apr 19, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@paulcager
Copy link

Running org.jboss.netty.example.proxy.hexDumpProxy I get an NPE in HexDumpProxyInboundHandler.channelInterestChanged when a new connection arrives:

    public void channelInterestChanged(ChannelHandlerContext ctx,
            ChannelStateEvent e) throws Exception {
        // If inboundChannel is not saturated anymore, continue accepting
        // the incoming traffic from the outboundChannel.
        synchronized (trafficLock) {
            if (e.getChannel().isWritable()) {
                outboundChannel.setReadable(true);
            }
        }
    }

I think this happens because in channelOpen inboundChannel.setReadable(false); is called before executing outboundChannel = f.getChannel();

@normanmaurer
Copy link
Member

Could you please include the stacktrace ?

@paulcager
Copy link
Author

Here's the stack trace. I'm using a recent 3.4.1.Final-SNAPSHOT for testing.

Proxying *:1919 to www.google.co.uk:80 ...
java.lang.NullPointerException
    at org.jboss.netty.example.proxy.HexDumpProxyInboundHandler.channelInterestChanged(HexDumpProxyInboundHandler.java:102)
    at org.jboss.netty.channel.Channels.fireChannelInterestChanged(Channels.java:361)
    at org.jboss.netty.channel.Channels$3.run(Channels.java:349)
    at org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:41)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processEventQueue(AbstractNioWorker.java:352)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:236)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

normanmaurer added a commit that referenced this issue Apr 21, 2012
normanmaurer added a commit that referenced this issue Apr 21, 2012
@ghost ghost assigned normanmaurer Apr 21, 2012
@normanmaurer
Copy link
Member

Fixed thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants