Bill --

1.  Can you upgrade to XalanJ 2.1.0?  This FastStringBuffer class has
been substantially changed and may make this problem go away.  It
doesn't look like the changes had anything to do with this problem but
it would be nice to check it out with the current release.

2.  In any event, can you forward (to me personally if you'd like) a
copy of your full XML and XSLT to see if I can reproduce the problem?

Thanks,
Gary

Bill Gates wrote:
> 
> Here's the stack trace.  It's actually coming back through Junit so I've
> cleaned off some of the display stuff.
> This is in the exception caught on the transform.  The xelus stuff is of
> course our custom stuff....
>    thanks,
>              g888
> 
> *********** TRACE *************
> javax.xml.transform.TransformerException: String index out of range: -14320
> at
> org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1242)
> 
> at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:483)
> 
> at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1147)
> 
> at com.xelus.soa.dt.DtTransformation.transformToDOM(DtTransformation.java:412)
> 
> at com.xelus.soa.dt.DtSyncService.transformToDOM(DtSyncService.java:250)
> at com.xelus.soa.dt.DtSyncService.transformDOMToDOM(DtSyncService.java:545)
> at test.xelus.soa.dt.DTTestSuite.DOMToDOM(DTTestSuite.java:1224)
> 
> at java.lang.reflect.Method.invoke(Native Method)
> at test.xelus.soa.dt.DTTestSuite$2.run(DTTestSuite.java:1310)
> ---------
> java.lang.StringIndexOutOfBoundsException: String index out of range: -14320
> at java.lang.String.getChars(String.java:551)
> at org.apache.xml.utils.FastStringBuffer.append(FastStringBuffer.java:389)
> at org.apache.xpath.DOMHelper.getNodeData(DOMHelper.java:1314)
> at org.apache.xpath.DOMHelper.getNodeData(DOMHelper.java:1308)
> at org.apache.xpath.DOMHelper.getNodeData(DOMHelper.java:1267)
> at org.apache.xpath.objects.XNodeSet.getStringFromNode(XNodeSet.java:184)
> at org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:284)
> at
> 
>org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2202)
> 
> at
> org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:739)
> 
> at
> org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.java:498)
> 
> at
> org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:193)
> 
> at
> 
>org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2202)
> 
> at
> 
>org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2085)
> 
> at
> org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1219)
> 
> at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:483)
> 
> at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1147)
> 
> at com.xelus.soa.dt.DtTransformation.transformToDOM(DtTransformation.java:412)
> 
> at com.xelus.soa.dt.DtSyncService.transformToDOM(DtSyncService.java:250)
> at com.xelus.soa.dt.DtSyncService.transformDOMToDOM(DtSyncService.java:545)
> at test.xelus.soa.dt.DTTestSuite.DOMToDOM(DTTestSuite.java:1224)
> at java.lang.reflect.Method.invoke(Native Method)
> at test.xelus.soa.dt.DTTestSuite$2.run(DTTestSuite.java:1310)
> *********** END  TRACE *************
> Gary L Peskin wrote:
> 
> > Can you send us the stack trace when the exception occurs?
> >
> > Gary
> >
> > Bill Gates wrote:
> > >
> > > I'm getting a weird behavior using Xalan 2.0.1 and the transform
> > > method.  I'm not sure if it's just my lack of understanding of what's
> > > happening or a real issue.  I presumed that this would work.
> > >
> > > (This isn't the exact code because it's spread out but a best display of
> > > the snippets I'm using with Xalan.)
> > >
> > > I have a ControlledParser class which is essentially a subclass of
> > > DomParser with the setDeferred expansion to false by default.  This is
> > > the behavior we need.
> > >
> > > I get an instance of the parser and call
> > > parser.parse(new InputSource(new StringReader(xmlString)));
> > > Then I get a DOMSource with new DOMSource(parser.getDocument())
> > >
> > > I get my xml source and xsl source the same way.  Then I do the basics:
> > >
> > > DOMResult domResult = new DOMResult();
> > > TransformerFactory factory = TransformerFactory.newInstance();
> > > Transformer transformer = factory.newTransformer(xslSource);
> > > transformer.transform(xmlSource, domResult);
> > >
> > > This all seems pretty rudimentary to me.  It seems to work until the
> > > point where I have an xmlSource file of greater than 76K (roughly).
> > > Then I start getting the String index out of range errors during the
> > > transform call.
> > >
> > > I can fix this by instead doing:
> > >
> > >             DocumentBuilderFactory factory =
> > > DocumentBuilderFactory.newInstance();
> > >             factory.setNamespaceAware(true);
> > >             DocumentBuilder builder = factory.newDocumentBuilder();
> > >             Document xmlDoc = builder.parse(new InputSource(
> > >                 new StringReader(xml)));
> > >             DOMSource xmlSource = new DOMSource(xmlDoc);
> > >
> > > To get the xmlSource and then doing the same transform but I'm not sure
> > > why that is.  Could somebody explain to me the difference?  I would have
> > > though that I could pass any DOMSource to the transform and it would
> > > work but that doesn't seem to be the case.  It's apparent to me I'm
> > > missing something basic.
> > >
> > >    Thanks,
> > >             g888

Reply via email to