Skip to content

Commit ad1ccbd

Browse files
Minor code adjustments to CommonUtils to use String.isEmpty()
1 parent 13fa0d0 commit ad1ccbd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

cas-client-core/src/main/java/org/jasig/cas/client/util/CommonUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static void assertFalse(final boolean cond, final String message) {
135135
* @return true if its null or length of 0, false otherwise.
136136
*/
137137
public static boolean isEmpty(final String string) {
138-
return string == null || string.length() == 0;
138+
return string == null || string.isEmpty();
139139
}
140140

141141
/**
@@ -157,7 +157,7 @@ public static boolean isNotEmpty(final String string) {
157157
* @return true if its blank, false otherwise.
158158
*/
159159
public static boolean isBlank(final String string) {
160-
return isEmpty(string) || string.trim().length() == 0;
160+
return isEmpty(string) || string.trim().isEmpty();
161161
}
162162

163163
/**
@@ -193,7 +193,7 @@ public static String constructRedirectUrl(final String casServerLoginUrl, final
193193
* @param value the value to encode.
194194
* @return the encoded value.
195195
*/
196-
public static String urlEncode(String value) {
196+
public static String urlEncode(final String value) {
197197
try {
198198
return URLEncoder.encode(value, "UTF-8");
199199
} catch (final UnsupportedEncodingException e) {
@@ -228,7 +228,7 @@ public static void readAndRespondToProxyReceptorRequest(final HttpServletRequest
228228
protected static String findMatchingServerName(final HttpServletRequest request, final String serverName) {
229229
final String[] serverNames = serverName.split(" ");
230230

231-
if (serverNames == null || serverNames.length == 0 || serverNames.length == 1) {
231+
if (serverNames.length == 0 || serverNames.length == 1) {
232232
return serverName;
233233
}
234234

@@ -323,7 +323,7 @@ public static String constructServiceUrl(final HttpServletRequest request, final
323323
final URIBuilder originalRequestUrl = new URIBuilder(request.getRequestURL().toString(), encode);
324324
originalRequestUrl.setParameters(request.getQueryString());
325325

326-
URIBuilder builder = null;
326+
final URIBuilder builder;
327327

328328
boolean containsScheme = true;
329329
if (!serverName.startsWith("https://") && !serverName.startsWith("http://")) {

0 commit comments

Comments
 (0)