From commits-return-8541-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Tue Oct 6 10:40:10 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 6934A180636 for ; Tue, 6 Oct 2020 12:40:10 +0200 (CEST) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id A2063121B3B for ; Tue, 6 Oct 2020 10:40:09 +0000 (UTC) Received: (qmail 52244 invoked by uid 500); 6 Oct 2020 10:40:09 -0000 Mailing-List: contact commits-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list commits@zookeeper.apache.org Received: (qmail 52232 invoked by uid 99); 6 Oct 2020 10:40:09 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Oct 2020 10:40:09 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id D33CF811B2; Tue, 6 Oct 2020 10:40:08 +0000 (UTC) Date: Tue, 06 Oct 2020 10:40:08 +0000 To: "commits@zookeeper.apache.org" Subject: [zookeeper] branch master updated: ZOOKEEPER-3952: Remove commons-lang from ZooKeeper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <160198080852.18872.3630152739165101336@gitbox.apache.org> From: symat@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: zookeeper X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ec1503bb00945471baa248f392eed51064bb48ab X-Git-Newrev: d3282c62ddb30a8ce265dcebca0e106c51f07ca3 X-Git-Rev: d3282c62ddb30a8ce265dcebca0e106c51f07ca3 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. symat pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/zookeeper.git The following commit(s) were added to refs/heads/master by this push: new d3282c6 ZOOKEEPER-3952: Remove commons-lang from ZooKeeper d3282c6 is described below commit d3282c62ddb30a8ce265dcebca0e106c51f07ca3 Author: Tamas Penzes AuthorDate: Tue Oct 6 10:39:37 2020 +0000 ZOOKEEPER-3952: Remove commons-lang from ZooKeeper Removed commons-lang from main project, replaced functionality with standard Java code. Author: Tamas Penzes Reviewers: Christopher Tubbs , Enrico Olivelli , Mate Szalay-Beko , tison Closes #1478 from tamaashu/ZOOKEEPER-3952 --- pom.xml | 48 +++++++++++++++++++--- .../zookeeper-contrib-zooinspector/ivy.xml | 8 +--- .../zookeeper-contrib-zooinspector/pom.xml | 6 --- zookeeper-server/pom.xml | 4 -- .../java/org/apache/zookeeper/common/PathTrie.java | 23 +++++++---- .../zookeeper/server/FinalRequestProcessor.java | 3 +- 6 files changed, 60 insertions(+), 32 deletions(-) diff --git a/pom.xml b/pom.xml index b994523..5c95183 100755 --- a/pom.xml +++ b/pom.xml @@ -444,10 +444,10 @@ 2.0.0 1.60 3.2.2 - 2.6 3.2.5 4.0.2 8.17 + 3.0.0-M3 yes @@ -468,11 +468,6 @@ ${commons-collections.version} - commons-lang - commons-lang - ${commons-lang.version} - - org.apache.yetus audience-annotations ${audience-annotations.version} @@ -1046,6 +1041,47 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + ${enforcer.version} + + + banned-commons-lang + + enforce + + + + + + commons-lang:commons-lang + + false + We don't use commons-lang any more, so do not depend on it directly. + + + + + + banned-commons-lang3 + + enforce + + + + + + org.apache.commons:commons-lang3 + + false + We don't use commons-lang3, so do not depend on it directly. + + + + + + diff --git a/zookeeper-contrib/zookeeper-contrib-zooinspector/ivy.xml b/zookeeper-contrib/zookeeper-contrib-zooinspector/ivy.xml index d841d18..96acdde 100644 --- a/zookeeper-contrib/zookeeper-contrib-zooinspector/ivy.xml +++ b/zookeeper-contrib/zookeeper-contrib-zooinspector/ivy.xml @@ -39,12 +39,8 @@ - - - + + diff --git a/zookeeper-contrib/zookeeper-contrib-zooinspector/pom.xml b/zookeeper-contrib/zookeeper-contrib-zooinspector/pom.xml index c9f3b1e..b517441 100755 --- a/zookeeper-contrib/zookeeper-contrib-zooinspector/pom.xml +++ b/zookeeper-contrib/zookeeper-contrib-zooinspector/pom.xml @@ -35,7 +35,6 @@ 0.6 - 2.4 18.0 @@ -85,11 +84,6 @@ ${rat.version} - commons-lang - commons-lang - ${commons-lang.version} - - commons-collections commons-collections diff --git a/zookeeper-server/pom.xml b/zookeeper-server/pom.xml index 5cdb8b3..5dbc028 100755 --- a/zookeeper-server/pom.xml +++ b/zookeeper-server/pom.xml @@ -49,10 +49,6 @@ test - commons-lang - commons-lang - - org.apache.zookeeper zookeeper-jute ${project.version} diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/common/PathTrie.java b/zookeeper-server/src/main/java/org/apache/zookeeper/common/PathTrie.java index 95258b2..86acdd9 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/common/PathTrie.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/common/PathTrie.java @@ -27,7 +27,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; - import org.apache.commons.lang.StringUtils; + import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -203,10 +203,10 @@ public void addPath(final String path) { Objects.requireNonNull(path, "Path cannot be null"); - final String[] pathComponents = StringUtils.split(path, '/'); - if (pathComponents.length == 0) { + if (path.length() == 0) { throw new IllegalArgumentException("Invalid path: " + path); } + final String[] pathComponents = split(path); writeLock.lock(); try { @@ -233,10 +233,11 @@ public void deletePath(final String path) { Objects.requireNonNull(path, "Path cannot be null"); - final String[] pathComponents = StringUtils.split(path, '/'); - if (pathComponents.length == 0) { + if (path.length() == 0) { throw new IllegalArgumentException("Invalid path: " + path); } + final String[] pathComponents = split(path); + writeLock.lock(); try { @@ -267,10 +268,10 @@ public boolean existsNode(final String path) { Objects.requireNonNull(path, "Path cannot be null"); - final String[] pathComponents = StringUtils.split(path, '/'); - if (pathComponents.length == 0) { + if (path.length() == 0) { throw new IllegalArgumentException("Invalid path: " + path); } + final String[] pathComponents = split(path); readLock.lock(); try { @@ -299,7 +300,7 @@ public String findMaxPrefix(final String path) { Objects.requireNonNull(path, "Path cannot be null"); - final String[] pathComponents = StringUtils.split(path, '/'); + final String[] pathComponents = split(path); readLock.lock(); try { @@ -344,4 +345,10 @@ } } + private static String[] split(final String path){ + return Stream.of(path.split("/")) + .filter(t -> !t.trim().isEmpty()) + .toArray(String[]::new); + } + } diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/FinalRequestProcessor.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/FinalRequestProcessor.java index a23e903..26d5baf 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/FinalRequestProcessor.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/FinalRequestProcessor.java @@ -25,7 +25,6 @@ import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Set; -import org.apache.commons.lang.StringUtils; import org.apache.jute.Record; import org.apache.zookeeper.ClientCnxn; import org.apache.zookeeper.KeeperException; @@ -554,7 +553,7 @@ public class FinalRequestProcessor implements RequestProcessor { String prefixPath = getEphemerals.getPrefixPath(); Set allEphems = zks.getZKDatabase().getDataTree().getEphemerals(request.sessionId); List ephemerals = new ArrayList<>(); - if (StringUtils.isBlank(prefixPath) || "/".equals(prefixPath.trim())) { + if (prefixPath == null || prefixPath.trim().isEmpty() || "/".equals(prefixPath.trim())) { ephemerals.addAll(allEphems); } else { for (String p : allEphems) {