com.captiveimagination.jgn.DefaultUncaughtExceptionHandler uncaughtException

again a problem :slight_smile:



i get the following errormessage out of the blue sky:



12.11.2008 01:13:21 com.captiveimagination.jgn.DefaultUncaughtExceptionHandler uncaughtException
SCHWERWIEGEND: Uncaught exception: Terminating Thread.
java.lang.NullPointerException
   at com.captiveimagination.jgn.synchronization.SynchronizationManager.serverNextId(SynchronizationManager.java:226)
   at com.captiveimagination.jgn.synchronization.SynchronizationManager.messageReceived(SynchronizationManager.java:395)
   at com.captiveimagination.jgn.MessageServer.sendToListener(MessageServer.java:463)
   at com.captiveimagination.jgn.MessageServer.notifyIncoming(MessageServer.java:494)
   at com.captiveimagination.jgn.MessageServer.updateEvents(MessageServer.java:381)
   at com.captiveimagination.jgn.clientserver.JGNClient.updateEvents(JGNClient.java:252)
   at com.captiveimagination.jgn.clientserver.JGNClient.update(JGNClient.java:236)
   at com.captiveimagination.jgn.UpdatableRunnable.run(JGN.java:435)



I think the error comes from my SynchronizationManager for my vehilce...

how could i find out the reason for the error, because from the errormessage i can only guess where the null pointer could be.

when i switch client and server (execute the same code on a different computer in my network) i get:

[code]12.11.2008 01:35:10 com.captiveimagination.jgn.DefaultUncaughtExceptionHandler uncaughtException
SCHWERWIEGEND: Uncaught exception: Terminating Thread.
java.lang.NegativeArraySizeException
   at com.captiveimagination.jgn.convert.ArrayConverter.readObjectData(ArrayConverter.java:94)
   at com.captiveimagination.jgn.convert.Converter.readObject(Converter.java:223)
   at com.captiveimagination.jgn.convert.FieldConverter.readObjectData(FieldConverter.java:106)
   at com.captiveimagination.jgn.convert.Converter.readClassAndObject(Converter.java:185)
   at com.captiveimagination.jgn.NIOMessageServer.readMessage(NIOMessageServer.java:190)
   at com.captiveimagination.jgn.TCPMessageServer.read(TCPMessageServer.java:134)
   at com.captiveimagination.jgn.NIOMessageServer.updateTraffic(NIOMessageServer.java:143)
   at com.captiveimagination.jgn.clientserver.JGNServer.updateTraffic(JGNServer.java:171)
   at com.captiveimagination.jgn.clientserver.JGNServer.update(JGNServer.java:160)
   at com.captiveimagination.jgn.UpdatableRunnable.run(JGN.java:435)
   at java.lang.Thread.run(Unknown Source)[/code]



strange...

It looks like you're sending some object that JGN is not able to properly serialize / deserialize and causes it to fail.  What does your Message object look like?

Just an observation from looking at the stack, wouldnt you be better pushing read bytes to a queue that is processed by other threads, that way you maximise the network socket reading ??

I do both…I separate the functionality out because there's a lot of logic about how messages get where they belong, so in the end I fill up a ByteBuffer with as many messages as it will hold and continue to push that to the NIO connection until it's empty.