GX Serial java NPE

2 posts / 0 new
Last post
pan_henryk
GX Serial java NPE

Hi,

Looking at your GX serial code

https://github.com/Gurux/gurux.serial.java/blob/master/development/src/m...

I see close method:

public final void close() {
if (hWnd != 0) {
if (receiver != null) {
receiver.interrupt();
receiver = null;
}
try {
notifyMediaStateChange(MediaState.CLOSING);
} catch (RuntimeException ex) {
notifyError(ex);
throw ex;
} finally {
try {
NativeCode.closeSerialPort(hWnd, closing);
} catch (java.lang.Exception e) {
// Ignore all errors on close.
}
hWnd = 0;
notifyMediaStateChange(MediaState.CLOSED);
bytesSend = 0;
receiver.resetBytesReceived();
syncBase.resetReceivedSize();
}
}
}

You are setting receiver to null in line 515 and then calling
receiver.resetBytesReceived(); in line 531
what ends ... you know how :)

Cheers,

Jakub

Kurumi
Kurumi's picture

Hi,

Thank you from this info. I created ticket from this:
http://www.gurux.fi/node/5707

We have fixed this and we are releasing new version today to github and central.
I added your name to CREDITS.md

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi