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 2017/07/11 11:17:11 UTC

[Bug 61281] New: XML export of xlsx results in IndexOutOfBoundsException

https://bz.apache.org/bugzilla/show_bug.cgi?id=61281

            Bug ID: 61281
           Summary: XML export of xlsx results in
                    IndexOutOfBoundsException
           Product: POI
           Version: 3.14-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: misc.daniel@stucki.me
  Target Milestone: ---

When attempting to Export the XML of attached xlsx, there occurs following
exception:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.rangeCheck(Unknown Source)
        at java.util.ArrayList.get(Unknown Source)
        at
org.apache.poi.xssf.extractor.XSSFExportToXml.exportToXML(XSSFExportToXml.java:203)
        at
org.apache.poi.xssf.extractor.XSSFExportToXml.exportToXML(XSSFExportToXml.java:109)

The reason is, that one column of the table isn't mapped. When I do the export
from Excel, it works. There is a different handling between Excel and Apache
POI.
The code for exporting the XML is as following:

 XSSFWorkbook wb = /*given from previous code execution*/;
       for (XSSFMap map : wb.getCustomXMLMappings()) {
           XSSFExportToXml exporter = new XSSFExportToXml(map);

           ByteArrayOutputStream os = new ByteArrayOutputStream();
           exporter.exportToXML(os, true);
       }

-- 
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


[Bug 61281] XML export of xlsx results in IndexOutOfBoundsException

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

PJ Fanning <fa...@yahoo.com> changed:

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

--- Comment #8 from PJ Fanning <fa...@yahoo.com> ---
Latest patch applied using
https://svn.apache.org/viewvc?view=revision&revision=1801721

-- 
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


[Bug 61281] XML export of xlsx results in IndexOutOfBoundsException

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

--- Comment #6 from Daniel <mi...@stucki.me> ---
Created attachment 35122
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35122&action=edit
Proposed fix that provides same behaviour as excel

-- 
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


[Bug 61281] XML export of xlsx results in IndexOutOfBoundsException

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

Daniel <mi...@stucki.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #35119|0                           |1
        is obsolete|                            |
  Attachment #35119|1                           |0
           is patch|                            |

--- Comment #2 from Daniel <mi...@stucki.me> ---
Comment on attachment 35119
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35119
[PATCH] proposed patch including testcase

Mark patch as obsolete, as the solution is not complete

-- 
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


[Bug 61281] XML export of xlsx results in IndexOutOfBoundsException

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

Daniel <mi...@stucki.me> changed:

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

--- Comment #5 from Daniel <mi...@stucki.me> ---
Thanks for your fast fix. unfortunately, it just gets rid of the exception, but
doesn't provide the same behaviour as the export in Excel does. ==> Reopen

Please see attached patch that has a testcase illustrating the Problem and a
proposed fix.

-- 
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


[Bug 61281] XML export of xlsx results in IndexOutOfBoundsException

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

PJ Fanning <fa...@yahoo.com> changed:

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

--- Comment #4 from PJ Fanning <fa...@yahoo.com> ---
added guard in https://svn.apache.org/viewvc?view=revision&revision=1801634

-- 
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


[Bug 61281] XML export of xlsx results in IndexOutOfBoundsException

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

--- Comment #7 from PJ Fanning <fa...@yahoo.com> ---
Hi Daniel - any chance you could do a Github Pull Request?
https://github.com/apache/poi

-- 
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


[Bug 61281] XML export of xlsx results in IndexOutOfBoundsException

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

Daniel <mi...@stucki.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |misc.daniel@stucki.me

--- Comment #1 from Daniel <mi...@stucki.me> ---
Created attachment 35119
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35119&action=edit
[PATCH] proposed patch including testcase

-- 
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


[Bug 61281] XML export of xlsx results in IndexOutOfBoundsException

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

--- Comment #3 from Daniel <mi...@stucki.me> ---
Created attachment 35120
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35120&action=edit
xlsx which ends up in a IndexOutOfBoundsException

-- 
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