Tika
  1. Tika
  2. TIKA-398

TestParsers fails when classpathh contains special characters like spaces

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.8
    • Component/s: parser
    • Labels:
      None
    • Environment:

      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.

      1. TIKA-398.patch
        1 kB
        Uwe Schindler

        Activity

        Uwe Schindler created issue -
        Uwe Schindler made changes -
        Field Original Value New Value
        Attachment TIKA-398.patch [ 12440628 ]
        Chris A. Mattmann made changes -
        Assignee Chris A. Mattmann [ chrismattmann ]
        Chris A. Mattmann made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Chris A. Mattmann added a comment -
        • schedule for 0.8
        Show
        Chris A. Mattmann added a comment - schedule for 0.8
        Chris A. Mattmann made changes -
        Fix Version/s 0.8 [ 12314877 ]
        mattmann committed 930950 (2 files)
        Reviews: none

        - patch for TIKA-398 TestParsers fails when classpathh contains special characters like spaces (Uwe Schindler via mattmann)

        Hide
        Chris A. Mattmann added a comment -
        • patch committed in r930950, all tests pass on my Mac OS X 10.5.6. Thanks, Uwe!
        Show
        Chris A. Mattmann added a comment - patch committed in r930950, all tests pass on my Mac OS X 10.5.6. Thanks, Uwe!
        Chris A. Mattmann made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Chris A. Mattmann
            Reporter:
            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

                Development