DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28099>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28099

junit problem with quotes in path

[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|Normal                      |Major
           Priority|Other                       |Medium



------- Additional Comments From [EMAIL PROTECTED]  2004-03-31 21:33 -------
It looks like this is a much more fundamental bug than I first realized.
The <sysproperty key="java.library.path" 
path="${javalib.including.dlls.path}"/> element nested in the junit task is 
responsible for the call to the "public void addConfiguredSysproperty
(Environment.Variable sysp)" method at line 403 of the 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask class.  When I run the 
build in the debugger and look at the contents of the Environment.Variable 
instance passed into the addConfiguredSysproperty method the problem has 
already surfaced.

Within my debugger I am setting the java.library.path system property of the 
jvm running the org.apache.tools.ant.Main class 
to 'C:\Perl\bin;"C:\junk";C:\devtools\vim\vim62;C:\Python23'
(i.e. -
Djava.library.path='C:\Perl\bin;"C:\junk";C:\devtools\vim\vim62;C:\Python23')

Setting a breakpoint within the addConfiguredSysproperty(Environment.Variable) 
method I find that the Environment.Variable instance has a key of 
java.library.path (as expected) and a String value 
of "C:\\workarea\\javaapps\\examplewebcomponent\\'C;C:\\Perl\\bin;C:\\junk;C:\\d
evtools\\vim\\vim62;C:\\Python23'"
The C:\\workarea\javaapps\examplewebcomponent\\ directory corresponds to the 
value of the directory in which java was executed (my ${basedir}).  The 
troublesome portion is the extra \'C; found before C:\\Perl\\bin....

As the snipt originally provided shows the value of the path attribute of the 
nested sysproperty element is comming from ${javalib.including.dlls.path}.  
Consequently, I decided to take a look at the value of the 
javalib.including.dlls.path and java.library.path ant variables while sitting 
at my breakpoint inside of the addConfiguredSysproperty(Environment.Variable) 
method.  Using my evaluation window I find:
this.getProject().getProperty("java.library.path") 
= "'C:\\Perl\\bin;C:\\junk;C:\\devtools\\vim\\vim62;C:\\Python23'"
and
this.getProject().getProperty("javalib.including.dlls.path") 
= "'C:\\Perl\\bin;C:\\junk;C:\\devtools\\vim\\vim62;C:\\Python23'"

So the ant properties are fine but somewhere deep within ant's dynamic XML to 
java code mapping it has prepended the base directory to the value of the 
Environment.Variable instance.  I took a look at the Environment.Variable class 
and it's way too simple to have been responsible for prepending a base 
directory.

At this stage I recognize I am way too deep in the Ant jungle.  Obviously 
Environment.Variable classes get some special treatment I don't know about that 
isn't listed in the "Conversions Ant will perform for attributes" section of 
the ant manual.  For now I will run away screaming, warn my teammates of the 
problem, and promise not ever have double quotes in my PATH environment 
variable.  Solving the problem myself means learning much more of the nitty 
gritty ant internals than I have time for.  Hopefully the kings of the Ant 
jungle will look into this problem and solve it for all of us in some future 
release.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to