Here you can find the source of createURI(String uri)
Parameter | Description |
---|---|
uri | URI text |
Parameter | Description |
---|---|
IllegalArgumentException | if uri doesn't look like a URI |
public static URI createURI(String uri)
//package com.java2s; //License from project: LGPL import java.net.URI; import java.net.URISyntaxException; public class Main { /**//w w w . j av a 2 s .co m * Convenience method to turn a String into a URI without throwing * any pesky checked exceptions. * * @param uri URI text * @return URI * @throws IllegalArgumentException if uri doesn't look like a URI */ public static URI createURI(String uri) { try { return new URI(uri); } catch (URISyntaxException e) { throw (IllegalArgumentException) new IllegalArgumentException("Bad URI: " + uri).initCause(e); } } }