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 2016/04/26 16:42:51 UTC

[Bug 59378] New: Docx file corruption on write - The part /_rels/.rels does not have any content type

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

            Bug ID: 59378
           Summary: Docx file corruption on write - The part /_rels/.rels
                    does not have any content type
           Product: POI
           Version: 3.15-dev
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: thomas.schwery@gmail.com

Created attachment 33805
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33805&action=edit
File corrupted after a write

Some docx files that are fine to Word become corrupt after being opened and
saved, even without any modifications.

The attached file exhibits this behavior:
- The file can be opened fine with Word
- The file can be opened fine with POI through XWPFDocument
- On save by POI, the file cannot be opened by Word (the error message
indicates that the document is corrupt but can be repaired)
- On reopen by POI through XWPFDocument, an InvalidFormatException is thrown

    XWPFDocument doc = new XWPFDocument( [ input file ] );
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    doc.write(out);
    out.close();

    XWPFDocument doc2 = new XWPFDocument(new
ByteArrayInputStream(out.toByteArray()));

This code throws the following exception:
    org.apache.poi.openxml4j.exceptions.InvalidFormatException: The part
/_rels/.rels does not have any content type ! Rule: Package require content
types when retrieving a part from a package. [M.1.14]
    org.apache.poi.POIXMLException:
org.apache.poi.openxml4j.exceptions.InvalidFormatException: The part
/_rels/.rels does not have any content type ! Rule: Package require content
types when retrieving a part from a package. [M.1.14]
            at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
            at
org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:128)
            [...]
    Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: The
part /_rels/.rels does not have any content type ! Rule: Package require
content types when retrieving a part from a package. [M.1.14]
            at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:291)
            at
org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:713)
            at
org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:296)
            at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)

-- 
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 59378] Docx file corruption on write - The part /_rels/.rels does not have any content type

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

Dominik Stadler <do...@gmx.at> changed:

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

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
I tried to reproduce this, but could not, reading the document, then writing it
out and reading back in did work fine. Is there anything else that is involved
to make it fail?

-- 
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 59378] Docx file corruption on write - The part /_rels/.rels does not have any content type

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

thomas.schwery@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEEDINFO                    |RESOLVED

--- Comment #2 from thomas.schwery@gmail.com ---
It now works.

The error was caused by the inclusion in my projects of an old Xalan (2.5)
library. Upgrading it to Xalan 2.7 solved the error.

Sorry for the false report.

-- 
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 59378] Docx file corruption on write - The part /_rels/.rels does not have any content type

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

--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
There is now a unit-test via r1746623 which verifies that it stays fixed.

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