]> source.dussan.org Git - poi.git/commitdiff
New openxml4j version, and new save/reload test
authorNick Burch <nick@apache.org>
Mon, 28 Jul 2008 23:32:13 +0000 (23:32 +0000)
committerNick Burch <nick@apache.org>
Mon, 28 Jul 2008 23:32:13 +0000 (23:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@680564 13f79535-47bb-0310-9956-ffa450edef68

build.xml
src/ooxml/java/org/apache/poi/POIXMLDocument.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index a16a6602633644d1ad9c683345f54c23a2c8d5b0..dab532f4802616df1fc2ff6f982723f0cfe294c7 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -135,8 +135,8 @@ under the License.
   <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"/>
   <!-- No official release of openxml4j yet -->
-  <property name="ooxml.jar6.dir" location="${ooxml.lib}/openxml4j-bin-alpha-080407.jar"/>
-  <property name="ooxml.jar6.url" value="http://people.apache.org/~nick/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-beta-080728.jar"/>
 
   <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
   <!-- "Copy these file(s), free of charge" -->
index f9f543d7bffa9a734887513fce32a270cc033b32..3fb718f6ce97216b455cdae29646bfe67ea2cada 100644 (file)
@@ -75,6 +75,10 @@ public abstract class POIXMLDocument {
                // Get core part
                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) {
             throw new IOException(e.toString());
        }
index 642b723a5a15e1b8363315943fac5e7081bb0033..045f42cb07d8e6c506fef57bdce15b2d8cd30090 100644 (file)
@@ -20,14 +20,13 @@ package org.apache.poi.xssf.usermodel;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileOutputStream;
+
+import junit.framework.TestCase;
 
 import org.openxml4j.opc.Package;
 import org.openxml4j.opc.PackagePart;
 import org.openxml4j.opc.PackagingURIHelper;
 
-import junit.framework.TestCase;
-
 public class TestXSSFBugs extends TestCase {
        private String getFilePath(String file) {
                File xml = new File(
@@ -71,6 +70,12 @@ public class TestXSSFBugs extends TestCase {
                assertFalse(wb.getNameAt(2).getCTName().isSetLocalSheetId());
                assertEquals("SheetC!$A$1", wb.getNameAt(2).getReference());
                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());
        }
        
        /**