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 2018/09/13 16:45:36 UTC

[Bug 62717] New: Content type of parts could not always be saved

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

            Bug ID: 62717
           Summary: Content type of parts could not always be saved
           Product: POI
           Version: 3.17-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: OPC
          Assignee: dev@poi.apache.org
          Reporter: pouponbe@fr.ibm.com
  Target Milestone: ---

In the class org.apache.poi.openxml4j.opc.internal.ContentTypeManager the
method addContentType(PackagePartName,String) doesn't authorized to register
the same contentType string for two different package part name if those part
name have different extension.

-- 
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 62717] Content type of parts could not always be saved

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

--- Comment #5 from Dominik Stadler <do...@gmx.at> ---
*** Bug 62718 has been marked as a duplicate of this bug. ***

-- 
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 62717] Content type of parts could not always be saved

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

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

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

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
I quickly tried to reproduce this, but could not on latest trunk. 

Which operating system are you running this on?

BTW in your sample, you do not flush/close secondPkg, maybe that is related?

-- 
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 62717] Content type of parts could not always be saved

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

--- Comment #3 from pouponbe@fr.ibm.com ---
Exception in thread "main"
org.apache.poi.openxml4j.exceptions.InvalidFormatException: The part
/dummy/text.properties 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$EntryTriple.register(ZipPackage.java:325)
        at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:293)
        at
org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:725)
        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:238)
        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:167)
        at
org.apache.poi.openxml4j.opc.OPCPackage.openOrCreate(OPCPackage.java:322)
        at test.Main.main(Main.java:59)

-- 
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 62717] Content type of parts could not always be saved

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |62718


Referenced Bugs:

https://bz.apache.org/bugzilla/show_bug.cgi?id=62718
[Bug 62718] Could not open old document due to unsaved content type.
-- 
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 62717] Content type of parts could not always be saved

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

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
Can you provide a code snippet to avoid confusion?

Would you be able to try the latest POI version - 4.0.0?

-- 
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 62717] Content type of parts could not always be saved

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

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

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

--- Comment #6 from Dominik Stadler <do...@gmx.at> ---
Could not reproduce and no reply for a long time, thus closing for now, please
repoen with more information if this is still a problem for you.

-- 
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 62717] Content type of parts could not always be saved

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

--- Comment #2 from pouponbe@fr.ibm.com ---
Code that reproduce :
File testFile = new File("test.zip");
    OPCPackage mainPkg = OPCPackage.openOrCreate(testFile);

    PackagePartName firstPartName =
PackagingURIHelper.createPartName("/dummy/text.txt");
    PackagePart firstPkg = mainPkg.createPart(firstPartName, "text/plain");
    OutputStreamWriter osW = new OutputStreamWriter(firstPkg.getOutputStream(),
"UTF8");
    osW.append("FOO");
    osW.flush();
    osW.close();
    firstPkg.flush();
    firstPkg.close();

    PackagePartName secondPartName =
PackagingURIHelper.createPartName("/dummy/text.properties");
    PackagePart secondPkg = mainPkg.createPart(secondPartName, "text/plain");
    osW = new OutputStreamWriter(secondPkg.getOutputStream(), "UTF8");
    osW.append("BAR FOO");
    osW.flush();
    osW.close();
    firstPkg.flush();
    firstPkg.close();

    mainPkg.close();

    mainPkg = OPCPackage.openOrCreate(testFile);

And yes it failed also with 4.0.

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