[ https://issues.apache.org/jira/browse/XMLBEANS-391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Beeker resolved XMLBEANS-391. ------------------------------------- Fix Version/s: Version 5.1.0 Resolution: Cannot Reproduce This error is not reproducible anymore. So it seems to be fixed in the past. > Assert in Xobj.fetch_text() firing in seemingly ok cases > -------------------------------------------------------- > > Key: XMLBEANS-391 > URL: https://issues.apache.org/jira/browse/XMLBEANS-391 > Project: XMLBeans > Issue Type: Bug > Components: Cursor > Affects Versions: Version 2.4.1 > Reporter: Radu Preotiuc > Priority: Minor > Fix For: Version 5.1.0 > > > Xobj.fetch_text() starts with an assert like this: > assert isValid() && isOccupied(); > But it seems that sometimes this 'assert' fires incorrectly. Here's a repro > case: > Schema: > <?xml version="1.0" encoding="ISO-8859-1"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://cfnxml" > targetNamespace="http://cfnxml" > elementFormDefault="qualified"> > <xs:element name="root"> > <xs:complexType> > <xs:sequence> > <xs:element name="invoice" type="InvoiceType"/> > </xs:sequence> > </xs:complexType> > </xs:element> > <xs:complexType name="InvoiceType"> > <xs:sequence> > <xs:element name="termsOfPaymentId" type="xs:integer"/> > </xs:sequence> > </xs:complexType> > </xs:schema> > Document ("test.xml"): > <?xml version="1.0" encoding="UTF-8"?> > <root xmlns="http://cfnxml" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <invoice> > <termsOfPaymentId>100</termsOfPaymentId> > </invoice> > </root> > Code: > File f = new File("test.xml"); > XmlObject doc = XmlObject.Factory.parse(f); > System.out.println("Root type = " + doc.schemaType()); > System.out.println("Valid = " + doc.validate()); > InvoiceType invoice = ((RootDocument) doc).getRoot().getInvoice(); > invoice.setTermsOfPaymentId(null); > invoice.setTermsOfPaymentId(BigInteger.valueOf(10)); > invoice.getTermsOfPaymentId(); > System.out.println("Final document = " + doc.xmlText()); > If you run the repro with assertions enabled, then the assert fires, but if > you disable assertions, the repro seems to work, so maybe the assert is > incorrect. -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org