git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1615781 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_11_BETA2
@@ -35,6 +35,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection; | |||
import org.apache.poi.poifs.common.POIFSConstants; | |||
import org.apache.poi.util.IOUtils; | |||
import org.apache.xmlbeans.impl.common.SystemCache; | |||
public abstract class POIXMLDocument extends POIXMLDocumentPart{ | |||
public static final String DOCUMENT_CREATOR = "Apache POI"; | |||
@@ -56,6 +57,11 @@ public abstract class POIXMLDocument extends POIXMLDocumentPart{ | |||
protected POIXMLDocument(OPCPackage pkg) { | |||
super(pkg); | |||
this.pkg = pkg; | |||
// Workaround for XMLBEANS-512 - ensure that when we parse | |||
// the file, we start with a fresh XML Parser each time, | |||
// and avoid the risk of getting a SaxHandler that's in error | |||
SystemCache.get().setSaxLoader(null); | |||
} | |||
/** |
@@ -20,16 +20,20 @@ package org.apache.poi.xssf.model; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.io.OutputStream; | |||
import java.util.*; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlOptions; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSst; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.SstDocument; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
/** |
@@ -38,6 +38,7 @@ import java.util.List; | |||
import org.apache.poi.EncryptedDocumentException; | |||
import org.apache.poi.POIDataSamples; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.POIXMLProperties; | |||
import org.apache.poi.hssf.HSSFTestDataSamples; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
@@ -1859,14 +1860,12 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { | |||
assertEquals(null, props.getCoreProperties().getDescription()); | |||
// Now check the spreadsheet itself | |||
// TODO Fix then enable | |||
/* | |||
try { | |||
new XSSFWorkbook(pkg); | |||
fail("Should fail as too much expansion occurs"); | |||
} catch(POIXMLException e) { | |||
// Expected | |||
} */ | |||
} | |||
// Try with one with the entities in the Content Types | |||
try { | |||
@@ -1875,6 +1874,10 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { | |||
} catch(Exception e) { | |||
// Expected | |||
} | |||
// Check we can still parse valid files after all that | |||
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("sample.xlsx"); | |||
assertEquals(3, wb.getNumberOfSheets()); | |||
} | |||
/** |