https://issues.apache.org/bugzilla/show_bug.cgi?id=50939
Summary: RecordFormatException (another)
Product: POI
Version: 3.8-dev
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=26779)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26779)
the smallest file i could manage to show the problem.
Hello,
i have another case of record format exception. i am aware that similar issues
have been reported, and that one has been fixed in 3.8.1 beta, but mine is
still there with that version.
1. the evidence:
=============
1.1 the file
--------------
i have tried to boil my file down to the absolute minimum, and here it is:
1.2 my code (fragment)
--------------------------
my code that tries to read this is as simple as
private static HSSFWorkbook readFile(String filename) throws IOException
{
mfis = new FileInputStream(filename);
HSSFWorkbook wb = null;
61 try {
62 wb = new HSSFWorkbook(mfis);
63 } catch ( IOException ioe ) {
// blah
} catch(RecordFormatException rfe){
// blahblah
}
return wb;
}
1.3 the stack trace
----------------------
the stack trace is ( copied from eclipse console)
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record
instance
at
org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:65)
at
org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:300)
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:442)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:298)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:260)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:204)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:340)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:321)
at
org.panda.giggling.in.ChecklistTransformer.readFile(ChecklistTransformer.java:62)
at
org.panda.giggling.in.ChecklistTransformer.readAndTransform(ChecklistTransformer.java:159)
at org.panda.giggling.Main.extractChecklistsFromFiles(Main.java:339)
at org.panda.giggling.Main.main(Main.java:113)
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:216)
at
org.apache.poi.hssf.record.RecordInputStream.readFully(RecordInputStream.java:288)
at
org.apache.poi.hssf.record.RecordInputStream.readFully(RecordInputStream.java:284)
at
org.apache.poi.hssf.record.chart.ChartEndObjectRecord.<init>(ChartEndObjectRecord.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$ReflectionConstructorRecordCreator.create(RecordFactory.java:57)
... 13 more
note: i couldn't persuade eclipse to show the 13 more ( is there a trick to
this? please tell me )
2. circumstantial notes
=====================
2.-1 i first observed this using poi 3.7 around december. now i discovered
3.8.1beta and tried again. no discernible difference. the above stack trace is
against 3.8.1 beta
(unless i screwed up, which is at least possible if not likely).
2.0 the recently solved issue was about requesting 2 bytes and getting only one
( i think). my numbers are different so maybe this _is_ a different issue
2.1 my code runs on a win xt box at work. the same problem can however be
observed on my home mac.
2.2 the file was generated using excel 2003.
2.3 i tried eliminating that embedded graphic on "Sheet 2", and the crash went
away
2.4 one apparent workaround is to take this file to a mac, open it with
neo_office, write a blank in an otherwise empty cell, save, remove the blank
and save again, and done. the same exorcism does not work using OpenOffice (or
indeed Excel2003) on that same win box that held the original file. All cited
programs read the file without apparent effort.
2.5 there are other files, similar in structure, but different in content
details that are read (by that same code snippet of mine) without problem. in
particular, those files also contain embedded graphics like on "sheet3". all
these files were forked off the same template some 6 years ago but have seen
profuse editing since. research into the recent change history of the original
(non-stripped) file revealed no obvious reasons for suspicion. ( if "sheet 2"
still held the orig data, "sheet3" would show bar graphs presenting some aspect
of those data. i earnestly believe you don't need to know more. )
2.6 i read in some tickets about BiffViewer analysis. I hope i can be excused
for not managing to get ahold of BiffViewer (where is it? how is it run? i'm
getting too old for this sort of thing...). I found other purported BiffViewers
on the web and tried to look at a working file vs this nonworking file (in the
pre-reduced state) but could make no sense of what i saw there.
2.7 and finally, i looked at the same working and the non-working file (as in
2.6) using notepad++ (Plugins > Compare) and found one potential strangeness:
the working file sported a line (near the end) of
VersionCompatible32="393222000", where the nonworking file said
VersionCompatible32="393B".
The long number is all but ubiquitous according to google, the short number was
a zero-hit search. A search in an alleged file format spec for ms excel showed
no evidence of the term VersionCompatible so this dead-ended, too.
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.
many thanks,
mats.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]