This sure seems like a bug, would you open up a bug in JIRA so we can track it. Also if you have a patch for it, it would be very much appreciated.
Cezar > -----Original Message----- > From: Christopher Lamey [mailto:[EMAIL PROTECTED] > Sent: Friday, September 02, 2005 2:19 PM > To: user@xmlbeans.apache.org > Subject: pretty print and ampersands > > Hello, > > 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:18 6) > > Is this expected behavior? > > Cheers, > topher > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]