@Test public void testFromObjectWithInvalidURLString() throws Exception { assertEquals(null, URLUtil.fromObject("httpp: }
public static URL fromObject(Object source) { if (source == null) { return null; } if (source instanceof URL) { return (URL) source; } if (source instanceof File) { try { return ((File) source).toURI().toURL(); } catch (MalformedURLException e) { return null; } } if (source instanceof String) { return fromString((String) source); } return null; }
URLUtil { public static URL fromObject(Object source) { if (source == null) { return null; } if (source instanceof URL) { return (URL) source; } if (source instanceof File) { try { return ((File) source).toURI().toURL(); } catch (MalformedURLException e) { return null; } } if (source instanceof String) { return fromString((String) source); } return null; } }
URLUtil { public static URL fromObject(Object source) { if (source == null) { return null; } if (source instanceof URL) { return (URL) source; } if (source instanceof File) { try { return ((File) source).toURI().toURL(); } catch (MalformedURLException e) { return null; } } if (source instanceof String) { return fromString((String) source); } return null; }  }
URLUtil { public static URL fromObject(Object source) { if (source == null) { return null; } if (source instanceof URL) { return (URL) source; } if (source instanceof File) { try { return ((File) source).toURI().toURL(); } catch (MalformedURLException e) { return null; } } if (source instanceof String) { return fromString((String) source); } return null; }  static boolean isHttpsUrl(URL url); static boolean isHttpUrl(URL url); static boolean isFileUrl(URL url); static boolean isForResourceWithExtension(URL url, String extension); static URL stripQuery(URL url); static File urlToFile(URL url); static URL fromString(String urlString); static URL fromString(String urlString, String protocol); static URL fromObject(Object source); static URI toURI(URL url); static String addQueryParameter(String urlString, String queryParameter); static String addQueryParameterIfMissing(String urlString, String queryParameter, boolean ignoreCase); static boolean hasQueryParameter(String urlString, String queryParameter, boolean ignoreCase); }
URLUtil { public static URL fromObject(Object source) { if (source == null) { return null; } if (source instanceof URL) { return (URL) source; } if (source instanceof File) { try { return ((File) source).toURI().toURL(); } catch (MalformedURLException e) { return null; } } if (source instanceof String) { return fromString((String) source); } return null; }  static boolean isHttpsUrl(URL url); static boolean isHttpUrl(URL url); static boolean isFileUrl(URL url); static boolean isForResourceWithExtension(URL url, String extension); static URL stripQuery(URL url); static File urlToFile(URL url); static URL fromString(String urlString); static URL fromString(String urlString, String protocol); static URL fromObject(Object source); static URI toURI(URL url); static String addQueryParameter(String urlString, String queryParameter); static String addQueryParameterIfMissing(String urlString, String queryParameter, boolean ignoreCase); static boolean hasQueryParameter(String urlString, String queryParameter, boolean ignoreCase);  }