Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Cannot Reproduce
-
Version 2
-
None
-
None
-
dev2lt 10:52 AM > java -version
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode)
dev2lt 01:46 PM > uname -a
Linux dev2lt 2.6.12-1.1398_FC4smp #1 SMP Fri Jul 15 01:30:13 EDT 2005 i686 i686 i386 GNU/Linux
dev2lt 10:52 AM > java -version java version "1.5.0_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08) Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode) dev2lt 01:46 PM > uname -a Linux dev2lt 2.6.12-1.1398_FC4smp #1 SMP Fri Jul 15 01:30:13 EDT 2005 i686 i686 i386 GNU/Linux
Description
The following elements in our xml cause a
java.lang.ArrayIndexOutOfBoundsException in Document.save(StringWriter,
XmlOptions) in xmlbeans when we first call setSavePrettyPrint() on the
XmlOptions object we pass into the Document.save(StringWriter,
XmlOptions) method:
<value>uranium miner &</value>
<value>uranium miner & s</value>
<value>uranium miner & </value>
These do not:
<value>uranium miner & s</value>
<value>&</value>
Basically, we're seeing that any "&" at the end of an element value
needs to have a non-whitespace character at least three characters from
the right of it in order to avoid the problem.
If setSavePrettyPrint() is not called, everything works.
Here's the stack against the 2.0.0 xmlbeans release:
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.apache.xmlbeans.impl.store.Saver
$TextSaver.replace(Saver.java:1438)
at org.apache.xmlbeans.impl.store.Saver
$TextSaver.entitizeContent(Saver.java:1269)
at org.apache.xmlbeans.impl.store.Saver
$TextSaver.emitText(Saver.java:966)
at org.apache.xmlbeans.impl.store.Saver.process(Saver.java:288)
at org.apache.xmlbeans.impl.store.Saver
$TextSaver.ensure(Saver.java:1466)
at org.apache.xmlbeans.impl.store.Saver$TextSaver.read(Saver.java:1553)
at org.apache.xmlbeans.impl.store.Saver
$TextReader.read(Saver.java:1680)
at org.apache.xmlbeans.impl.store.Cursor._save(Cursor.java:609)
at org.apache.xmlbeans.impl.store.Cursor.save(Cursor.java:2554)
at
org.apache.xmlbeans.impl.values.XmlObjectBase.save(XmlObjectBase.java:186)