• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

(B&S) Error in my cache(ArrayList)

Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
In my Data.java i have the following code that opens the datafile accordingly and attempts to make use of a cache P.s If i violate any code pls feel free to edit my posts accordingly):

When i try to run it i get the following error:

D:\Developer>java -jar runme.jar alone
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size:
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.set(ArrayList.java:338)
at suncertify.db.Data.getRecords(Unknown Source)
at suncertify.db.Data.<init>(Unknown Source)
at suncertify.db.DataAdapter.<init>(Unknown Source)
at suncertify.remote.ContractorConnector.getLocal(Unknown Source)
at suncertify.gui.GUIController.<init>(Unknown Source)
at suncertify.gui.MainWindow.<init>(Unknown Source)
at suncertify.gui.ApplicationRunner.<init>(Unknown Source)
at suncertify.gui.ApplicationRunner.main(Unknown Source)

I really dont know how to handle the problem. At first i figured it was that i didnt set an initial capacity for the arraylist, but right now after doing that it doesnt still change. Your insight into the problems will highly be appreciated
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The set() method replaces the element at the specified position in this list with the specified element. You do not have any element in the array now.

Try to use add() method.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!