Bug 46917

Summary: LeftoverDataException "Initialisation of record 0xB6" in HSSF with latest svn version
Product: POI Reporter: Axel Rose <axel.roeslein>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Axel Rose 2009-03-26 03:53:16 UTC
With some of my XLS input files I get a LeftoverDataException like this:

Exception in thread "main" org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0xB6 left 6 bytes remaining still to be read.
        at org.apache.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:124)
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:367)
        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 ExcelExtractor.openWorkbook(ExcelExtractor.java:668)

I tried with the latest update from svn from March 26.

There is no such exception opening the XLS file with POI3.1

The data file itself is confidential. What could I do to help debug this.


Regards,
Axel.
Comment 1 Nick Burch 2009-03-26 05:04:39 UTC
Can you identify the bit of the file in question, then send us the BiffViewer output for that record + the ones either side, and the POIFSViewer binary data for the record?

That'll let us re-create the record problem without needing the whole file
Comment 2 Axel Rose 2009-03-26 05:42:20 UTC
BiffViewer itself warns while reading in the file in question


~/work/poi35svn > java -cp build/classes org.apache.poi.hssf.dev.BiffViewer /tmp/t.xls > /tmp/t.biff
org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0xB6 left 6 bytes remaining still to be read.
        at org.apache.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:124)
        at org.apache.poi.hssf.dev.BiffViewer.createRecords(BiffViewer.java:70)
        at org.apache.poi.hssf.dev.BiffViewer.main(BiffViewer.java:398)
Discarding 6 bytes and continuing
org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0xB6 left 12 bytes remaining still to be read.
        at org.apache.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:124)
        at org.apache.poi.hssf.dev.BiffViewer.createRecords(BiffViewer.java:70)
        at org.apache.poi.hssf.dev.BiffViewer.main(BiffViewer.java:398)
Discarding 12 bytes and continuing


This is probably the interesting extract:


Offset=0x000313ED(201709) recno=7107 sid=0x00D7 size=0x0044(68)
[DBCELL]
    .rowoffset = 0x00003960
    .cell_0 = 0x0000
    .cell_1 = 0x026C
    .cell_2 = 0x0030
    .cell_3 = 0x0024
    .cell_4 = 0x0018
    .cell_5 = 0x0136
    .cell_6 = 0x00C2
    .cell_7 = 0x0298
    .cell_8 = 0x0262
    .cell_9 = 0x025A
    .cell_10 = 0x025A
    .cell_11 = 0x0266
    .cell_12 = 0x026D
    .cell_13 = 0x00B6
    .cell_14 = 0x00C2
    .cell_15 = 0x0298
    .cell_16 = 0x0262
    .cell_17 = 0x0260
    .cell_18 = 0x0268
    .cell_19 = 0x0258
    .cell_20 = 0x026D
    .cell_21 = 0x00B6
    .cell_22 = 0x028D
    .cell_23 = 0x00B6
    .cell_24 = 0x00B6
    .cell_25 = 0x0136
    .cell_26 = 0x00C2
    .cell_27 = 0x029E
    .cell_28 = 0x0268
    .cell_29 = 0x0260
    .cell_30 = 0x0260
    .cell_31 = 0x026C
    .cell_32 = 0x026D
[/DBCELL]



Offset=0x0001EB58(125784) recno=4247 sid=0x00B4 size=0x0002(2)
[SXIVD] (0xB4)
  rawData=[FE, FF]
[/SXIVD]

[SXPI]
    .isxvi      =0x0005
    .isxvd      =0x7FFD
    .idObj      =0x0001
[/SXPI]

Offset=0x0001EB5E(125790) recno=4248 sid=0x00B6 size=0x000C(12)
Offset=0x0001EB6E(125806) recno=4249 sid=0x00C5 size=0x0036(54)
[SXDI]
  .isxvdData = 0x0006
  .iiftab = 0x0000
  .df = 0x0000
  .isxvd = 0x0000
  .isxvi = 0x0000
  .ifmt = 0x0004
[/SXDI]


Offset=0x000207DC(133084) recno=4564 sid=0x00B4 size=0x0002(2)
[SXIVD] (0xB4)
  rawData=[FE, FF]
[/SXIVD]

Offset=0x000207E2(133090) recno=4565 sid=0x00B6 size=0x0006(6)
[SXPI]
    .isxvi      =0x0002
    .isxvd      =0x7FFD
    .idObj      =0x0001
[/SXPI]

Offset=0x000207EC(133100) recno=4566 sid=0x00C5 size=0x0036(54)
[SXDI]
  .isxvdData = 0x0006
  .iiftab = 0x0000
  .df = 0x0000
  .isxvd = 0x0000
  .isxvi = 0x0000
  .ifmt = 0x0004
[/SXDI]


Offset=0x000208BB(133307) recno=4571 sid=0x00C5 size=0x001B(27)
[SXDI]
  .isxvdData = 0x000B
  .iiftab = 0x0000
  .df = 0x0000
  .isxvd = 0x0000
  .isxvi = 0x0000
  .ifmt = 0x0004
[/SXDI]

Offset=0x000208DA(133338) recno=4572 sid=0x00B5 size=0x00B6(182)
[SXLI] (0xB5)
  rawData=[00, 00, 00, 00, 03, 00, 00, 00, 03, 00, 00, 00, 0B, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 01, 00, 03, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 02, 00, 05, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 03, 00, 0D, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 04, 00, 0F, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 05, 00, 0A, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 06, 00, 01, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 07, 00, 04, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 08, 00, 00, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 09, 00, 08, 00, 01, 00, 00, 00, 03, 00, 00, 00, 03, 00, 0A, 00, 09, 00, 00, 00, 01, 00, 01, 00, 00, 42, 03, 00, 0A, 00, 09, 00, 00, 00, 0D, 00, 01, 00, 00, 4A, 00, 00, 00, 00, 00, 00]
[/SXLI]

Offset=0x00020994(133524) recno=4573 sid=0x00B5 size=0x003C(60)
[SXLI] (0xB5)
  rawData=[00, 00, 00, 00, 01, 00, 00, 10, 00, 00, 00, 00, 00, 00, 01, 00, 02, 10, 01, 00, 00, 00, 00, 00, 01, 00, 04, 10, 02, 00, 00, 00, 00, 00, 01, 00, 06, 10, 03, 00, 00, 00, 00, 00, 01, 00, 08, 10, 04, 00, 00, 00, 00, 00, 01, 00, 0A, 10, 05, 00]
[/SXLI]


Offset=0x0002218B(139659) recno=4845 sid=0x00B4 size=0x0002(2)
[SXIVD] (0xB4)
  rawData=[FE, FF]
[/SXIVD]

Offset=0x00022191(139665) recno=4846 sid=0x00B6 size=0x0006(6)
[SXPI]
    .isxvi      =0x0002
    .isxvd      =0x7FFD
    .idObj      =0x0001
[/SXPI]

Offset=0x0002219B(139675) recno=4847 sid=0x00C5 size=0x0036(54)
[SXDI]
  .isxvdData = 0x0006
  .iiftab = 0x0000
  .df = 0x0000
  .isxvd = 0x0000
  .isxvi = 0x0000
  .ifmt = 0x0004
[/SXDI]


Offset=0x00025261(152161) recno=5352 sid=0x00B4 size=0x0002(2)
[SXIVD] (0xB4)
  rawData=[FE, FF]
[/SXIVD]

Offset=0x00025267(152167) recno=5353 sid=0x00B6 size=0x0006(6)
[SXPI]
    .isxvi      =0x0002
    .isxvd      =0x7FFD
    .idObj      =0x0001
[/SXPI]

Offset=0x00025271(152177) recno=5354 sid=0x00C5 size=0x0036(54)
[SXDI]
  .isxvdData = 0x0006
  .iiftab = 0x0000
  .df = 0x0000
  .isxvd = 0x0000
  .isxvi = 0x0000
  .ifmt = 0x0004
[/SXDI]


Offset=0x000382CB(230091) recno=8083 sid=0x00B4 size=0x0002(2)
[SXIVD] (0xB4)
  rawData=[FE, FF]
[/SXIVD]

[SXPI]
    .isxvi      =0x0002
    .isxvd      =0x7FFD
    .idObj      =0x0001
[/SXPI]

Offset=0x000382D1(230097) recno=8084 sid=0x00B6 size=0x0012(18)
Offset=0x000382E7(230119) recno=8085 sid=0x00C5 size=0x0036(54)
[SXDI]
  .isxvdData = 0x0006
  .iiftab = 0x0000
  .df = 0x0000
  .isxvd = 0x0000
  .isxvi = 0x0000
  .ifmt = 0x0004
[/SXDI]


I cannot send the output from POIFSViewer as this would show confidential data.


Regards,
Axel.
Comment 3 Nick Burch 2009-03-26 08:27:02 UTC
Please use biffviewer / eclipse + breakpoint to identify the record in question, then upload the bit of POIFSViewer output for the area around that record. That way, we can re-create the problem record(s) to test with, without needing the whole spreadsheet
Comment 4 Josh Micich 2009-03-26 09:59:29 UTC
I just read the MS documentation for SXPI(0x00B6) more closely and it says that the 2 ushort fields of SXPI may be repeated for each field that is showing in the page area.  This seems to agree with the observations here of 6 and 12  bytes left over.

PageItemRecord needs fixing (this was added only recently in 3.5-beta5)
Comment 5 Josh Micich 2009-03-26 10:43:37 UTC
Fixed in svn r758770

junit added 

svn.apache.org is *really* slow right now