Here you can find the source of newUrl(String href)
Parameter | Description |
---|---|
href | The data of the URL |
Parameter | Description |
---|---|
IllegalArgumentException | If a MalformedURLException was thrown |
public static URL newUrl(String href)
//package com.java2s; //License from project: Open Source License import java.net.*; public class Main { /**/* www . j ava2s . c o m*/ * Creates a new URL and wraps the {@link java.net.MalformedURLException} around an IllegalArgumentException if one * was thrown. * * @param href The data of the URL * @return A new URL * @throws IllegalArgumentException If a MalformedURLException was thrown */ public static URL newUrl(String href) { try { return new URL(href); } catch (MalformedURLException e) { throw new IllegalArgumentException("Malformed URL: " + href, e); } } }