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

TestParsers fails when classpathh contains special characters like spaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.7
    • 0.8
    • parser
    • None
    • Windows 7 with space in username and running tests in home dir

    Description

      The test TestParsers has the same problem like some Lucene tests in the past and also SolrInfoMBeanTest:
      If you want to get a File instance from the classpath and you use Class.getResource(), the return value is URL. If you call getFile() or getPath() on this URL, the returned String is just the File/Path part of the URL, which may contain url escaping ("%20" for spaces).

      The correct way to get File instances from getResource() URLs is to cast it to an URI and use the File ctor that takes URIs. This is the "official" way as described in Java docs and various forums.

      Attached is a trivial patch.

      Attachments

        1. TIKA-398.patch
          1 kB
          Uwe Schindler

        Activity

          People

            chrismattmann Chris A. Mattmann
            uschindler Uwe Schindler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified