the url returned by the source is a url which should be treaded as such.
You can create a new java.net.URL object with this string and then a
File object using the url object.
Maodo DIOP wrote:
> Hi Team developpers,
> I have found a bug in the
> class*o**rg.apache.excalibur.source.impl.SourceResolverImpl * method
> *public Source resolveURI( String location, String baseURI,Map
> parameters ) *line *176-181* . which return the uri of a given file .
> But this uri is defined under OS platform where file protocol is
> "file:/" under Windows OS and without the slash under other plateforms
> which is a real bug according to me . We know that file protocol is
> "file:/" .
> Here an example
> Source mySource = resolver.resolveURI(myFile);
> When i get this variable String myFilename = (String
> int fileLength = myFilename.length();
> To delete this file we must test the plateform which is not the aim of
> Java programming "*W*rite *O*nce *R*un *A*nywhere" .
> //Get the real file without part of "file:/"
> filename = filename.substring(URL_PREFIX_LEN,end);
> //Get the real file without part of "file:" under other OS
> filename = filename.substring(URL_PREFIX_LEN-1,end);
> int end = int *end *= filename.length() ; and
> private final static String URL_PREFIX = "file:/";
> private final static int *URL_PREFIX_LEN *= URL_PREFIX.length();
> This is due to the *o**rg.apache.excalibur.source.impl.SourceResolverImpl *
> methode *public Source resolveURI( String location, String baseURI,Map
> parameters )* line *176-181* .
> String systemID = location;
> * // special handling for windows file paths*
> if( location.length() > 1 && location.charAt( 1 ) == ':' )
> systemID = "*file:/" + location;*
> else if( location.length() > 2 && location.charAt(0) == '/' &&
> location.charAt(2) == ':' )
> systemID = *"file:" + location;
> *What is your comments for ?*