vgritsenko 02/01/24 19:42:29
Modified: src/java/org/apache/cocoon/components/xslt
XSLTProcessorImpl.java
Log:
Always recycle sources.
Revision Changes Path
1.6 +11 -10
xml-cocoon2/src/java/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java
Index: XSLTProcessorImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSLTProcessorImpl.java 23 Jan 2002 00:29:16 -0000 1.5
+++ XSLTProcessorImpl.java 25 Jan 2002 03:42:29 -0000 1.6
@@ -356,16 +356,15 @@
throws TransformerException
{
if (this.getLogger().isDebugEnabled()) {
- getLogger().debug("XSLTProcessorImpl: resolve(href = " + href
+ getLogger().debug("resolve(href = " + href
+ ", base = " + base + "); resolver = " + resolver);
}
+ Source xslSource = null;
try {
- Source xslSource;
if (href.indexOf(":") > 1) {
xslSource = resolver.resolve(href);
- }
- else {
+ } else {
// patch for a null pointer passed as base
if (base == null)
throw new IllegalArgumentException("Null pointer passed as base");
@@ -377,25 +376,25 @@
// this should never occur as the base should
// always be protocol:/....
return null; // we can't resolve this
- }
- else {
+ } else {
xslSource = resolver.resolve(new StringBuffer(base.substring(0,
lastPathElementPos))
.append("/").append(href).toString());
}
- }
- else {
+ } else {
File parent = new File(base.substring(5));
File parent2 = new File(parent.getParentFile(), href);
xslSource = resolver.resolve(parent2.toURL().toExternalForm());
}
}
+
InputSource is = xslSource.getInputSource();
if (this.getLogger().isDebugEnabled()) {
getLogger().debug("xslSource = " + xslSource
+ ", system id = " + is.getSystemId());
}
- return new StreamSource(is.getByteStream(),
- is.getSystemId());
+
+ return new StreamSource(is.getByteStream(), is.getSystemId());
+
} catch (ResourceNotFoundException rnfe) {
// to obtain the same behaviour as when the resource is
// transformed by the XSLT Transformer we should return null here.
@@ -408,6 +407,8 @@
throw new TransformerException(se);
} catch (ProcessingException pe) {
throw new TransformerException(pe);
+ } finally {
+ if (xslSource != null) xslSource.recycle();
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]