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

Discussion in 'Android Questions' started by jahswani, Jul 28, 2015.

  1. jahswani

    jahswani Active Member Licensed 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...
    Code:
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Where is the code that causes this error?

    Check the unfiltered logs. The full stack trace might be there.
     
  3. jahswani

    jahswani Active Member Licensed User

    this the reconnect code.
    Code:
    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...
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Remove the Try / Catch block. It will give you more information. The problem is probably in the WriteCommand sub.
     
  5. jahswani

    jahswani Active Member Licensed User

    I commented the writecommand sub.It gave me a java.lang.NullPointerException not sure to know where it is comming from...
     
  6. jahswani

    jahswani Active Member Licensed User

    SOLVED NOW !!!
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    You should post the solution.
     
  8. jahswani

    jahswani Active Member Licensed 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...
     
Loading...