Can you also add a validation check here to ensure that the URI (and hence the original path given by the user) is valid and not malformed. I, just for fun, entered "file:hello", and it gave me a NPE at a random location.