@@ -453,7 +453,7 @@ public List<URL> getBackupUrls() {
453
453
}
454
454
455
455
static String appendDefaultPort (String address , int defaultPort ) {
456
- if (address != null && address . length () > 0 && defaultPort > 0 ) {
456
+ if (StringUtils . isNotEmpty ( address ) && defaultPort > 0 ) {
457
457
int i = address .indexOf (':' );
458
458
if (i < 0 ) {
459
459
return address + ":" + defaultPort ;
@@ -508,7 +508,7 @@ public String[] getParameter(String key, String[] defaultValue) {
508
508
509
509
public List <String > getParameter (String key , List <String > defaultValue ) {
510
510
String value = getParameter (key );
511
- if (value == null || value . length () == 0 ) {
511
+ if (StringUtils . isEmpty ( value ) ) {
512
512
return defaultValue ;
513
513
}
514
514
String [] strArray = COMMA_SPLIT_PATTERN .split (value );
@@ -872,7 +872,7 @@ public boolean hasMethodParameter(String method, String key) {
872
872
return false ;
873
873
}
874
874
String value = getMethodParameter (method , key );
875
- return value != null && value . length () > 0 ;
875
+ return StringUtils . isNotEmpty ( value ) ;
876
876
}
877
877
878
878
public boolean isLocalHost () {
@@ -1167,7 +1167,7 @@ private void buildParameters(StringBuilder buf, boolean concat, String[] paramet
1167
1167
List <String > includes = (ArrayUtils .isEmpty (parameters ) ? null : Arrays .asList (parameters ));
1168
1168
boolean first = true ;
1169
1169
for (Map .Entry <String , String > entry : new TreeMap <>(getParameters ()).entrySet ()) {
1170
- if (entry . getKey () != null && entry .getKey (). length () > 0
1170
+ if (StringUtils . isNotEmpty ( entry .getKey ())
1171
1171
&& (includes == null || includes .contains (entry .getKey ()))) {
1172
1172
if (first ) {
1173
1173
if (concat ) {
@@ -1197,7 +1197,7 @@ private String buildString(boolean appendUser, boolean appendParameter, boolean
1197
1197
}
1198
1198
if (appendUser && StringUtils .isNotEmpty (username )) {
1199
1199
buf .append (username );
1200
- if (password != null && password . length () > 0 ) {
1200
+ if (StringUtils . isNotEmpty ( password ) ) {
1201
1201
buf .append (":" );
1202
1202
buf .append (password );
1203
1203
}
@@ -1209,7 +1209,7 @@ private String buildString(boolean appendUser, boolean appendParameter, boolean
1209
1209
} else {
1210
1210
host = getHost ();
1211
1211
}
1212
- if (host != null && host . length () > 0 ) {
1212
+ if (StringUtils . isNotEmpty ( host ) ) {
1213
1213
buf .append (host );
1214
1214
if (port > 0 ) {
1215
1215
buf .append (":" );
@@ -1222,7 +1222,7 @@ private String buildString(boolean appendUser, boolean appendParameter, boolean
1222
1222
} else {
1223
1223
path = getPath ();
1224
1224
}
1225
- if (path != null && path . length () > 0 ) {
1225
+ if (StringUtils . isNotEmpty ( path ) ) {
1226
1226
buf .append ("/" );
1227
1227
buf .append (path );
1228
1228
}
@@ -1295,11 +1295,11 @@ public String getPathKey() {
1295
1295
1296
1296
public static String buildKey (String path , String group , String version ) {
1297
1297
StringBuilder buf = new StringBuilder ();
1298
- if (group != null && group . length () > 0 ) {
1298
+ if (StringUtils . isNotEmpty ( group ) ) {
1299
1299
buf .append (group ).append ("/" );
1300
1300
}
1301
1301
buf .append (path );
1302
- if (version != null && version . length () > 0 ) {
1302
+ if (StringUtils . isNotEmpty ( version ) ) {
1303
1303
buf .append (":" ).append (version );
1304
1304
}
1305
1305
return buf .toString ();
@@ -1448,11 +1448,7 @@ public boolean equals(Object obj) {
1448
1448
return false ;
1449
1449
}
1450
1450
URL other = (URL ) obj ;
1451
- if (host == null ) {
1452
- if (other .host != null ) {
1453
- return false ;
1454
- }
1455
- } else if (!host .equals (other .host )) {
1451
+ if (!StringUtils .isEquals (host , other .host )) {
1456
1452
return false ;
1457
1453
}
1458
1454
if (parameters == null ) {
@@ -1462,35 +1458,19 @@ public boolean equals(Object obj) {
1462
1458
} else if (!parameters .equals (other .parameters )) {
1463
1459
return false ;
1464
1460
}
1465
- if (password == null ) {
1466
- if (other .password != null ) {
1467
- return false ;
1468
- }
1469
- } else if (!password .equals (other .password )) {
1461
+ if (!StringUtils .isEquals (password , other .password )) {
1470
1462
return false ;
1471
1463
}
1472
- if (path == null ) {
1473
- if (other .path != null ) {
1474
- return false ;
1475
- }
1476
- } else if (!path .equals (other .path )) {
1464
+ if (!StringUtils .isEquals (path , other .path )) {
1477
1465
return false ;
1478
1466
}
1479
1467
if (port != other .port ) {
1480
1468
return false ;
1481
1469
}
1482
- if (protocol == null ) {
1483
- if (other .protocol != null ) {
1484
- return false ;
1485
- }
1486
- } else if (!protocol .equals (other .protocol )) {
1470
+ if (!StringUtils .isEquals (protocol , other .protocol )) {
1487
1471
return false ;
1488
1472
}
1489
- if (username == null ) {
1490
- if (other .username != null ) {
1491
- return false ;
1492
- }
1493
- } else if (!username .equals (other .username )) {
1473
+ if (!StringUtils .isEquals (username , other .username )) {
1494
1474
return false ;
1495
1475
}
1496
1476
return true ;
0 commit comments