Bug 53264 - unable to create record instance..Not enough data (0) to read requested (6) bytes
Summary: unable to create record instance..Not enough data (0) to read requested (6) b...
Status: NEEDINFO
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.8-FINAL
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-18 19:04 UTC by csekhar406
Modified: 2012-06-12 13:32 UTC (History)
0 users



Attachments
the Sample file causing the problem (747.01 KB, application/octet-stream)
2012-06-07 15:31 UTC, csekhar406
Details

Note You need to log in before you can comment on or make changes to this bug.
Description csekhar406 2012-05-18 19:04:37 UTC
I am using Poi latest final 3.8 version to fix this issue.but still i am getting the fallowing exception.

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance 
        at org.apache.poi.hssf.record.RecordFactory$ReflectionRecordCreator.create(RecordFactory.java:64) 
        at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:263) 
        at org.apache.poi.hssf.record.RecordFactoryInputStream.readNextRecord(RecordFactoryInputStream.java:270) 
        at org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:236) 
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:377) 
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:275) 
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:200) 
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:316) 
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:297) 
        at com.alstom.hpr.manager.excel.impl.type.XlsImport.importFile(XlsImport.java:40) 
        at com.alstom.hpr.manager.excel.impl.BaseExcelManagement.importFile(BaseExcelManagement.java:89) 
        at com.alstom.hpr.struts.imports.ImportFinUnitDataAction.importFile(ImportFinUnitDataAction.java:190) 
        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:597) 
        at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280) 
        at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216) 
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) 
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) 
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 
        at com.alstom.fwk.servlet.StrutsServlet.service(StrutsServlet.java:95) 
        at com.alstom.hpr.servlet.HprStrutsServlet.service(HprStrutsServlet.java:98) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
        at com.alstom.fwk.servlet.filter.SimConnectionFilter.doFilter(SimConnectionFilter.java:47) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
        at com.alstom.fwk.servlet.filter.LoggerFilter.doFilter(LoggerFilter.java:71) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
        at com.alstom.fwk.servlet.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:121) 
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) 
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
        at java.lang.Thread.run(Thread.java:662) 
Caused by: org.apache.poi.hssf.record.RecordFormatException: Not enough data (0) to read requested (6) bytes 
        at org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:215) 
        at org.apache.poi.hssf.record.RecordInputStream.readFully(RecordInputStream.java:278) 
        at org.apache.poi.hssf.record.RecordInputStream.readFully(RecordInputStream.java:274) 
        at org.apache.poi.hssf.record.chart.ChartEndBlockRecord.<init>(ChartEndBlockRecord.java:44) 
        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$ReflectionRecordCreator.create(RecordFactory.java:56) 
        ... 46 more 


Code i have written is
i am getting the inputstream from the FormFile of struts request 
HSSFWorkbook wb = new HSSFWorkbook(is); 


i'd appreciate developer's comments on whether this is indeed a bug and not some rudeness on the part of my own code,please
Comment 1 Nick Burch 2012-05-22 11:58:03 UTC
Without either the file or some investigations by yourself, we've not enough to go on...

If you can't share the file, please identify the offending record and post the raw bytes of it. If possible, please then also compare the POI parsing of it to what the spec details, and try to identify the reason why POI is expecting more data than is present (it might be that a field is actually optional for example)
Comment 2 csekhar406 2012-06-06 07:45:13 UTC
The file you are trying to attach is 4922 kilobytes (KB) in size. Attachments cannot be more than 1000 KB. 
We recommend that you store your attachment elsewhere and then paste the URL to this file on the attachment creation page in the appropriate text field. 
Alternately, if your attachment is an image, you could convert it to a compressible format like JPG or PNG and try again.


I am getting the following when i am trying to add the file to bugzila.Can you provide any mail id so that i can send the attachment to the mail.
Comment 3 Yegor Kozlov 2012-06-06 08:06:34 UTC
Can you zip the file? 

(In reply to comment #2)
> The file you are trying to attach is 4922 kilobytes (KB) in size.
> Attachments cannot be more than 1000 KB. 
> We recommend that you store your attachment elsewhere and then paste the URL
> to this file on the attachment creation page in the appropriate text field. 
> Alternately, if your attachment is an image, you could convert it to a
> compressible format like JPG or PNG and try again.
> 
> 
> I am getting the following when i am trying to add the file to bugzila.Can
> you provide any mail id so that i can send the attachment to the mail.
Comment 4 csekhar406 2012-06-07 15:31:47 UTC
Created attachment 28902 [details]
the Sample file causing the problem
Comment 5 csekhar406 2012-06-12 04:22:34 UTC
Hi,


Could you please let me know if any information needed from my end to fix this issue?

Waiting for your Reply.

Thank You,
Comment 6 Nick Burch 2012-06-12 13:32:32 UTC
We know from the stacktrace that the problem is probably with the ChartEndBlockRecord, but there's a tiny chance it might be a problem with the record before that

If you can, please try to (probably using a debugger) work out what the data is that's associated with the problematic record. Then, compare that with the Microsoft provided file format specification. Does the length match what the spec allows? Are there options in the record which cause variable length? If so, does POI handle them?