Uploaded image for project: 'Commons Exec'
  1. Commons Exec
  2. EXEC-25

Test failures on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0
    • None

    Description

      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

          private String replaceFileSeparator(String input) {
              return input.replace('/', File.separatorChar).replace('\\', File.separatorChar);
          }
      

      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.

      Attachments

        Activity

          People

            sgoeschl Siegfried Goeschl
            dennisl@apache.org Dennis Lundberg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: