Android Question error: (ArrayIndexOutOfBoundsException) java.lang.ArrayIndexOutOfBoundsException: src.length=8192 sr

jahswant

Well-Known Member
Licensed User
Longtime User
What is this error i am trying to solve my issue here http://b4x.com/android/forum/thread...issue-of-bluetooth-service.56462/#post-355205 . I nearly solved the pb.After 2 seconds the reconnection is effective but sometimes it breaks after reconnection and will reconnect again after 1 to 3 3mins.Thus rendering my app unstable.What's this issue ? See my Logs...
B4X:
service running
StartAStream
ast_Terminated
error: (IOException) java.io.IOException: [JSR82] read: read() failed.
ast_Terminated
Trying To ReConnect On 0C:14:20:8B:E3:B2
1
StartAStream
Trying To ReConnect On 0C:14:20:8B:E3:B2
Connected
2
ast_Terminated
error: (IOException) java.io.IOException: [JSR82] read: read() failed.
ast_Terminated
Trying To ReConnect On 0C:14:20:8B:E3:B2
1
Trying To ReConnect On 0C:14:20:8B:E3:B2
2
StartAStream
error: (ArrayIndexOutOfBoundsException) java.lang.ArrayIndexOutOfBoundsException: src.length=8192 srcPos=0 dst.length=65535 dstPos=0 length=65535
ast_Terminated
Trying To ReConnect On 0C:14:20:8B:E3:B2
1
Trying To ReConnect On 0C:14:20:8B:E3:B2
2
Trying To ReConnect On 0C:14:20:8B:E3:B2
3
Trying To ReConnect On 0C:14:20:8B:E3:B2
4
Trying To ReConnect On 0C:14:20:8B:E3:B2
5
Trying To ReConnect On 0C:14:20:8B:E3:B2
6
Trying To ReConnect On 0C:14:20:8B:E3:B2
7
Trying To ReConnect On 0C:14:20:8B:E3:B2
8
Trying To ReConnect On 0C:14:20:8B:E3:B2
9
Trying To ReConnect On 0C:14:20:8B:E3:B2
10
Trying To ReConnect On 0C:14:20:8B:E3:B2
11
Trying To ReConnect On 0C:14:20:8B:E3:B2
12
Trying To ReConnect On 0C:14:20:8B:E3:B2
13
Trying To ReConnect On 0C:14:20:8B:E3:B2
14
Trying To ReConnect On 0C:14:20:8B:E3:B2
15
Trying To ReConnect On 0C:14:20:8B:E3:B2
16
Trying To ReConnect On 0C:14:20:8B:E3:B2
17
Trying To ReConnect On 0C:14:20:8B:E3:B2
18
Trying To ReConnect On 0C:14:20:8B:E3:B2
19
Trying To ReConnect On 0C:14:20:8B:E3:B2
20
.......
Trying To ReConnect On 0C:14:20:8B:E3:B2
59
Trying To ReConnect On 0C:14:20:8B:E3:B2
60
Trying To ReConnect On 0C:14:20:8B:E3:B2
61
Trying To ReConnect On 0C:14:20:8B:E3:B2
62
Trying To ReConnect On 0C:14:20:8B:E3:B2
63
Trying To ReConnect On 0C:14:20:8B:E3:B2
64
Trying To ReConnect On 0C:14:20:8B:E3:B2
65
Trying To ReConnect On 0C:14:20:8B:E3:B2
66
Trying To ReConnect On 0C:14:20:8B:E3:B2
67
Trying To ReConnect On 0C:14:20:8B:E3:B2
68
Trying To ReConnect On 0C:14:20:8B:E3:B2
69
Trying To ReConnect On 0C:14:20:8B:E3:B2
70
Trying To ReConnect On 0C:14:20:8B:E3:B2
71
Trying To ReConnect On 0C:14:20:8B:E3:B2
72
Trying To ReConnect On 0C:14:20:8B:E3:B2
73
Trying To ReConnect On 0C:14:20:8B:E3:B2
74
Trying To ReConnect On 0C:14:20:8B:E3:B2
75
Trying To ReConnect On 0C:14:20:8B:E3:B2
76
Trying To ReConnect On 0C:14:20:8B:E3:B2
77
Trying To ReConnect On 0C:14:20:8B:E3:B2
78
StartAStream
Trying To ReConnect On 0C:14:20:8B:E3:B2
Connected
79
 

jahswant

Well-Known Member
Licensed User
Longtime User
this the reconnect code.
B4X:
Sub Timer1_Tick
    Try
    TryingToConnect = True
    Log("Trying To ReConnect On " & (Main.MYSEC))
    BTConnectToDevice
    i = i+1
    If BTConnected = True Then
    Log("Connected")
    timer1.Enabled = False
    WriteCommand
    TryingToConnect = False
    End If
    Catch
    Log(LastException.Message)
    End Try   
    Log(i)
    UpdateUI   
End Sub
I checheked the unfiltered logs didn't print the stack trace...
 
Upvote 0

jahswant

Well-Known Member
Licensed User
Longtime User
I commented the writecommand sub.It gave me a java.lang.NullPointerException not sure to know where it is comming from...
 
Upvote 0

jahswant

Well-Known Member
Licensed User
Longtime User
yeah Sure : My timer was initialized to reconnect after 1 Secs so it was quite difficult for the app to do this within 1 Sec.So i Changed to 5 Secs now it will reconnect and have enough time to try to maintain the connection...
 
Upvote 0
Top