Java tutorial
//package com.java2s; import java.net.MalformedURLException; import java.net.URL; public class Main { public static final URL safeCreateUrl(final String url) { try { return new URL(url); } catch (MalformedURLException ex) { return null; } } }