[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: [jira] Created: (XMLBEANS-391) Assert in Xobj.fetch_text() firing
From: "Radu Preotiuc-Pietro (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date: 2008-11-27 3:00:44
Message-ID: 1242697181.1227754844181.JavaMail.jira () brutus
[Download RAW message or body]
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