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: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to