private static URL doURL(Resource res) throws IOException { if (!(res instanceof FileResource)) throw new IOException("resource [" + res.getPath() + "] must be a local file"); return ((FileResource) res).toURL(); }