rzbanshee350 / android-ftdi-usb2serial-driver-package

Automatically exported from code.google.com/p/android-ftdi-usb2serial-driver-package
0 stars 2 forks source link

NullPointerException #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compile and run Rev 78 
2. Click to "PORT CONFIG"
3. Click to "Main"

What is the expected output? What do you see instead?
NullPointerException, the app closes.

What version of the product are you using? On what operating system?
Asus Transformer 101, Android 4.0.3

Please provide any additional information below.

The NullPointer Exception happens at    mApp.setSerialPortConfigSelections. It 
looks like the HashTables are not filled correctly, due to wrong string 
comparisons (== instead of .equals()).

Original issue reported on code.google.com by gerth...@gmail.com on 13 May 2012 at 12:50

GoogleCodeExporter commented 8 years ago
The wrong string comparisons happen for example here:

//stop bits hashmap
        for(String str: stop_bits_list){
            if(str == "1"){
                mStopBitsHashMap.put(str, FTDI_Constants.STOP_BITS_1);
            }else if(str == "1.5"){
                mStopBitsHashMap.put(str, FTDI_Constants.STOP_BITS_15);
            }else if(str == "2"){
                mStopBitsHashMap.put(str, FTDI_Constants.STOP_BITS_2);
            }
        }

Original comment by gerth...@gmail.com on 13 May 2012 at 12:51

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Indeed, changing all '==' to equals() solves this problem.

Original comment by giorgos...@gmail.com on 11 Jun 2012 at 4:03