@Test public void urlToFile() { ClassLoader classLoader = this.getClass().getClassLoader(); String resourceCandidate = "colors" + "_" + "en" + ".properties"; URL url = classLoader.getResource(resourceCandidate); assertNotNull("the problem is in this test, not the code tested", url); File file = MiscUtil.urlToFile(url); assertNotNull(file); }
public static File urlToFile(URL url) { if(url.getProtocol() != "file") { return null; } String path = url.getPath(); if(path == null) return null; File candidate = new File(path); if(candidate.exists()) { return candidate; } else { return null; } }
MiscUtil { public static File urlToFile(URL url) { if(url.getProtocol() != "file") { return null; } String path = url.getPath(); if(path == null) return null; File candidate = new File(path); if(candidate.exists()) { return candidate; } else { return null; } } }
MiscUtil { public static File urlToFile(URL url) { if(url.getProtocol() != "file") { return null; } String path = url.getPath(); if(path == null) return null; File candidate = new File(path); if(candidate.exists()) { return candidate; } else { return null; } }  }
MiscUtil { public static File urlToFile(URL url) { if(url.getProtocol() != "file") { return null; } String path = url.getPath(); if(path == null) return null; File candidate = new File(path); if(candidate.exists()) { return candidate; } else { return null; } }  static Locale toLocale(String localeName); static File urlToFile(URL url); }
MiscUtil { public static File urlToFile(URL url) { if(url.getProtocol() != "file") { return null; } String path = url.getPath(); if(path == null) return null; File candidate = new File(path); if(candidate.exists()) { return candidate; } else { return null; } }  static Locale toLocale(String localeName); static File urlToFile(URL url);  }