You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Joseph Campolongo <jc...@cra.com> on 2007/02/28 19:45:01 UTC
Set() of a nil element leaves element in invalid state
I have assertions enabled for v.2.2.0 of XmlBeans under JDK 1.5_10.
While trying to validate my bean, I get an AssertionError at the
following location:
at
org.apache.xmlbeans.impl.values.XmlObjectBase.build_text(XmlObjectBase.j
ava:837)
at
org.apache.xmlbeans.impl.store.Xobj.ensureOccupancy(Xobj.java:1694)
at org.apache.xmlbeans.impl.store.Cur.next(Cur.java:1444)
at
org.apache.xmlbeans.impl.store.Validate.process(Validate.java:74)
at
org.apache.xmlbeans.impl.store.Validate.<init>(Validate.java:39)
at org.apache.xmlbeans.impl.store.Xobj.validate(Xobj.java:1860)
at
org.apache.xmlbeans.impl.values.XmlObjectBase.validate(XmlObjectBase.jav
a:343)
The line of code is
assert((_flags & FLAG_VALUE_DATED) == 0);
In other words, after a set() call, the value is in an invalid state.
What is happening is that I'm first setting various values in the bean
and then validating it. It appears that, if I set a value that had
previously been 'nil', then the above flag gets set on the element:
XmlBase64BinaryImpl(XmlObjectBase).invalidate_nilvalue() line:
792
Xobj$ElementXobj(Xobj).invalidateNil() line: 1385
Xobj$AttrXobj(Xobj).invalidateSpecialAttr(Xobj) line: 915
Cur.moveNode(Xobj, Cur) line: 1922
Cur.moveNode(Cur) line: 1841
Xobj$ElementXobj(Xobj).removeAttr(QName) line: 520
Xobj$ElementXobj(Xobj).invalidate_nil() line: 2038
XmlBase64BinaryImpl(XmlObjectBase).set_commit() line: 1313
XmlBase64BinaryImpl(XmlObjectBase).set(byte[]) line: 1617
XmlBase64BinaryImpl(XmlObjectBase).setByteArrayValue(byte[])
line: 1553
SymbolImpl.setSymbolData(byte[]) line: 466
The set occurs, but, after the set, the 'nil' attribute is cleared,
which calls the following code:
public final void invalidate_nilvalue()
{
assert((_flags & FLAG_STORE) != 0);
_flags |= FLAG_VALUE_DATED | FLAG_NIL_DATED;
}
This code very clearly sets the FLAG_VALUE_DATA flag, which leaves the
entire element in an invalid state.
Is this how everything should work? Is the assert incorrect? Is there
something I should be doing to the bean after I set the values? How
should I approach dealing with this? I'm running into this quite a bit,
so I would appreciate any help.
Thank you,
jvc
RE: Set() of a nil element leaves element in invalid state
Posted by Cezar Andrei <ce...@bea.com>.
Joseph,
Do I understand correctly that when running with asserts disabled it
works fine?
Please file a bug in JIRA to track of it, and if you can include a small
repro would be even better.
Cezar
________________________________
From: Joseph Campolongo [mailto:jcampolongo@cra.com]
Sent: Wednesday, February 28, 2007 12:45 PM
To: user@xmlbeans.apache.org
Subject: Set() of a nil element leaves element in invalid state
I have assertions enabled for v.2.2.0 of XmlBeans under JDK 1.5_10.
While trying to validate my bean, I get an AssertionError at the
following location:
at
org.apache.xmlbeans.impl.values.XmlObjectBase.build_text(XmlObjectBase.j
ava:837)
at
org.apache.xmlbeans.impl.store.Xobj.ensureOccupancy(Xobj.java:1694)
at org.apache.xmlbeans.impl.store.Cur.next(Cur.java:1444)
at
org.apache.xmlbeans.impl.store.Validate.process(Validate.java:74)
at
org.apache.xmlbeans.impl.store.Validate.<init>(Validate.java:39)
at org.apache.xmlbeans.impl.store.Xobj.validate(Xobj.java:1860)
at
org.apache.xmlbeans.impl.values.XmlObjectBase.validate(XmlObjectBase.jav
a:343)
The line of code is
assert((_flags & FLAG_VALUE_DATED) == 0);
In other words, after a set() call, the value is in an invalid state.
What is happening is that I'm first setting various values in the bean
and then validating it. It appears that, if I set a value that had
previously been 'nil', then the above flag gets set on the element:
XmlBase64BinaryImpl(XmlObjectBase).invalidate_nilvalue() line:
792
Xobj$ElementXobj(Xobj).invalidateNil() line: 1385
Xobj$AttrXobj(Xobj).invalidateSpecialAttr(Xobj) line: 915
Cur.moveNode(Xobj, Cur) line: 1922
Cur.moveNode(Cur) line: 1841
Xobj$ElementXobj(Xobj).removeAttr(QName) line: 520
Xobj$ElementXobj(Xobj).invalidate_nil() line: 2038
XmlBase64BinaryImpl(XmlObjectBase).set_commit() line: 1313
XmlBase64BinaryImpl(XmlObjectBase).set(byte[]) line: 1617
XmlBase64BinaryImpl(XmlObjectBase).setByteArrayValue(byte[])
line: 1553
SymbolImpl.setSymbolData(byte[]) line: 466
The set occurs, but, after the set, the 'nil' attribute is cleared,
which calls the following code:
public final void invalidate_nilvalue()
{
assert((_flags & FLAG_STORE) != 0);
_flags |= FLAG_VALUE_DATED | FLAG_NIL_DATED;
}
This code very clearly sets the FLAG_VALUE_DATA flag, which leaves the
entire element in an invalid state.
Is this how everything should work? Is the assert incorrect? Is there
something I should be doing to the bean after I set the values? How
should I approach dealing with this? I'm running into this quite a bit,
so I would appreciate any help.
Thank you,
jvc
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.