You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/04/09 16:37:42 UTC
svn commit: r160684 -
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
Author: andreas
Date: Sat Apr 9 07:37:41 2005
New Revision: 160684
URL: http://svn.apache.org/viewcvs?view=rev&rev=160684
Log:
Use byte array instead of separate thread to convert DOM to input stream. This avoids the 'pipe closed' exception.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java?view=diff&r1=160683&r2=160684
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java Sat Apr 9 07:37:41 2005
@@ -156,7 +156,19 @@
}
try {
Document doc = this.node.getDocument();
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+
+ transformer.setOutputProperty("encoding", "UTF-8");
+ transformer.setOutputProperty("indent", "yes");
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ transformer.transform(new DOMSource(doc), new StreamResult(bos));
+ return new ByteArrayInputStream(bos.toByteArray());
+
+ /*
return convert(doc);
+ */
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -180,7 +192,8 @@
} finally {
try {
pos.close();
- } catch (IOException ignore) {
+ } catch (Exception ignore) {
+ ignore.printStackTrace();
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org