BenLenest / java-simple-serial-connector

Automatically exported from code.google.com/p/java-simple-serial-connector
0 stars 0 forks source link

Exception in getPortNames() when ports not available #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. System don`t have any serial ports.
2. Call getPortNames()
3. Application crashes

# Problematic frame:
# j  jssc.SerialNativeInterface.getSerialPortNames()[Ljava/lang/String;+0

---------------  T H R E A D  ---------------

Current thread (0x00000000003ac000):  JavaThread "main" [_thread_in_Java, 
id=12264, stack(0x00000000020d0000,0x00000000021d0000)]

siginfo: ExceptionCode=0xc0000005, reading address 0xffffffff00000002

Original issue reported on code.google.com by w...@posten.ru on 25 Apr 2012 at 11:53

GoogleCodeExporter commented 8 years ago
Version: jSSC-0.9.0
MS Win7, 64 bit

Original comment by w...@posten.ru on 25 Apr 2012 at 12:00

GoogleCodeExporter commented 8 years ago
Workaround:

public static String[] GetPortList() {
    try {
        String[] serialPortNames = SerialPortList.getPortNames();
        return serialPortNames;
    } catch (NullPointerException e) {
    }
    return new String[0];
}

Original comment by w...@posten.ru on 25 Apr 2012 at 12:07

GoogleCodeExporter commented 8 years ago
As I see, you use jSSC-0.8-tb2 (see 223 string of your stack trace: 
0x0000000067c40000 - 0x0000000067c5d000 
    C:\Users\Pavel\.jssc\windows\jSSC-0.8-tb2_x86_64.dll)

jSSC-0.8-tb2 have no checking of returned array from native code, that's why 
you have this error. This issue was fixed in jSSC-0.8-tb3.

Original comment by scream3r.org@gmail.com on 13 Mar 2013 at 8:41