Author: thorsten
Date: Thu Oct 9 03:23:17 2008
New Revision: 703116
URL: http://svn.apache.org/viewvc?rev=703116&view=rev
Log:
Using byte array instead of input stream to easier reuse the object
Modified:
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Modified:
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
URL:
http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?rev=703116&r1=703115&r2=703116&view=diff
==============================================================================
---
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
(original)
+++
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Thu Oct 9 03:23:17 2008
@@ -47,6 +47,7 @@
import org.apache.excalibur.xml.sax.SAXParser;
import org.apache.forrest.dispatcher.api.Structurer;
import org.apache.forrest.dispatcher.config.DispatcherBean;
+import org.apache.forrest.dispatcher.exception.DispatcherException;
import org.apache.forrest.dispatcher.impl.CocoonResolver;
import org.apache.forrest.dispatcher.impl.XMLStructurer;
import org.apache.forrest.dispatcher.impl.XMLStructurerAxiom;
@@ -242,9 +243,9 @@
Source propsSource = m_resolver.resolveURI(propertyURI);
if(propsSource!=null){
InputStream stream = new
BufferedInputStream(propsSource.getInputStream());
- // get the bytes from the stream
- byte [] properties = IOUtils.getStreamAsByteArray(stream);
if (config.isAllowXmlProperties()){
+ // get the bytes from the stream
+ byte [] properties = IOUtils.getStreamAsByteArray(stream);
map.put(DEFAULT_VARIABLES, properties);
}else{
XMLProperties.parseProperties(stream, map);
@@ -269,6 +270,8 @@
parser = (SAXParser) manager.lookup(SAXParser.ROLE);
// adding the result to the consumer
parser.parse(new InputSource(result), super.xmlConsumer);
+ } catch (DispatcherException e) {
+ throw new SAXException(e);
} catch (Exception e) {
throw new SAXException(e);
} finally {