[ https://issues.apache.org/jira/browse/DIRMINA-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12548147 ]
Trustin Lee commented on DIRMINA-435: ------------------------------------- Hi Matthew, thanks for tracking down this problem for us. I really appreciate it. I have made some change in SocketConnector so it doesn't create a session as long as finishConnect() returns false. Please check out the latest source code, give it a try and let me know if it fixes your problem or not, because my fix is different from yours. > 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 > Attachments: mina.patch > > > 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.