@Test public void fileToURLAndBack() throws MalformedURLException { File file = new File("a b.xml"); URL url = file.toURI().toURL(); ConfigurationWatchList cwl = new ConfigurationWatchList(); File back = cwl.convertToFile(url); assertEquals(file.getName(), back.getName()); }
@SuppressWarnings("deprecation") File convertToFile(URL url) { String protocol = url.getProtocol(); if ("file".equals(protocol)) { return new File(URLDecoder.decode(url.getFile())); } else { addInfo("URL [" + url + "] is not of type file"); return null; } }
ConfigurationWatchList extends ContextAwareBase { @SuppressWarnings("deprecation") File convertToFile(URL url) { String protocol = url.getProtocol(); if ("file".equals(protocol)) { return new File(URLDecoder.decode(url.getFile())); } else { addInfo("URL [" + url + "] is not of type file"); return null; } } }
ConfigurationWatchList extends ContextAwareBase { @SuppressWarnings("deprecation") File convertToFile(URL url) { String protocol = url.getProtocol(); if ("file".equals(protocol)) { return new File(URLDecoder.decode(url.getFile())); } else { addInfo("URL [" + url + "] is not of type file"); return null; } }  }
ConfigurationWatchList extends ContextAwareBase { @SuppressWarnings("deprecation") File convertToFile(URL url) { String protocol = url.getProtocol(); if ("file".equals(protocol)) { return new File(URLDecoder.decode(url.getFile())); } else { addInfo("URL [" + url + "] is not of type file"); return null; } }  ConfigurationWatchList buildClone(); void clear(); void setMainURL(URL mainURL); void addToWatchList(URL url); URL getMainURL(); List<File> getCopyOfFileWatchList(); boolean changeDetected(); }
ConfigurationWatchList extends ContextAwareBase { @SuppressWarnings("deprecation") File convertToFile(URL url) { String protocol = url.getProtocol(); if ("file".equals(protocol)) { return new File(URLDecoder.decode(url.getFile())); } else { addInfo("URL [" + url + "] is not of type file"); return null; } }  ConfigurationWatchList buildClone(); void clear(); void setMainURL(URL mainURL); void addToWatchList(URL url); URL getMainURL(); List<File> getCopyOfFileWatchList(); boolean changeDetected();  }