Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update problem

 
Gil Carvalho
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi



I having this error each time i try to check if new version is available

java.lang.ArrayIndexOutOfBoundsException: length=1; index=1

This errror are related to Updater class in private void checkForUpdates()

This is my class App




My AppInfo class



My Updater



and my txt



I have this log

06-06 15:43:54.342: E/AndroidRuntime(24775): FATAL EXCEPTION: Timer-0
06-06 15:43:54.342: E/AndroidRuntime(24775): Process: gmc.ebspmamobile, PID: 24775
06-06 15:43:54.342: E/AndroidRuntime(24775): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
06-06 15:43:54.342: E/AndroidRuntime(24775): at gmc.ebspmamobile.UpdaterService.checkForUpdates(UpdaterService.java:126)
06-06 15:43:54.342: E/AndroidRuntime(24775): at gmc.ebspmamobile.UpdaterService.access$1(UpdaterService.java:112)
06-06 15:43:54.342: E/AndroidRuntime(24775): at gmc.ebspmamobile.UpdaterService$CheckForUpdatesTimer.run(UpdaterService.java:99)
06-06 15:43:54.342: E/AndroidRuntime(24775): at java.util.Timer$TimerImpl.run(Timer.java:284)


any help please?

Thanks
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a lot of code. And, unfortunately despite posting it all, it isn't clear what line of code actually causes the exception because the numbering in the posted code isn't the same as the numbering in the real code.

java.lang.ArrayIndexOutOfBoundsException: length=1; index=1

The problem comes because you have an Array with 1 value in it (length=1) but you are trying to get the second value out of it (index=1, remember indexes are 0 based). So you try to get a value that doesn't exist.


<edit> had "List" when I meant "Array"</edit>
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is the error comes from line 101 in your above code, which is this:

You assume on line 100 that the String was split into at least two parts but no split occurred, so on line 101 there is a single token. You need to find out what value is being read that doesn't match the expected pattern, then figure out what to do with it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic