Bug 37630

Summary: RecordFormatException: java.lang.UnsupportedOperationException: 60 (96)
Product: POI Reporter: juergen <richts>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: the excel file i use to reproduce the exception.

Description juergen 2005-11-24 15:29:07 UTC
when I open the attached file, i get the exception from the summary.

stacktrace:

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	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:243)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:157)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:152)
	at com.segue.scc.util.excel.MSExcelWriter.loadWorkbook(MSExcelWriter.java:66)
	at
com.segue.tm.common.entities.execution.util.ManualTestOfflineExecutor.write(ManualTestOfflineExecutor.java:47)
	at
com.segue.tm.common.entities.execution.util._TestManualTestOfflineExecutor.testWrite(_TestManualTestOfflineExecutor.java:36)
	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.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
	at junit.textui.TestRunner.start(TestRunner.java:172)
	at
com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
	at
com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
	at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
Caused by: org.apache.poi.hssf.record.RecordFormatException:
java.lang.UnsupportedOperationException: 60 (96)
	at
org.apache.poi.hssf.record.NameRecord.getParsedExpressionTokens(NameRecord.java:789)
	at org.apache.poi.hssf.record.NameRecord.fillFields(NameRecord.java:757)
	at org.apache.poi.hssf.record.Record.<init>(Record.java:57)
	at org.apache.poi.hssf.record.NameRecord.<init>(NameRecord.java:143)
	... 29 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:258)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:157)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:152)
	at com.segue.scc.util.excel.MSExcelWriter.loadWorkbook(MSExcelWriter.java:66)
	at
com.segue.tm.common.entities.execution.util.ManualTestOfflineExecutor.write(ManualTestOfflineExecutor.java:47)
	at
com.segue.tm.common.entities.execution.util._TestManualTestOfflineExecutor.testWrite(_TestManualTestOfflineExecutor.java:36)
	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.junit2.JUnitStarter.main(JUnitStarter.java:31)


this happens with 2.5.1-final and with the current cvs version.
Comment 1 juergen 2005-11-24 15:29:52 UTC
Created attachment 17034 [details]
the excel file i use to reproduce the exception.
Comment 2 juergen 2005-11-25 09:34:53 UTC
I'm using the cvs version now, and changed Ptg.java, line around 190 to:

            case MemErrPtg.sid :        // 0x27       These 3 values 
            case MemErrPtg.sid+0x20 :   // 0x47       documented in 
            case MemErrPtg.sid+0x40 :   // 0x67       openOffice.org doc.
            case 0x60 :
                retval = new MemErrPtg(in);

                break;


i don't know, what this means, but now i can read my excel file.
Comment 3 Jason Height 2006-01-21 06:43:35 UTC
Fixed! Error caused by ArrayPtgs not being implemented.

They now are!

Fix available in SVN.

Jason
Comment 4 nshashank1982 2007-05-29 14:13:32 UTC
I am trying to read a excel which contains two drop down lists.
I get the following error.

Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: 
Unable to construct record instance
	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:191)
	at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:115)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:205)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:257)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:238)
	at excelFileReader.ParseExcel.main(ParseExcel.java:17)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:179)
	... 5 more
Caused by: org.apache.poi.hssf.record.RecordFormatException: 
java.lang.UnsupportedOperationException:  Unknown Ptg in Formula: 0x0 (0)
	at org.apache.poi.hssf.record.FormulaRecord.fillFields
(FormulaRecord.java:109)
	at org.apache.poi.hssf.record.Record.<init>(Record.java:56)
	at org.apache.poi.hssf.record.FormulaRecord.<init>
(FormulaRecord.java:89)
	... 10 more
Caused by: java.lang.UnsupportedOperationException:  Unknown Ptg in Formula: 
0x0 (0)
	at org.apache.poi.hssf.record.formula.Ptg.createPtg(Ptg.java:357)
	at org.apache.poi.hssf.record.formula.Ptg.createParsedExpressionTokens
(Ptg.java:98)
	at org.apache.poi.hssf.record.FormulaRecord.fillFields
(FormulaRecord.java:107)
	... 12 more
Comment 5 Josh Micich 2008-12-01 23:37:00 UTC
Original fix was in svn r370987.

Comment #4 seems to refer to a different problem.  Without an example file it is difficult to be sure if it has been fixed, but there has been much work with formulas since version 3.0.   If your workbook still fails to read with POI 3.5-beta4, please upload it to a new bugzilla entry.