Skip to content

Commit 16e8e59

Browse files
committed
use guava for checking strings [ci skip]
1 parent c47cb76 commit 16e8e59

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

src/main/java/de/rwth/idsg/steve/utils/StringUtils.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
public final class StringUtils {
1010
private StringUtils() { }
1111

12-
public static boolean isNullOrEmpty(String str) {
13-
return str == null || str.length() == 0;
14-
}
15-
1612
/**
1713
* We don't want to hard-code operation names,
1814
* but derive them from the actual request object.
@@ -29,7 +25,7 @@ public static String getOperationName(RequestType requestType) {
2925
}
3026

3127
// http://stackoverflow.com/a/4886141
32-
s = s.replaceAll("(\\p{Ll})(\\p{Lu})","$1 $2");
28+
s = s.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2");
3329

3430
return s;
3531
}

src/main/java/de/rwth/idsg/steve/web/LocalDateEditor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package de.rwth.idsg.steve.web;
22

3-
import de.rwth.idsg.steve.utils.StringUtils;
3+
import com.google.common.base.Strings;
44
import org.joda.time.LocalDate;
55
import org.joda.time.format.DateTimeFormat;
66
import org.joda.time.format.DateTimeFormatter;
@@ -27,7 +27,7 @@ public String getAsText() {
2727

2828
@Override
2929
public void setAsText(String text) {
30-
if (StringUtils.isNullOrEmpty(text)) {
30+
if (Strings.isNullOrEmpty(text)) {
3131
setValue(null);
3232
} else {
3333
setValue(DATE_FORMATTER.parseLocalDate(text));

src/main/java/de/rwth/idsg/steve/web/LocalDateTimeEditor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package de.rwth.idsg.steve.web;
22

3-
import de.rwth.idsg.steve.utils.StringUtils;
3+
import com.google.common.base.Strings;
44
import org.joda.time.LocalDateTime;
55
import org.joda.time.format.DateTimeFormat;
66
import org.joda.time.format.DateTimeFormatter;
@@ -27,7 +27,7 @@ public String getAsText() {
2727

2828
@Override
2929
public void setAsText(String text) {
30-
if (StringUtils.isNullOrEmpty(text)) {
30+
if (Strings.isNullOrEmpty(text)) {
3131
setValue(null);
3232
} else {
3333
setValue(DATE_TIME_FORMATTER.parseLocalDateTime(text));

0 commit comments

Comments
 (0)