get exception when evaluating hyperlink after export & clear cell
@Test public void testZSS4xxx(){ Book book = Util.loadBook(Issue400Test.class, "book/blank.xlsx"); Sheet sheet = book.getSheetAt(0); Ranges.range(sheet, "A1").setCellEditText("http://www.google.com"); Ranges.range(sheet, "A2").setCellEditText("http://www.zkoss.org"); Hyperlink link = Ranges.range(sheet, "A1").getCellHyperlink(); Assert.assertNotNull(link); Assert.assertEquals(Hyperlink.HyperlinkType.URL,link.getType()); Assert.assertEquals(link.getAddress(), "http://www.google.com"); Assert.assertEquals(link.getLabel(), "http://www.google.com"); link = Ranges.range(sheet, "A2").getCellHyperlink(); Assert.assertNotNull(link); Assert.assertEquals(Hyperlink.HyperlinkType.URL,link.getType()); Assert.assertEquals(link.getAddress(), "http://www.zkoss.org"); Assert.assertEquals(link.getLabel(), "http://www.zkoss.org"); book = Util.swap(book); sheet = book.getSheetAt(0); link = Ranges.range(sheet, "A1").getCellHyperlink(); Assert.assertNotNull(link); Assert.assertEquals(Hyperlink.HyperlinkType.URL,link.getType()); Assert.assertEquals(link.getAddress(), "http://www.google.com"); Assert.assertEquals(link.getLabel(), "http://www.google.com"); link = Ranges.range(sheet, "A2").getCellHyperlink(); Assert.assertNotNull(link); Assert.assertEquals(Hyperlink.HyperlinkType.URL,link.getType()); Assert.assertEquals(link.getAddress(), "http://www.zkoss.org"); Assert.assertEquals(link.getLabel(), "http://www.zkoss.org"); Ranges.range(sheet, "A1").clearContents(); Util.export(book, Setup.getTempFile());//get error if has this line link = Ranges.range(sheet, "A1").getCellHyperlink(); Assert.assertNull(link); link = Ranges.range(sheet, "A2").getCellHyperlink(); Assert.assertNotNull(link); Assert.assertEquals(Hyperlink.HyperlinkType.URL,link.getType()); Assert.assertEquals(link.getAddress(), "http://www.zkoss.org"); Assert.assertEquals(link.getLabel(), "http://www.zkoss.org"); }
org.apache.xmlbeans.impl.values.XmlValueDisconnectedException at org.apache.xmlbeans.impl.values.XmlObjectBase.check_orphaned(XmlObjectBase.java:1213) at org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTHyperlinkImpl.getRef(Unknown Source) at org.zkoss.poi.xssf.usermodel.XSSFHyperlink.getCellRef(XSSFHyperlink.java:138) at org.zkoss.poi.xssf.usermodel.XSSFSheet.getHyperlink(XSSFSheet.java:621) at org.zkoss.poi.xssf.usermodel.XSSFCell.getHyperlink(XSSFCell.java:910) at org.zkoss.poi.xssf.usermodel.XSSFCell.getHyperlink(XSSFCell.java:1) at org.zkoss.zss.model.sys.impl.BookHelper.getHyperlink(BookHelper.java:1016) at org.zkoss.zss.model.sys.impl.XRangeImpl.getHyperlink(XRangeImpl.java:161) at org.zkoss.zss.api.impl.RangeImpl.getCellHyperlink(RangeImpl.java:635) at org.zkoss.zss.api.impl.Issue400Test.testZSS4xxx(Issue400Test.java:1056) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)