velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r546678 - /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolManager.java
Date Wed, 13 Jun 2007 00:06:22 GMT
Author: nbubna
Date: Tue Jun 12 17:06:21 2007
New Revision: 546678

URL: http://svn.apache.org/viewvc?view=rev&rev=546678
Log:
break retrieval of FileInputStream into separate method

Modified:
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolManager.java

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolManager.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolManager.java?view=diff&rev=546678&r1=546677&r2=546678
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolManager.java (original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolManager.java Tue
Jun 12 17:06:21 2007
@@ -213,20 +213,7 @@
         if (inputStream == null)
         {
             // then, try the file system directly
-            File file = new File(path);
-            if (file.exists())
-            {
-                try
-                {
-                    inputStream = new FileInputStream(file);
-                }
-                catch (FileNotFoundException fnfe)
-                {
-                    // we should not be able to get here
-                    // since we already checked whether the file exists
-                    throw new IllegalStateException(fnfe);
-                }
-            }
+            inputStream = getFileInputStream(path);
         }
 
         // if we still haven't found one
@@ -236,5 +223,23 @@
         }
         return inputStream;
     }
-    
+
+    protected InputStream getFileInputStream(String path)
+    {
+        File file = new File(path);
+        if (file.exists())
+        {
+            try
+            {
+                return new FileInputStream(file);
+            }
+            catch (FileNotFoundException fnfe)
+            {
+                // we should not be able to get here
+                // since we already checked whether the file exists
+                throw new IllegalStateException(fnfe);
+            }
+        }
+        return null;
+    }
 }



Mime
View raw message