Results 1 to 5 of 5
Thread: strange Error message
- 08-25-2008, 08:39 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 54
- Rep Power
- 0
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...
little:polarbear
- 08-25-2008, 08:54 PM #2
The message says that the index 10 is past the end of the array.Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
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?
- 08-25-2008, 08:59 PM #3
Member
- Join Date
- Jun 2008
- Posts
- 54
- Rep Power
- 0
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
- 08-25-2008, 10:16 PM #4
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.
- 08-25-2008, 11:45 PM #5
Member
- Join Date
- Jun 2008
- Posts
- 54
- Rep Power
- 0
Similar Threads
-
Can't solve error message while looping
By BHCluster in forum New To JavaReplies: 15Last Post: 04-22-2008, 10:51 AM -
System.in.read(); strange error!
By kantze in forum New To JavaReplies: 2Last Post: 03-19-2008, 01:44 PM -
java error message
By baileyr in forum New To JavaReplies: 2Last Post: 01-23-2008, 03:47 AM -
Strange error message "Source not found"
By ppayal in forum EclipseReplies: 0Last Post: 11-25-2007, 06:19 PM -
error message on jsp
By sandor in forum Web FrameworksReplies: 1Last Post: 04-11-2007, 02:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks