https://issues.apache.org/bugzilla/show_bug.cgi?id=53984

Triqui <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from Triqui <[email protected]> ---
Well, in fact, I can't right now, since I cannot share the contents of the
files, and modifying and saving the files fixes the issues.

But...
I attached the relevant part of the BiffViewer output for one of the files
And after debugging the execution I can explain what happens exactly.

Having COLINFO record right after the row block means that ColumnInfoRecords
are included in the row block and when processing them the 
RowRecordsAggregate(RecordStream rs, SharedValueManager svm) constructor throws
an exception when checking the type of record:

    if (!(rec instanceof CellValueRecordInterface)) { // TRUE for
ColumnInfoRecord
        throw new RuntimeException("Unexpected record type (" +
rec.getClass().getName() + ")");
    }

Oops sorry, I just realized I didn't attach the exception stack, i was going to
paste it after the bug title, but forgot to do it. Here it is:
java.lang.RuntimeException: Unexpected record type
(org.apache.poi.hssf.record.ColumnInfoRecord)
    at
org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.<init>(RowRecordsAggregate.java:107)
~[poi-3.8.jar:3.8]
    at org.apache.poi.hssf.model.InternalSheet.<init>(InternalSheet.java:208)
~[poi-3.8.jar:3.8]
    at
org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:163)
~[poi-3.8.jar:3.8]
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:296)
~[poi-3.8.jar:3.8]
    at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:49)
~[poi-ooxml-3.8.jar:3.8]


I have fixed this modifying the RecordOrderer.isEndOfRowBlock method, but don't
know if that's the right thing to do:
    public static boolean isEndOfRowBlock(int sid) {
        switch(sid) {
            case ViewDefinitionRecord.sid:
                // should have been prefixed with DrawingRecord (0x00EC), but
bug 46280 seems to allow this
            case DrawingRecord.sid:
            case DrawingSelectionRecord.sid:
            case ObjRecord.sid:
            case TextObjectRecord.sid:

            case GutsRecord.sid:   // see Bug 50426
            case ColumnInfoRecord.sid:   // see Bug 53984
            case WindowOneRecord.sid:
                // should really be part of workbook stream, but some apps seem
to put this before WINDOW2
            case WindowTwoRecord.sid:
                return true;

            case DVALRecord.sid:
                return true;
            case EOFRecord.sid:
                // WINDOW2 should always be present, so shouldn't have got this
far
                throw new RuntimeException("Found EOFRecord before
WindowTwoRecord was encountered");
        }
        return PageSettingsBlock.isComponentRecord(sid);
    }

Please, let me know if this info is enough or not.
In the meantime I will try to get one of those files without any sensible
information so I can attach it here.

Thanks.

-- 
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]

Reply via email to