You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Axel Rose <ax...@googlemail.com> on 2008/11/20 16:24:50 UTC
ContinueRecord: Unexpected record type
I get the following error when reading certain XLS files with POI 3.2-FINAL
and POI 3.5 latest svn version
---
Exception in thread "main" java.lang.RuntimeException: Unexpected record
type (org.apache.poi.hssf.record.ContinueRecord)
at
org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.<init>(RowRecordsAggregate.java:87)
at org.apache.poi.hssf.model.Sheet.<init>(Sheet.java:197)
at org.apache.poi.hssf.model.Sheet.createSheet(Sheet.java:159)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:286)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:200)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:182)
at ExcelExtractor.openWorkbook(ExcelExtractor.java:529)
at ExtractorTest.main(ExtractorTest.java:57)
---
#529 of ExcelExtractor: wb = new HSSFWorkbook(new POIFSFileSystem(inp));
This doesn't happen when using POI 3.0 though.
Has anybody an idea how to avoid this Exception?
Ideally I hope for a fix in the coming 3.5 release and perhaps some hints to
end users
how to avoid this situation.
Thanks for any help,
Axel.
Re: ContinueRecord: Unexpected record type
Posted by Yegor Kozlov <ye...@dinom.ru>.
Is there anything special about the xls file? Can you describe the content?
Yegor
> I'm not allowed to upload the XLS file unfortunately.
> If I knew how to provoke the error I'd file the bug.
>
>
> Axel
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: ContinueRecord: Unexpected record type
Posted by Axel Rose <ax...@googlemail.com>.
I changed line 87 in RowRecordsAggregate.java to
throw new RuntimeException("Unexpected record type (" +
rec.getClass().getName() + ")" + "\n### " + rec.toString());
This shows at runtime the output:
Exception in thread "main" java.lang.RuntimeException: Unexpected record
type (org.apache.poi.hssf.record.ContinueRecord)
### [CONTINUE RECORD]
.id = 3c
[/CONTINUE RECORD]
...
Now checking the BiffViewer output I found
Offset 0x742b (29739)
recordid = 0x3c, size = 6658
[MSODRAWINGGROUP]
org.apache.poi.ddf.EscherContainerRecord (DggContainer):
isContainer: true
...
Is this the right place?
(I'll have to think about Josh's reply in a minute ...)
Axel
Re: ContinueRecord: Unexpected record type
Posted by Axel Rose <ax...@googlemail.com>.
The output from BiffViewer has not a single CONTINUE record instance.
I would need to debug further. I'm using Eclipse but haven't had success to
import
it without errors.
Axel
Re: ContinueRecord: Unexpected record type
Posted by Josh Micich <jo...@gmail.com>.
In many cases, ContinueRecords will be dissolved by RecordInputStream
when the prior record is constructing itself (as the prior record asks
for data beyond its data-size, RecordInputStream automatically grabs
more data from the following ContinueRecord).
If a ContinueRecord hangs around, it is for one of 3 reasons:
(a) POI is totally unaware of the previous record type (i,e, UnknownRecord).
(b) POI has some logic error while reading the prior record and does
not consume the following ContinueRecord in the right way.
(c) Some badly behaved application has put/left a ContinueRecord in
the wrong place.
The fact that your problem goes away when Excel saves the file
suggests reason (c).
Before making a fix, it is helpful to characterise the problem better
(otherwise the resulting 'solution' may end up making other bugs
downstream more difficult to solve).
As far as BiffView is concerned, the offending ContinueRecord should
appear as-is. Text search for "CONTINUE". This should find it.
If there are too many ContinueRecords in the dump, you can help locate
the offending record by putting a breakpoint at
RowRecordsAggregate.java:87. When you hit the breakpoint, inspect the
RecordStream rs. You should be able to drill down to the recently
read records. You might find some specific data nearby that helps you
locate the section of the BiffView dump that has the offending
ContinueRecord.
Once you find that record, if you could cut out a section of the dump
including several records before and after. If possible, grab
everything from the prior DIMENSIONS record to the next WINDOW2
record. Hopefully you won't have too much data that needs sanitising.
-josh
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: ContinueRecord: Unexpected record type
Posted by Axel Rose <ax...@googlemail.com>.
2008/11/21 Yegor Kozlov <ye...@dinom.ru>
> Do you know what software was used to generate the problem xls? I guess it
> wasn't Excel.
This could well be the case. I will check this.
Axel
Re: ContinueRecord: Unexpected record type
Posted by Yegor Kozlov <ye...@dinom.ru>.
Do you know what software was used to generate the problem xls? I guess it wasn't Excel.
Yegor
> 2008/11/20 Yegor Kozlov <ye...@dinom.ru>
>
>> 1. Re-save the file in Excel. Can you still reproduce the bug?
>
>
> No.
>
>
>> 2. Try to narrow down the problem. Delete sheets to make the book as small
>> as possible.
>>
>
> Doesn't make sense here because any resave makes the problem non
> reproducible.
> Opening the original file in MS Excel is possible though.
>
>
> 3. Create a dump of excel records using BiffViewer:
>
>
> Done. 142000 lines auf text output.
>
>
>> You can then erase all sensitive data and upload the file in Bugzilla.
>>
>
> Close to impossible ...
>
> I spotted a few "[UNKNOWN RECORD]" instances in the BiffViewer output.
> I wonder which one of those is a "org.apache.poi.hssf.record.ContinueRecord"
> and how to avoid those records in the input.
>
>
> Axel
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: ContinueRecord: Unexpected record type
Posted by Ulf Dittmer <ud...@yahoo.com>.
You could patch the ContinueRecord class so that it
dumps all its data to standard out whenever an
instance is created. That might be enough to pinpoint
the row/cell numbers and possibly the functionality
involved.
Ulf
--- Axel Rose <ax...@googlemail.com> wrote:
> I spotted a few "[UNKNOWN RECORD]" instances in the
> BiffViewer output.
> I wonder which one of those is a
> "org.apache.poi.hssf.record.ContinueRecord"
> and how to avoid those records in the input.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: ContinueRecord: Unexpected record type
Posted by Axel Rose <ax...@googlemail.com>.
2008/11/20 Yegor Kozlov <ye...@dinom.ru>
> 1. Re-save the file in Excel. Can you still reproduce the bug?
No.
> 2. Try to narrow down the problem. Delete sheets to make the book as small
> as possible.
>
Doesn't make sense here because any resave makes the problem non
reproducible.
Opening the original file in MS Excel is possible though.
3. Create a dump of excel records using BiffViewer:
Done. 142000 lines auf text output.
> You can then erase all sensitive data and upload the file in Bugzilla.
>
Close to impossible ...
I spotted a few "[UNKNOWN RECORD]" instances in the BiffViewer output.
I wonder which one of those is a "org.apache.poi.hssf.record.ContinueRecord"
and how to avoid those records in the input.
Axel
Re: ContinueRecord: Unexpected record type
Posted by Yegor Kozlov <ye...@dinom.ru>.
1. Re-save the file in Excel. Can you still reproduce the bug?
2. Try to narrow down the problem. Delete sheets to make the book as small as possible.
3. Create a dump of excel records using BiffViewer:
http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java
Usage: BiffViewer problemfile.xls
You can then erase all sensitive data and upload the file in Bugzilla.
Yegor
> I'm not allowed to upload the XLS file unfortunately.
> If I knew how to provoke the error I'd file the bug.
>
>
> Axel
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: ContinueRecord: Unexpected record type
Posted by Axel Rose <ax...@googlemail.com>.
I'm not allowed to upload the XLS file unfortunately.
If I knew how to provoke the error I'd file the bug.
Axel
Re: ContinueRecord: Unexpected record type
Posted by Yegor Kozlov <ye...@dinom.ru>.
Create a bug in bugzilla and upload the problem file.
Yegor
> I get the following error when reading certain XLS files with POI 3.2-FINAL
> and POI 3.5 latest svn version
>
> ---
> Exception in thread "main" java.lang.RuntimeException: Unexpected record
> type (org.apache.poi.hssf.record.ContinueRecord)
> at
> org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.<init>(RowRecordsAggregate.java:87)
> at org.apache.poi.hssf.model.Sheet.<init>(Sheet.java:197)
> at org.apache.poi.hssf.model.Sheet.createSheet(Sheet.java:159)
> at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:286)
> at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:200)
> at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:182)
> at ExcelExtractor.openWorkbook(ExcelExtractor.java:529)
> at ExtractorTest.main(ExtractorTest.java:57)
> ---
>
> #529 of ExcelExtractor: wb = new HSSFWorkbook(new POIFSFileSystem(inp));
>
> This doesn't happen when using POI 3.0 though.
>
> Has anybody an idea how to avoid this Exception?
>
> Ideally I hope for a fix in the coming 3.5 release and perhaps some hints to
> end users
> how to avoid this situation.
>
>
> Thanks for any help,
> Axel.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org