Bug 45784 - Failure to read files containing charts with titles having greater than 127 characters
Summary: Failure to read files containing charts with titles having greater than 127 c...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-11 10:56 UTC by Laird Trimble
Modified: 2008-11-05 19:47 UTC (History)
1 user (show)



Attachments
created with Office Excel 2003 (11.8146.8131) SP2 (13.50 KB, application/octet-stream)
2008-09-11 10:58 UTC, Laird Trimble
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laird Trimble 2008-09-11 10:56:49 UTC
Using POI 3.1, when I read in a file containing a chart with a title containing more than 127 characters I get an exception (see below).  Titles with 127 or less characters cause no problem.  The interesting line is near the bottom and says "Caused by: java.lang.IllegalArgumentException: Illegal length - asked for -126 but only 130 left!
        at org.apache.poi.hssf.record.RecordInputStream.readUnicodeLEString(RecordInputStream.java:252)"

I have attaced the small xls file that generated the exception below.


Exception in thread "AWT-EventQueue-0" org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:208)
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:126)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:246)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:169)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:151)
        at pkintegrator.PKIntegratorApp.updateReport(PKIntegratorApp.java:223)
        at pkintegrator.PKIntegratorApp.submitPressed(PKIntegratorApp.java:189)
        at pkintegrator.PKIntegratorView.submitStudy(PKIntegratorView.java:532)
        at pkintegrator.PKIntegratorView.submitButtonActionPerformed(PKIntegratorView.java:1537)
        at pkintegrator.PKIntegratorView.access$1800(PKIntegratorView.java:42)
        at pkintegrator.PKIntegratorView$FormListener.actionPerformed(PKIntegratorView.java:1458)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
        at java.awt.Component.processMouseEvent(Component.java:5517)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
        at java.awt.Component.processEvent(Component.java:5282)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3984)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1791)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedConstructorAccessor67.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:196)
        ... 35 more
Caused by: java.lang.IllegalArgumentException: Illegal length - asked for -126 but only 130 left!
        at org.apache.poi.hssf.record.RecordInputStream.readUnicodeLEString(RecordInputStream.java:252)
        at org.apache.poi.hssf.record.SeriesTextRecord.fillFields(SeriesTextRecord.java:78)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.SeriesTextRecord.<init>(SeriesTextRecord.java:56)
        ... 39 more
BUILD SUCCESSFUL (total time: 96 minutes 38 seconds)
Comment 1 Laird Trimble 2008-09-11 10:58:31 UTC
Created attachment 22560 [details]
created with Office Excel 2003 (11.8146.8131) SP2

this is the file that generated the exception trace in the bug report
Comment 2 Nick Burch 2008-09-21 10:49:20 UTC
Fixed in svn trunk
Comment 3 Laird Trimble 2008-10-06 18:58:45 UTC
Nick,

Thanks for the notification of the bug fix.  I can now read in the attached .xls file that contains a chart having a title longer than 127 characters.  However, when I try to write out the file unchanged I get the following error:

Error java.lang.ArrayIndexOutOfBoundsException: 3204

BTW, I am using the latest build of poi-3.2-alpha.

Laird
Comment 4 Josh Micich 2008-11-05 19:47:19 UTC
Fixed in svn r711764

There were some more issues with calculating record size for re-serialization.

For reference, the initial fix was in svn r697562.