Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Not A Bug
-
2.3.31
-
None
-
None
-
Windows
Description
I was trying to use the FileTemplateLoader. While it seemed to work fine on Linux, it did not work on Windows. The thing was that I was trying to feed it with absolute file paths, and the base directory of the FileTemplateLoader was the root directory.
It was thus "X:\" for Windows and "/" for Linux. FileTemplateLoader was unable to retrieve the files with the absolute path on Windows, because it was trying to prepend the base path to the file names. So, it was prepending the "X:\" to the absolute file paths, already containing that "X:\" directory.
@Override public Object findTemplateSource(final String name) throws IOException { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<File>() { @Override public File run() throws IOException { File source = new File(baseDir, SEP_IS_SLASH ? name : name.replace('/', File.separatorChar)); if (!source.isFile()) { return null; }
I'm not sure whether this is by design and if files must always be relative to the base path of one of the FileTemplateLoader objects.