[ 
https://issues.apache.org/jira/browse/DIRMINA-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12527048
 ] 

Trustin Lee commented on DIRMINA-435:
-------------------------------------

What's really odd is that the NPE is thrown from ConcurrentHashMap.hash().  The 
hash() method has nowhere to throw such an exception because its purely an 
arithmetic function.  If the returned IoSession is null, the NPE should be 
thrown from putIfAbsent() method.

Could you try to upgrade the JRE?  Let me run the tests too soon.





> NullPointerException in IoServiceListenerSupport
> ------------------------------------------------
>
>                 Key: DIRMINA-435
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-435
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.2
>         Environment: WinXP SP 2
> java version "1.5.0_11"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
>            Reporter: Matthew Phillips
>
> This is an odd one, since it occurs on WinXP and not on Mac OS X. The error 
> was seen under 1.5, but also occurs on 1.6. I see the following NPE :
> -----
> Exception trace:
> java.lang.NullPointerException
>       at java.util.concurrent.ConcurrentHashMap.hash(Unknown Source)
>       at java.util.concurrent.ConcurrentHashMap.putIfAbsent(Unknown Source)
>       at 
> org.apache.mina.common.support.IoServiceListenerSupport.fireSessionCreated(IoServiceListenerSupport.java:152)
>       at 
> org.apache.mina.transport.socket.nio.SocketIoProcessor.doAddNew(SocketIoProcessor.java:135)
>       at 
> org.apache.mina.transport.socket.nio.SocketIoProcessor.access$300(SocketIoProcessor.java:44)
>       at 
> org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:444)
>       at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:39)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown 
> Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>       at java.lang.Thread.run(Unknown Source)
> ------
> The NPE is being caused by IoSession.getServiceAddress () returning null, 
> which then bombs the attempt to use it as a key in the map 
> (IoServiceListenerSupport:151):
>        SocketAddress serviceAddress = session.getServiceAddress(); // null
>         // Get the session set.
>         Set<IoSession> s = new IdentityHashSet<IoSession>();
>         Set<IoSession> sessions = managedSessions.putIfAbsent(serviceAddress,
>                 Collections.synchronizedSet(s));
> This has me stumped. Can anyone help?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to