You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2021/10/19 14:07:48 UTC

[Bug 65640] New: org.apache.poi.ooxml.POIXMLException on parsing docx file

https://bz.apache.org/bugzilla/show_bug.cgi?id=65640

            Bug ID: 65640
           Summary: org.apache.poi.ooxml.POIXMLException on parsing docx
                    file
           Product: POI
           Version: 4.1.2-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: redmanmale+apache@gmail.com
  Target Milestone: ---

Created attachment 38073
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38073&action=edit
sample

I try to parse docx document and get an error.
MS Word handle this file normally.

<business logic>

Caused by: org.apache.poi.ooxml.POIXMLException:
org.apache.xmlbeans.XmlException: Element
hdr@http://schemas.openxmlformats.org/wordprocessingml/2006/main is not a valid
ftr@http://schemas.openxmlformats.org/wordprocessingml/2006/main document or a
valid substitution.
at org.apache.poi.xwpf.usermodel.XWPFFooter.onDocumentRead(XWPFFooter.java:119)
at
org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:233)
at org.apache.poi.ooxml.POIXMLDocument.load(POIXMLDocument.java:184)
at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:138)
at
org.apache.poi.xwpf.extractor.XWPFWordExtractor.<init>(XWPFWordExtractor.java:60)
at
org.apache.poi.ooxml.extractor.ExtractorFactory.createExtractor(ExtractorFactory.java:224)
at
org.apache.tika.parser.microsoft.ooxml.OOXMLExtractorFactory.parse(OOXMLExtractorFactory.java:173)
at
org.apache.tika.parser.microsoft.ooxml.OOXMLParser.parse(OOXMLParser.java:113)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:281)
... 11 more
Caused by: org.apache.xmlbeans.XmlException: Element
hdr@http://schemas.openxmlformats.org/wordprocessingml/2006/main is not a valid
ftr@http://schemas.openxmlformats.org/wordprocessingml/2006/main document or a
valid substitution.
at org.apache.xmlbeans.impl.store.Locale.autoTypeDocument(Locale.java:324)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1275)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1259)
at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
at
org.openxmlformats.schemas.wordprocessingml.x2006.main.FtrDocument$Factory.parse(Unknown
Source)
at org.apache.poi.xwpf.usermodel.XWPFFooter.onDocumentRead(XWPFFooter.java:94)
... 19 more

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65640] org.apache.poi.ooxml.POIXMLException on parsing docx file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65640

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
If you are not using POI 5.0.0, could you try that version? This issue might be
fixed there - in POI 5.0.0, we have a newer version of the OOXML xsd.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65640] org.apache.poi.ooxml.POIXMLException on parsing docx file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65640

--- Comment #5 from redmanmale <re...@gmail.com> ---
I've processed all my docx (around 30k) and it's the only one with such error.
So it's not a common thing.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65640] org.apache.poi.ooxml.POIXMLException on parsing docx file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65640

--- Comment #3 from Tim Allison <ta...@mitre.org> ---
This was initially opened on Tika's JIRA
(https://issues.apache.org/jira/browse/TIKA-3578).  We had another user earlier
report the same thing: https://issues.apache.org/jira/browse/TIKA-2404

I agree that the file is corrupt.  Not clear how common this is and/or if we
should add flexibility to deal with it.

Thank you @redmanmale+apache for opening this over here.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65640] org.apache.poi.ooxml.POIXMLException on parsing docx file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65640

PJ Fanning <fa...@yahoo.com> changed:

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

--- Comment #2 from PJ Fanning <fa...@yahoo.com> ---
The latest POI code cannot parse your docx.

Your docx seems corrupted. In other docx files with headers/footers, the
headers appear in headerX.xml files and the footers in footerX.xml files.

Your docx has all the headers in footerX.xml files.

Can you find out what generated this docx as the bug might be in the code that
created the docx file?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 65640] org.apache.poi.ooxml.POIXMLException on parsing docx file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65640

--- Comment #4 from PJ Fanning <fa...@yahoo.com> ---
The only workaround I can think of is for the user who has corrupt files like
this to parse the docx zip and to rename any footer*.xml files that have hdr
root elements as header *.xml -- but the user would probably need to update the
rels (relationships file) to record the rename.

Adding extra parsing overhead and the wasted CPU cycles for all users to fix
files that have this corruption in a small number of files is probably not
worth it. Unless we discover that this form of corrupted file is very common
and there is no hope of getting the producing software fixed, then we might
need to bite the bullet.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org