saintbyte / openbmap

Automatically exported from code.google.com/p/openbmap
Other
1 stars 1 forks source link

Crash while logging #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open client
2. Start logging

What is the expected output? What do you see instead?
Expected output: Client logging
What I see: Client crashes for no apparent reason

What version of the product are you using? On what operating system?
Beta 0.6.0 (built from source, commit d8301e18b980, July 21) on Cyanogenmod 
10.1.2 (Android 4.2.2)

Please provide any additional information below.
Logcat is attached.

Looking at the file, the error is apparent: the exception is caused by 
WirelessLoggerService line 623. Apparently mTelephony.getNetworkOperator 
returned an empty string, thus attempting to get the first 3 chars from it will 
throw a StringIndexOutOfBounds exception. The empty string was possibly caused 
by a dropped connection (I happened to run into this in my own project just a 
few days earlier...)

A better approach would be: call mTelephonyManager.getNetworkOperator and store 
it in a variable, then test if is an empty string. In that case, we can 
probably return null as we don't have a network connection. (Multiple calls to 
getNetworkOperator are better avoided, as in very rare and unfortunate 
circumstances we may get dropped from the network just between the if statement 
and the getSubstring call...)

Original issue reported on code.google.com by mich...@vonglasow.com on 20 Aug 2013 at 5:51

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed. In GSM mode cell is ignored completly if getNetworkOperator returns 
empty string.
In CDMA mode issue is addressed, but cell is tracked nevertheless as missing 
operator info can be normal behaviour, see  
http://developer.android.com/reference/android/telephony/TelephonyManager.html#g
etNetworkOperator()

Original comment by wish7code on 20 Aug 2013 at 10:07