You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Siegfried Goeschl (JIRA)" <ji...@apache.org> on 2008/07/18 22:40:31 UTC

[jira] Resolved: (EXEC-25) Test failures on Windows

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

Siegfried Goeschl resolved EXEC-25.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0

+) doing variable substitution and file separator fixing for the command line argument
+) doing variable substitution BUT NO file separator fixing for the command line argument
+) took the time to cleanup and re-factor some code to StringUtils


> Test failures on Windows
> ------------------------
>
>                 Key: EXEC-25
>                 URL: https://issues.apache.org/jira/browse/EXEC-25
>             Project: Commons Exec
>          Issue Type: Bug
>            Reporter: Dennis Lundberg
>            Assignee: Siegfried Goeschl
>             Fix For: 1.0
>
>
> When I run the tests for exec using 'mvn test' I get the following error.
> junit.framework.AssertionFailedError: Arrays not equal
> 	at org.apache.commons.exec.CommandLineTest.assertEquals(CommandLineTest.java:31)
> 	at org.apache.commons.exec.CommandLineTest.testCommandLineParsingWithExpansion2(CommandLineTest.java:320)
> As far as I can tell there are two problems with the code:
> 1. The test cases need to take into account that there are different file separators on Windows and Unix.
> That's easy enough to fix. I just added this
> {code}
>     private String replaceFileSeparator(String input) {
>         return input.replace('/', File.separatorChar).replace('\\', File.separatorChar);
>     }
> {code}
> and wrapped the first element of the "expected" String arrays with it.
> 2. Variable substitution isn't performed correctly.
> After adding the above I got test failures on Unix. I debugged the test case and found out that the value of the command line executable was this: " C:\Programme\jdk1.5.0_12/bin/java". This suggests to me that variable substitution is performed *after* CommandLine.setExecutable(String) is performed, resulting in an executable with possibly wrong file separators.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.