@@ -183,7 +183,7 @@ public static UriComponentsBuilder fromUri(URI uri) {
183
183
* @return the new {@code UriComponentsBuilder}
184
184
*/
185
185
public static UriComponentsBuilder fromUriString (String uri ) {
186
- Assert .notNull (uri , "'uri' must not be null" );
186
+ Assert .notNull (uri , "URI must not be null" );
187
187
Matcher matcher = URI_PATTERN .matcher (uri );
188
188
if (matcher .matches ()) {
189
189
UriComponentsBuilder builder = new UriComponentsBuilder ();
@@ -243,7 +243,7 @@ public static UriComponentsBuilder fromUriString(String uri) {
243
243
* @return the URI components of the URI
244
244
*/
245
245
public static UriComponentsBuilder fromHttpUrl (String httpUrl ) {
246
- Assert .notNull (httpUrl , "'httpUrl' must not be null" );
246
+ Assert .notNull (httpUrl , "HTTP URL must not be null" );
247
247
Matcher matcher = HTTP_URL_PATTERN .matcher (httpUrl );
248
248
if (matcher .matches ()) {
249
249
UriComponentsBuilder builder = new UriComponentsBuilder ();
@@ -429,7 +429,7 @@ public String toUriString() {
429
429
* @return this UriComponentsBuilder
430
430
*/
431
431
public UriComponentsBuilder uri (URI uri ) {
432
- Assert .notNull (uri , "'uri' must not be null" );
432
+ Assert .notNull (uri , "URI must not be null" );
433
433
this .scheme = uri .getScheme ();
434
434
if (uri .isOpaque ()) {
435
435
this .ssp = uri .getRawSchemeSpecificPart ();
@@ -489,7 +489,7 @@ public UriComponentsBuilder scheme(String scheme) {
489
489
* @return this UriComponentsBuilder
490
490
*/
491
491
public UriComponentsBuilder uriComponents (UriComponents uriComponents ) {
492
- Assert .notNull (uriComponents , "'uriComponents' must not be null" );
492
+ Assert .notNull (uriComponents , "UriComponents must not be null" );
493
493
uriComponents .copyToUriComponentsBuilder (this );
494
494
return this ;
495
495
}
@@ -538,7 +538,7 @@ public UriComponentsBuilder host(String host) {
538
538
* @return this UriComponentsBuilder
539
539
*/
540
540
public UriComponentsBuilder port (int port ) {
541
- Assert .isTrue (port >= -1 , "'port' must not be < -1" );
541
+ Assert .isTrue (port >= -1 , "Port must be >= -1" );
542
542
this .port = String .valueOf (port );
543
543
resetSchemeSpecificPart ();
544
544
return this ;
@@ -587,7 +587,6 @@ public UriComponentsBuilder replacePath(String path) {
587
587
* @return this UriComponentsBuilder
588
588
*/
589
589
public UriComponentsBuilder pathSegment (String ... pathSegments ) throws IllegalArgumentException {
590
- Assert .notNull (pathSegments , "'segments' must not be null" );
591
590
this .pathBuilder .addPathSegments (pathSegments );
592
591
resetSchemeSpecificPart ();
593
592
return this ;
@@ -647,7 +646,7 @@ public UriComponentsBuilder replaceQuery(String query) {
647
646
* @return this UriComponentsBuilder
648
647
*/
649
648
public UriComponentsBuilder queryParam (String name , Object ... values ) {
650
- Assert .notNull (name , "'name' must not be null" );
649
+ Assert .notNull (name , "Name must not be null" );
651
650
if (!ObjectUtils .isEmpty (values )) {
652
651
for (Object value : values ) {
653
652
String valueAsString = (value != null ? value .toString () : null );
@@ -667,8 +666,9 @@ public UriComponentsBuilder queryParam(String name, Object... values) {
667
666
* @return this UriComponentsBuilder
668
667
*/
669
668
public UriComponentsBuilder queryParams (MultiValueMap <String , String > params ) {
670
- Assert .notNull (params , "'params' must not be null" );
671
- this .queryParams .putAll (params );
669
+ if (params != null ) {
670
+ this .queryParams .putAll (params );
671
+ }
672
672
return this ;
673
673
}
674
674
@@ -680,7 +680,7 @@ public UriComponentsBuilder queryParams(MultiValueMap<String, String> params) {
680
680
* @return this UriComponentsBuilder
681
681
*/
682
682
public UriComponentsBuilder replaceQueryParam (String name , Object ... values ) {
683
- Assert .notNull (name , "'name' must not be null" );
683
+ Assert .notNull (name , "Name must not be null" );
684
684
this .queryParams .remove (name );
685
685
if (!ObjectUtils .isEmpty (values )) {
686
686
queryParam (name , values );
@@ -695,9 +695,10 @@ public UriComponentsBuilder replaceQueryParam(String name, Object... values) {
695
695
* @return this UriComponentsBuilder
696
696
*/
697
697
public UriComponentsBuilder replaceQueryParams (MultiValueMap <String , String > params ) {
698
- Assert .notNull (params , "'params' must not be null" );
699
698
this .queryParams .clear ();
700
- this .queryParams .putAll (params );
699
+ if (params != null ) {
700
+ this .queryParams .putAll (params );
701
+ }
701
702
return this ;
702
703
}
703
704
@@ -709,7 +710,7 @@ public UriComponentsBuilder replaceQueryParams(MultiValueMap<String, String> par
709
710
*/
710
711
public UriComponentsBuilder fragment (String fragment ) {
711
712
if (fragment != null ) {
712
- Assert .hasLength (fragment , "'fragment' must not be empty" );
713
+ Assert .hasLength (fragment , "Fragment must not be empty" );
713
714
this .fragment = fragment ;
714
715
}
715
716
else {
0 commit comments