[ 
https://issues.apache.org/jira/browse/AVRO-3371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

radai rosenblatt updated AVRO-3371:
-----------------------------------
    Description: 
when building master on windows, I get the following failure in the 
avro-maven-plugin java module:
{code:java}
[INFO] Running org.apache.avro.mojo.TestIDLProtocolMojo
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.2 s 
<<< FAILURE! - in org.apache.avro.mojo.TestIDLProtocolMojo
[ERROR] 
org.apache.avro.mojo.TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools 
 Time elapsed: 0.06 s  <<< ERROR!
java.lang.RuntimeException: 
org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
resource 
'C:\Users\radai\work\avro\lang\java\maven-plugin/src/test/resources/templates/enum.vm'
        at 
org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:551)
        at 
org.apache.avro.compiler.specific.SpecificCompiler.compile(SpecificCompiler.java:629)
        at 
org.apache.avro.compiler.specific.SpecificCompiler.compileToDestination(SpecificCompiler.java:538)
        at 
org.apache.avro.mojo.IDLProtocolMojo.doCompile(IDLProtocolMojo.java:107)
        at 
org.apache.avro.mojo.AbstractAvroMojo.compileFiles(AbstractAvroMojo.java:281)
        at 
org.apache.avro.mojo.AbstractAvroMojo.execute(AbstractAvroMojo.java:231)
        at 
org.apache.avro.mojo.TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools(TestIDLProtocolMojo.java:68)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at junit.framework.TestCase.runTest(TestCase.java:177)
        at junit.framework.TestCase.runBare(TestCase.java:142)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:130)
        at junit.framework.TestSuite.runTest(TestSuite.java:241)
        at junit.framework.TestSuite.run(TestSuite.java:236)
        at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:405)
        at 
org.apache.maven.surefire.junitcore.pc.InvokerStrategy.schedule(InvokerStrategy.java:54)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:362)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at 
org.apache.maven.surefire.junitcore.pc.ParallelComputerBuilder$PC$1.run(ParallelComputerBuilder.java:590)
        at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:157)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
        at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)
Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to 
find resource 
'C:\Users\radai\work\avro\lang\java\maven-plugin/src/test/resources/templates/enum.vm'
        at 
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:465)
        at 
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
        at 
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
        at 
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
        at 
org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314)
        at 
org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:549)
        ... 50 more {code}
this fails 2 other tests in the same module as well:
{code:java}
[ERROR] Errors:
[ERROR]   TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools:68 ▒ 
Runtime org.ap...
[ERROR]   TestProtocolMojo.testSetCompilerVelocityAdditionalTools:59 ▒ Runtime 
org.apach...
[ERROR]   TestSchemaMojo.testSetCompilerVelocityAdditionalTools:59 ▒ Runtime 
org.apache.... {code}
the root issue as far as i can tell seems to be this velocity configuration in 
SpecificCompiler:
{code:java}
private void initializeVelocity() {
   ...
   velocityEngine.addProperty("resource.loader.file.path", "/, .");
   ...
} {code}
which defines 2 "root paths": "/" and "."

however, under windows and given a path of the form "C:/<whatever>" this will 
try looking for either "/C:/<whatever>" or "./C:/<whatever>" - both are "wrong" 
for a windows absolute path.

 

relevant code is in 
org.apache.velocity.runtime.resource.loader.FileResourceLoader.getFile():
{code:java}
private File getFile(String path, String template) {
   File file = null; 
   if("".equals(path)) {
      file = new File( template );   <---- NEVER TAKEN
   } else {
      if (template.startsWith("/")) {
         template = template.substring(1);
      }
      file = new File ( path, template );
   }
   return file;
}{code}
quickest fix i can think of is add "" as a 3rd possible root to velocity config 
in class SpecificCompiler

  was:
when building master on windows, I get the following failure in the 
avro-maven-plugin java module:

```

[INFO] Running org.apache.avro.mojo.TestIDLProtocolMojo
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.2 s 
<<< FAILURE! - in org.apache.avro.mojo.TestIDLProtocolMojo
[ERROR] 
org.apache.avro.mojo.TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools 
 Time elapsed: 0.06 s  <<< ERROR!
java.lang.RuntimeException: 
org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
resource 
'C:\Users\radai\work\avro\lang\java\maven-plugin/src/test/resources/templates/enum.vm'
        at 
org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:551)
        at 
org.apache.avro.compiler.specific.SpecificCompiler.compile(SpecificCompiler.java:629)
        at 
org.apache.avro.compiler.specific.SpecificCompiler.compileToDestination(SpecificCompiler.java:538)
        at 
org.apache.avro.mojo.IDLProtocolMojo.doCompile(IDLProtocolMojo.java:107)
        at 
org.apache.avro.mojo.AbstractAvroMojo.compileFiles(AbstractAvroMojo.java:281)
        at 
org.apache.avro.mojo.AbstractAvroMojo.execute(AbstractAvroMojo.java:231)
        at 
org.apache.avro.mojo.TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools(TestIDLProtocolMojo.java:68)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at junit.framework.TestCase.runTest(TestCase.java:177)
        at junit.framework.TestCase.runBare(TestCase.java:142)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:130)
        at junit.framework.TestSuite.runTest(TestSuite.java:241)
        at junit.framework.TestSuite.run(TestSuite.java:236)
        at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:405)
        at 
org.apache.maven.surefire.junitcore.pc.InvokerStrategy.schedule(InvokerStrategy.java:54)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:362)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at 
org.apache.maven.surefire.junitcore.pc.ParallelComputerBuilder$PC$1.run(ParallelComputerBuilder.java:590)
        at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:157)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
        at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)
Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to 
find resource 
'C:\Users\radai\work\avro\lang\java\maven-plugin/src/test/resources/templates/enum.vm'
        at 
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:465)
        at 
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
        at 
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
        at 
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
        at 
org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314)
        at 
org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:549)
        ... 50 more

```

 

this fails 2 other tests in the same module as well:

```

[ERROR] Errors:
[ERROR]   TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools:68 ▒ 
Runtime org.ap...
[ERROR]   TestProtocolMojo.testSetCompilerVelocityAdditionalTools:59 ▒ Runtime 
org.apach...
[ERROR]   TestSchemaMojo.testSetCompilerVelocityAdditionalTools:59 ▒ Runtime 
org.apache....

```

 

the root issue as far as i can tell seems to be this velocity configuration in 
SpecificCompiler:

```java

{color:#cc7832}private void {color}{color:#ffc66d}initializeVelocity{color}() {
{color:#cc7832}...{color}{color:#cc7832}
{color}{color:#cc7832} 
{color}{color:#9876aa}velocityEngine{color}.addProperty({color:#6a8759}"resource.loader.file.path"{color}{color:#cc7832},
 {color}{color:#6a8759}"/, ."{color}){color:#cc7832};
{color}...}

```

which defines 2 "root paths": "/" and "."

however, under windows and given a path of the form "C:/<whatever" this will 
try looking for either "/C:/<whatever>" or "./C:/<whatever>" - both are "wrong" 
for a windows absolute path.

 

relevant code is in 
org.apache.velocity.runtime.resource.loader.FileResourceLoader.getFile():

```java

{color:#cc7832}private {color}File {color:#ffc66d}getFile{color}(String 
path{color:#cc7832}, {color}String template) {
File file = {color:#cc7832}null;{color}{color:#cc7832}
{color}{color:#cc7832} if{color}({color:#6a8759}""{color}.equals(path)) {
   file = {color:#cc7832}new {color}File( template ){color:#cc7832};   <---- 
NEVER TAKEN
{color}{color:#cc7832} {color}} {color:#cc7832}else{color} {
   {color:#cc7832}if {color}(template.startsWith({color:#6a8759}"/"{color})) {
      template = template.substring({color:#6897bb}1{color}){color:#cc7832};
{color}{color:#cc7832}   {color}}
   file = {color:#cc7832}new {color}File ( path{color:#cc7832}, {color}template 
){color:#cc7832};
{color}{color:#cc7832} {color}}
{color:#cc7832}return {color}file{color:#cc7832};
{color}}

```

 

quickest fix i can think of is add "" as a 3rd possible root to velocity config 
in class SpecificCompiler


> velocity fails to find file by absolute path on windows
> -------------------------------------------------------
>
>                 Key: AVRO-3371
>                 URL: https://issues.apache.org/jira/browse/AVRO-3371
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.11.0
>            Reporter: radai rosenblatt
>            Priority: Major
>
> when building master on windows, I get the following failure in the 
> avro-maven-plugin java module:
> {code:java}
> [INFO] Running org.apache.avro.mojo.TestIDLProtocolMojo
> [ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.2 s 
> <<< FAILURE! - in org.apache.avro.mojo.TestIDLProtocolMojo
> [ERROR] 
> org.apache.avro.mojo.TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools
>   Time elapsed: 0.06 s  <<< ERROR!
> java.lang.RuntimeException: 
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
> resource 
> 'C:\Users\radai\work\avro\lang\java\maven-plugin/src/test/resources/templates/enum.vm'
>         at 
> org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:551)
>         at 
> org.apache.avro.compiler.specific.SpecificCompiler.compile(SpecificCompiler.java:629)
>         at 
> org.apache.avro.compiler.specific.SpecificCompiler.compileToDestination(SpecificCompiler.java:538)
>         at 
> org.apache.avro.mojo.IDLProtocolMojo.doCompile(IDLProtocolMojo.java:107)
>         at 
> org.apache.avro.mojo.AbstractAvroMojo.compileFiles(AbstractAvroMojo.java:281)
>         at 
> org.apache.avro.mojo.AbstractAvroMojo.execute(AbstractAvroMojo.java:231)
>         at 
> org.apache.avro.mojo.TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools(TestIDLProtocolMojo.java:68)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at junit.framework.TestCase.runTest(TestCase.java:177)
>         at junit.framework.TestCase.runBare(TestCase.java:142)
>         at junit.framework.TestResult$1.protect(TestResult.java:122)
>         at junit.framework.TestResult.runProtected(TestResult.java:142)
>         at junit.framework.TestResult.run(TestResult.java:125)
>         at junit.framework.TestCase.run(TestCase.java:130)
>         at junit.framework.TestSuite.runTest(TestSuite.java:241)
>         at junit.framework.TestSuite.run(TestSuite.java:236)
>         at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
>         at org.junit.runners.Suite.runChild(Suite.java:128)
>         at org.junit.runners.Suite.runChild(Suite.java:27)
>         at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
>         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
>         at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
>         at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
>         at org.junit.runners.Suite.runChild(Suite.java:128)
>         at org.junit.runners.Suite.runChild(Suite.java:27)
>         at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
>         at 
> org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:405)
>         at 
> org.apache.maven.surefire.junitcore.pc.InvokerStrategy.schedule(InvokerStrategy.java:54)
>         at 
> org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:362)
>         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
>         at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
>         at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
>         at 
> org.apache.maven.surefire.junitcore.pc.ParallelComputerBuilder$PC$1.run(ParallelComputerBuilder.java:590)
>         at 
> org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
>         at 
> org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
>         at 
> org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
>         at 
> org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
>         at 
> org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
>         at 
> org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:157)
>         at 
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
>         at 
> org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
>         at 
> org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
>         at 
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)
> Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to 
> find resource 
> 'C:\Users\radai\work\avro\lang\java\maven-plugin/src/test/resources/templates/enum.vm'
>         at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:465)
>         at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
>         at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
>         at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
>         at 
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314)
>         at 
> org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:549)
>         ... 50 more {code}
> this fails 2 other tests in the same module as well:
> {code:java}
> [ERROR] Errors:
> [ERROR]   TestIDLProtocolMojo.testSetCompilerVelocityAdditionalTools:68 ▒ 
> Runtime org.ap...
> [ERROR]   TestProtocolMojo.testSetCompilerVelocityAdditionalTools:59 ▒ 
> Runtime org.apach...
> [ERROR]   TestSchemaMojo.testSetCompilerVelocityAdditionalTools:59 ▒ Runtime 
> org.apache.... {code}
> the root issue as far as i can tell seems to be this velocity configuration 
> in SpecificCompiler:
> {code:java}
> private void initializeVelocity() {
>    ...
>    velocityEngine.addProperty("resource.loader.file.path", "/, .");
>    ...
> } {code}
> which defines 2 "root paths": "/" and "."
> however, under windows and given a path of the form "C:/<whatever>" this will 
> try looking for either "/C:/<whatever>" or "./C:/<whatever>" - both are 
> "wrong" for a windows absolute path.
>  
> relevant code is in 
> org.apache.velocity.runtime.resource.loader.FileResourceLoader.getFile():
> {code:java}
> private File getFile(String path, String template) {
>    File file = null; 
>    if("".equals(path)) {
>       file = new File( template );   <---- NEVER TAKEN
>    } else {
>       if (template.startsWith("/")) {
>          template = template.substring(1);
>       }
>       file = new File ( path, template );
>    }
>    return file;
> }{code}
> quickest fix i can think of is add "" as a 3rd possible root to velocity 
> config in class SpecificCompiler



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to