accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject [accumulo] branch master updated: Update commons-collection to 4.3 (#1110)
Date Mon, 29 Apr 2019 17:30:01 GMT
This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 51b8644  Update commons-collection to 4.3 (#1110)
51b8644 is described below

commit 51b8644b61c5b1cb868dff26dd65529fb20456d3
Author: Mike Miller <mmiller@apache.org>
AuthorDate: Mon Apr 29 13:29:56 2019 -0400

    Update commons-collection to 4.3 (#1110)
---
 assemble/pom.xml                                   | 10 +++++-----
 core/pom.xml                                       |  8 ++++----
 .../accumulo/core/client/rfile/RFileWriter.java    |  2 +-
 .../core/clientImpl/ConditionalWriterImpl.java     |  2 +-
 .../core/iterators/system/VisibilityFilter.java    |  2 +-
 .../core/iterators/user/RowEncodingIterator.java   |  3 +--
 .../core/iterators/user/TransformingIterator.java  |  5 ++---
 .../core/iterators/user/VisibilityFilter.java      |  2 +-
 .../iterators/user/RowEncodingIteratorTest.java    |  6 ++----
 .../ShardedTableDistributionFormatterTest.java     | 23 ++--------------------
 pom.xml                                            | 10 +++++-----
 server/base/pom.xml                                |  8 ++++----
 .../accumulo/server/problems/ProblemReports.java   |  2 +-
 .../server/util/RemoveEntriesForMissingFiles.java  |  2 +-
 server/tserver/pom.xml                             |  8 ++++----
 .../org/apache/accumulo/tserver/TabletServer.java  |  2 +-
 .../accumulo/tserver/log/RecoveryLogReader.java    |  6 +++---
 shell/pom.xml                                      |  8 ++++----
 .../accumulo/shell/commands/TablesCommand.java     |  2 +-
 19 files changed, 44 insertions(+), 67 deletions(-)

diff --git a/assemble/pom.xml b/assemble/pom.xml
index 40f8c50..81e5652 100644
--- a/assemble/pom.xml
+++ b/assemble/pom.xml
@@ -113,11 +113,6 @@
       <optional>true</optional>
     </dependency>
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
       <groupId>commons-configuration</groupId>
       <artifactId>commons-configuration</artifactId>
       <optional>true</optional>
@@ -255,6 +250,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-math3</artifactId>
       <optional>true</optional>
     </dependency>
diff --git a/core/pom.xml b/core/pom.xml
index dd934c6..b468ee4 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -52,10 +52,6 @@
       <artifactId>protobuf-java</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-configuration</groupId>
       <artifactId>commons-configuration</artifactId>
     </dependency>
@@ -85,6 +81,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-math3</artifactId>
     </dependency>
     <dependency>
diff --git a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileWriter.java b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileWriter.java
index 8b05088..e531722 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileWriter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileWriter.java
@@ -31,7 +31,7 @@ import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.FileSKVWriter;
 import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.collections4.map.LRUMap;
 
 import com.google.common.base.Preconditions;
 
diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ConditionalWriterImpl.java
b/core/src/main/java/org/apache/accumulo/core/clientImpl/ConditionalWriterImpl.java
index bd2617a..80df6cf 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ConditionalWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ConditionalWriterImpl.java
@@ -80,7 +80,7 @@ import org.apache.accumulo.core.util.NamingThreadFactory;
 import org.apache.accumulo.fate.util.LoggingRunnable;
 import org.apache.accumulo.fate.zookeeper.ZooLock;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.LockID;
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.collections4.map.LRUMap;
 import org.apache.commons.lang.mutable.MutableLong;
 import org.apache.hadoop.io.Text;
 import org.apache.htrace.Trace;
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java
b/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java
index 342ad03..463add0 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java
@@ -28,7 +28,7 @@ import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.security.VisibilityEvaluator;
 import org.apache.accumulo.core.security.VisibilityParseException;
 import org.apache.accumulo.core.util.BadArgumentException;
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.collections4.map.LRUMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowEncodingIterator.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowEncodingIterator.java
index 2c73eb1..c693ba8 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowEncodingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowEncodingIterator.java
@@ -33,7 +33,6 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.IteratorEnvironment;
 import org.apache.accumulo.core.iterators.OptionDescriber;
 import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
-import org.apache.commons.collections.BufferOverflowException;
 import org.apache.hadoop.io.Text;
 
 /**
@@ -118,7 +117,7 @@ public abstract class RowEncodingIterator
         values.add(new Value(sourceTopValue));
         kvBufSize += sourceTopKey.getSize() + sourceTopValue.getSize() + 128;
         if (kvBufSize > maxBufferSize) {
-          throw new BufferOverflowException(
+          throw new IllegalArgumentException(
               "Exceeded buffer size of " + maxBufferSize + " for row: " + sourceTopKey.getRow());
         }
         sourceIter.next();
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
index fdea103..7d2f542 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
@@ -47,8 +47,7 @@ import org.apache.accumulo.core.security.VisibilityEvaluator;
 import org.apache.accumulo.core.security.VisibilityParseException;
 import org.apache.accumulo.core.util.BadArgumentException;
 import org.apache.accumulo.core.util.Pair;
-import org.apache.commons.collections.BufferOverflowException;
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.collections4.map.LRUMap;
 import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -347,7 +346,7 @@ public abstract class TransformingIterator extends WrappingIterator implements
O
 
           // try to defend against a scan or compaction using all memory in a tablet server
           if (appened > maxBufferSize)
-            throw new BufferOverflowException(
+            throw new IllegalArgumentException(
                 "Exceeded buffer size of " + maxBufferSize + ", prefixKey: " + prefixKey);
 
           if (getSource().hasTop() && key == getSource().getTopKey())
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/VisibilityFilter.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/VisibilityFilter.java
index 35d4a4e..08dab37 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/VisibilityFilter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/VisibilityFilter.java
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.security.VisibilityEvaluator;
 import org.apache.accumulo.core.security.VisibilityParseException;
 import org.apache.accumulo.core.util.BadArgumentException;
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.collections4.map.LRUMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowEncodingIteratorTest.java
b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowEncodingIteratorTest.java
index 93526d3..872d883 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowEncodingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowEncodingIteratorTest.java
@@ -38,7 +38,6 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.IteratorEnvironment;
 import org.apache.accumulo.core.iterators.IteratorUtil;
 import org.apache.accumulo.core.iterators.SortedMapIterator;
-import org.apache.commons.collections.BufferOverflowException;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
@@ -156,7 +155,7 @@ public class RowEncodingIteratorTest {
     assertFalse(iter.hasTop());
   }
 
-  @Test(expected = BufferOverflowException.class)
+  @Test(expected = IllegalArgumentException.class)
   public void testEncodeSome() throws IOException {
     byte[] kbVal = new byte[1024];
     // This code is shamelessly borrowed from the WholeRowIteratorTest.
@@ -173,7 +172,6 @@ public class RowEncodingIteratorTest {
     bigBufferOpts.put(RowEncodingIterator.MAX_BUFFER_SIZE_OPT, "1K");
     iter.init(src, bigBufferOpts, new DummyIteratorEnv());
     iter.seek(range, new ArrayList<>(), false);
-    // BufferOverflowException should be thrown as RowEncodingIterator can't fit the whole
row into
-    // its buffer.
+    // IllegalArgumentException should be thrown as we can't fit the whole row into its buffer
   }
 }
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatterTest.java
b/core/src/test/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatterTest.java
index ce733fe..778de12 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatterTest.java
@@ -27,8 +27,6 @@ import java.util.TreeMap;
 
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Predicate;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -65,26 +63,9 @@ public class ShardedTableDistributionFormatterTest {
     String[] resultLines = formatter.next().split("\n");
     List<String> results = Arrays.asList(resultLines).subList(2, 4);
 
-    assertTrue(CollectionUtils.exists(results, new AggregateReportChecker("NULL", 1)));
-    assertTrue(CollectionUtils.exists(results, new AggregateReportChecker("19700101", 2)));
+    assertTrue(results.stream().anyMatch(s -> s.startsWith("NULL") && s.endsWith(""
+ 1)));
+    assertTrue(results.stream().anyMatch(s -> s.startsWith("19700101") && s.endsWith(""
+ 2)));
 
     assertFalse(formatter.hasNext());
   }
-
-  private static class AggregateReportChecker implements Predicate {
-    private String day;
-    private int count;
-
-    AggregateReportChecker(String day, int count) {
-      this.day = day;
-      this.count = count;
-    }
-
-    @Override
-    public boolean evaluate(Object arg) {
-      String resLine = (String) arg;
-      return resLine.startsWith(this.day) && resLine.endsWith("" + this.count);
-    }
-
-  }
 }
diff --git a/pom.xml b/pom.xml
index aa19f09..fc1f8fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -252,11 +252,6 @@
         <version>1.12</version>
       </dependency>
       <dependency>
-        <groupId>commons-collections</groupId>
-        <artifactId>commons-collections</artifactId>
-        <version>3.2</version>
-      </dependency>
-      <dependency>
         <groupId>commons-configuration</groupId>
         <artifactId>commons-configuration</artifactId>
         <version>1.10</version>
@@ -415,6 +410,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.commons</groupId>
+        <artifactId>commons-collections4</artifactId>
+        <version>4.3</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.commons</groupId>
         <artifactId>commons-jci-core</artifactId>
         <version>1.1</version>
       </dependency>
diff --git a/server/base/pom.xml b/server/base/pom.xml
index 205130a..d356b56 100644
--- a/server/base/pom.xml
+++ b/server/base/pom.xml
@@ -49,10 +49,6 @@
       <artifactId>commons-codec</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-configuration</groupId>
       <artifactId>commons-configuration</artifactId>
     </dependency>
@@ -77,6 +73,10 @@
       <artifactId>accumulo-start</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-client-api</artifactId>
     </dependency>
diff --git a/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
b/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
index 240395f..b39939a 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
@@ -48,7 +48,7 @@ import org.apache.accumulo.fate.util.LoggingRunnable;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.util.MetadataTableUtil;
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.collections4.map.LRUMap;
 import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
b/server/base/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
index f47cc49..6578c43 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
@@ -44,7 +44,7 @@ import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.cli.ServerUtilOpts;
 import org.apache.accumulo.server.fs.VolumeManager;
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.collections4.map.LRUMap;
 import org.apache.hadoop.fs.Path;
 import org.apache.htrace.TraceScope;
 
diff --git a/server/tserver/pom.xml b/server/tserver/pom.xml
index 1ab56e6..16e2f3a 100644
--- a/server/tserver/pom.xml
+++ b/server/tserver/pom.xml
@@ -49,10 +49,6 @@
       <artifactId>commons-codec</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
@@ -77,6 +73,10 @@
       <artifactId>accumulo-start</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-client-api</artifactId>
     </dependency>
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 124a019..d238804 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -255,7 +255,7 @@ import org.apache.accumulo.tserver.tablet.ScanBatch;
 import org.apache.accumulo.tserver.tablet.Tablet;
 import org.apache.accumulo.tserver.tablet.TabletClosedException;
 import org.apache.accumulo.tserver.tablet.TabletData;
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.commons.collections4.map.LRUMap;
 import org.apache.hadoop.fs.FSError;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/RecoveryLogReader.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/RecoveryLogReader.java
index c6cf990..2fe9d47 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/RecoveryLogReader.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/RecoveryLogReader.java
@@ -23,13 +23,13 @@ import java.util.AbstractMap;
 import java.util.Iterator;
 import java.util.Map.Entry;
 import java.util.Objects;
+import java.util.PriorityQueue;
 
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.log.SortedLogState;
 import org.apache.accumulo.tserver.logger.LogEvents;
 import org.apache.accumulo.tserver.logger.LogFileKey;
 import org.apache.accumulo.tserver.logger.LogFileValue;
-import org.apache.commons.collections.buffer.PriorityBuffer;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -111,7 +111,7 @@ public class RecoveryLogReader implements CloseableIterator<Entry<LogFileKey,Log
     }
   }
 
-  private PriorityBuffer heap = new PriorityBuffer();
+  private PriorityQueue heap = new PriorityQueue<>();
   private Iterator<Entry<LogFileKey,LogFileValue>> iter;
 
   public RecoveryLogReader(VolumeManager fs, Path directory) throws IOException {
@@ -170,7 +170,7 @@ public class RecoveryLogReader implements CloseableIterator<Entry<LogFileKey,Log
 
   @VisibleForTesting
   synchronized boolean seek(WritableComparable<?> key) throws IOException {
-    PriorityBuffer reheap = new PriorityBuffer(heap.size());
+    PriorityQueue reheap = new PriorityQueue(heap.size());
     boolean result = false;
     for (Object obj : heap) {
       Index index = (Index) obj;
diff --git a/shell/pom.xml b/shell/pom.xml
index 07c1bab..e5a5128 100644
--- a/shell/pom.xml
+++ b/shell/pom.xml
@@ -48,10 +48,6 @@
       <artifactId>commons-cli</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
@@ -81,6 +77,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-vfs2</artifactId>
     </dependency>
     <dependency>
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java
index a985494..08154ce 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java
@@ -30,7 +30,7 @@ import org.apache.accumulo.shell.Shell.Command;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
-import org.apache.commons.collections.MapUtils;
+import org.apache.commons.collections4.MapUtils;
 
 import com.google.common.collect.Iterators;
 import com.google.common.collect.Maps;


Mime
View raw message