From 191cb539f62259c8e0ac25d0b61546b7a5215f68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 20 Oct 2016 09:03:26 +0200 Subject: [PATCH] Remove commons-lang dependency --- build.gradle | 1 - .../java/net/pterodactylus/sone/data/impl/AbstractPostBuilder.java | 4 +--- .../net/pterodactylus/sone/data/impl/AbstractPostReplyBuilder.java | 4 +--- .../java/net/pterodactylus/sone/data/impl/PostReplyBuilderImpl.java | 4 +--- 4 files changed, 3 insertions(+), 10 deletions(-) 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. */ -- 2.7.4