Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 55803 invoked from network); 23 Jun 2007 23:58:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Jun 2007 23:58:06 -0000 Received: (qmail 36142 invoked by uid 500); 23 Jun 2007 23:58:09 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 36064 invoked by uid 500); 23 Jun 2007 23:58:09 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 36053 invoked by uid 99); 23 Jun 2007 23:58:09 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Jun 2007 16:58:09 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Jun 2007 16:58:05 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 919F81A981D; Sat, 23 Jun 2007 16:57:45 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r550141 - in /cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl: src/main/java/org/apache/cocoon/components/source/impl/QDoxSource.java status.xml Date: Sat, 23 Jun 2007 23:57:45 -0000 To: cvs@cocoon.apache.org From: joerg@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070623235745.919F81A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: joerg Date: Sat Jun 23 16:57:44 2007 New Revision: 550141 URL: http://svn.apache.org/viewvc?view=rev&rev=550141 Log: COCOON-2077: Fixed getInputStream() in XModuleSource and QDoxSource: Set up XMLSerializer in a component way, i.e. retrieve it from ServiceManager. Modified: cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/src/main/java/org/apache/cocoon/components/source/impl/QDoxSource.java cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/status.xml Modified: cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/src/main/java/org/apache/cocoon/components/source/impl/QDoxSource.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/src/main/java/org/apache/cocoon/components/source/impl/QDoxSource.java?view=diff&rev=550141&r1=550140&r2=550141 ============================================================================== --- cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/src/main/java/org/apache/cocoon/components/source/impl/QDoxSource.java (original) +++ cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/src/main/java/org/apache/cocoon/components/source/impl/QDoxSource.java Sat Jun 23 16:57:44 2007 @@ -42,7 +42,8 @@ import org.apache.avalon.framework.logger.Logger; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; -import org.apache.cocoon.serialization.XMLSerializer; +import org.apache.avalon.framework.service.ServiceSelector; +import org.apache.cocoon.serialization.Serializer; import org.apache.cocoon.xml.XMLUtils; import org.apache.commons.lang.StringUtils; @@ -133,6 +134,9 @@ */ protected RE reLink; + // TODO: make this actually configurable + private String configuredSerializerName; + /** * Contains a regular expression to match the {@link …} occurrances. * @@ -345,20 +349,32 @@ * @see org.apache.excalibur.source.Source#getInputStream() */ public InputStream getInputStream() throws IOException, SourceException { - if (logger.isDebugEnabled()) { - logger.debug("Getting InputStream for class " + javadocClass.getFullyQualifiedName()); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Getting InputStream for class " + this.javadocClass.getFullyQualifiedName()); } - XMLSerializer serializer = new XMLSerializer(); + + // Serialize the SAX events to the XMLSerializer ByteArrayInputStream inputStream = null; + ServiceSelector selector = null; + Serializer serializer = null; try { + selector = (ServiceSelector)this.manager.lookup(Serializer.ROLE + "Selector"); + serializer = (Serializer)selector.select(this.configuredSerializerName); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048); serializer.setOutputStream(outputStream); toSAX(serializer); inputStream = new ByteArrayInputStream(outputStream.toByteArray()); - } catch (SAXException se) { - logger.error("SAX exception!", se); - throw new SourceException("Serializing SAX to a ByteArray failed!", se); + } catch (SAXException e) { + throw new SourceException("Serializing SAX to a ByteArray failed!", e); + } catch (ServiceException e) { + throw new SourceException("Retrieving serializer failed.", e); + } finally { + if (selector != null) { + selector.release(serializer); + this.manager.release(selector); + } } return inputStream; } @@ -868,7 +884,7 @@ outputSuperClassInheritance(handler, jClass, INTERFACE_INHERITANCE); for (int i=0; i + - + + Fixed getInputStream() in QDoxSource: + Set up XMLSerializer in a component way, i.e. retrieve it from ServiceManager. +