View | Details | Raw Unified | Return to bug 62592
Collapse All | Expand All

(-)src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java (+3 lines)
Lines 250-255 Link Here
250
        final ZipArchiveEntry contentTypeEntry =
250
        final ZipArchiveEntry contentTypeEntry =
251
                zipArchive.getEntry(CONTENT_TYPES_PART_NAME);
251
                zipArchive.getEntry(CONTENT_TYPES_PART_NAME);
252
        if (contentTypeEntry != null) {
252
        if (contentTypeEntry != null) {
253
            if (this.contentTypeManager != null) {
254
                throw new InvalidFormatException("ContentTypeManager can only be created once. This must be a cyclic relation?");
255
            }
253
            try {
256
            try {
254
                this.contentTypeManager = new ZipContentTypeManager(
257
                this.contentTypeManager = new ZipContentTypeManager(
255
                        zipArchive.getInputStream(contentTypeEntry), this);
258
                        zipArchive.getInputStream(contentTypeEntry), this);
(-)src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java (+15 lines)
Lines 1090-1095 Link Here
1090
		openInvalidFile("SampleSS.txt", true);
1090
		openInvalidFile("SampleSS.txt", true);
1091
	}
1091
	}
1092
1092
1093
	@Test(expected = InvalidFormatException.class)
1094
	public void testBug62592() throws Exception {
1095
		InputStream is = OpenXML4JTestDataSamples.openSampleStream("62592.thmx");
1096
		OPCPackage p = OPCPackage.open(is);
1097
	}
1098
1099
	@Test
1100
	public void testBug62592SequentialCallsToGetParts() throws Exception {
1101
		//make absolutely certain that sequential calls don't throw InvalidFormatExceptions
1102
		String originalFile = OpenXML4JTestDataSamples.getSampleFileName("TestPackageCommon.docx");
1103
		OPCPackage p2 = OPCPackage.open(originalFile, PackageAccess.READ);
1104
		p2.getParts();
1105
		p2.getParts();
1106
	}
1107
1093
	@Test
1108
	@Test
1094
	public void testDoNotCloseStream() throws IOException {
1109
	public void testDoNotCloseStream() throws IOException {
1095
		OutputStream os = Mockito.mock(OutputStream.class);
1110
		OutputStream os = Mockito.mock(OutputStream.class);

Return to bug 62592