Summary: | OutOfBoundsException in autoSizeColumn | ||
---|---|---|---|
Product: | POI | Reporter: | PiterBoss <komisarskip> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | CC: | wim.deblauwe |
Priority: | P1 | ||
Version: | 3.0-dev | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | Windows XP | ||
Attachments: |
Testcase for this bug
Improved version of the test case by Wim Deblauwe |
Description
PiterBoss
2007-08-10 06:21:05 UTC
Your document probably contains some sort of invalid styling. It looks like the autoSizing code is trying to fetch the font details for the cell, and is failing when it can't find it. If you upload the problem file, we can look at throwing a more helpful error i have no file. I'm trying to generate one.... please post a full test case. I can't reproduce it. Regards, Yegor Created attachment 21072 [details]
Testcase for this bug
The attached test program reproduces the bug. I also get the same stacktrace
and ArrayIndexOutOfBoundsException.
regards,
Wim
thanks for the test case. I will find time to look into it. Yegor Improper usage. The maximum number of fonts in a workbook is 32767 ( the maximum positive short). You are creating a new font for each cell in a loop and finally the font index becomes negative. The subsequent call of HSSFSheet.autoSizeColumn results in ArrayIndexOutOfBoundsException. See how I suggest rewriting your sample code. It should work fine. P.S. I'm going to change HSSFWorkbook.createFont and throw an exception if the font index becomes greater than 32767. This way users will get a clearer indication of the problem. I will commit the fix in a little while. Regards, Yegor Created attachment 21091 [details]
Improved version of the test case by Wim Deblauwe
Thank you for looking into this. You might want to add a note to the busy developers guide (http://poi.apache.org/hssf/quick-guide.html#WorkingWithFonts) for this. |