Created attachment 23494 [details] problem.xls Please check the attached Excel file, it throws "RecordFormatException: Unable to construct record instance" when open it by following codes. -- FileInputStream is = new FileInputStream("problem.xls") POIFSFileSystem poifs = new POIFSFileSystem(is); return new HSSFWorkbook(poifs); -- org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance at org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:71) at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:254) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:373) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:277) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:202) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:184)
Could you please post the full stacktrace, so we can see which record can't be created? Also, can you please confirm which build of 3.5 you're using?
I am using the POI latest development version (checkout from SVN today) The full stacktrace under the namespace "org.apache.poi" is pasted in previous post.
Please check further down your stacktrace, you'll see there the details of the record that couldn't be constructed
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance at org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:71) at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:254) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:373) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:277) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:202) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:184) at com.dttn.excel.helper.ExcelFactory.readExcel03(ExcelFactory.java:116) at com.dttn.excel.helper.ExcelFactory.readExcel03(ExcelFactory.java:86) at com.dttn.excel.helper.ExcelFactory.read(ExcelFactory.java:33) at com.dttn.excel.generator.module.ExcelEnveloperModule.actionPerformed(ExcelEnveloperModule.java:112) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6134) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5899) at java.awt.Container.processEvent(Container.java:2023) at java.awt.Component.dispatchEventImpl(Component.java:4501) at java.awt.Container.dispatchEventImpl(Container.java:2081) at java.awt.Component.dispatchEvent(Component.java:4331) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895) at java.awt.Container.dispatchEventImpl(Container.java:2067) at java.awt.Window.dispatchEventImpl(Window.java:2458) at java.awt.Component.dispatchEvent(Component.java:4331) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Caused by: java.lang.NegativeArraySizeException at org.apache.poi.util.StringUtil.readCompressedUnicode(StringUtil.java:119) at org.apache.poi.hssf.record.NameRecord.<init>(NameRecord.java:436) at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:63) ... 34 more
Fixed in svn (was a signed vs unsigned issue reading in very long strings)
svn r765163
svn r765163 .