You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by cb...@apache.org on 2016/07/16 09:35:33 UTC

svn commit: r1752917 - in /velocity/engine/trunk/velocity-engine-core/src: main/java/org/apache/velocity/runtime/resource/ main/java/org/apache/velocity/runtime/resource/loader/ test/java/org/apache/velocity/test/ test/java/org/apache/velocity/test/misc/

Author: cbrisson
Date: Sat Jul 16 09:35:32 2016
New Revision: 1752917

URL: http://svn.apache.org/viewvc?rev=1752917&view=rev
Log:
better backward compatibility handling for resource loader API change

Added:
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java
      - copied, changed from r1752787, velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
Modified:
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ResourceLoaderInstanceTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java Sat Jul 16 09:35:32 2016
@@ -22,7 +22,7 @@ package org.apache.velocity.runtime.reso
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.RuntimeConstants;
 
-import org.apache.velocity.runtime.resource.loader.ResourceLoader;
+import org.apache.velocity.runtime.resource.loader.ResourceLoader2;
 
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.exception.ParseErrorException;
@@ -45,7 +45,7 @@ public abstract class Resource
      * stream for this template, and knows how to check the
      * source of the input stream for modification.
      */
-    protected ResourceLoader resourceLoader;
+    protected ResourceLoader2 resourceLoader;
 
     /**
      * The number of milliseconds in a minute, used to calculate the
@@ -236,7 +236,7 @@ public abstract class Resource
      * in the template stream
      * @return The resource loader for this resource.
      */
-    public ResourceLoader getResourceLoader()
+    public ResourceLoader2 getResourceLoader()
     {
         return resourceLoader;
     }
@@ -247,7 +247,7 @@ public abstract class Resource
      * came from the list of possible sources.
      * @param resourceLoader
      */
-    public void setResourceLoader(ResourceLoader resourceLoader)
+    public void setResourceLoader(ResourceLoader2 resourceLoader)
     {
         this.resourceLoader = resourceLoader;
     }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Sat Jul 16 09:35:32 2016
@@ -32,7 +32,7 @@ import org.apache.velocity.exception.Res
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.RuntimeServices;
-import org.apache.velocity.runtime.resource.loader.ResourceLoader;
+import org.apache.velocity.runtime.resource.loader.ResourceLoader2;
 import org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory;
 import org.apache.velocity.util.ClassUtils;
 import org.apache.velocity.util.StringUtils;
@@ -102,7 +102,7 @@ public class ResourceManagerImpl
             return;
         }
 
-        ResourceLoader resourceLoader = null;
+        ResourceLoader2 resourceLoader = null;
 
         this.rsvc = rsvc;
         log = rsvc.getLog();
@@ -120,7 +120,7 @@ public class ResourceManagerImpl
             ExtendedProperties configuration = (ExtendedProperties) it.next();
 
             String loaderClass = StringUtils.nullTrim(configuration.getString("class"));
-            ResourceLoader loaderInstance = (ResourceLoader) configuration.get("instance");
+            ResourceLoader2 loaderInstance = (ResourceLoader2) configuration.get("instance");
 
             if (loaderInstance != null)
             {
@@ -424,7 +424,7 @@ public class ResourceManagerImpl
 
         for (Iterator it = resourceLoaders.iterator(); it.hasNext();)
         {
-            ResourceLoader resourceLoader = (ResourceLoader) it.next();
+            ResourceLoader2 resourceLoader = (ResourceLoader2) it.next();
             resource.setResourceLoader(resourceLoader);
 
             /*
@@ -516,7 +516,7 @@ public class ResourceManagerImpl
         /* check whether this can now be found in a higher priority
          * resource loader.  if so, pass the request off to loadResource.
          */
-        ResourceLoader loader = resource.getResourceLoader();
+        ResourceLoader2 loader = resource.getResourceLoader();
         if (resourceLoaders.size() > 0 && resourceLoaders.indexOf(loader) > 0)
         {
             String name = resource.getName();
@@ -583,7 +583,7 @@ public class ResourceManagerImpl
      */
     public String getLoaderNameForResource(String resourceName)
     {
-        ResourceLoader loader = getLoaderForResource(resourceName);
+        ResourceLoader2 loader = getLoaderForResource(resourceName);
         if (loader == null)
         {
             return null;
@@ -592,14 +592,14 @@ public class ResourceManagerImpl
     }
 
     /**
-     * Returns the first {@link ResourceLoader} in which the specified
+     * Returns the first {@link ResourceLoader2} in which the specified
      * resource exists.
      */
-    private ResourceLoader getLoaderForResource(String resourceName)
+    private ResourceLoader2 getLoaderForResource(String resourceName)
     {
         for (Iterator i = resourceLoaders.iterator(); i.hasNext(); )
         {
-            ResourceLoader loader = (ResourceLoader)i.next();
+            ResourceLoader2 loader = (ResourceLoader2)i.next();
             if (loader.resourceExists(resourceName))
             {
                 return loader;

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java Sat Jul 16 09:35:32 2016
@@ -21,7 +21,6 @@ package org.apache.velocity.runtime.reso
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.Reader;
 
 import org.apache.commons.collections.ExtendedProperties;
@@ -77,7 +76,7 @@ import org.apache.velocity.util.ClassUti
  * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  * @version $Id$
  */
-public class ClasspathResourceLoader extends ResourceLoader
+public class ClasspathResourceLoader extends ResourceLoader2
 {
 
     /**
@@ -93,51 +92,6 @@ public class ClasspathResourceLoader ext
     }
 
     /**
-     * Get an InputStream so that the Runtime can build a
-     * template with it.
-     *
-     * @param name name of template to get
-     * @return InputStream containing the template
-     * @throws ResourceNotFoundException if template not found
-     *         in  classpath.
-     * @deprecated use {@link #getResourceReader(String, String)}
-     */
-    public @Deprecated InputStream getResourceStream( String name )
-        throws ResourceNotFoundException
-    {
-        InputStream result = null;
-
-        if (StringUtils.isEmpty(name))
-        {
-            throw new ResourceNotFoundException ("No template name provided");
-        }
-
-        /**
-         * look for resource in thread classloader first (e.g. WEB-INF\lib in
-         * a servlet container) then fall back to the system classloader.
-         */
-
-        try
-        {
-            result = ClassUtils.getResourceAsStream( getClass(), name );
-        }
-        catch( Exception fnfe )
-        {
-            throw new ResourceNotFoundException("ClasspathResourceLoader problem with template: " + name, fnfe );
-        }
-
-        if (result == null)
-        {
-             String msg = "ClasspathResourceLoader Error: cannot find resource " +
-              name;
-
-             throw new ResourceNotFoundException( msg );
-        }
-
-        return result;
-    }
-
-    /**
      * Get a Reader so that the Runtime can build a
      * template with it.
      *
@@ -196,7 +150,7 @@ public class ClasspathResourceLoader ext
     }
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#isSourceModified(org.apache.velocity.runtime.resource.Resource)
      */
     public boolean isSourceModified(Resource resource)
     {
@@ -204,7 +158,7 @@ public class ClasspathResourceLoader ext
     }
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#getLastModified(org.apache.velocity.runtime.resource.Resource)
      */
     public long getLastModified(Resource resource)
     {

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java Sat Jul 16 09:35:32 2016
@@ -19,7 +19,6 @@ package org.apache.velocity.runtime.reso
  * under the License.
  */
 
-import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
@@ -128,7 +127,7 @@ import org.apache.velocity.util.StringUt
  * @version $Id$
  * @since 1.5
  */
-public class DataSourceResourceLoader extends ResourceLoader
+public class DataSourceResourceLoader extends ResourceLoader2
 {
     private String dataSourceName;
     private String tableName;
@@ -139,7 +138,7 @@ public class DataSourceResourceLoader ex
     private DataSource dataSource;
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#init(org.apache.commons.collections.ExtendedProperties)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.commons.collections.ExtendedProperties)
      */
     public void init(ExtendedProperties configuration)
     {
@@ -188,7 +187,7 @@ public class DataSourceResourceLoader ex
     }
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#isSourceModified(org.apache.velocity.runtime.resource.Resource)
      */
     public boolean isSourceModified(final Resource resource)
     {
@@ -197,7 +196,7 @@ public class DataSourceResourceLoader ex
     }
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#getLastModified(org.apache.velocity.runtime.resource.Resource)
      */
     public long getLastModified(final Resource resource)
     {
@@ -205,76 +204,6 @@ public class DataSourceResourceLoader ex
     }
 
     /**
-     * Get an InputStream so that the Runtime can build a
-     * template with it.
-     *
-     *  @param name name of template
-     *  @return InputStream containing template
-     * @throws ResourceNotFoundException
-     * @deprecated Use {@link #getResourceReader(String,String)}
-     */
-    public synchronized @Deprecated InputStream getResourceStream(final String name)
-        throws ResourceNotFoundException
-    {
-        if (org.apache.commons.lang3.StringUtils.isEmpty(name))
-        {
-            throw new ResourceNotFoundException("DataSourceResourceLoader: Template name was empty or null");
-        }
-
-        Connection conn = null;
-        ResultSet rs = null;
-        PreparedStatement ps = null;
-        try
-        {
-            conn = openDbConnection();
-            ps = getStatement(conn, templateColumn, tableName, keyColumn, name);
-            rs = ps.executeQuery();
-
-            if (rs.next())
-            {
-                InputStream stream = rs.getBinaryStream(templateColumn);
-                if (stream == null)
-                {
-                    throw new ResourceNotFoundException("DataSourceResourceLoader: "
-                                                        + "template column for '"
-                                                        + name + "' is null");
-                }
-
-                return new BufferedInputStream(stream);
-            }
-            else
-            {
-                throw new ResourceNotFoundException("DataSourceResourceLoader: "
-                                                    + "could not find resource '"
-                                                    + name + "'");
-
-            }
-        }
-        catch (SQLException sqle)
-        {
-            String msg = "DataSourceResourceLoader: database problem while getting resource '"
-                         + name + "': ";
-
-            log.error(msg, sqle);
-            throw new ResourceNotFoundException(msg);
-        }
-        catch (NamingException ne)
-        {
-            String msg = "DataSourceResourceLoader: database problem while getting resource '"
-                         + name + "': ";
-
-            log.error(msg, ne);
-            throw new ResourceNotFoundException(msg);
-        }
-        finally
-        {
-            closeResultSet(rs);
-            closeStatement(ps);
-            closeDbConnection(conn);
-        }
-    }
-
-    /**
      * Get an InputStream so that the Runtime can build a
      * template with it.
      *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java Sat Jul 16 09:35:32 2016
@@ -19,7 +19,6 @@ package org.apache.velocity.runtime.reso
  * under the License.
  */
 
-import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -49,7 +48,7 @@ import org.apache.velocity.util.StringUt
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  * @version $Id$
  */
-public class FileResourceLoader extends ResourceLoader
+public class FileResourceLoader extends ResourceLoader2
 {
     /**
      * The paths to search for templates.
@@ -65,7 +64,7 @@ public class FileResourceLoader extends
     private Map templatePaths = Collections.synchronizedMap(new HashMap());
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#init(org.apache.commons.collections.ExtendedProperties)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.commons.collections.ExtendedProperties)
      */
     public void init( ExtendedProperties configuration)
     {
@@ -94,86 +93,6 @@ public class FileResourceLoader extends
     }
 
     /**
-     * Get an InputStream so that the Runtime can build a
-     * template with it.
-     *
-     * @param templateName name of template to get
-     * @return InputStream containing the template
-     * @throws ResourceNotFoundException if template not found
-     * @deprecated Use {@link #getResourceReader(String,String)}
-     *         in the file template path.
-     */
-    public @Deprecated InputStream getResourceStream(String templateName)
-        throws ResourceNotFoundException
-    {
-        /*
-         * Make sure we have a valid templateName.
-         */
-        if (org.apache.commons.lang3.StringUtils.isEmpty(templateName))
-        {
-            /*
-             * If we don't get a properly formed templateName then
-             * there's not much we can do. So we'll forget about
-             * trying to search any more paths for the template.
-             */
-            throw new ResourceNotFoundException(
-                "Need to specify a file name or file path!");
-        }
-
-        String template = StringUtils.normalizePath(templateName);
-        if ( template == null || template.length() == 0 )
-        {
-            String msg = "File resource error : argument " + template +
-                " contains .. and may be trying to access " +
-                "content outside of template root.  Rejected.";
-
-            log.error("FileResourceLoader : " + msg);
-
-            throw new ResourceNotFoundException ( msg );
-        }
-
-        int size = paths.size();
-        for (int i = 0; i < size; i++)
-        {
-            String path = (String) paths.get(i);
-            InputStream rawStream = null;
-            UnicodeInputStream inputStream = null;
-
-            try
-            {
-                rawStream = findTemplate(path, template);
-                inputStream = new UnicodeInputStream(rawStream, true);
-
-            }
-            catch (IOException ioe)
-            {
-                closeQuiet(rawStream);
-                String msg = "Exception while loading Template " + template;
-                log.error(msg, ioe);
-                throw new VelocityException(msg, ioe);
-            }
-
-            if (inputStream != null)
-            {
-                /*
-                 * Store the path that this template came
-                 * from so that we can check its modification
-                 * time.
-                 */
-                templatePaths.put(templateName, path);
-                return inputStream;
-            }
-        }
-
-        /*
-         * We have now searched all the paths for
-         * templates and we didn't find anything so
-         * throw an exception.
-         */
-         throw new ResourceNotFoundException("FileResourceLoader : cannot find " + template);
-    }
-
-    /**
      * Get a Reader so that the Runtime can build a
      * template with it.
      *
@@ -410,7 +329,7 @@ public class FileResourceLoader extends
     }
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#getLastModified(org.apache.velocity.runtime.resource.Resource)
      */
     public long getLastModified(Resource resource)
     {

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java Sat Jul 16 09:35:32 2016
@@ -22,7 +22,6 @@ package org.apache.velocity.runtime.reso
 import java.io.IOException;
 import java.io.InputStream;
 
-import java.io.InputStreamReader;
 import java.io.Reader;
 import java.util.Hashtable;
 import java.util.Vector;
@@ -66,7 +65,7 @@ import org.apache.commons.collections.Ex
  * @author <a href="mailto:daveb@miceda-data.com">Dave Bryson</a>
  * @version $Id$
  */
-public class JarResourceLoader extends ResourceLoader
+public class JarResourceLoader extends ResourceLoader2
 {
     /**
      * Maps entries to the parent JAR File
@@ -169,64 +168,6 @@ public class JarResourceLoader extends R
     }
 
     /**
-     * Get an InputStream so that the Runtime can build a
-     * template with it.
-     *
-     * @param source name of template to get
-     * @return InputStream containing the template
-     * @throws ResourceNotFoundException if template not found
-     *         in the file template path.
-     * @deprecated Use {@link #getResourceReader(String, String)}
-     */
-    public @Deprecated InputStream getResourceStream( String source )
-        throws ResourceNotFoundException
-    {
-        InputStream results = null;
-
-        if (org.apache.commons.lang3.StringUtils.isEmpty(source))
-        {
-            throw new ResourceNotFoundException("Need to have a resource!");
-        }
-
-        String normalizedPath = StringUtils.normalizePath( source );
-
-        if ( normalizedPath == null || normalizedPath.length() == 0 )
-        {
-            String msg = "JAR resource error : argument " + normalizedPath +
-                " contains .. and may be trying to access " +
-                "content outside of template root.  Rejected.";
-
-            log.error( "JarResourceLoader : " + msg );
-
-            throw new ResourceNotFoundException ( msg );
-        }
-
-        /*
-         *  if a / leads off, then just nip that :)
-         */
-        if ( normalizedPath.startsWith("/") )
-        {
-            normalizedPath = normalizedPath.substring(1);
-        }
-
-        if ( entryDirectory.containsKey( normalizedPath ) )
-        {
-            String jarurl  = (String)entryDirectory.get( normalizedPath );
-
-            if ( jarfiles.containsKey( jarurl ) )
-            {
-                JarHolder holder = (JarHolder)jarfiles.get( jarurl );
-                results =  holder.getResource( normalizedPath );
-                return results;
-            }
-        }
-
-        throw new ResourceNotFoundException( "JarResourceLoader Error: cannot find resource " +
-          source );
-
-    }
-
-    /**
      * Get a Reader so that the Runtime can build a
      * template with it.
      *
@@ -305,7 +246,7 @@ public class JarResourceLoader extends R
     // TODO: SHOULD BE DELEGATED TO THE JARHOLDER
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#isSourceModified(org.apache.velocity.runtime.resource.Resource)
      */
     public boolean isSourceModified(Resource resource)
     {
@@ -313,7 +254,7 @@ public class JarResourceLoader extends R
     }
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#getLastModified(org.apache.velocity.runtime.resource.Resource)
      */
     public long getLastModified(Resource resource)
     {

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java Sat Jul 16 09:35:32 2016
@@ -40,102 +40,15 @@ import org.apache.commons.collections.Ex
  * This is abstract class the all text resource loaders should
  * extend.
  *
+ * @deprecated - use {@link ResourceLoader2}
+ *
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  * @version $Id$
  */
-public abstract class ResourceLoader
+public @Deprecated abstract class ResourceLoader extends ResourceLoader2
 {
     /**
-     * Does this loader want templates produced with it
-     * cached in the Runtime.
-     */
-    protected boolean isCachingOn = false;
-
-    /**
-     * This property will be passed on to the templates
-     * that are created with this loader.
-     */
-    protected long modificationCheckInterval = 2;
-
-    /**
-     * Class name for this loader, for logging/debuggin
-     * purposes.
-     */
-    protected String className = null;
-
-    protected RuntimeServices rsvc = null;
-    protected Logger log = null;
-
-    /**
-     * This initialization is used by all resource
-     * loaders and must be called to set up common
-     * properties shared by all resource loaders
-     *
-     * @param rs
-     * @param configuration
-     */
-    public void commonInit(RuntimeServices rs, ExtendedProperties configuration)
-    {
-        this.rsvc = rs;
-        this.log = rsvc.getLog();
-
-        /*
-         *  these two properties are not required for all loaders.
-         *  For example, for ClasspathLoader, what would cache mean?
-         *  so adding default values which I think are the safest
-         *
-         *  don't cache, and modCheckInterval irrelevant...
-         */
-
-        try
-        {
-            isCachingOn = configuration.getBoolean("cache", false);
-        }
-        catch (Exception e)
-        {
-            isCachingOn = false;
-            String msg = "Exception parsing cache setting: " + configuration.getString("cache");
-            log.error(msg, e);
-            throw new VelocityException(msg, e);
-        }
-        try
-        {
-            modificationCheckInterval = configuration.getLong("modificationCheckInterval", 0);
-        }
-        catch (Exception e)
-        {
-            modificationCheckInterval = 0;
-            String msg = "Exception parsing modificationCheckInterval setting: " + configuration.getString("modificationCheckInterval");
-            log.error(msg, e);
-            throw new VelocityException(msg, e);
-        }
-
-        /*
-         * this is a must!
-         */
-        className = ResourceCacheImpl.class.getName();
-        try
-        {
-            className = configuration.getString("class", className);
-        }
-        catch (Exception e)
-        {
-            String msg = "Exception retrieving resource cache class name";
-            log.error(msg, e);
-            throw new VelocityException(msg, e);
-        }
-    }
-
-    /**
-     * Initialize the template loader with a
-     * a resources class.
-     *
-     * @param configuration
-     */
-    public abstract void init(ExtendedProperties configuration);
-
-    /**
      * Get the InputStream that the Runtime will parse
      * to create a template.
      *
@@ -187,181 +100,4 @@ public abstract class ResourceLoader
             throw new VelocityException(msg, ioe);
         }
     }
-
-    /**
-     * Given a template, check to see if the source of InputStream
-     * has been modified.
-     *
-     * @param resource
-     * @return True if the resource has been modified.
-     */
-    public abstract boolean isSourceModified(Resource resource);
-
-    /**
-     * Get the last modified time of the InputStream source
-     * that was used to create the template. We need the template
-     * here because we have to extract the name of the template
-     * in order to locate the InputStream source.
-     *
-     * @param resource
-     * @return Time in millis when the resource has been modified.
-     */
-    public abstract long getLastModified(Resource resource);
-
-    /**
-     * Return the class name of this resource Loader
-     *
-     * @return Class name of the resource loader.
-     */
-    public String getClassName()
-    {
-        return className;
-    }
-
-    /**
-     * Set the caching state. If true, then this loader
-     * would like the Runtime to cache templates that
-     * have been created with InputStreams provided
-     * by this loader.
-     *
-     * @param value
-     */
-    public void setCachingOn(boolean value)
-    {
-        isCachingOn = value;
-    }
-
-    /**
-     * The Runtime uses this to find out whether this
-     * template loader wants the Runtime to cache
-     * templates created with InputStreams provided
-     * by this loader.
-     *
-     * @return True if this resource loader caches.
-     */
-    public boolean isCachingOn()
-    {
-        return isCachingOn;
-    }
-
-    /**
-     * Set the interval at which the InputStream source
-     * should be checked for modifications.
-     *
-     * @param modificationCheckInterval
-     */
-    public void setModificationCheckInterval(long modificationCheckInterval)
-    {
-        this.modificationCheckInterval = modificationCheckInterval;
-    }
-
-    /**
-     * Get the interval at which the InputStream source
-     * should be checked for modifications.
-     *
-     * @return The modification check interval.
-     */
-    public long getModificationCheckInterval()
-    {
-        return modificationCheckInterval;
-    }
-
-    /**
-     * Check whether any given resource exists. This is not really
-     * a very efficient test and it can and should be overridden in the
-     * subclasses extending ResourceLoader.
-     *
-     * @param resourceName The name of a resource.
-     * @return true if a resource exists and can be accessed.
-     * @since 1.6
-     */
-    public boolean resourceExists(final String resourceName)
-    {
-        Reader reader = null;
-        try
-        {
-            reader = getResourceReader(resourceName, null);
-        }
-        catch (ResourceNotFoundException e)
-        {
-            if (log.isDebugEnabled())
-            {
-                log.debug("Could not load resource '{}' from ResourceLoader {}",
-                        resourceName, this.getClass().getName(), e);
-            }
-        }
-        finally
-        {
-            try
-            {
-                if (reader != null)
-                {
-                    reader.close();
-                }
-            }
-            catch (Exception e)
-            {
-                if (log.isErrorEnabled())
-                {
-                    String msg = "While closing InputStream for resource '" +
-                            resourceName + "' from ResourceLoader " +
-                            this.getClass().getName();
-                    log.error(msg, e);
-                    throw new VelocityException(msg, e);
-                }
-            }
-        }
-        return (reader != null);
-    }
-
-    /**
-     * Builds a Reader given a raw InputStream and an encoding. Should be use
-     * by every subclass that whishes to accept optional BOMs in resources.
-     * This method does *not* close the given input stream whenever an exception is thrown.
-     *
-     * @param rawStream The raw input stream.
-     * @param encoding  The asked encoding.
-     * @return found reader
-     * @throws IOException, UnsupportedEncodingException
-     * @since 2.0
-     */
-    protected Reader buildReader(InputStream rawStream, String encoding)
-            throws IOException, UnsupportedEncodingException
-    {
-        UnicodeInputStream inputStream = new UnicodeInputStream(rawStream);
-        /*
-         * Check encoding
-         */
-        String foundEncoding = inputStream.getEncodingFromStream();
-        if (foundEncoding != null && encoding != null && !UnicodeInputStream.sameEncoding(foundEncoding, encoding))
-        {
-            log.warn("Found BOM encoding '{}' differs from asked encoding: '{}' - using BOM encoding to read resource.", foundEncoding, encoding);
-            encoding = foundEncoding;
-        }
-        if (encoding == null)
-        {
-            if (foundEncoding == null)
-            {
-                encoding = rsvc.getString(RuntimeConstants.INPUT_ENCODING);
-            } else
-            {
-                encoding = foundEncoding;
-            }
-        }
-
-        try
-        {
-            return new InputStreamReader(inputStream, encoding);
-        }
-        catch (UnsupportedEncodingException uee)
-        {
-            try
-            {
-                inputStream.close();
-            }
-            catch (IOException ioe) {}
-            throw uee;
-        }
-    }
-
 }

Copied: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java (from r1752787, velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java)
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java?p2=velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java&p1=velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java&r1=1752787&r2=1752917&rev=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader2.java Sat Jul 16 09:35:32 2016
@@ -19,22 +19,21 @@ package org.apache.velocity.runtime.reso
  * under the License.    
  */
 
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-
+import org.apache.commons.collections.ExtendedProperties;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.io.UnicodeInputStream;
 import org.apache.velocity.runtime.RuntimeConstants;
-import org.slf4j.Logger;
-
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.resource.Resource;
 import org.apache.velocity.runtime.resource.ResourceCacheImpl;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.exception.VelocityException;
-import org.apache.commons.collections.ExtendedProperties;
+import org.slf4j.Logger;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
 
 /**
  * This is abstract class the all text resource loaders should
@@ -42,9 +41,10 @@ import org.apache.commons.collections.Ex
  *
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @author <a href="mailto:claude.brisson@gmail.com">Claude Brisson</a>
  * @version $Id$
  */
-public abstract class ResourceLoader
+public abstract class ResourceLoader2
 {
     /**
      * Does this loader want templates produced with it
@@ -136,20 +136,6 @@ public abstract class ResourceLoader
     public abstract void init(ExtendedProperties configuration);
 
     /**
-     * Get the InputStream that the Runtime will parse
-     * to create a template.
-     *
-     * @param source
-     * @return The input stream for the requested resource.
-     * @throws ResourceNotFoundException
-     * @deprecated Use {@link #getResourceReader(String, String)}
-     */
-    public
-    @Deprecated
-    abstract InputStream getResourceStream(String source)
-            throws ResourceNotFoundException;
-
-    /**
      * Get the Reader that the Runtime will parse
      * to create a template.
      *
@@ -158,35 +144,8 @@ public abstract class ResourceLoader
      * @throws ResourceNotFoundException
      * @since 2.0
      */
-    public Reader getResourceReader(String source, String encoding)
-            throws ResourceNotFoundException
-    {
-        /*
-         * We provide a default implementation that relies on the deprecated method getResourceStream()
-         * to enhance backward compatibility. The day getResourceStream() is removed, this method should
-         * become abstract.
-         */
-        InputStream rawStream = null;
-        try
-        {
-            rawStream = getResourceStream(source);
-            return buildReader(rawStream, encoding);
-        }
-        catch(IOException ioe)
-        {
-            if (rawStream != null)
-            {
-                try
-                {
-                    rawStream.close();
-                }
-                catch (IOException e) {}
-            }
-            String msg = "Exception while loading resousrce " + source;
-            log.error(msg, ioe);
-            throw new VelocityException(msg, ioe);
-        }
-    }
+    public abstract Reader getResourceReader(String source, String encoding)
+            throws ResourceNotFoundException;
 
     /**
      * Given a template, check to see if the source of InputStream
@@ -269,7 +228,7 @@ public abstract class ResourceLoader
     /**
      * Check whether any given resource exists. This is not really
      * a very efficient test and it can and should be overridden in the
-     * subclasses extending ResourceLoader.
+     * subclasses extending ResourceLoader2.
      *
      * @param resourceName The name of a resource.
      * @return true if a resource exists and can be accessed.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java Sat Jul 16 09:35:32 2016
@@ -37,13 +37,13 @@ public class ResourceLoaderFactory
      * @param loaderClassName
      * @return TemplateLoader
      */
-    public static ResourceLoader getLoader(RuntimeServices rs, String loaderClassName)
+    public static ResourceLoader2 getLoader(RuntimeServices rs, String loaderClassName)
     {
-        ResourceLoader loader = null;
+        ResourceLoader2 loader = null;
 
         try
         {
-            loader = (ResourceLoader) ClassUtils.getNewInstance( loaderClassName );
+            loader = (ResourceLoader2) ClassUtils.getNewInstance( loaderClassName );
 
             rs.getLog().debug("ResourceLoader instantiated: "
                               + loader.getClass().getName());

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java Sat Jul 16 09:35:32 2016
@@ -113,7 +113,7 @@ import org.apache.velocity.util.ClassUti
  * @version $Id$
  * @since 1.5
  */
-public class StringResourceLoader extends ResourceLoader
+public class StringResourceLoader extends ResourceLoader2
 {
     /**
      * Key to determine whether the repository should be set as the static one or not.
@@ -210,7 +210,7 @@ public class StringResourceLoader extend
 
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#init(org.apache.commons.collections.ExtendedProperties)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.commons.collections.ExtendedProperties)
      */
     public void init(final ExtendedProperties configuration)
     {
@@ -341,44 +341,6 @@ public class StringResourceLoader extend
     }
 
     /**
-     * Get an InputStream so that the Runtime can build a
-     * template with it.
-     *
-     * @param name name of template to get.
-     * @return InputStream containing the template.
-     * @throws ResourceNotFoundException Ff template not found
-     *         in the RepositoryFactory.
-     * @deprecated use {@link #getResourceReader(String,String)}
-     */
-    public @Deprecated InputStream getResourceStream(final String name)
-            throws ResourceNotFoundException
-    {
-        if (StringUtils.isEmpty(name))
-        {
-            throw new ResourceNotFoundException("No template name provided");
-        }
-
-        StringResource resource = this.repository.getStringResource(name);
-
-        if(resource == null)
-        {
-            throw new ResourceNotFoundException("Could not locate resource '" + name + "'");
-        }
-
-        byte [] byteArray = null;
-
-        try
-        {
-            byteArray = resource.getBody().getBytes(resource.getEncoding());
-            return new ByteArrayInputStream(byteArray);
-        }
-        catch(UnsupportedEncodingException ue)
-        {
-            throw new VelocityException("Could not convert String using encoding " + resource.getEncoding(), ue);
-        }
-    }
-
-    /**
      * Get a reader so that the Runtime can build a
      * template with it.
      *
@@ -441,7 +403,7 @@ public class StringResourceLoader extend
     }
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#isSourceModified(org.apache.velocity.runtime.resource.Resource)
      */
     public boolean isSourceModified(final Resource resource)
     {
@@ -459,7 +421,7 @@ public class StringResourceLoader extend
     }
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#getLastModified(org.apache.velocity.runtime.resource.Resource)
      */
     public long getLastModified(final Resource resource)
     {

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java Sat Jul 16 09:35:32 2016
@@ -21,7 +21,6 @@ package org.apache.velocity.runtime.reso
 
 import java.io.InputStream;
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.io.Reader;
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -41,7 +40,7 @@ import org.apache.commons.lang3.StringUt
  * @version $Id: URLResourceLoader.java 191743 2005-06-21 23:22:20Z dlr $
  * @since 1.5
  */
-public class URLResourceLoader extends ResourceLoader
+public class URLResourceLoader extends ResourceLoader2
 {
     private String[] roots = null;
     protected HashMap templateRoots = null;
@@ -49,7 +48,7 @@ public class URLResourceLoader extends R
     private Method[] timeoutMethods;
 
     /**
-     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#init(org.apache.commons.collections.ExtendedProperties)
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader2#init(org.apache.commons.collections.ExtendedProperties)
      */
     public void init(ExtendedProperties configuration)
     {
@@ -89,75 +88,6 @@ public class URLResourceLoader extends R
     }
 
     /**
-     * Get an InputStream so that the Runtime can build a
-     * template with it.
-     *
-     * @param name name of template to fetch bytestream of
-     * @return InputStream containing the template
-     * @throws ResourceNotFoundException if template not found
-     *         in the file template path.
-     * @deprecated Use {@link #findTemplateReader(source)}
-     */
-    public synchronized @Deprecated InputStream getResourceStream(String name)
-        throws ResourceNotFoundException
-    {
-        if (StringUtils.isEmpty(name))
-        {
-            throw new ResourceNotFoundException("URLResourceLoader : No template name provided");
-        }
-
-        InputStream inputStream = null;
-        Exception exception = null;
-        for(int i=0; i < roots.length; i++)
-        {
-            try
-            {
-                URL u = new URL(roots[i] + name);
-                URLConnection conn = u.openConnection();
-                tryToSetTimeout(conn);
-                inputStream = conn.getInputStream();
-
-                if (inputStream != null)
-                {
-                    if (log.isDebugEnabled()) log.debug("URLResourceLoader: Found '{}' at '{}'", name, roots[i]);
-
-                    // save this root for later re-use
-                    templateRoots.put(name, roots[i]);
-                    break;
-                }
-            }
-            catch(IOException ioe)
-            {
-                if (log.isDebugEnabled()) log.debug("URLResourceLoader: Exception when looking for '{}' at '{}'", name, roots[i], ioe);
-
-                // only save the first one for later throwing
-                if (exception == null)
-                {
-                    exception = ioe;
-                }
-            }
-        }
-
-        // if we never found the template
-        if (inputStream == null)
-        {
-            String msg;
-            if (exception == null)
-            {
-                msg = "URLResourceLoader : Resource '" + name + "' not found.";
-            }
-            else
-            {
-                msg = exception.getMessage();
-            }
-            // convert to a general Velocity ResourceNotFoundException
-            throw new ResourceNotFoundException(msg);
-        }
-
-        return inputStream;
-    }
-
-    /**
      * Get a Reader so that the Runtime can build a
      * template with it.
      *

Modified: velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ResourceLoaderInstanceTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ResourceLoaderInstanceTestCase.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ResourceLoaderInstanceTestCase.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ResourceLoaderInstanceTestCase.java Sat Jul 16 09:35:32 2016
@@ -32,12 +32,12 @@ import org.apache.velocity.VelocityConte
 import org.apache.velocity.app.Velocity;
 import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.RuntimeSingleton;
-import org.apache.velocity.test.misc.TestLogger;
 import org.apache.velocity.runtime.resource.loader.FileResourceLoader;
-import org.apache.velocity.runtime.resource.loader.ResourceLoader;
+import org.apache.velocity.runtime.resource.loader.ResourceLoader2;
+import org.apache.velocity.test.misc.TestLogger;
 
 /**
- * Test that an instance of a ResourceLoader can be successfully passed in.
+ * Test that an instance of a ResourceLoader2 can be successfully passed in.
  *
  * @author <a href="mailto:wglass@apache.org">Will Glass-Husain</a>
  * @version $Id$
@@ -89,7 +89,7 @@ public class ResourceLoaderInstanceTestC
             throws Exception
     {
 
-        ResourceLoader rl = new FileResourceLoader();
+        ResourceLoader2 rl = new FileResourceLoader();
 
         // pass in an instance to Velocity
         Velocity.reset();

Modified: velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java?rev=1752917&r1=1752916&r2=1752917&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java Sat Jul 16 09:35:32 2016
@@ -19,13 +19,12 @@ package org.apache.velocity.test.misc;
  * under the License.    
  */
 
-import java.io.InputStream;
 import java.io.Reader;
 
 import org.apache.commons.collections.ExtendedProperties;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.resource.Resource;
-import org.apache.velocity.runtime.resource.loader.ResourceLoader;
+import org.apache.velocity.runtime.resource.loader.ResourceLoader2;
 
 /**
  * Resource Loader that always throws an exception.  Used to test
@@ -34,18 +33,13 @@ import org.apache.velocity.runtime.resou
  * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
  * @version $Id$
  */
-public class ExceptionGeneratingResourceLoader extends ResourceLoader
+public class ExceptionGeneratingResourceLoader extends ResourceLoader2
 {
 
     public void init(ExtendedProperties configuration)
     {
     }
 
-    public @Deprecated InputStream getResourceStream(String source) throws ResourceNotFoundException
-    {
-        throw new RuntimeException("exception");
-    }
-
     public Reader getResourceReader(String source, String encoding) throws ResourceNotFoundException
     {
         throw new RuntimeException("exception");