class FileUtil {

    public static File toFile(URL url) {
        if (url == null) {
            return null;
        }

        if (!"file".equals(url.getProtocol())) {
            return null;
        }

        String path = url.getPath();

        return (path != null) ? new File(StringEscapeUtil.unescapeURL(path)) : null;

    }

}