velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbris...@apache.org
Subject svn commit: r537525 - /velocity/dvsl/trunk/src/java/org/apache/tools/dvsl/DVSL.java
Date Sat, 12 May 2007 23:09:42 GMT
Author: cbrisson
Date: Sat May 12 16:09:42 2007
New Revision: 537525

URL: http://svn.apache.org/viewvc?view=rev&rev=537525
Log:
applied Takayoshi Kimura patch fixing VELOCITY-275

Modified:
    velocity/dvsl/trunk/src/java/org/apache/tools/dvsl/DVSL.java

Modified: velocity/dvsl/trunk/src/java/org/apache/tools/dvsl/DVSL.java
URL: http://svn.apache.org/viewvc/velocity/dvsl/trunk/src/java/org/apache/tools/dvsl/DVSL.java?view=diff&rev=537525&r1=537524&r2=537525
==============================================================================
--- velocity/dvsl/trunk/src/java/org/apache/tools/dvsl/DVSL.java (original)
+++ velocity/dvsl/trunk/src/java/org/apache/tools/dvsl/DVSL.java Sat May 12 16:09:42 2007
@@ -70,13 +70,13 @@
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.context.Context;
 import org.apache.velocity.runtime.log.LogSystem;
 
 import org.dom4j.Document;
+import org.dom4j.io.SAXReader;
 
 /**
  *  Main DVSL class - use this as the helper class for apps
@@ -556,22 +556,17 @@
     public long transform(File f, Writer writer)
         throws Exception
     {
-        Reader reader = null;
-
+        InputStream is = null;
         try
         {
-            reader = new FileReader(f);
-            return xform(reader, writer);
-        }
-        catch(Exception e)
-        {
-            throw e;
+            is = new FileInputStream(f);
+            return transform(is, writer);
         }
         finally
         {
-            if (reader != null)
+            if (is != null)
             {
-                reader.close();
+                is.close();
             }
         }
     }
@@ -585,7 +580,8 @@
     public long transform(InputStream is, Writer writer)
         throws Exception
     {
-        return xform(new InputStreamReader(is), writer);
+        SAXReader reader = new SAXReader();
+        return xform(reader.read(is), writer);
     }
 
     /**
@@ -603,24 +599,7 @@
     public long transform(String infile, Writer writer)
         throws Exception
     {
-       Reader reader = null;
-
-        try
-        {
-            reader = new FileReader(infile);
-            return xform(reader, writer);
-        }
-        catch(Exception e)
-        {
-            throw e;
-        }
-        finally
-        {
-            if (reader != null)
-            {
-                reader.close();
-            }
-        }
+        return transform(new File(infile), writer);
     }
 
 



Mime
View raw message