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
Post a Comment