Bug 53302

Summary: [Patch] EscherAggregate does not handle Continue records
Product: POI Reporter: Evgeniy Berlog <superrubiroyd>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Bug Depends on:    
Bug Blocks: 53010    
Attachments: File from existing bugzilla bug to show current implementation defect
Patch which fixes bug and addes unit tests

Description Evgeniy Berlog 2012-05-27 20:48:41 UTC
Created attachment 28839 [details]
File from existing bugzilla bug to show current implementation defect

When a worksheet contains drawing objects (shapes, pictures, etc.), the drawing parts in the BIFF format are stored together in a so called drawing aggregate. The object that handles this logic in HSSF is org.apache.poi.hssf.record.EscherAggregate. Current implementation assumes that a drawing aggregate consists of DrawingRecord, ObjRecord and TextObjectRecord objects. In reality, a drawing aggregate can include one or more Continue records at arbitrary positions. Current aggregation logic terminates at the first Continue record and, as result, the aggregated data is not complete. When parsing such incorrectly aggregated data into Escher tree, user can see warnings in stdout: "WARNING: N bytes remaining but no space left" and the parsed tree will not contain all shapes from the worksheet.  


..........
RowRecordsAggregate
DrawingRecord          <-- start of the drawing aggregate
ObjRecord
DrawingRecord
TextObjectRecord
DrawingRecord
ObjRecord
DrawingRecord
TextObjectRecord
DrawingRecord
ObjRecord
DrawingRecord
TextObjectRecord
DrawingRecord
ObjRecord
DrawingRecord
TextObjectRecord
ContinueRecord         <-- current implementation reads up to this point   
ObjRecord
ContinueRecord
TextObjectRecord       <-- end of the drawing aggregate
WindowTwoRecord
..........
Comment 1 Evgeniy Berlog 2012-05-27 20:52:43 UTC
Created attachment 28840 [details]
Patch which fixes bug and addes unit tests
Comment 2 Yegor Kozlov 2012-05-28 12:15:55 UTC
Applied in r1343218

Yegor