@Test public void testStripQueryWithNull() { URL url = null; URL result = URLUtil.stripQuery(url); assertNull(result); }
public static URL stripQuery(URL url) { if (url == null || url.getQuery() == null) { return url; } try { String urlString = url.toExternalForm(); return new URL(urlString.substring(0, urlString.indexOf('?'))); } catch (MalformedURLException e) { return null; } }
URLUtil { public static URL stripQuery(URL url) { if (url == null || url.getQuery() == null) { return url; } try { String urlString = url.toExternalForm(); return new URL(urlString.substring(0, urlString.indexOf('?'))); } catch (MalformedURLException e) { return null; } } }
URLUtil { public static URL stripQuery(URL url) { if (url == null || url.getQuery() == null) { return url; } try { String urlString = url.toExternalForm(); return new URL(urlString.substring(0, urlString.indexOf('?'))); } catch (MalformedURLException e) { return null; } }  }
URLUtil { public static URL stripQuery(URL url) { if (url == null || url.getQuery() == null) { return url; } try { String urlString = url.toExternalForm(); return new URL(urlString.substring(0, urlString.indexOf('?'))); } catch (MalformedURLException e) { 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 stripQuery(URL url) { if (url == null || url.getQuery() == null) { return url; } try { String urlString = url.toExternalForm(); return new URL(urlString.substring(0, urlString.indexOf('?'))); } catch (MalformedURLException e) { 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);  }