Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-1758

BatchCommandLineBuilder fails on systems with whitespace in path

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • cli
    • None

    Description

      All tests for CLI module fail with errors like that:

      Tests run: 6, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.048 sec <<< FAILURE! - in org.apache.tika.cli.TikaCLIBatchCommandL
      ineTest
      testTwoDirsNoFlags(org.apache.tika.cli.TikaCLIBatchCommandLineTest)  Time elapsed: 0.026 sec  <<< ERROR!
      java.nio.file.InvalidPathException: Illegal char <"> at index 0: "C:\Users\Uwe Schindler\Projects\TIKA\svn\tika-app\testInput"
              at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
              at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
              at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
              at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
              at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
              at java.nio.file.Paths.get(Paths.java:84)
              at org.apache.tika.cli.BatchCommandLineBuilder.translateCommandLine(BatchCommandLineBuilder.java:137)
              at org.apache.tika.cli.BatchCommandLineBuilder.build(BatchCommandLineBuilder.java:51)
              at org.apache.tika.cli.TikaCLIBatchCommandLineTest.testTwoDirsNoFlags(TikaCLIBatchCommandLineTest.java:127)
      

      The reason is that BatchCommandLineBuilder adds quotes for unknown reasons!? If you use ProcessBuilder you don't need that! Not sure what this should do, but the problem is: The first argument (the executable) contains quotes after the method transformed it and breaks the test.

      I have no idea how to fix this, but the quotes should not be in a String[] command line at all.

      Attachments

        1. TIKA-1758.patch
          51 kB
          Yaniv Kunda

        Issue Links

          Activity

            People

              Unassigned Unassigned
              uschindler Uwe Schindler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: