Author: vgritsenko Date: Thu Oct 7 07:21:36 2004 New Revision: 53976 Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/SourceTag.java cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObject.java Log: cleanup
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/SourceTag.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/SourceTag.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/SourceTag.java Thu Oct 7 07:21:36 2004 @@ -1,12 +1,12 @@ /* * Copyright 1999-2004 The Apache Software Foundation. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,11 +26,10 @@ /** * @author <a href="mailto:[EMAIL PROTECTED]">Volker Schmitt</a> - * @version CVS $Id: SourceTag.java,v 1.4 2004/03/05 13:02:24 bdelacretaz Exp $ + * @version CVS $Id$ */ public class SourceTag extends XMLProducerTagSupport { private String src; - private EmbeddedXMLPipe embeddedXMLPipe = new EmbeddedXMLPipe(null); public void setSrc(String src) { this.src = src; @@ -39,12 +38,14 @@ /* * @see Tag#doEndTag(String, String, String) */ - public int doEndTag(String namespaceURI, String localName, String qName) throws SAXException { + public int doEndTag(String namespaceURI, String localName, String qName) + throws SAXException { Source source = null; try { - embeddedXMLPipe.setConsumer(this.xmlConsumer); source = resolver.resolveURI(src); - SourceUtil.toSAX(source, this.embeddedXMLPipe); + SourceUtil.toSAX(source, new EmbeddedXMLPipe(this.xmlConsumer)); + } catch (SAXException e) { + throw e; } catch (Exception e) { if (e instanceof ProcessingException) { ProcessingException pe = (ProcessingException) e; @@ -54,9 +55,9 @@ } throw new SAXException(e.getMessage(), e); } finally { - embeddedXMLPipe.setConsumer(null); - if (source != null) + if (source != null) { resolver.release(source); + } } return EVAL_PAGE; } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObject.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObject.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObject.java Thu Oct 7 07:21:36 2004 @@ -1,12 +1,12 @@ /* * Copyright 1999-2004 The Apache Software Foundation. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,7 +44,7 @@ * Source object. * * @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a> - * @version CVS $Id: XScriptObject.java,v 1.1 2004/03/10 12:58:08 stephan Exp $ + * @version CVS $Id$ * @since August 4, 2001 */ public abstract class XScriptObject implements Source, Serviceable { @@ -113,8 +113,7 @@ } public void toEmbeddedSAX(ContentHandler handler) throws SAXException { - EmbeddedXMLPipe newHandler = new EmbeddedXMLPipe(handler); - toSAX(newHandler); + toSAX(new EmbeddedXMLPipe(handler)); } /* The Source interface methods. */