@@ -85,41 +85,12 @@ protected Address buildLiteral()
8585
8686 /**
8787 * Create a new {@link Address} from the given URL. Improperly formatted or encoded URLs are not parse-able and will
88- * result in an exception.
88+ * result in an exception. No builder parameterization is possible using this method.
8989 *
9090 * @see http://en.wikipedia.org/wiki/URI_scheme
9191 * @throws IllegalArgumentException when the input URL or URL fragment is not valid.
9292 */
9393 public static Address create (String url ) throws IllegalArgumentException
94- {
95- try {
96- URI u = new URI (url );
97- String scheme = u .getScheme ();
98- String host = u .getHost ();
99- if (scheme != null && host == null )
100- return AddressBuilder .begin ().scheme (u .getScheme ()).schemeSpecificPart (u .getRawSchemeSpecificPart ())
101- .build ();
102- else
103- return AddressBuilder .begin ().scheme (scheme ).domain (host ).port (u .getPort ())
104- .path (u .getRawPath ()).queryLiteral (u .getRawQuery ()).anchor (u .getRawFragment ()).build ();
105- }
106- catch (URISyntaxException e ) {
107- throw new IllegalArgumentException (
108- "[" + url + "] is not a valid URL fragment. Consider encoding relevant portions of the URL with ["
109- + Encoder .class
110- + "], or use the provided builder pattern via this class to specify part encoding." , e );
111- }
112- }
113-
114- /**
115- * Create a new {@link Address} from the given URL. Improperly formatted or encoded URLs are not parse-able and will
116- * result in an exception.
117- * <p>
118- *
119- * @see http://en.wikipedia.org/wiki/URI_scheme
120- * @throws IllegalArgumentException when the input URL or URL fragment is not valid.
121- */
122- public static Address createLiteral (String url ) throws IllegalArgumentException
12394 {
12495 try {
12596 URI u = new URI (url );
@@ -130,14 +101,13 @@ public static Address createLiteral(String url) throws IllegalArgumentException
130101 .buildLiteral ();
131102 else
132103 return AddressBuilder .begin ().scheme (scheme ).domain (host ).port (u .getPort ())
133- .path (u .getRawPath ()).queryLiteral (u .getRawQuery ()).anchor (u .getRawFragment ())
134- .buildLiteral ();
104+ .path (u .getRawPath ()).queryLiteral (u .getRawQuery ()).anchor (u .getRawFragment ()).buildLiteral ();
135105 }
136106 catch (URISyntaxException e ) {
137107 throw new IllegalArgumentException (
138108 "[" + url + "] is not a valid URL fragment. Consider encoding relevant portions of the URL with ["
139109 + Encoder .class
140- + "], or use the provided builder pattern via this class to specify part encoding" , e );
110+ + "], or use the provided builder pattern via this class to specify part encoding. " , e );
141111 }
142112 }
143113
0 commit comments