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 2006/11/29 10:42:23 UTC

DO NOT REPLY [Bug 41064] New: - Error when opening an excel file

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41064>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41064

           Summary: Error when opening an excel file
           Product: POI
           Version: 3.0-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POIFS
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: julien.kirch@bnpparibas.com


Hi, I have a parsing error when trying to read an excel file

Environment : jdk 1.4.2 under Windows XP SP1, error identical under poi
2.0, 2.5.1 and 3.0-alpha2-20060616, parsing an a file created with excel
2002 (containing some french characters) :

HSSFWorkbook hssfWorkbook = new HSSFWorkbook(new POIFSFileSystem(new
BufferedInputStream(new FileInputStream("MyFile.xls"))));

Code worked a few days ago but failed since some changes in the excel file

Error is at
java.lang.StringIndexOutOfBoundsException: String index out of range: 14172
at java.lang.String.checkBounds(String.java:287)
at java.lang.String.<init>(String.java:319)
at org.apache.poi.util.StringUtil.getFromCompressedUnicode(StringUtil.java:163)

original cause is in StringUtil : "return new String(string, offset, len, "ISO-
8859-1");" where string.length - offset > len

As in all other cases len = string.length - offest  I tried to force the len 
value but it gives me a 
org.apache.poi.hssf.record.RecordFormatException: Unhandled Continue Record
	at 
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:185)
so I'm stucked for now	
	
Initial stacktrace : 
	
java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedConstructorAccessor9.newInstance(Unknown Source)
	at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
	at 
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:213)
	at 
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:149)
	at 
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
	at 
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:152)
	at 
com.bnpparibas.grp.framework.testing.testpack.TestPackReader.<init>(TestPackReader.java:114)
	at 
com.bnpparibas.grp.framework.testing.testpack.TestPackReaderTest.testTestPack(TestPackReaderTest.java:13)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at junit.textui.TestRunner.doRun(TestRunner.java:116)
	at 
com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:69)
	at junit.textui.TestRunner.doRun(TestRunner.java:109)
	at 
com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:24)
	at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of 
range: 14172
	at java.lang.String.checkBounds(String.java:287)
	at java.lang.String.<init>(String.java:319)
	at 
org.apache.poi.util.StringUtil.getFromCompressedUnicode(StringUtil.java:163)
	at 
org.apache.poi.hssf.record.StringRecord.fillFields(StringRecord.java:89)
	at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
	at org.apache.poi.hssf.record.StringRecord.<init>(StringRecord.java:51)
	... 32 more

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record 
instance, the following exception occured: null
	at 
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:226)
	at 
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:149)
	at 
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
	at 
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:152)
	at 
com.bnpparibas.grp.framework.testing.testpack.TestPackReader.<init>(TestPackReader.java:114)
	at 
com.bnpparibas.grp.framework.testing.testpack.TestPackReaderTest.testTestPack(TestPackReaderTest.java:13)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)


Process finished with exit code -1

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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


DO NOT REPLY [Bug 41064] - Error when opening an excel file

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41064>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41064





------- Additional Comments From julien.kirch@bnpparibas.com  2006-12-21 02:42 -------
Created an attachment (id=19297)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19297&action=view)
Patch proposal

I tried to fix the problem by limiting the read String then by adding the
following ContinueRecord

It don't break any current testcase and fix my problem

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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


DO NOT REPLY [Bug 41064] - Error when opening an excel file

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41064>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41064





------- Additional Comments From julien.kirch@bnpparibas.com  2006-12-18 02:25 -------
Created an attachment (id=19279)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19279&action=view)
File to reproduce the problem

I tried to remove as much unused data as possible from the file but failed to
reduce it to a minimal one.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


DO NOT REPLY [Bug 41064] - Error when opening an excel file

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41064>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41064


nick@torchbox.com changed:

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




------- Additional Comments From nick@torchbox.com  2007-12-04 08:56 -------
Thanks for this, patch applied

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

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


DO NOT REPLY [Bug 41064] - Error when opening an excel file

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41064>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41064





------- Additional Comments From julien.kirch@bnpparibas.com  2006-11-29 01:44 -------
Error in description :

original cause is in StringUtil : "return new String(string, offset, len, "ISO-
8859-1");" where string.length - offset < len

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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/