From: David ‘Bombe’ Roden Date: Thu, 20 Oct 2016 07:03:26 +0000 (+0200) Subject: Remove commons-lang dependency X-Git-Tag: 0.9.6^2~13 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=191cb539f62259c8e0ac25d0b61546b7a5215f68;p=Sone.git Remove commons-lang dependency --- diff --git a/build.gradle b/build.gradle index ba3a410..e8a5051 100644 --- a/build.gradle +++ b/build.gradle @@ -41,7 +41,6 @@ dependencies { compile group: 'net.pterodactylus', name: 'utils', version: '0.12.4' compile group: 'com.google.inject', name: 'guice', version: '3.0' compile group: 'com.google.guava', name: 'guava', version: '14.0.1' - compile group: 'commons-lang', name: 'commons-lang', version: '2.6' compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.1.2' compile group: 'com.google.code.findbugs', name: 'jsr305', version: '2.0.1' diff --git a/src/main/java/net/pterodactylus/sone/data/impl/AbstractPostBuilder.java b/src/main/java/net/pterodactylus/sone/data/impl/AbstractPostBuilder.java index f33a446..9e2c50a 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/AbstractPostBuilder.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/AbstractPostBuilder.java @@ -19,8 +19,6 @@ package net.pterodactylus.sone.data.impl; import static com.google.common.base.Preconditions.checkState; -import org.apache.commons.lang.StringUtils; - import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.database.PostBuilder; import net.pterodactylus.sone.database.SoneProvider; @@ -163,7 +161,7 @@ public abstract class AbstractPostBuilder implements PostBuilder { checkState((randomId && (id == null)) || (!randomId && (id != null)), "exactly one of random ID or custom ID must be set"); checkState(senderId != null, "sender must not be null"); checkState((currentTime && (time == 0)) || (!currentTime && (time > 0)), "one of current time or custom time must be set"); - checkState(!StringUtils.isBlank(text), "text must not be empty"); + checkState((text != null) && !text.trim().isEmpty(), "text must not be empty"); checkState((recipientId == null) || !recipientId.equals(senderId), "sender and recipient must not be the same"); } diff --git a/src/main/java/net/pterodactylus/sone/data/impl/AbstractPostReplyBuilder.java b/src/main/java/net/pterodactylus/sone/data/impl/AbstractPostReplyBuilder.java index 10bdf76..bd8090f 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/AbstractPostReplyBuilder.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/AbstractPostReplyBuilder.java @@ -19,8 +19,6 @@ package net.pterodactylus.sone.data.impl; import static com.google.common.base.Preconditions.checkState; -import org.apache.commons.lang.StringUtils; - import net.pterodactylus.sone.database.PostReplyBuilder; /** @@ -58,7 +56,7 @@ public abstract class AbstractPostReplyBuilder extends AbstractReplyBuilder= 0)), "either current time or custom time must be set"); - checkState(!StringUtils.isBlank(text), "text must not be empty"); + checkState((text != null) && !text.trim().isEmpty(), "text must not be empty"); checkState(postId != null, "post must not be null"); } diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java index 30f32fc..7235bc9 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java @@ -26,8 +26,6 @@ import net.pterodactylus.sone.database.PostProvider; import net.pterodactylus.sone.database.PostReplyBuilder; import net.pterodactylus.sone.database.SoneProvider; -import org.apache.commons.lang.StringUtils; - /** * {@link PostReplyBuilder} implementation that creates {@link PostReplyImpl} * objects. @@ -63,7 +61,7 @@ public class PostReplyBuilderImpl extends AbstractPostReplyBuilder { checkState((randomId && (id == null)) || (!randomId && (id != null)), "either random ID nor custom ID must be set"); checkState(senderId != null, "sender must not be null"); checkState((currentTime && (time == 0)) || (!currentTime && (time >= 0)), "either current time or custom time must be set"); - checkState(!StringUtils.isBlank(text), "text must not be empty"); + checkState((text != null) && !text.trim().isEmpty(), "text must not be empty"); checkState(postId != null, "post must not be null"); /* create new post reply. */