You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ce...@apache.org on 2005/08/27 00:16:06 UTC
svn commit: r240356 - in
/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store: DomImpl.java
Xobj.java
Author: cezar
Date: Fri Aug 26 15:15:59 2005
New Revision: 240356
URL: http://svn.apache.org/viewcvs?rev=240356&view=rev
Log:
Yana.Kadiyska. Fixing occupancy checks
Modified:
xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java
xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Xobj.java
Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java?rev=240356&r1=240355&r2=240356&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java Fri Aug 26 15:15:59 2005
@@ -1323,8 +1323,7 @@
{
Xobj node = (Xobj) n;
- if (node.isVacant())
- node.ensureOccupancy();
+ node.ensureOccupancy();
if (node.isFirstChildPtrDomUsable())
return (Xobj.NodeXobj) node._firstChild;
Xobj lastAttr = node.lastAttr();
@@ -1487,8 +1486,7 @@
{
assert n instanceof Xobj: "PI, Comments and Elements always backed up by Xobj";
Xobj node = (Xobj) n;
- if (node.isVacant())
- node.ensureOccupancy();
+ node.ensureOccupancy();
if (node.isNextSiblingPtrDomUsable())
return
(Xobj.NodeXobj) node._nextSibling;
@@ -1539,6 +1537,7 @@
if (!(node._src instanceof Xobj))
return null;
Xobj src = (Xobj) node._src;
+ src.ensureOccupancy();
boolean isThisNodeAfterText = node.isNodeAftertext();
prev = node._prev;
if (prev == null)
@@ -2400,7 +2399,8 @@
s = CharUtil.getString( node._src, node._off, node._cch );
else{
Xobj src = (Xobj) node._src;
- boolean isThisNodeAfterText =node.isNodeAftertext();
+ src.ensureOccupancy();
+ boolean isThisNodeAfterText = node.isNodeAftertext();
s =
isThisNodeAfterText ?
src.getCharsAfterAsString(node._off, node._cch) :
@@ -2614,11 +2614,10 @@
int count;
assert n instanceof Xobj;
- Xobj node = (Xobj)n;
- if ( !node.isVacant() )
- node.ensureOccupancy();
- if ( (count = node.getDomZeroOneChildren()) < 2)
- return count;
+ Xobj node = (Xobj) n;
+ node.ensureOccupancy();
+ if ((count = node.getDomZeroOneChildren()) < 2)
+ return count;
return n.locale().domLength(n);
}
Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Xobj.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Xobj.java?rev=240356&r1=240355&r2=240356&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Xobj.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Xobj.java Fri Aug 26 15:15:59 2005
@@ -1693,26 +1693,42 @@
String value = user.build_text( this );
- Cur c = tempCur();
-
- c.next();
long saveVersion = _locale._versionAll;
long saveVersionSansText = _locale._versionSansText;
- c.insertString( value );
+ setValue( value );
assert saveVersionSansText == _locale._versionSansText;
_locale._versionAll = saveVersion;
- c.release();
assert _user == null;
_user = user;
}
}
-
+ private void setValue(String val)
+ {
+ assert !isRoot();
+ assert CharUtil.isValid(val, 0, val.length());
+
+ // Check for nothing to insert
+
+ if (val.length() <= 0)
+ return;
+
+ _locale.notifyChange();
+ Xobj lastAttr = lastAttr();
+ int startPos = 1;
+ Xobj charOwner = this;
+ if (lastAttr != null)
+ {
+ charOwner = lastAttr;
+ startPos = charOwner.posAfter();
+ }
+ charOwner.insertCharsHelper(startPos, val, 0, val.length(), true);
+ }
//
// TypeStore
//
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org