pmackinney / LeptonBackgammon

A FIBS backgammon client written for Android
Apache License 2.0
4 stars 1 forks source link

ArrayIndexOutOfBoundsException #9

Open ellenspertus opened 3 years ago

ellenspertus commented 3 years ago

I've been running version 8 on my Pixel 2 and have been able to play games, but it recently crashe and crashes whenever I start it. I forget what preceded the crash. Here is a trace:

2021-02-05 15:30:18.362 4550-7763/? E/AndroidRuntime: FATAL EXCEPTION: pool-5-thread-1
    Process: net.mackinney.lepton, PID: 4550
    java.lang.ArrayIndexOutOfBoundsException: length=2; index=3
        at net.mackinney.lepton.GameHelper.parse(GameHelper.java:280)
        at net.mackinney.lepton.TelnetHandler.run(TelnetHandler.java:90)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
pmackinney commented 3 years ago

Great feedback & suggestions! They'll go in the paper if not the app.

Larger Icons, I can do easily.

If I make it vibrate on tap, then I have to investigate how to properly integrate it with the Android app preferences...

The ArrayIndexOutOfBoundsException is here (simplified):

if (line.startsWith("5 GammonBot")) {

words = line.split(" ");

test( words[3] ... words[4] )

It's really usual for that line to have fewer than 3 words. A typical example is:

5 GammonBot_III someplayer - 1 0 1912.15 827 8 1040515752 192.168.143.5 3DFiBs -

Good news, though, on review I see that I should be testing word 2 instead of word 3. You've identified another bug: the Invite button offers a GammonBot that isn't ready too often.

I'll fix the index and test that there are at least 4 words before asking for the correct indexes. ;-)

Thanks! Paul On Fri, Feb 5, 2021 at 3:41 PM Ellen Spertus notifications@github.com wrote:

I've been running version 8 on my Pixel 2 and have been able to play games, but it recently crashe and crashes whenever I start it. I forget what preceded the crash. Here is a trace:

2021-02-05 15:30:18.362 4550-7763/? E/AndroidRuntime: FATAL EXCEPTION: pool-5-thread-1

Process: net.mackinney.lepton, PID: 4550

java.lang.ArrayIndexOutOfBoundsException: length=2; index=3

    at net.mackinney.lepton.GameHelper.parse(GameHelper.java:280)

    at net.mackinney.lepton.TelnetHandler.run(TelnetHandler.java:90)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

    at java.lang.Thread.run(Thread.java:923)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pmackinney/LeptonBackgammon/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJTAH5NPLN6U62O335AFYDS5R6YRANCNFSM4XFTQCXA .

-- paul@mackinney.net Home Computer & Network Consulting