Solrcas uri generation failing on windows
-----------------------------------------

                 Key: UIMA-2131
                 URL: https://issues.apache.org/jira/browse/UIMA-2131
             Project: UIMA
          Issue Type: Bug
          Components: Sandbox-Solrcas
         Environment: Windows
            Reporter: Marshall Schor
            Assignee: Marshall Schor


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: /// 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to