https://issues.apache.org/bugzilla/show_bug.cgi?id=47229
Summary: LeftoverDataException
Product: POI
Version: 3.5-dev
Platform: PC
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
I get the following exception when trying to read in an Excel document with the
following record:
Offset=0x0000121D(4637) recno=199 sid=0x01AE size=0x000A(10)
[java] org.apache.poi.hssf.record.SupBookRecord [SUPBOOK External
References nSheets=0 url=BLP^CM]
[java] Offset=0x0000122B(4651) recno=200 sid=0x0023 size=0x005C(92)
[java] [UNKNOWNRECORD] (0x23)
[java] rawData=[E2, 7F, 00, 00, 00, 00, 37, 00, 30, 31, 30, 36, 37, 32,
41, 54, 30, 20, 4D, 55, 4E, 49, 2C, 5B, 52, 54, 47, 5F, 4D, 4F, 4F, 44, 59, 5F,
55, 4E, 44, 45, 52, 4C, 59, 49, 4E, 47, 2C, 52, 54, 47, 5F, 53, 50, 5F, 55, 4E,
44, 45, 52, 4C, 59, 49, 4E, 47, 5D, 01, 00, 00, 02, 09, 00, 00, 23, 4E, 2F, 41,
20, 4E, 2E, 41, 2E, 02, 09, 00, 00, 23, 4E, 2F, 41, 20, 4E, 2E, 41, 2E]
[java] [/UNKNOWNRECORD]
I've fixed this by changing hasNextRecord in RecordInputStream as follows to
read the remaining bytes:
Index: RecordInputStream.java
===================================================================
--- RecordInputStream.java (revision 776494 (
https://svn.apache.org/viewcvs.cgi?view=rev&rev=776494 ))
+++ RecordInputStream.java (working copy)
@@ -121,7 +121,9 @@
*/
public boolean hasNextRecord() throws LeftoverDataException {
if (_currentDataLength != -1 && _currentDataLength !=
_currentDataOffset) {
- throw new LeftoverDataException(_currentSid, remaining());
+
+ //throw new LeftoverDataException(_currentSid, remaining());
+ byte[] remainder = readRemainder();
}
if (_currentDataLength != DATA_LEN_NEEDS_TO_BE_READ) {
_nextSid = readNextSid();
I appreciate the exception still needs to be thrown in some cases, I just need
to do this in order for it to be more a little more forgiving of weird Excel
records. Just so that you know there might be an issue here.
this is with the 3.5-beta6 (latest SVN code)
--
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]