You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/12/16 21:42:05 UTC

DO NOT REPLY [Bug 52348] New: XSSFWorkbook#createCellStyle() fails with ArrayIndexOutOfBoundsException

https://issues.apache.org/bugzilla/show_bug.cgi?id=52348

             Bug #: 52348
           Summary: XSSFWorkbook#createCellStyle() fails with
                    ArrayIndexOutOfBoundsException
           Product: POI
           Version: 3.8-dev
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: nestor.urquiza@gmail.com
    Classification: Unclassified


Created attachment 28079
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28079
5 files showing the issue

This is a bug resulting from a discussion on the mailing list
http://apache-poi.1045710.n5.nabble.com/XSSFWorkbook-createCellStyle-fails-with-ArrayIndexOutOfBoundsException-td5033683.html

I am attaching 5 files (two input xlsx files with the output xlsx you can
obtain yourself if you run the JUnit class that uses the Util class). One is a
util class that should allow me to merge two XLSX books and the other a JUnit
test that cannot run and creates an output file where the style for the second
sheet is missing.

Look for the below lines and uncomment the code in the Util class then run the
test again. The Exception will be thrown:

//BUG: The below produces:
                    /*
                    java.lang.ArrayIndexOutOfBoundsException: -1
                    at java.util.ArrayList.get(ArrayList.java:324)
                    at
org.apache.poi.xssf.model.StylesTable.getCellStyleXfAt(StylesTable.java:305)
                    at
org.apache.poi.xssf.usermodel.XSSFCellStyle.<init>(XSSFCellStyle.java:79)
                    at
org.apache.poi.xssf.model.StylesTable.createCellStyle(StylesTable.java:521)
                    at
org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:443)
                    */
                    //newCellStyle =
newCell.getSheet().getWorkbook().createCellStyle();
                    //newCellStyle.cloneStyleFrom(oldCell.getCellStyle());
                    //styleMap.put(stHashCode, newCellStyle);

Thanks!
-Nestor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52348] XSSFWorkbook#createCellStyle() fails with ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52348

--- Comment #4 from nestor.urquiza@gmail.com 2012-01-03 18:44:16 UTC ---
Created attachment 28118
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28118
two screenshots showing how the second style of the merged sheet gets messed up

Hi Yegor,

First, Happy and healthy 2012! 

Thanks for looking at this issue. I can confirm the exception is not longer
generated however the style for the second document is not respected after the
merge. If you run my JUnit test you can confirm so but in any case I am
attaching the screenshots for you to have a quick look at what is currently
happening.

Thanks!
-Nestor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52348] XSSFWorkbook#createCellStyle() fails with ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52348

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Yegor Kozlov <ye...@dinom.ru> 2011-12-19 09:06:38 UTC ---
Fixed in r1220659, junit added

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52348] XSSFWorkbook#createCellStyle() fails with ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52348

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
         OS/Version|                            |All

--- Comment #1 from Nick Burch <ni...@alfresco.com> 2011-12-17 10:45:44 UTC ---
Are you able to unpack one of the problematic files (.xlsx files are a zip of
xml files), and see if there's anything obviously different in the styles file
between one that works and one that doesn't?

For a problem file, does adding or removing styles in excel fix things?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52348] XSSFWorkbook#createCellStyle() fails with ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52348

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from Yegor Kozlov <ye...@dinom.ru> 2011-12-19 08:47:42 UTC ---
I confirmed the problem in trunk. 

The simplest failing test case is:

XSSFWorkbook targetWorkbook = new XSSFWorkbook(new
FileInputStream("balance.xlsx"));
XSSFCellStyle style = targetWorkbook.createCellStyle();

Somehow appending a new cell style to balance.xlsx results in exception. 

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org