You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2007/06/24 01:57:45 UTC
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
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 <code>{</code><code>@link …}</code> 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<interfaces.length; i++) {
- String name = interfaces[i].getValue().toString();
+ String name = interfaces[i].getValue();
String pckg = name.substring(0, name.lastIndexOf('.'));
name = name.substring(pckg.length() + 1);
Modified: cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/status.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/status.xml?view=diff&rev=550141&r1=550140&r2=550141
==============================================================================
--- cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/status.xml (original)
+++ cocoon/trunk/blocks/cocoon-qdox/cocoon-qdox-impl/status.xml Sat Jun 23 16:57:44 2007
@@ -16,7 +16,7 @@
limitations under the License.
-->
<!DOCTYPE status [
-<!ELEMENT status (developers, todo, changes)>
+<!ELEMENT status (developers?, todo?, changes)>
<!ELEMENT developers (person+)>
<!ELEMENT person EMPTY>
<!ATTLIST person
@@ -63,9 +63,12 @@
<!-- SVN $Id$ -->
<status>
- <!-- The following list contains the changes since the latest 2.1.x version. -->
<changes>
<release version="@version@" date="@date@">
+ <action dev="JH" type="fix" fixes-bug="COCOON-2077" due-to="Ellis Pritchard">
+ Fixed getInputStream() in QDoxSource:
+ Set up XMLSerializer in a component way, i.e. retrieve it from ServiceManager.
+ </action>
</release>
</changes>