Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-2131

Solrcas uri generation failing on windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.3.1Addons
    • Sandbox-Solrcas
    • None
    • Windows

    Description

      The getURI code in solrcas (SolrCASConsumer) has the code:

      if (!uri.isAbsolute())
      uri = UriUtils.create(new StringBuilder(FILEPATH).append(getContext().getDataPath()).
      append("/").append(path.replace(FILEPATH, EMPTY_STRING)).toString()); // this supports relative file paths

      On Windows, the getContext().getDataPath() returned "C:\blah\blah", so the string passed to UriUtils.create was something like:

      file://C:\a\b\c\Solrcas/src/test/resources/org/apache/uima/solrcas/

      The "backslash" char is "escaped" by the create method, since it's not a valid in URIs, giving:

      file://C:%5Ca%5Cb%5Cc%5CSolrcas/src/test/resources/org/apache/uima/solrcas/

      When this URI is given to new File(...) this causes an error to be thrown:

      java.lang.IllegalArgumentException: URI has an authority component

      It thinks there's an authority component because of the colon character. It seems the right thing to do for this kind of an "absolute" URI on Windows, if it starts with a C: or something similar, is to prefix this with another "/" char, so the string looks like

      file:///C:\a\b\c\Solrcas/src/test/resources/org/apache/uima/solrcas/

      e.g., file: followed by 3 slashes: ///

      Attachments

        Activity

          People

            schor Marshall Schor
            schor Marshall Schor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: