forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r742940 - /forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
Date Tue, 10 Feb 2009 11:44:38 GMT
Author: thorsten
Date: Tue Feb 10 11:44:18 2009
New Revision: 742940

URL: http://svn.apache.org/viewvc?rev=742940&view=rev
Log:
minor code changes regarding the order of invocation

Modified:
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java?rev=742940&r1=742939&r2=742940&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
Tue Feb 10 11:44:18 2009
@@ -38,7 +38,6 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamSource;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.forrest.dispatcher.exception.ContractException;
 import org.apache.forrest.dispatcher.impl.XSLContract;
@@ -53,7 +52,8 @@
   private SAXParser parser;
   private DocumentBuilder builder;
   private String name;
-  
+  private ContractHandler handler;
+  private LoggingErrorListener listener;
 
   /**
    * @return the name of the contract
@@ -86,6 +86,9 @@
     SAXParserFactory factory = SAXParserFactory.newInstance();
     factory.setNamespaceAware(true);
     factory.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+    // FIXME: Make encoding configurable
+    handler = new ContractHandler("UTF-8");
+    listener = new LoggingErrorListener(log);
     try {
       parser = factory.newSAXParser();
       builder = DocumentBuilderFactory.newInstance()
@@ -118,7 +121,7 @@
     transformer.setOutputProperty(OutputKeys.INDENT, "yes");
     transformer.setOutputProperty(OutputKeys.METHOD, "xml");
     // set errorListener
-    transformer.setErrorListener(new LoggingErrorListener(log));
+    transformer.setErrorListener(listener);
     // do we allow xml properties?
     if (allowXmlProperties) {
       for (Iterator<String> iter = params.keySet().iterator(); iter.hasNext();) {
@@ -191,8 +194,6 @@
   public void setTemplate(InputStream stream, XSLContract contract)
       throws XMLStreamException, ContractException {
 
-    // FIXME: Make encoding configurable
-    ContractHandler handler = new ContractHandler("UTF-8");
     try {
       /* DEBUG_CODE: 
        * The following is useful to see what is going on



Mime
View raw message