Velocity
  1. Velocity
  2. VELOCITY-144

Allow absolute filename with FileResourceLoader

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3-rc1
    • Fix Version/s: 1.5
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: PC

      Description

      There is no way of providing an absolute path (e.g. c:\temp\wibble.tmp) to the
      FileResourceLoader because it always attempts to use the 2-argument File
      constructor (even if the path component is empty).

      The following fix resolves this problem:
      In FileResourceLoader.findTemplate replace:
      File file = new File( path, template );
      with
      File file = null;

      if("".equals(path))
      file = new File( template );
      else
      file = new File ( path, template );

      Note this does not introduce any security risks as the FileResourceLoader must
      be configured to search the empty ("") path.

        Activity

        Dale Peakall created issue -
        Jeff Turner made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 17379 12315014
        Will Glass-Husain made changes -
        Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Henning Schmiedehausen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12325019 ] Default workflow, editable Closed status [ 12551906 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551906 ] jira [ 12552687 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Dale Peakall
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development