New openxml4j version, and new save/reload test

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@680564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-07-28 23:32:13 +00:00
parent 5d95d3f082
commit 2eb8c41181
3 changed files with 14 additions and 5 deletions

View File

@ -135,8 +135,8 @@ under the License.
<property name="ooxml.jar5.dir" location="${ooxml.lib}/jsr173_1.0_api.jar"/> <property name="ooxml.jar5.dir" location="${ooxml.lib}/jsr173_1.0_api.jar"/>
<property name="ooxml.jar5.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/> <property name="ooxml.jar5.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/>
<!-- No official release of openxml4j yet --> <!-- No official release of openxml4j yet -->
<property name="ooxml.jar6.dir" location="${ooxml.lib}/openxml4j-bin-alpha-080407.jar"/> <property name="ooxml.jar6.dir" location="${ooxml.lib}/openxml4j-bin-beta-080728.jar"/>
<property name="ooxml.jar6.url" value="http://people.apache.org/~nick/openxml4j-bin-alpha-080407.jar"/> <property name="ooxml.jar6.url" value="http://people.apache.org/~nick/openxml4j-bin-beta-080728.jar"/>
<!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm --> <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
<!-- "Copy these file(s), free of charge" --> <!-- "Copy these file(s), free of charge" -->

View File

@ -75,6 +75,10 @@ public abstract class POIXMLDocument {
// Get core part // Get core part
this.corePart = this.pkg.getPart(coreDocRelationship); this.corePart = this.pkg.getPart(coreDocRelationship);
// Verify it's there
if(corePart == null) {
throw new IllegalArgumentException("No core part found for this document! Nothing with " + coreDocRelationship.getRelationshipType() + " present as a relation.");
}
} catch (OpenXML4JException e) { } catch (OpenXML4JException e) {
throw new IOException(e.toString()); throw new IOException(e.toString());
} }

View File

@ -20,14 +20,13 @@ package org.apache.poi.xssf.usermodel;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import junit.framework.TestCase;
import org.openxml4j.opc.Package; import org.openxml4j.opc.Package;
import org.openxml4j.opc.PackagePart; import org.openxml4j.opc.PackagePart;
import org.openxml4j.opc.PackagingURIHelper; import org.openxml4j.opc.PackagingURIHelper;
import junit.framework.TestCase;
public class TestXSSFBugs extends TestCase { public class TestXSSFBugs extends TestCase {
private String getFilePath(String file) { private String getFilePath(String file) {
File xml = new File( File xml = new File(
@ -71,6 +70,12 @@ public class TestXSSFBugs extends TestCase {
assertFalse(wb.getNameAt(2).getCTName().isSetLocalSheetId()); assertFalse(wb.getNameAt(2).getCTName().isSetLocalSheetId());
assertEquals("SheetC!$A$1", wb.getNameAt(2).getReference()); assertEquals("SheetC!$A$1", wb.getNameAt(2).getReference());
assertEquals("SheetC", wb.getNameAt(2).getSheetName()); assertEquals("SheetC", wb.getNameAt(2).getSheetName());
// Save and re-load, still there
Package nPkg = saveAndOpen(wb);
XSSFWorkbook nwb = new XSSFWorkbook(nPkg);
assertEquals(3, nwb.getNumberOfNames());
assertEquals("SheetA!$A$1", nwb.getNameAt(0).getReference());
} }
/** /**