~ubuntu-branches/ubuntu/wily/plexus-velocity/wily

« back to all changes in this revision

Viewing changes to src/main/java/org/codehaus/plexus/velocity/SiteResourceLoader.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-08-06 10:56:03 UTC
  • mfrom: (1.1.2) (2.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20130806105603-jj3sb2w91rnh01b3
Tags: 1.1.8-1
* New upstream release
* Switched the build dependency on Commons Collections to 3.x
* debian/control:
  - Updated Standards-Version to 3.9.4 (no changes)
  - Removed Michael Koch from the uploaders (Closes: #654128)
  - Use canonical URLs for the Vcs-* fields
* debian/copyright: Updated the Format URI

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import org.apache.velocity.exception.ResourceNotFoundException;
22
22
 
23
23
import java.io.InputStream;
 
24
import java.io.File;
24
25
import java.io.FileInputStream;
25
26
import java.io.FileNotFoundException;
26
27
 
36
37
{
37
38
    private static String resource;
38
39
 
 
40
    private static File resourceDir;
 
41
 
39
42
    public static void setResource( String staticResource )
40
43
    {
41
44
        resource = staticResource;
 
45
        resourceDir = new File( resource ).getParentFile();
42
46
    }
43
47
 
44
48
    public void init( ExtendedProperties p )
52
56
        {
53
57
            try
54
58
            {
55
 
                return new FileInputStream( resource );
 
59
                File f = new File( resourceDir, name );
 
60
                if ( f.exists() )
 
61
                {
 
62
                    return new FileInputStream( f );
 
63
                }
 
64
                else
 
65
                {
 
66
                    return new FileInputStream( resource );
 
67
                }
56
68
            }
57
69
            catch ( FileNotFoundException e )
58
70
            {