Bug 33082

Summary: HSSFWorkbook throws InvocationTargetException
Product: POI Reporter: Jim Peters <jim.peters>
Component: POIFSAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major CC: avik
Priority: P2    
Version: 2.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 33951    
Attachments: Here's the offending .xls

Description Jim Peters 2005-01-13 16:43:52 UTC
I searched the archives for this but did not find a bug describing my 
problem.  The problem is murkier - A Excel 2000 file from my customer receives 
the error.  If I save the file with my Excel for Office 2003, the file works 
correctly.

Code here, standard:
String sFName = (TEMP_FILES_DIR + File.separatorChar + (String)valIn.get
("TEMP_DOCUMNT_FILE_NM"));
sFName = sFName.replace(File.separatorChar, '/');
			
FileInputStream fis = null;
File fileToWrite = new File(sFName);
fis = new FileInputStream(fileToWrite);
			
POIFSFileSystem fs = new POIFSFileSystem(fis);
HSSFWorkbook wb = new HSSFWorkbook(fs);  //Exception thrown here
HSSFSheet sheet = wb.getSheetAt(0);

Here's the Exception:
08:31:40,271 INFO  [STDOUT] java.lang.reflect.InvocationTargetException
08:31:40,271 INFO  [STDOUT] 	at 
sun.reflect.GeneratedConstructorAccessor34.newInstance(Unknown Source)
08:31:40,271 INFO  [STDOUT] 	at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
08:31:40,271 INFO  [STDOUT] 	at java.lang.reflect.Constructor.newInstance
(Constructor.java:274)
08:31:40,271 INFO  [STDOUT] 	at 
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:224)
08:31:40,271 INFO  [STDOUT] 	at 
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160)
08:31:40,271 INFO  [STDOUT] 	at 
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
08:31:40,271 INFO  [STDOUT] 	at 
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
08:31:40,271 INFO  [STDOUT] 	at 
SupplierPartUpload.SupplierPartUpload.renderPage(SupplierPartUpload.java:143)
08:31:40,281 INFO  [STDOUT] 	at SupplierPartUpload.SupplierPartUpload.doPost
(SupplierPartUpload.java:94)
08:31:40,281 INFO  [STDOUT] 	at javax.servlet.http.HttpServlet.service
(HttpServlet.java:768)
08:31:40,281 INFO  [STDOUT] 	at javax.servlet.http.HttpServlet.service
(HttpServlet.java:861)
08:31:40,281 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:237)
08:31:40,281 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:157)
08:31:40,281 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationDispatcher.invoke
(ApplicationDispatcher.java:704)
08:31:40,281 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationDispatcher.doInclude
(ApplicationDispatcher.java:590)
08:31:40,281 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationDispatcher.include
(ApplicationDispatcher.java:510)
08:31:40,281 INFO  [STDOUT] 	at POS.POS.doPost(POS.java:116)
08:31:40,281 INFO  [STDOUT] 	at javax.servlet.http.HttpServlet.service
(HttpServlet.java:768)
08:31:40,281 INFO  [STDOUT] 	at javax.servlet.http.HttpServlet.service
(HttpServlet.java:861)
08:31:40,281 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:237)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:157)
08:31:40,291 INFO  [STDOUT] 	at 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter
(ReplyHeaderFilter.java:75)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:186)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:157)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:214)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardValveContext.invokeNext
(StandardValveContext.java:104)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardContextValve.invokeInternal
(StandardContextValve.java:198)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:152)
08:31:40,291 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardValveContext.invokeNext
(StandardValveContext.java:104)
08:31:40,301 INFO  [STDOUT] 	at 
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke
(CustomPrincipalValve.java:66)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardValveContext.invokeNext
(StandardValveContext.java:102)
08:31:40,301 INFO  [STDOUT] 	at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke
(SecurityAssociationValve.java:158)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardValveContext.invokeNext
(StandardValveContext.java:102)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardValveContext.invokeNext
(StandardValveContext.java:104)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardValveContext.invokeNext
(StandardValveContext.java:102)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
08:31:40,301 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:109)
08:31:40,311 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardValveContext.invokeNext
(StandardValveContext.java:104)
08:31:40,311 INFO  [STDOUT] 	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
08:31:40,311 INFO  [STDOUT] 	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
08:31:40,311 INFO  [STDOUT] 	at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
08:31:40,311 INFO  [STDOUT] 	at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
08:31:40,311 INFO  [STDOUT] 	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnecti
on(Http11Protocol.java:705)
08:31:40,311 INFO  [STDOUT] 	at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
08:31:40,311 INFO  [STDOUT] 	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:683)
08:31:40,311 INFO  [STDOUT] 	at java.lang.Thread.run(Thread.java:534)
08:31:40,321 INFO  [STDOUT] Caused by: java.lang.ArrayIndexOutOfBoundsException
08:31:40,321 INFO  [STDOUT] 	at java.lang.System.arraycopy(Native Method)
08:31:40,321 INFO  [STDOUT] 	at 
org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)
08:31:40,321 INFO  [STDOUT] 	at 
org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)
08:31:40,321 INFO  [STDOUT] 	at 
org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
08:31:40,321 INFO  [STDOUT] 	at org.apache.poi.hssf.record.Record.fillFields
(Record.java:90)
08:31:40,321 INFO  [STDOUT] 	at org.apache.poi.hssf.record.Record.<init>
(Record.java:55)
08:31:40,321 INFO  [STDOUT] 	at org.apache.poi.hssf.record.ObjRecord.<init>
(ObjRecord.java:61)
08:31:40,321 INFO  [STDOUT] 	... 50 more
Comment 1 Jim Peters 2005-01-13 19:03:39 UTC
Created attachment 13997 [details]
Here's the offending .xls
Comment 2 Jim Joyce 2005-02-23 22:47:15 UTC
(In reply to comment #0)
> I searched the archives for this but did not find a bug describing my 
> problem.  The problem is murkier - A Excel 2000 file from my customer 
receives 

I can reproduce this at will with a template file I was given to work with. If 
the file is saved with any sheet having a cell selected with a "pull-down", it 
will fail exactly as this BUG describes.

If I take the same file (without changing the format) and ensure that NO sheet 
has a cell selected which contains a "pull-down" menu, it can be sucessfully 
read.
Comment 3 Avik Sengupta 2005-04-22 17:08:15 UTC
*** Bug 34575 has been marked as a duplicate of this bug. ***
Comment 4 Avik Sengupta 2005-05-03 15:30:51 UTC
This is now fixed in CVS! Please verify, on latest CVS or a release after today.