Code example for MalformedURLException

0
 
        Uri uri = Uri.parse(decoded);
        String scheme = uri.getScheme();
        if(null == scheme) {
          //没有协议开头的url都是非法的,throw MalformedURLException 
            throw new MalformedURLException();
        } else if (scheme.equals(FILE_SCHEME)) {
          //对于file接口,所有的文件路径都是相对workspace的,所以file协议的文件路径也转为相对workspace的 
            decoded = uri.getPath();
        } 
 
        XPathResolver pathResolver = new XPathResolver(decoded, appWorkSpace, cxt);
 
        String path = pathResolver.resolve();
        if(null == path) {
            throw new XInvalidModificationException(INVALID_MODIFICATION_EXCEPTION_NOT_IN_ROOT_DIR);
        } 
 
        File file = new File(path);
        if (!file.exists()) {
            throw new FileNotFoundException();