Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-25-2008, 09:39 PM
Member
 
Join Date: Jun 2008
Posts: 54
Rep Power: 0
little_polarbear is on a distinguished road
Default strange Error message
hey, and it is me again...

i found out how to read in stuff from an excel sheet, i am preety proud about it, but althought it is working, i am getting a really strange error message

Warning: Property storage name for 5 is empty - setting to Root Entry
1
2
3
4
5
6
7
8
9
10
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
at jxl.read.biff.SheetImpl.getCell(SheetImpl.java:354 )
at Excel.main(Excel.java:23)


and my code is:

import java.io.File;
import java.io.IOException;
import java.util.Date;
import jxl.*;
import jxl.read.biff.BiffException;


public class Excel
{


public static void main(String[] args) throws BiffException, IOException
{
Workbook workbook = Workbook.getWorkbook(new File("//Volumes//ws.xls"));

Sheet sheet = workbook.getSheet(0);


int x;

for(int a = 0; a < 11 ; a++)
{
Cell a1 = sheet.getCell(0,a);

String stringa1 = a1.getContents();

x = Integer.parseInt(stringa1);

System.out.println(x);

}



}
}


does anyone know how to handle it...

littleolarbear
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 08-25-2008, 09:54 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
Default
Quote:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
The message says that the index 10 is past the end of the array.
The following code trys to get a cell with that index:
sheet.getCell(0,a);

Why do you think that there is a cell at index 10? You have the value 11 hardcoded in your program in the for loop. The loop goes from a=0 to 10 - that's 11 cells.
Is there a method you can call to get the correct number of cells?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-25-2008, 09:59 PM
Member
 
Join Date: Jun 2008
Posts: 54
Rep Power: 0
little_polarbear is on a distinguished road
Default
ok, i changed it and i am not getting this message anymore :-) ur brilliant, i just don't know what to do with the other error message

Warning: Property storage name for 5 is empty - setting to Root Entry
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-25-2008, 11:16 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
Default
That doesn't look like a java error message. It must be from the package you are using. You'll have to read its docs.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 08-26-2008, 12:45 AM
Member
 
Join Date: Jun 2008
Posts: 54
Rep Power: 0
little_polarbear is on a distinguished road
Default
hey, thank u very much...
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't solve error message while looping BHCluster New To Java 15 04-22-2008 11:51 AM
System.in.read(); strange error! kantze New To Java 2 03-19-2008 02:44 PM
java error message baileyr New To Java 2 01-23-2008 04:47 AM
Strange error message "Source not found" ppayal Eclipse 0 11-25-2007 07:19 PM
error message on jsp sandor Web Frameworks 1 04-11-2007 03:10 AM


All times are GMT +2. The time now is 11:57 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org