You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by wg...@apache.org on 2005/01/07 02:27:12 UTC

svn commit: r124470 - in jakarta/velocity/trunk: build src/java/org/apache/velocity/runtime/resource/loader src/java/org/apache/velocity/test test/absolute

Author: wglass
Date: Thu Jan  6 17:27:10 2005
New Revision: 124470

URL: http://svn.apache.org/viewcvs?view=rev&rev=124470
Log:
backed out absolute file name use (r124382) to due security concern
Removed:
   jakarta/velocity/trunk/src/java/org/apache/velocity/test/AbsoluteFileResourceLoaderTest.java
   jakarta/velocity/trunk/test/absolute/
Modified:
   jakarta/velocity/trunk/build/testcases.xml
   jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java

Modified: jakarta/velocity/trunk/build/testcases.xml
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/build/testcases.xml?view=diff&rev=124470&p1=jakarta/velocity/trunk/build/testcases.xml&r1=124469&p2=jakarta/velocity/trunk/build/testcases.xml&r2=124470
==============================================================================
--- jakarta/velocity/trunk/build/testcases.xml	(original)
+++ jakarta/velocity/trunk/build/testcases.xml	Thu Jan  6 17:27:10 2005
@@ -53,7 +53,6 @@
 
   <target name="test-all" depends="
                                    test-template,
-                                   test-absolutefileloader,
                                    test-velocityapp,
                                    test-introspect,
                                    test-introspect2,
@@ -88,17 +87,6 @@
       <classpath refid="classpath"/>
     </java>
    </target>
-   
-   <target name="test-absolutefileloader">
-    <echo message="Running absolute file resource loader test..."/>
-
-    <java classname="${velocity.test.runner}" fork="yes"
-          failonerror="${testbed.failonerror}">
-      <arg value="org.apache.velocity.test.AbsoluteFileResourceLoaderTest"/>
-      <classpath refid="classpath"/>
-  </java>
-  </target>
-   
 
  <target name="test-eventhandling">
     <echo message="Running Event Handler tests..."/>

Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java?view=diff&rev=124470&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java&r1=124469&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java&r2=124470
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java	(original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java	Thu Jan  6 17:27:10 2005
@@ -36,7 +36,6 @@
 /**
  * A loader for templates stored on the file system.
  *
- * @author <a href="mailto:wglass@apache.org">Will Glass-Husain</a>
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  * @version $Id$
  */
@@ -86,7 +85,6 @@
     public synchronized InputStream getResourceStream(String templateName)
         throws ResourceNotFoundException
     {
-
         /*
          * Make sure we have a valid templateName.
          */
@@ -163,7 +161,7 @@
     {
         try 
         {
-            File file = getFile(path,template);
+            File file = new File( path, template );   
         
             if ( file.canRead() )
             {
@@ -208,13 +206,13 @@
         for (int i = 0; currentFile == null && i < paths.size(); i++)
         {
             String testPath = (String) paths.get(i);
-            File testFile = getFile(testPath, fileName);
+            File testFile = new File(testPath, fileName);
             if (testFile.canRead())
             {
                 currentFile = testFile;
             }
         }
-        File file = getFile(path, fileName);
+        File file = new File(path, fileName);
         if (currentFile == null || !file.exists())
         {
             /*
@@ -246,7 +244,7 @@
     public long getLastModified(Resource resource)
     {
         String path = (String) templatePaths.get(resource.getName());
-        File file = getFile(path, resource.getName());
+        File file = new File(path, resource.getName());
 
         if (file.canRead())
         {
@@ -256,21 +254,5 @@
         {
             return 0;
         }            
-    }
-
-
-    /**
-     * Create a File based on either a relative path if given, or absolute path otherwise
-     */
-    private File getFile(String path, String template)
-    {
-        File file = null;
-
-        if( "".equals(path) )
-            file = new File( template );
-        else
-            file = new File ( path, template );
-
-        return file;
     }
 }

Deleted: /jakarta/velocity/trunk/src/java/org/apache/velocity/test/AbsoluteFileResourceLoaderTest.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/test/AbsoluteFileResourceLoaderTest.java?view=auto&rev=124469
==============================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org