Hi,
I'm using mina-core-2.0.2 and just got :
java.lang.NullPointerException
at
org.apache.mina.core.service.SimpleIoProcessorPool.dispose(SimpleIoProcessorPool.java:289)
at
org.apache.mina.core.service.SimpleIoProcessorPool.<init>(SimpleIoProcessorPool.java:229)
at
org.apache.mina.core.service.SimpleIoProcessorPool.<init>(SimpleIoProcessorPool.java:112)
at
org.apache.mina.core.polling.AbstractPollingIoConnector.<init>(AbstractPollingIoConnector.java:93)
at
org.apache.mina.transport.socket.nio.NioSocketConnector.<init>(NioSocketConnector.java:55)
Looking at the SimpleIoProcessorPool source code, this happens because
in the constructor the pool attribute is first initialised with a size :
SimpleIoProcessorPool.SimpleIoProcessorPool:
...
pool = new IoProcessor[size];
and then its elements are initialised one by one :
SimpleIoProcessorPool.SimpleIoProcessorPool:
...
pool[i] = processorConstructor.newInstance();
If an exception is thrown during the pool initialisation, dispose() is
called.
The problem is that dispose() expects the pool attribute to have all its
elements initialised.
SimpleIoProcessorPool.dispose:
...
for (IoProcessor<S> ioProcessor : pool) {
if (ioProcessor.isDisposing()) {
continue;
}
...
So if the pool is only partially initialised when calling dispose(), we
get a NullPointerException.
--
Rodolphe Rocca