Bug 60293 - Handling illegal "Odd" footer in XWPF
Summary: Handling illegal "Odd" footer in XWPF
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-21 14:57 UTC by Tim Allison
Modified: 2016-10-31 19:05 UTC (History)
0 users



Attachments
triggering doc from TIKA-2125 (127.89 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-10-31 10:50 UTC, Tim Allison
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Allison 2016-10-21 14:57:56 UTC
On TIKA-2125, Seva Alekseyev provided a document that contains "odd" as the footer type.

According to ECMA[1] (labeled-page 727, pdf-page 737), there can be three types of footers: first, odd and even.  However, the way to encode those is "first" "default" "even", and the xsd makes this clear.

<w:sectPr>   …   <w:footerReference r:id="rId6" w:type="first" />   <w:footerReference r:id="rId7" w:type="default" />   <w:footerReference r:id="rId10" w:type="even" />   … </w:sectPr> 
The 

So the file submitted on TIKA-2125 is out of compliance.

Do we want to add special handling to convert "odd" to "default"?


[1] http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-376,%20Fourth%20Edition,%20Part%201%20-%20Fundamentals%20And%20Markup%20Language%20Reference.zip
Comment 1 Mark Murphy 2016-10-30 19:00:50 UTC
I would say that depends on what Microsoft Word does. Can you attach the sample?
Comment 2 Tim Allison 2016-10-31 10:50:24 UTC
Created attachment 34412 [details]
triggering doc from TIKA-2125
Comment 3 Tim Allison 2016-10-31 11:04:32 UTC
Word seems to handle it without complaining.
Comment 4 Mark Murphy 2016-10-31 16:36:21 UTC
Looks that way, I suspect it is just treating everything that is not FIRST or EVEN as DEFAULT. Not sure we need to convert anything, just handle it. This document does not look like it was created by MS Word since that writes default and even. At least it does at version 2016, but it does accept odd.
Comment 5 Tim Allison 2016-10-31 19:05:34 UTC
r1767353

Agreed.  This is non-standard/invalid.  I added a try/catch block, and I applied "default" in the catch block.  Thank you!