[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    [jira] Commented: (XMLBEANS-391) Assert in Xobj.fetch_text() firing
From:       "Kevin Van Dyck (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date:       2010-11-25 9:57:14
Message-ID: 20789701.305851290679034071.JavaMail.jira () thor
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/XMLBEANS-391?page=com.atlassian.jira.plugi \
n.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-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic