Bug 57355 - XSSFPicture.resize() throws ArrayIndexOutOfBoundsException
Summary: XSSFPicture.resize() throws ArrayIndexOutOfBoundsException
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.11-dev
Hardware: PC All
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-16 10:28 UTC by Dominik Stadler
Modified: 2014-12-16 10:40 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik Stadler 2014-12-16 10:28:50 UTC
The change "r1638623: Picture method to resize with different scales in width and height, Date: Mittwoch, 12. November 2014 01:19:00" introduced a method XSSFSheet.getColumnWidthInPixels() which causes the following:

java.lang.ArrayIndexOutOfBoundsException: -1
    at java.util.ArrayList.elementData(ArrayList.java:400)
    at java.util.ArrayList.get(ArrayList.java:413)
    at org.apache.poi.xssf.model.StylesTable.getStyleAt(StylesTable.java:239)
    at org.apache.poi.xssf.usermodel.XSSFSheet.getColumnWidthInPixels(XSSFSheet.java:718)
    at org.apache.poi.ss.util.ImageUtils.getDimensionFromAnchor(ImageUtils.java:231)
    at org.apache.poi.ss.util.ImageUtils.setPreferredSize(ImageUtils.java:143)
    at org.apache.poi.xssf.usermodel.XSSFPicture.getPreferredSize(XSSFPicture.java:221)
    at org.apache.poi.xssf.usermodel.XSSFPicture.resize(XSSFPicture.java:180)
    at org.apache.poi.xssf.usermodel.XSSFPicture.resize(XSSFPicture.java:155)
    at org.apache.poi.xssf.usermodel.XSSFPicture.resize(XSSFPicture.java:146)
    at org.apache.poi.xssf.usermodel.TestXSSFPicture.testResizeWithColumns(TestXSSFPicture.java:260)

Fix is likely to simply remove two lines from the new method which are actually not needed, but cause this error.
Comment 1 Dominik Stadler 2014-12-16 10:40:45 UTC
Fixed on trunk by removing the two unnecessary lines.