[ 
https://issues.apache.org/jira/browse/XMLBEANS-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935705#action_12935705
 ] 

Kevin Van Dyck commented on XMLBEANS-391:
-----------------------------------------

any news on this issue?

> 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-Pietro
>            Priority: Minor
>
> 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org

Reply via email to