You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Adam Lally (JIRA)" <ui...@incubator.apache.org> on 2006/12/29 22:17:21 UTC
[jira] Closed: (UIMA-132) Provide better support for filenames with
spaces in resource URL
[ http://issues.apache.org/jira/browse/UIMA-132?page=all ]
Adam Lally closed UIMA-132.
---------------------------
Resolution: Fixed
> Provide better support for filenames with spaces in resource URL
> ----------------------------------------------------------------
>
> Key: UIMA-132
> URL: http://issues.apache.org/jira/browse/UIMA-132
> Project: UIMA
> Issue Type: Improvement
> Components: Core Java Framework
> Reporter: Adam Lally
> Assigned To: Adam Lally
> Priority: Minor
> Fix For: 2.1
>
>
> The UimaContext.getResourceURL() method is difficult to use correctly. It is tempting for users to write code such as:
> URL url = getContext().getResourceURL(key);
> FileReader fr = new FileReader(url.getPath());
> which is not safe since the URL can contain spaces encoded as %20, and the url.getPath() does not automatically decode them.
> We should add the alternative methods and appropriate JavaDoc comments guiding the user toward the appropriate method:
> URI getResourceURI() -- this works better because URI.getPath() *does* do decoding.
> String getResourceFilePath() -- if the URL is a "file:" URL, return its decoded path, otherwise throw an exception (e.g., for an "http" URL)
> Additionally, it would be nice if we supported filenames (without the file: prefix) in the <fileUrl> descriptor element, for example:
> <fileUrl>c:/program files/myproj/myfile.txt</fileUrl>
> Currently this gives a MalformedUrlException, but it would be helpful for the framework to detect that exception and try appending "file:/" to see if that makes a valid URL.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira