cziegeler 2003/07/12 07:21:06
Modified: src/blocks/portal/java/org/apache/cocoon/portal/transformation RSSTransformer.java Log: Fixing bug in streaming descriptions Revision Changes Path 1.3 +10 -12 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/RSSTransformer.java Index: RSSTransformer.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/RSSTransformer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RSSTransformer.java 12 Jul 2003 13:49:56 -0000 1.2 +++ RSSTransformer.java 12 Jul 2003 14:21:06 -0000 1.3 @@ -83,9 +83,6 @@ /** The xmlizer for converting html to xml */ protected XMLizer xmlizer; - /** The xml serializer */ - protected XMLSerializer serializer; - /** The xml deserializer */ protected XMLDeserializer deserializer; @@ -112,20 +109,24 @@ final String text = this.endTextRecording(); final String html = "<html><body>"+text+"</body></html>"; - boolean parsed = false; + Object parsed = null; + XMLSerializer serializer = null; try { + serializer = (XMLSerializer)this.manager.lookup(XMLSerializer.ROLE); InputStream inputStream = new ByteArrayInputStream(html.getBytes()); this.xmlizer.toSAX(inputStream, "text/html", null, - this.serializer); + serializer); // if no exception occurs, everything is fine! - parsed = true; + parsed = serializer.getSAXFragment(); } catch (Exception ignore) { + } finally { + this.manager.release( serializer ); } - if ( parsed ) { + if ( parsed != null ) { this.deserializer.setConsumer( this.filter ); - this.deserializer.deserialize( this.serializer.getSAXFragment()); + this.deserializer.deserialize( parsed ); } else { this.sendTextEvent(text); } @@ -138,10 +139,8 @@ */ public void recycle() { this.manager.release( (Component) this.xmlizer ); - this.manager.release( this.serializer ); this.manager.release( this.deserializer ); this.xmlizer = null; - this.serializer = null; this.deserializer = null; this.filter = null; super.recycle(); @@ -158,7 +157,6 @@ super.setup(resolver, objectModel, src, par); try { this.xmlizer = (XMLizer)this.manager.lookup(XMLizer.ROLE); - this.serializer = (XMLSerializer)this.manager.lookup(XMLSerializer.ROLE); this.deserializer = (XMLDeserializer)this.manager.lookup(XMLDeserializer.ROLE); } catch (ComponentException ce) { throw new ProcessingException("Unable to lookup component.", ce);