java - URISyntaxException on Mac but not Windows -


i've been having issue when use url.tostring() on windows exception saying:

illegal char <:> @ index 4: file:\c:_workspace...

and whenever use url.touri() i'm getting:

urisyntaxexception: illegal character in path @ index 36: file:/users/test/library/application support/archi4...

this code problem occuring:

public static file getbundleentryasfile(string filepath) {     try {         filepath = filepath.replace("/", file.separator);         url fileurl = filelocator.tofileurl(getbundleentry(filepath));         return new file(filelocator.resolve(fileurl).tostring());     } catch (ioexception /*| urisyntaxexception*/ e) {         throw new illegalstateexception("error while locating bundle file [" + filepath + "]", e);     } } 

in return statement swap tostring() touri(). question if there better way of doing , making work on both macos , windows. feel i'm missing obvious. welcome!


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -