I am getting the following error in RAD:
java.net.URISyntaxException: Illegal character in path at index 16: file:/E:/Program Files/IBM/SDP/runtimes/base......
Could you please let me know what is the error and how to resolve it?
The "Illegal characters" exception means that the file path string you are passing to ReadXml is wrong: it is not a valid path. It may contain '?' , or ':' in the wrong place, or '*' for example. You need to look at the value, check what it is, and work out where the illegal character(s) are coming from.
The illegal character compilation error is a file type encoding error. It's produced if we use an incorrect encoding in our files when they are created. As result, in languages like Java, we can get this type of error when we try to compile our project.
public class URISyntaxException extends Exception. Checked exception thrown to indicate that a string could not be parsed as a URI reference.
There's an illegal character at index 16. I'd say it doesn't like the space in the path. You can percent encode special characters like spaces. Replace it with a %20 in this case.
The question I linked to above suggests using URLEncoder:
String thePath = "file://E:/Program Files/IBM/SDP/runtimes/base"; thePath = URLEncoder.encode(thePath, "UTF-8");
I ran into the same thing with the Bing Map API. URLEncoder just made things worse, but a replaceAll(" ","%20");
did the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With