You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2018/02/21 22:03:47 UTC
[accumulo] branch master updated: ACCUMULO-4820 Cleanup code for
2.0 (#388)
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 17bc708 ACCUMULO-4820 Cleanup code for 2.0 (#388)
17bc708 is described below
commit 17bc708dcabd17824a8378597e0542002470ed18
Author: Mike Miller <mm...@apache.org>
AuthorDate: Wed Feb 21 17:03:45 2018 -0500
ACCUMULO-4820 Cleanup code for 2.0 (#388)
* Replace explicit type with <>
* Collapse identical catch statements
* Utilize try with resources
---
.../accumulo/core/client/IteratorSetting.java | 2 +-
.../core/client/MutationsRejectedException.java | 2 +-
.../core/client/impl/ConditionalWriterImpl.java | 6 +-
.../core/client/impl/InstanceOperationsImpl.java | 4 --
.../core/client/impl/NamespaceOperationsImpl.java | 5 +-
.../accumulo/core/client/impl/ScannerIterator.java | 2 +-
.../core/client/impl/TableOperationsImpl.java | 17 ++----
.../impl/TabletServerBatchReaderIterator.java | 5 +-
.../core/client/impl/TabletServerBatchWriter.java | 11 +---
.../accumulo/core/client/impl/ThriftScanner.java | 2 +-
.../core/client/impl/ZookeeperLockChecker.java | 4 +-
.../core/client/mapred/AccumuloOutputFormat.java | 8 +--
.../client/mapreduce/AccumuloOutputFormat.java | 8 +--
.../core/client/mapreduce/InputTableConfig.java | 2 +-
.../mapreduce/lib/impl/InputConfigurator.java | 12 +---
.../mapreduce/lib/partition/RangePartitioner.java | 5 +-
.../core/client/mock/MockBatchDeleter.java | 5 +-
.../accumulo/core/conf/ConfigurationCopy.java | 2 +-
.../core/conf/CredentialProviderFactoryShim.java | 70 ++++------------------
.../org/apache/accumulo/core/conf/Property.java | 4 +-
.../core/constraints/VisibilityConstraint.java | 4 +-
.../accumulo/core/file/BloomFilterLayer.java | 4 +-
.../accumulo/core/file/map/MapFileOperations.java | 2 +-
.../accumulo/core/file/rfile/SplitLarge.java | 3 +-
.../core/file/rfile/VisMetricsGatherer.java | 4 +-
.../accumulo/core/file/rfile/bcfile/BCFile.java | 10 +---
.../core/iterators/AggregatingIterator.java | 8 +--
.../accumulo/core/iterators/IteratorUtil.java | 8 +--
.../iterators/system/SourceSwitchingIterator.java | 2 +-
.../core/iterators/user/TransformingIterator.java | 5 +-
.../CachingHDFSSecretKeyEncryptionStrategy.java | 10 +---
.../NonCachingSecretKeyEncryptionStrategy.java | 10 +---
.../accumulo/core/util/LocalityGroupUtil.java | 4 +-
.../accumulo/core/util/SimpleThreadPool.java | 2 +-
.../format/ShardedTableDistributionFormatter.java | 2 +-
.../accumulo/core/client/IteratorSettingTest.java | 4 +-
.../client/impl/TableOperationsHelperTest.java | 2 +-
.../core/client/impl/TabletLocatorImplTest.java | 2 +-
.../client/mapreduce/AccumuloInputFormatTest.java | 2 +-
.../client/mapreduce/InputTableConfigTest.java | 2 +-
.../conf/CredentialProviderFactoryShimTest.java | 2 +-
.../core/file/BloomFilterLayerLookupTest.java | 3 +-
.../core/file/rfile/MultiThreadedRFileTest.java | 2 +-
.../core/iterators/SortedMapIteratorTest.java | 4 +-
.../system/SourceSwitchingIteratorTest.java | 22 +++----
.../iterators/system/TimeSettingIteratorTest.java | 13 ++--
.../iterators/system/VisibilityFilterTest.java | 5 +-
.../iterators/user/RowDeletingIteratorTest.java | 28 ++++-----
.../iterators/user/RowEncodingIteratorTest.java | 7 +--
.../core/iterators/user/RowFilterTest.java | 4 +-
.../iterators/user/TransformingIteratorTest.java | 16 ++---
.../user/WholeColumnFamilyIteratorTest.java | 13 ++--
.../core/iterators/user/WholeRowIteratorTest.java | 13 ++--
.../ReplicationConfigurationUtilTest.java | 8 +--
.../apache/accumulo/core/util/PartitionerTest.java | 6 +-
.../apache/accumulo/fate/zookeeper/ZooCache.java | 4 +-
.../apache/accumulo/fate/zookeeper/ZooLock.java | 8 +--
.../accumulo/fate/zookeeper/ZooQueueLock.java | 4 +-
.../impl/MiniAccumuloClusterControl.java | 40 ++++---------
.../org/apache/accumulo/proxy/ProxyServer.java | 4 +-
.../java/org/apache/accumulo/server/Accumulo.java | 5 +-
.../accumulo/server/client/BulkImporter.java | 11 +---
.../server/client/ClientServiceHandler.java | 17 +-----
.../server/constraints/MetadataConstraints.java | 4 +-
.../org/apache/accumulo/server/fs/VolumeUtil.java | 5 +-
.../apache/accumulo/server/init/Initialize.java | 4 +-
.../accumulo/server/master/LiveTServerSet.java | 9 +--
.../server/master/balancer/TableLoadBalancer.java | 4 +-
.../server/master/state/MetaDataStateStore.java | 4 --
.../server/master/state/MetaDataTableScanner.java | 4 +-
.../accumulo/server/problems/ProblemReports.java | 2 +-
.../server/replication/ReplicaSystemHelper.java | 5 +-
.../server/security/handler/ZKAuthenticator.java | 8 +--
.../server/security/handler/ZKAuthorizor.java | 5 +-
.../server/security/handler/ZKPermHandler.java | 5 +-
.../accumulo/server/util/AccumuloStatus.java | 4 +-
.../org/apache/accumulo/server/util/Admin.java | 5 +-
.../accumulo/server/util/FileSystemMonitor.java | 5 +-
.../accumulo/server/util/FindOfflineTablets.java | 5 +-
.../accumulo/server/util/MasterMetadataUtil.java | 12 ++--
.../accumulo/server/util/MetadataTableUtil.java | 6 +-
.../accumulo/server/util/ReplicationTableUtil.java | 8 +--
.../replication/CloseWriteAheadLogReferences.java | 4 --
.../java/org/apache/accumulo/master/Master.java | 4 +-
.../master/MasterClientServiceHandler.java | 4 +-
.../apache/accumulo/master/tableOps/CleanUp.java | 5 +-
.../apache/accumulo/master/tableOps/LoadFiles.java | 5 +-
.../java/org/apache/accumulo/monitor/Monitor.java | 2 +-
.../java/org/apache/accumulo/tracer/SpanTree.java | 2 +-
.../org/apache/accumulo/tracer/TraceServer.java | 6 +-
.../org/apache/accumulo/tserver/InMemoryMap.java | 2 +-
.../tserver/TabletIteratorEnvironment.java | 2 +-
.../org/apache/accumulo/tserver/TabletServer.java | 12 ++--
.../tserver/TabletServerResourceManager.java | 4 +-
.../org/apache/accumulo/tserver/WriteTracker.java | 2 +-
.../apache/accumulo/tserver/tablet/Compactor.java | 9 +--
.../apache/accumulo/tserver/tablet/Scanner.java | 2 +-
.../org/apache/accumulo/tserver/tablet/Tablet.java | 20 ++-----
.../main/java/org/apache/accumulo/shell/Shell.java | 5 +-
.../java/org/apache/accumulo/shell/ShellUtil.java | 5 +-
.../accumulo/shell/commands/ExecfileCommand.java | 5 +-
.../accumulo/shell/commands/GetSplitsCommand.java | 6 +-
.../accumulo/shell/commands/SetIterCommand.java | 4 +-
.../commands/ShellPluginConfigurationCommand.java | 4 +-
.../org/apache/accumulo/shell/mock/MockShell.java | 5 +-
.../classloader/vfs/AccumuloVFSClassLoader.java | 2 +-
.../start/classloader/vfs/MiniDFSUtil.java | 5 +-
.../accumulo/test/CompactionRateLimitingIT.java | 5 +-
.../apache/accumulo/test/ConditionalWriterIT.java | 4 +-
.../org/apache/accumulo/test/InMemoryMapIT.java | 2 +-
.../org/apache/accumulo/test/NamespacesIT.java | 2 +-
.../apache/accumulo/test/TestMultiTableIngest.java | 4 +-
.../java/org/apache/accumulo/test/VolumeIT.java | 4 +-
.../test/functional/ConcurrentDeleteTableIT.java | 5 +-
.../accumulo/test/functional/ReadWriteIT.java | 4 +-
.../apache/accumulo/test/functional/ScanIdIT.java | 16 +----
.../accumulo/test/functional/SplitRecoveryIT.java | 4 +-
.../apache/accumulo/test/functional/SummaryIT.java | 2 +-
.../test/functional/WatchTheWatchCountIT.java | 5 +-
.../accumulo/test/functional/WriteLotsIT.java | 2 +-
.../CloseWriteAheadLogReferencesIT.java | 2 +-
.../test/performance/scan/CollectTabletStats.java | 4 +-
.../test/performance/thrift/NullTserver.java | 2 +-
.../test/proxy/TestProxyNamespaceOperations.java | 4 +-
124 files changed, 232 insertions(+), 574 deletions(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java b/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
index a6d9a09..ec2bcda 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
@@ -121,7 +121,7 @@ public class IteratorSetting implements Writable {
* the fully qualified class name for the iterator
*/
public IteratorSetting(int priority, String name, String iteratorClass) {
- this(priority, name, iteratorClass, new HashMap<String,String>());
+ this(priority, name, iteratorClass, new HashMap<>());
}
/**
diff --git a/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java b/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
index 3d26e2d..3bfc284 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
@@ -73,7 +73,7 @@ public class MutationsRejectedException extends AccumuloException {
String tableInfo = Tables.getPrintableTableInfoFromId(instance, Table.ID.of(tabletId.getTableId().toString()));
if (!result.containsKey(tableInfo)) {
- result.put(tableInfo, new HashSet<SecurityErrorCode>());
+ result.put(tableInfo, new HashSet<>());
}
result.get(tableInfo).addAll(hashMap.get(tabletId));
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
index 22d8a1b..638f7ba 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
@@ -96,7 +96,7 @@ import org.slf4j.LoggerFactory;
class ConditionalWriterImpl implements ConditionalWriter {
- private static ThreadPoolExecutor cleanupThreadPool = new ThreadPoolExecutor(1, 1, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), r -> {
+ private static ThreadPoolExecutor cleanupThreadPool = new ThreadPoolExecutor(1, 1, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), r -> {
Thread t = new Thread(r, "Conditional Writer Cleanup Thread");
t.setDaemon(true);
return t;
@@ -834,9 +834,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
Boolean bb = ve.evaluate(new ColumnVisibility(testVis));
cache.put(new Text(testVis), bb);
return bb;
- } catch (VisibilityParseException e) {
- return false;
- } catch (BadArgumentException e) {
+ } catch (VisibilityParseException | BadArgumentException e) {
return false;
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java
index 7a93371..7eade0d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java
@@ -193,10 +193,6 @@ public class InstanceOperationsImpl implements InstanceOperations {
transport = ThriftUtil.createTransport(AddressUtil.parseAddress(tserver, false), context);
TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport);
client.getTabletServerStatus(Tracer.traceInfo(), context.rpcCreds());
- } catch (TTransportException e) {
- throw new AccumuloException(e);
- } catch (ThriftSecurityException e) {
- throw new AccumuloException(e);
} catch (TException e) {
throw new AccumuloException(e);
} finally {
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
index bf21a17..9cfb1a4 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
@@ -268,10 +268,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
try {
return tableOps.doFateOperation(op, args, opts, namespace);
- } catch (TableExistsException e) {
- // should not happen
- throw new AssertionError(e);
- } catch (TableNotFoundException e) {
+ } catch (TableExistsException | TableNotFoundException e) {
// should not happen
throw new AssertionError(e);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
index c24e50b..ec0c48c 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
@@ -66,7 +66,7 @@ public class ScannerIterator implements Iterator<Entry<Key,Value>> {
private static final List<KeyValue> EMPTY_LIST = Collections.emptyList();
- private static ThreadPoolExecutor readaheadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 3l, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
+ private static ThreadPoolExecutor readaheadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 3l, TimeUnit.SECONDS, new SynchronousQueue<>(),
new NamingThreadFactory("Accumulo scanner read ahead thread"));
private class Reader implements Runnable {
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 63996b9..e4b34b5 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
@@ -756,7 +756,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
@Override
public void compact(String tableName, Text start, Text end, boolean flush, boolean wait) throws AccumuloSecurityException, TableNotFoundException,
AccumuloException {
- compact(tableName, start, end, new ArrayList<IteratorSetting>(), flush, wait);
+ compact(tableName, start, end, new ArrayList<>(), flush, wait);
}
@Override
@@ -802,10 +802,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
Map<String,String> opts = new HashMap<>();
try {
doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, config.getWait());
- } catch (TableExistsException e) {
- // should not happen
- throw new AssertionError(e);
- } catch (NamespaceExistsException e) {
+ } catch (TableExistsException | NamespaceExistsException e) {
// should not happen
throw new AssertionError(e);
} catch (NamespaceNotFoundException e) {
@@ -1385,27 +1382,21 @@ public class TableOperationsImpl extends TableOperationsHelper {
public static Map<String,String> getExportedProps(FileSystem fs, Path path) throws IOException {
HashMap<String,String> props = new HashMap<>();
- ZipInputStream zis = new ZipInputStream(fs.open(path));
- try {
+ try (ZipInputStream zis = new ZipInputStream(fs.open(path))) {
ZipEntry zipEntry;
while ((zipEntry = zis.getNextEntry()) != null) {
if (zipEntry.getName().equals(Constants.EXPORT_TABLE_CONFIG_FILE)) {
- BufferedReader in = new BufferedReader(new InputStreamReader(zis, UTF_8));
- try {
+ try (BufferedReader in = new BufferedReader(new InputStreamReader(zis, UTF_8))) {
String line;
while ((line = in.readLine()) != null) {
String sa[] = line.split("=", 2);
props.put(sa[0], sa[1]);
}
- } finally {
- in.close();
}
break;
}
}
- } finally {
- zis.close();
}
return props;
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
index ea0fe4f..a09576b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
@@ -393,10 +393,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
// there were some failures
try {
processFailures(failures, receiver, columns);
- } catch (TableNotFoundException e) {
- log.debug("{}", e.getMessage(), e);
- fatalException = e;
- } catch (AccumuloException e) {
+ } catch (TableNotFoundException | AccumuloException e) {
log.debug("{}", e.getMessage(), e);
fatalException = e;
} catch (AccumuloSecurityException e) {
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
index ba5a6fd..fa21db7 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
@@ -62,7 +62,6 @@ import org.apache.accumulo.core.data.thrift.UpdateErrors;
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.rpc.ThriftUtil;
import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
-import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException;
import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
import org.apache.accumulo.core.trace.Span;
@@ -667,7 +666,7 @@ public class TabletServerBatchWriter {
queued = new HashSet<>();
sendThreadPool = new SimpleThreadPool(numSendThreads, this.getClass().getName());
locators = new HashMap<>();
- binningThreadPool = new SimpleThreadPool(1, "BinMutations", new SynchronousQueue<Runnable>());
+ binningThreadPool = new SimpleThreadPool(1, "BinMutations", new SynchronousQueue<>());
binningThreadPool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
}
@@ -714,11 +713,7 @@ public class TabletServerBatchWriter {
failedMutations.add(mutationsToProcess);
} catch (AccumuloSecurityException e) {
updateAuthorizationFailures(Collections.singletonMap(new KeyExtent(tableId, null, null), SecurityErrorCode.valueOf(e.getSecurityErrorCode().name())));
- } catch (TableDeletedException e) {
- updateUnknownErrors(e.getMessage(), e);
- } catch (TableOfflineException e) {
- updateUnknownErrors(e.getMessage(), e);
- } catch (TableNotFoundException e) {
+ } catch (TableDeletedException | TableNotFoundException | TableOfflineException e) {
updateUnknownErrors(e.getMessage(), e);
}
@@ -1001,8 +996,6 @@ public class TabletServerBatchWriter {
} catch (ThriftSecurityException e) {
updateAuthorizationFailures(tabMuts.keySet(), e.code);
throw new AccumuloSecurityException(e.user, e.code, e);
- } catch (NoSuchScanIDException e) {
- throw new IOException(e);
} catch (TException e) {
throw new IOException(e);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
index d6637e4..b495334 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
@@ -79,7 +79,7 @@ public class ThriftScanner {
static {
for (TabletType ttype : TabletType.values()) {
- serversWaitedForWrites.put(ttype, Collections.synchronizedSet(new HashSet<String>()));
+ serversWaitedForWrites.put(ttype, Collections.synchronizedSet(new HashSet<>()));
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ZookeeperLockChecker.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ZookeeperLockChecker.java
index a9c33b5..b90478e 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ZookeeperLockChecker.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ZookeeperLockChecker.java
@@ -46,9 +46,7 @@ public class ZookeeperLockChecker implements TabletServerLockChecker {
public boolean isLockHeld(String tserver, String session) {
try {
return ZooLock.getSessionId(zc, root + "/" + tserver) == Long.parseLong(session, 16);
- } catch (KeeperException e) {
- throw new RuntimeException(e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
throw new RuntimeException(e);
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
index 426a4d6..62d32a6 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
@@ -519,9 +519,7 @@ public class AccumuloOutputFormat implements OutputFormat<Text,Mutation> {
} catch (TableNotFoundException e) {
log.error("Accumulo table " + table + " doesn't exist and cannot be created.", e);
throw new AccumuloException(e);
- } catch (AccumuloException e) {
- throw e;
- } catch (AccumuloSecurityException e) {
+ } catch (AccumuloException | AccumuloSecurityException e) {
throw e;
}
@@ -595,9 +593,7 @@ public class AccumuloOutputFormat implements OutputFormat<Text,Mutation> {
Connector c = getInstance(job).getConnector(principal, token);
if (!c.securityOperations().authenticateUser(principal, token))
throw new IOException("Unable to authenticate user");
- } catch (AccumuloException e) {
- throw new IOException(e);
- } catch (AccumuloSecurityException e) {
+ } catch (AccumuloException | AccumuloSecurityException e) {
throw new IOException(e);
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
index af69e5a..21b7714 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
@@ -519,9 +519,7 @@ public class AccumuloOutputFormat extends OutputFormat<Text,Mutation> {
} catch (TableNotFoundException e) {
log.error("Accumulo table " + table + " doesn't exist and cannot be created.", e);
throw new AccumuloException(e);
- } catch (AccumuloException e) {
- throw e;
- } catch (AccumuloSecurityException e) {
+ } catch (AccumuloException | AccumuloSecurityException e) {
throw e;
}
@@ -595,9 +593,7 @@ public class AccumuloOutputFormat extends OutputFormat<Text,Mutation> {
Connector c = getInstance(job).getConnector(principal, token);
if (!c.securityOperations().authenticateUser(principal, token))
throw new IOException("Unable to authenticate user");
- } catch (AccumuloException e) {
- throw new IOException(e);
- } catch (AccumuloSecurityException e) {
+ } catch (AccumuloException | AccumuloSecurityException e) {
throw new IOException(e);
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
index b892ac1..c8ec22f 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
@@ -326,7 +326,7 @@ public class InputTableConfig implements Writable {
Text colFam = new Text();
colFam.readFields(dataInput);
if (numPairs == 1) {
- columns.add(new Pair<Text,Text>(colFam, null));
+ columns.add(new Pair<>(colFam, null));
} else if (numPairs == 2) {
Text colQual = new Text();
colQual.readFields(dataInput);
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
index a8227fe..2212c9d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
@@ -736,11 +736,7 @@ public class InputConfigurator extends ConfiguratorBase {
}
}
}
- } catch (AccumuloException e) {
- throw new IOException(e);
- } catch (AccumuloSecurityException e) {
- throw new IOException(e);
- } catch (TableNotFoundException e) {
+ } catch (AccumuloException | TableNotFoundException | AccumuloSecurityException e) {
throw new IOException(e);
}
}
@@ -799,11 +795,7 @@ public class InputConfigurator extends ConfiguratorBase {
}
}
}
- } catch (AccumuloException e) {
- throw new IOException(e);
- } catch (AccumuloSecurityException e) {
- throw new IOException(e);
- } catch (TableNotFoundException e) {
+ } catch (AccumuloException | TableNotFoundException | AccumuloSecurityException e) {
throw new IOException(e);
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
index c6fab6f..f9d1bc1 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
@@ -90,12 +90,9 @@ public class RangePartitioner extends Partitioner<Text,Writable> implements Conf
for (Path path : cf) {
if (path.toUri().getPath().endsWith(cutFileName.substring(cutFileName.lastIndexOf('/')))) {
TreeSet<Text> cutPoints = new TreeSet<>();
- Scanner in = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(path.toString()), UTF_8)));
- try {
+ try (Scanner in = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(path.toString()), UTF_8)))) {
while (in.hasNextLine())
cutPoints.add(new Text(Base64.getDecoder().decode(in.nextLine())));
- } finally {
- in.close();
}
cutPointArray = cutPoints.toArray(new Text[cutPoints.size()]);
break;
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchDeleter.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchDeleter.java
index bacd844..b55b327 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchDeleter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchDeleter.java
@@ -58,8 +58,7 @@ public class MockBatchDeleter extends MockBatchScanner implements BatchDeleter {
@Override
public void delete() throws MutationsRejectedException, TableNotFoundException {
- BatchWriter writer = new MockBatchWriter(acc, tableName);
- try {
+ try (BatchWriter writer = new MockBatchWriter(acc, tableName)) {
Iterator<Entry<Key,Value>> iter = super.iterator();
while (iter.hasNext()) {
Entry<Key,Value> next = iter.next();
@@ -68,8 +67,6 @@ public class MockBatchDeleter extends MockBatchScanner implements BatchDeleter {
m.putDelete(k.getColumnFamily(), k.getColumnQualifier(), new ColumnVisibility(k.getColumnVisibility()), k.getTimestamp());
writer.addMutation(m);
}
- } finally {
- writer.close();
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
index 0f617bb..cf1c9fe 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
@@ -55,7 +55,7 @@ public class ConfigurationCopy extends AccumuloConfiguration {
* Creates a new empty configuration.
*/
public ConfigurationCopy() {
- this(new HashMap<String,String>());
+ this(new HashMap<>());
}
@Override
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java b/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java
index eb1920d..3929210 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java
@@ -98,10 +98,7 @@ public class CredentialProviderFactoryShim {
// Load Hadoop CredentialProviderFactory.getProviders(Configuration)
try {
getProvidersMethod = hadoopCredProviderFactoryClz.getMethod(HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME, Configuration.class);
- } catch (SecurityException e) {
- log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME, HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME, e);
- return false;
- } catch (NoSuchMethodException e) {
+ } catch (SecurityException | NoSuchMethodException e) {
log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME, HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME, e);
return false;
}
@@ -109,10 +106,7 @@ public class CredentialProviderFactoryShim {
// Instantiate Hadoop CredentialProviderFactory
try {
hadoopCredProviderFactory = hadoopCredProviderFactoryClz.newInstance();
- } catch (InstantiationException e) {
- log.trace("Could not instantiate class {}", HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME, e);
- return false;
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
log.trace("Could not instantiate class {}", HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME, e);
return false;
}
@@ -129,10 +123,7 @@ public class CredentialProviderFactoryShim {
// Load Hadoop CredentialProvider.getCredentialEntry(String)
try {
getCredentialEntryMethod = hadoopCredProviderClz.getMethod(HADOOP_CRED_PROVIDER_GET_CREDENTIAL_ENTRY_METHOD_NAME, String.class);
- } catch (SecurityException e) {
- log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_GET_CREDENTIAL_ENTRY_METHOD_NAME, HADOOP_CRED_PROVIDER_CLASS_NAME, e);
- return false;
- } catch (NoSuchMethodException e) {
+ } catch (SecurityException | NoSuchMethodException e) {
log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_GET_CREDENTIAL_ENTRY_METHOD_NAME, HADOOP_CRED_PROVIDER_CLASS_NAME, e);
return false;
}
@@ -140,10 +131,7 @@ public class CredentialProviderFactoryShim {
// Load Hadoop CredentialProvider.getAliases()
try {
getAliasesMethod = hadoopCredProviderClz.getMethod(HADOOP_CRED_PROVIDER_GET_ALIASES_METHOD_NAME);
- } catch (SecurityException e) {
- log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_GET_ALIASES_METHOD_NAME, HADOOP_CRED_PROVIDER_CLASS_NAME, e);
- return false;
- } catch (NoSuchMethodException e) {
+ } catch (SecurityException | NoSuchMethodException e) {
log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_GET_ALIASES_METHOD_NAME, HADOOP_CRED_PROVIDER_CLASS_NAME, e);
return false;
}
@@ -151,10 +139,7 @@ public class CredentialProviderFactoryShim {
// Load Hadoop CredentialProvider.createCredentialEntry(String, char[])
try {
createCredentialEntryMethod = hadoopCredProviderClz.getMethod(HADOOP_CRED_PROVIDER_CREATE_CREDENTIAL_ENTRY_METHOD_NAME, String.class, char[].class);
- } catch (SecurityException e) {
- log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_CREATE_CREDENTIAL_ENTRY_METHOD_NAME, HADOOP_CRED_PROVIDER_CLASS_NAME, e);
- return false;
- } catch (NoSuchMethodException e) {
+ } catch (SecurityException | NoSuchMethodException e) {
log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_CREATE_CREDENTIAL_ENTRY_METHOD_NAME, HADOOP_CRED_PROVIDER_CLASS_NAME, e);
return false;
}
@@ -162,10 +147,7 @@ public class CredentialProviderFactoryShim {
// Load Hadoop CredentialProvider.flush()
try {
flushMethod = hadoopCredProviderClz.getMethod(HADOOP_CRED_PROVIDER_FLUSH_METHOD_NAME);
- } catch (SecurityException e) {
- log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_FLUSH_METHOD_NAME, HADOOP_CRED_PROVIDER_CLASS_NAME, e);
- return false;
- } catch (NoSuchMethodException e) {
+ } catch (SecurityException | NoSuchMethodException e) {
log.trace("Could not find {} method on {}", HADOOP_CRED_PROVIDER_FLUSH_METHOD_NAME, HADOOP_CRED_PROVIDER_CLASS_NAME, e);
return false;
}
@@ -182,10 +164,7 @@ public class CredentialProviderFactoryShim {
// Load Hadoop CredentialEntry.getCredential()
try {
getCredentialMethod = hadoopCredentialEntryClz.getMethod(HADOOP_CRED_ENTRY_GET_CREDENTIAL_METHOD_NAME);
- } catch (SecurityException e) {
- log.trace("Could not find {} method on {}", HADOOP_CRED_ENTRY_GET_CREDENTIAL_METHOD_NAME, HADOOP_CRED_ENTRY_CLASS_NAME, e);
- return false;
- } catch (NoSuchMethodException e) {
+ } catch (SecurityException | NoSuchMethodException e) {
log.trace("Could not find {} method on {}", HADOOP_CRED_ENTRY_GET_CREDENTIAL_METHOD_NAME, HADOOP_CRED_ENTRY_CLASS_NAME, e);
return false;
}
@@ -218,13 +197,7 @@ public class CredentialProviderFactoryShim {
Object providersObj = null;
try {
providersObj = getProvidersMethod.invoke(hadoopCredProviderFactory, conf);
- } catch (IllegalArgumentException e) {
- log.warn("Could not invoke {}.{}", HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME, HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME, e);
- return null;
- } catch (IllegalAccessException e) {
- log.warn("Could not invoke {}.{}", HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME, HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME, e);
- return null;
- } catch (InvocationTargetException e) {
+ } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
log.warn("Could not invoke {}.{}", HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME, HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME, e);
return null;
}
@@ -264,13 +237,7 @@ public class CredentialProviderFactoryShim {
Object credential = getCredentialMethod.invoke(credEntryObj);
return (char[]) credential;
- } catch (IllegalArgumentException e) {
- log.warn("Failed to get credential for {} from {}", alias, providerObj, e);
- continue;
- } catch (IllegalAccessException e) {
- log.warn("Failed to get credential for {} from {}", alias, providerObj, e);
- continue;
- } catch (InvocationTargetException e) {
+ } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
log.warn("Failed to get credential for {} from {}", alias, providerObj, e);
continue;
}
@@ -307,13 +274,7 @@ public class CredentialProviderFactoryShim {
}
}
- } catch (IllegalArgumentException e) {
- log.warn("Failed to invoke {} on {}", HADOOP_CRED_PROVIDER_GET_ALIASES_METHOD_NAME, providerObj, e);
- continue;
- } catch (IllegalAccessException e) {
- log.warn("Failed to invoke {} on {}", HADOOP_CRED_PROVIDER_GET_ALIASES_METHOD_NAME, providerObj, e);
- continue;
- } catch (InvocationTargetException e) {
+ } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
log.warn("Failed to invoke {} on {}", HADOOP_CRED_PROVIDER_GET_ALIASES_METHOD_NAME, providerObj, e);
continue;
}
@@ -452,21 +413,14 @@ public class CredentialProviderFactoryShim {
} catch (IllegalArgumentException e) {
log.warn("Failed to invoke createCredentialEntry method on CredentialProvider", e);
return;
- } catch (IllegalAccessException e) {
- log.warn("Failed to invoke createCredentialEntry method", e);
- return;
- } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException | InvocationTargetException e) {
log.warn("Failed to invoke createCredentialEntry method", e);
return;
}
try {
flushMethod.invoke(credentialProvider);
- } catch (IllegalArgumentException e) {
- log.warn("Failed to invoke flush method on CredentialProvider", e);
- } catch (IllegalAccessException e) {
- log.warn("Failed to invoke flush method on CredentialProvider", e);
- } catch (InvocationTargetException e) {
+ } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
log.warn("Failed to invoke flush method on CredentialProvider", e);
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 036ef4f..482fe6c 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -809,9 +809,7 @@ public enum Property {
for (Annotation a : getClass().getField(name()).getAnnotations())
if (annotationType.isInstance(a))
return true;
- } catch (SecurityException e) {
- log.error("{}", e.getMessage(), e);
- } catch (NoSuchFieldException e) {
+ } catch (SecurityException | NoSuchFieldException e) {
log.error("{}", e.getMessage(), e);
}
return false;
diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java
index 6a962c2..04e01a3 100644
--- a/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java
+++ b/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java
@@ -76,9 +76,7 @@ public class VisibilityConstraint implements Constraint {
if (!ve.evaluate(new ColumnVisibility(cv)))
return Collections.singletonList(Short.valueOf((short) 2));
- } catch (BadArgumentException bae) {
- return Collections.singletonList(Short.valueOf((short) 1));
- } catch (VisibilityParseException e) {
+ } catch (BadArgumentException | VisibilityParseException bae) {
return Collections.singletonList(Short.valueOf((short) 1));
}
diff --git a/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java b/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
index 01fb699..ed9cfd9 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
@@ -492,7 +492,7 @@ public class BloomFilterLayer {
String fi = String.format("%010d", row);
// bmfr.seek(new Range(new Text("r"+fi)));
org.apache.accumulo.core.data.Key k1 = new org.apache.accumulo.core.data.Key(new Text("r" + fi), new Text("cf1"));
- bmfr.seek(new Range(k1, true, k1.followingKey(PartialKey.ROW_COLFAM), false), new ArrayList<ByteSequence>(), false);
+ bmfr.seek(new Range(k1, true, k1.followingKey(PartialKey.ROW_COLFAM), false), new ArrayList<>(), false);
if (valsSet.contains(row)) {
hits++;
if (!bmfr.hasTop()) {
@@ -515,7 +515,7 @@ public class BloomFilterLayer {
// bmfr.seek(new Range(new Text("r"+fi)));
org.apache.accumulo.core.data.Key k1 = new org.apache.accumulo.core.data.Key(new Text("r" + fi), new Text("cf1"));
- bmfr.seek(new Range(k1, true, k1.followingKey(PartialKey.ROW_COLFAM), false), new ArrayList<ByteSequence>(), false);
+ bmfr.seek(new Range(k1, true, k1.followingKey(PartialKey.ROW_COLFAM), false), new ArrayList<>(), false);
if (!bmfr.hasTop()) {
out.println("ERROR 2 " + row);
diff --git a/core/src/main/java/org/apache/accumulo/core/file/map/MapFileOperations.java b/core/src/main/java/org/apache/accumulo/core/file/map/MapFileOperations.java
index 10ca253..5330eac 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/map/MapFileOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/map/MapFileOperations.java
@@ -140,7 +140,7 @@ public class MapFileOperations extends FileOperations {
FileSKVIterator iter = new RangeIterator(new MapFileIterator(options.getTableConfiguration(), options.getFileSystem(), options.getFilename(),
options.getConfiguration()));
if (options.isSeekToBeginning()) {
- iter.seek(new Range(new Key(), null), new ArrayList<ByteSequence>(), false);
+ iter.seek(new Range(new Key(), null), new ArrayList<>(), false);
}
return iter;
}
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
index 4816990..09e5ce5 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
@@ -23,7 +23,6 @@ import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
@@ -74,7 +73,7 @@ public class SplitLarge {
small.startDefaultLocalityGroup();
large.startDefaultLocalityGroup();
- iter.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ iter.seek(new Range(), new ArrayList<>(), false);
while (iter.hasTop()) {
Key key = iter.getTopKey();
Value value = iter.getTopValue();
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/VisMetricsGatherer.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/VisMetricsGatherer.java
index b648335..21cb731 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/VisMetricsGatherer.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/VisMetricsGatherer.java
@@ -80,8 +80,8 @@ public class VisMetricsGatherer implements MetricsGatherer<Map<String,ArrayList<
}
}
localityGroups.add(name);
- metric.put(name, AtomicLongMap.create(new HashMap<String,Long>()));
- blocks.put(name, AtomicLongMap.create(new HashMap<String,Long>()));
+ metric.put(name, AtomicLongMap.create(new HashMap<>()));
+ blocks.put(name, AtomicLongMap.create(new HashMap<>()));
numLG++;
numEntries.add((long) 0);
numBlocks.add(0);
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java
index e998a87..ea6bc59 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java
@@ -384,11 +384,8 @@ public final class BCFile {
}
// add metaBCFileIndex to metaIndex as the last meta block
- BlockAppender appender = prepareMetaBlock(DataIndex.BLOCK_NAME, getDefaultCompressionAlgorithm());
- try {
+ try (BlockAppender appender = prepareMetaBlock(DataIndex.BLOCK_NAME, getDefaultCompressionAlgorithm())) {
dataIndex.write(appender);
- } finally {
- appender.close();
}
long offsetIndexMeta = out.position();
@@ -868,11 +865,8 @@ public final class BCFile {
}
// read data:BCFile.index, the data block index
- BlockReader blockR = getMetaBlock(DataIndex.BLOCK_NAME);
- try {
+ try (BlockReader blockR = getMetaBlock(DataIndex.BLOCK_NAME)) {
dataIndex = new DataIndex(blockR);
- } finally {
- blockR.close();
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
index 979eaeb..de88e43 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
@@ -174,13 +174,7 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>, O
if (null != env)
context = env.getConfig().get(Property.TABLE_CLASSPATH);
this.aggregators = new ColumnToClassMapping<>(options, org.apache.accumulo.core.iterators.aggregation.Aggregator.class, context);
- } catch (ClassNotFoundException e) {
- log.error(e.toString());
- throw new IllegalArgumentException(e);
- } catch (InstantiationException e) {
- log.error(e.toString());
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
+ } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
log.error(e.toString());
throw new IllegalArgumentException(e);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java b/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java
index 7ac67f8..1019dc8 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java
@@ -282,13 +282,7 @@ public class IteratorUtil {
skvi.init(prev, options, env);
prev = skvi;
}
- } catch (ClassNotFoundException e) {
- log.error(e.toString());
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- log.error(e.toString());
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
+ } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
log.error(e.toString());
throw new RuntimeException(e);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java
index 3631cc8..d192218 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIterator.java
@@ -87,7 +87,7 @@ public class SourceSwitchingIterator implements InterruptibleIterator {
}
public SourceSwitchingIterator(DataSource source, boolean onlySwitchAfterRow) {
- this(source, onlySwitchAfterRow, new ArrayList<SourceSwitchingIterator>());
+ this(source, onlySwitchAfterRow, new ArrayList<>());
}
public SourceSwitchingIterator(DataSource source) {
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 81854a9..2e2d7ff 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
@@ -415,10 +415,7 @@ abstract public class TransformingIterator extends WrappingIterator implements O
colVis = new ColumnVisibility(visibility.toArray());
visible = ve.evaluate(colVis);
visibleCache.put(visibility, visible);
- } catch (VisibilityParseException e) {
- log.error("Parse Error", e);
- visible = Boolean.FALSE;
- } catch (BadArgumentException e) {
+ } catch (VisibilityParseException | BadArgumentException e) {
log.error("Parse Error", e);
visible = Boolean.FALSE;
}
diff --git a/core/src/main/java/org/apache/accumulo/core/security/crypto/CachingHDFSSecretKeyEncryptionStrategy.java b/core/src/main/java/org/apache/accumulo/core/security/crypto/CachingHDFSSecretKeyEncryptionStrategy.java
index b301988..4633128 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/crypto/CachingHDFSSecretKeyEncryptionStrategy.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/crypto/CachingHDFSSecretKeyEncryptionStrategy.java
@@ -84,10 +84,7 @@ public class CachingHDFSSecretKeyEncryptionStrategy implements SecretKeyEncrypti
try {
Key plaintextKey = cipher.unwrap(params.getEncryptedKey(), params.getKeyAlgorithmName(), Cipher.SECRET_KEY);
params.setPlaintextKey(plaintextKey.getEncoded());
- } catch (InvalidKeyException e) {
- log.error("{}", e.getMessage(), e);
- throw new RuntimeException(e);
- } catch (NoSuchAlgorithmException e) {
+ } catch (InvalidKeyException | NoSuchAlgorithmException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
@@ -97,10 +94,7 @@ public class CachingHDFSSecretKeyEncryptionStrategy implements SecretKeyEncrypti
byte[] encryptedSecretKey = cipher.wrap(plaintextKey);
params.setEncryptedKey(encryptedSecretKey);
params.setOpaqueKeyEncryptionKeyID(secretKeyCache.getPathToKeyName());
- } catch (InvalidKeyException e) {
- log.error("{}", e.getMessage(), e);
- throw new RuntimeException(e);
- } catch (IllegalBlockSizeException e) {
+ } catch (InvalidKeyException | IllegalBlockSizeException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/security/crypto/NonCachingSecretKeyEncryptionStrategy.java b/core/src/main/java/org/apache/accumulo/core/security/crypto/NonCachingSecretKeyEncryptionStrategy.java
index fa2ee70..f49bac3 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/crypto/NonCachingSecretKeyEncryptionStrategy.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/crypto/NonCachingSecretKeyEncryptionStrategy.java
@@ -94,10 +94,7 @@ public class NonCachingSecretKeyEncryptionStrategy implements SecretKeyEncryptio
try {
Key plaintextKey = cipher.unwrap(params.getEncryptedKey(), params.getKeyAlgorithmName(), Cipher.SECRET_KEY);
params.setPlaintextKey(plaintextKey.getEncoded());
- } catch (InvalidKeyException e) {
- log.error("{}", e.getMessage(), e);
- throw new RuntimeException(e);
- } catch (NoSuchAlgorithmException e) {
+ } catch (InvalidKeyException | NoSuchAlgorithmException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
@@ -107,10 +104,7 @@ public class NonCachingSecretKeyEncryptionStrategy implements SecretKeyEncryptio
byte[] encryptedSecretKey = cipher.wrap(plaintextKey);
params.setEncryptedKey(encryptedSecretKey);
params.setOpaqueKeyEncryptionKeyID(pathToKeyName);
- } catch (InvalidKeyException e) {
- log.error("{}", e.getMessage(), e);
- throw new RuntimeException(e);
- } catch (IllegalBlockSizeException e) {
+ } catch (InvalidKeyException | IllegalBlockSizeException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java b/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
index 95844d4..423defb 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
@@ -83,7 +83,7 @@ public class LocalityGroupUtil {
String[] groups = acuconf.get(Property.TABLE_LOCALITY_GROUPS).split(",");
for (String group : groups) {
if (group.length() > 0)
- result.put(group, new HashSet<ByteSequence>());
+ result.put(group, new HashSet<>());
}
HashSet<ByteSequence> all = new HashSet<>();
for (Entry<String,String> entry : acuconf) {
@@ -278,7 +278,7 @@ public class LocalityGroupUtil {
int lgid = getLgid(mbs, cu);
if (parts.get(lgid) == null) {
- parts.set(lgid, new ArrayList<ColumnUpdate>());
+ parts.set(lgid, new ArrayList<>());
lgcount++;
}
diff --git a/core/src/main/java/org/apache/accumulo/core/util/SimpleThreadPool.java b/core/src/main/java/org/apache/accumulo/core/util/SimpleThreadPool.java
index 8991991..4714867 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/SimpleThreadPool.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/SimpleThreadPool.java
@@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit;
public class SimpleThreadPool extends ThreadPoolExecutor {
public SimpleThreadPool(int max, final String name) {
- super(max, max, 4l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamingThreadFactory(name));
+ super(max, max, 4l, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamingThreadFactory(name));
allowCoreThreadTimeOut(true);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatter.java b/core/src/main/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatter.java
index 336e986..41472df 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatter.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatter.java
@@ -51,7 +51,7 @@ public class ShardedTableDistributionFormatter extends AggregatingFormatter {
day = "NULL ";
String server = entry.getValue().toString();
if (countsByDay.get(day) == null)
- countsByDay.put(day, new HashSet<String>());
+ countsByDay.put(day, new HashSet<>());
countsByDay.get(day).add(server);
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java b/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
index ddea0b3..be36b6e 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
@@ -96,11 +96,11 @@ public class IteratorSettingTest {
@Test
public void testEquivalentConstructor() {
IteratorSetting setting1 = new IteratorSetting(100, Combiner.class);
- IteratorSetting setting2 = new IteratorSetting(100, "Combiner", Combiner.class, new HashMap<String,String>());
+ IteratorSetting setting2 = new IteratorSetting(100, "Combiner", Combiner.class, new HashMap<>());
assertEquals(setting1, setting2);
- IteratorSetting notEqual1 = new IteratorSetting(100, "FooCombiner", Combiner.class, new HashMap<String,String>());
+ IteratorSetting notEqual1 = new IteratorSetting(100, "FooCombiner", Combiner.class, new HashMap<>());
assertNotEquals(setting1, notEqual1);
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
index 496cde3..ad92c4c 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
@@ -151,7 +151,7 @@ public class TableOperationsHelperTest {
@Override
public void setProperty(String tableName, String property, String value) throws AccumuloException, AccumuloSecurityException {
if (!settings.containsKey(tableName))
- settings.put(tableName, new TreeMap<String,String>());
+ settings.put(tableName, new TreeMap<>());
settings.get(tableName).put(property, value);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
index 50cd059..d6c2254 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
@@ -1257,7 +1257,7 @@ public class TabletLocatorImplTest {
// create the ~ tablet so it exists
Map<KeyExtent,SortedMap<Key,Value>> ts3 = new HashMap<>();
- ts3.put(mte2, new TreeMap<Key,Value>());
+ ts3.put(mte2, new TreeMap<>());
tservers.tservers.put("tserver3", ts3);
assertNull(tab0TabletCache.locateTablet(context, new Text("row_0000000000"), false, false));
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index f2d2049..29179bd 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -176,7 +176,7 @@ public class AccumuloInputFormatTest {
public void testEmptyColumnFamily() throws IOException {
Job job = Job.getInstance();
Set<Pair<Text,Text>> cols = new HashSet<>();
- cols.add(new Pair<Text,Text>(new Text(""), null));
+ cols.add(new Pair<>(new Text(""), null));
cols.add(new Pair<>(new Text("foo"), new Text("bar")));
cols.add(new Pair<>(new Text(""), new Text("bar")));
cols.add(new Pair<>(new Text(""), new Text("")));
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
index f6f7b2f..372db9d 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
@@ -81,7 +81,7 @@ public class InputTableConfigTest {
public void testSerialization_columns() throws IOException {
Set<Pair<Text,Text>> columns = new HashSet<>();
columns.add(new Pair<>(new Text("cf1"), new Text("cq1")));
- columns.add(new Pair<Text,Text>(new Text("cf2"), null));
+ columns.add(new Pair<>(new Text("cf2"), null));
tableQueryConfig.fetchColumns(columns);
byte[] serialized = serialize(tableQueryConfig);
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShimTest.java b/core/src/test/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShimTest.java
index e540b72..d60c568 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShimTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShimTest.java
@@ -109,7 +109,7 @@ public class CredentialProviderFactoryShimTest {
Configuration conf = new Configuration();
conf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, absPath);
- checkCredentialProviders(conf, new HashMap<String,String>());
+ checkCredentialProviders(conf, new HashMap<>());
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java b/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java
index 71643e9..429c3dd 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java
@@ -28,7 +28,6 @@ import java.util.Random;
import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.PartialKey;
import org.apache.accumulo.core.data.Range;
@@ -140,7 +139,7 @@ public class BloomFilterLayerLookupTest {
String fi = String.format("%010d", row);
// bmfr.seek(new Range(new Text("r"+fi)));
Key k1 = new Key(new Text("r" + fi), new Text("cf1"));
- bmfr.seek(new Range(k1, true, k1.followingKey(PartialKey.ROW_COLFAM), false), new ArrayList<ByteSequence>(), false);
+ bmfr.seek(new Range(k1, true, k1.followingKey(PartialKey.ROW_COLFAM), false), new ArrayList<>(), false);
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
index 63e9c30..5ca9064 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
@@ -224,7 +224,7 @@ public class MultiThreadedRFileTest {
// now start up multiple RFile deepcopies
int maxThreads = 10;
String name = "MultiThreadedRFileTestThread";
- ThreadPoolExecutor pool = new ThreadPoolExecutor(maxThreads + 1, maxThreads + 1, 5 * 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
+ ThreadPoolExecutor pool = new ThreadPoolExecutor(maxThreads + 1, maxThreads + 1, 5 * 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
new NamingThreadFactory(name));
pool.allowCoreThreadTimeOut(true);
try {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/SortedMapIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/SortedMapIteratorTest.java
index d4080e1..0ec160f 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/SortedMapIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/SortedMapIteratorTest.java
@@ -22,15 +22,13 @@ import org.apache.accumulo.core.client.SampleNotPresentException;
import org.apache.accumulo.core.client.impl.BaseIteratorEnvironment;
import org.apache.accumulo.core.client.sample.RowSampler;
import org.apache.accumulo.core.client.sample.SamplerConfiguration;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
import org.junit.Test;
public class SortedMapIteratorTest {
@Test(expected = SampleNotPresentException.class)
public void testSampleNotPresent() {
- SortedMapIterator smi = new SortedMapIterator(new TreeMap<Key,Value>());
+ SortedMapIterator smi = new SortedMapIterator(new TreeMap<>());
smi.deepCopy(new BaseIteratorEnvironment() {
@Override
public boolean isSamplingEnabled() {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
index 261441c..326b35f 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
@@ -71,7 +71,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
AtomicBoolean iflag;
TestDataSource(SortedKeyValueIterator<Key,Value> iter) {
- this(iter, new ArrayList<TestDataSource>());
+ this(iter, new ArrayList<>());
}
public TestDataSource(SortedKeyValueIterator<Key,Value> iter, List<TestDataSource> copies) {
@@ -127,7 +127,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
TestDataSource tds = new TestDataSource(smi);
SourceSwitchingIterator ssi = new SourceSwitchingIterator(tds);
- ssi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ ssi.seek(new Range(), new ArrayList<>(), false);
testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
testAndCallNext(ssi, "r1", "cf1", "cq3", 5, "v2", true);
testAndCallNext(ssi, "r2", "cf1", "cq1", 5, "v3", true);
@@ -144,7 +144,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
TestDataSource tds = new TestDataSource(smi);
SourceSwitchingIterator ssi = new SourceSwitchingIterator(tds);
- ssi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ ssi.seek(new Range(), new ArrayList<>(), false);
testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
TreeMap<Key,Value> tm2 = new TreeMap<>();
@@ -176,7 +176,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
TestDataSource tds = new TestDataSource(smi);
SourceSwitchingIterator ssi = new SourceSwitchingIterator(tds, true);
- ssi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ ssi.seek(new Range(), new ArrayList<>(), false);
testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
TreeMap<Key,Value> tm2 = new TreeMap<>(tm1);
@@ -215,7 +215,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
TestDataSource tds2 = new TestDataSource(smi2);
tds.next = tds2;
- ssi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ ssi.seek(new Range(), new ArrayList<>(), false);
testAndCallNext(ssi, "r1", "cf1", "cq1", 6, "v3", true);
testAndCallNext(ssi, "r1", "cf1", "cq2", 6, "v4", true);
@@ -244,8 +244,8 @@ public class SourceSwitchingIteratorTest extends TestCase {
ssi.switchNow();
- ssi.seek(new Range("r1"), new ArrayList<ByteSequence>(), false);
- dc1.seek(new Range("r2"), new ArrayList<ByteSequence>(), false);
+ ssi.seek(new Range("r1"), new ArrayList<>(), false);
+ dc1.seek(new Range("r2"), new ArrayList<>(), false);
testAndCallNext(ssi, "r1", "cf1", "cq1", 6, "v3", true);
assertFalse(ssi.hasTop());
@@ -267,14 +267,14 @@ public class SourceSwitchingIteratorTest extends TestCase {
assertSame(flag, tds.iflag);
- ssi.seek(new Range("r1"), new ArrayList<ByteSequence>(), false);
+ ssi.seek(new Range("r1"), new ArrayList<>(), false);
testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
assertFalse(ssi.hasTop());
flag.set(true);
try {
- ssi.seek(new Range("r1"), new ArrayList<ByteSequence>(), false);
+ ssi.seek(new Range("r1"), new ArrayList<>(), false);
fail("expected to see IterationInterruptedException");
} catch (IterationInterruptedException iie) {}
@@ -287,7 +287,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
throw new IOException("Underlying iterator yielded to a position outside of its range: " + yieldPosition + " not in " + r);
}
r = new Range(yieldPosition, false, (Key) null, r.isEndKeyInclusive());
- ssi.seek(r, new ArrayList<ByteSequence>(), false);
+ ssi.seek(r, new ArrayList<>(), false);
}
return r;
}
@@ -307,7 +307,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
ssi.enableYielding(yield);
Range r = new Range();
- ssi.seek(r, new ArrayList<ByteSequence>(), false);
+ ssi.seek(r, new ArrayList<>(), false);
r = yield(r, ssi, yield);
testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
r = yield(r, ssi, yield);
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
index 59c5a55..3776b32 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
@@ -25,7 +25,6 @@ import java.util.HashSet;
import java.util.TreeMap;
import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
@@ -47,7 +46,7 @@ public class TimeSettingIteratorTest {
TimeSettingIterator tsi = new TimeSettingIterator(new SortedMapIterator(tm1), 50);
- tsi.seek(new Range(new Key("r1", "cf1", "cq1", 50l), true, new Key("r1", "cf1", "cq1", 50l), true), new HashSet<ByteSequence>(), false);
+ tsi.seek(new Range(new Key("r1", "cf1", "cq1", 50l), true, new Key("r1", "cf1", "cq1", 50l), true), new HashSet<>(), false);
assertTrue(tsi.hasTop());
assertEquals(new Key("r1", "cf1", "cq1", 50l), tsi.getTopKey());
@@ -66,7 +65,7 @@ public class TimeSettingIteratorTest {
assertFalse(tsi.hasTop());
- tsi.seek(new Range(new Key("r1", "cf1", "cq1", 50l), false, null, true), new HashSet<ByteSequence>(), false);
+ tsi.seek(new Range(new Key("r1", "cf1", "cq1", 50l), false, null, true), new HashSet<>(), false);
assertTrue(tsi.hasTop());
assertEquals(new Key("r2", "cf1", "cq1", 50l), tsi.getTopKey());
@@ -75,7 +74,7 @@ public class TimeSettingIteratorTest {
assertFalse(tsi.hasTop());
- tsi.seek(new Range(null, true, new Key("r1", "cf1", "cq1", 50l), false), new HashSet<ByteSequence>(), false);
+ tsi.seek(new Range(null, true, new Key("r1", "cf1", "cq1", 50l), false), new HashSet<>(), false);
assertTrue(tsi.hasTop());
assertEquals(new Key("r0", "cf1", "cq1", 50l), tsi.getTopKey());
@@ -84,7 +83,7 @@ public class TimeSettingIteratorTest {
assertFalse(tsi.hasTop());
- tsi.seek(new Range(new Key("r1", "cf1", "cq1", 51l), true, new Key("r1", "cf1", "cq1", 50l), false), new HashSet<ByteSequence>(), false);
+ tsi.seek(new Range(new Key("r1", "cf1", "cq1", 51l), true, new Key("r1", "cf1", "cq1", 50l), false), new HashSet<>(), false);
assertFalse(tsi.hasTop());
}
@@ -97,7 +96,7 @@ public class TimeSettingIteratorTest {
TimeSettingIterator tsi = new TimeSettingIterator(new SortedMapIterator(tm1), 50);
- tsi.seek(new Range(), new HashSet<ByteSequence>(), false);
+ tsi.seek(new Range(), new HashSet<>(), false);
assertTrue(tsi.hasTop());
final Key topKey = tsi.getTopKey();
@@ -128,7 +127,7 @@ public class TimeSettingIteratorTest {
Key startKey = new Key();
Key endKey = new Key(row, colf, colq, cv, Long.MIN_VALUE);
Range testRange = new Range(startKey, false, endKey, inclusiveEndRange);
- it.seek(testRange, new HashSet<ByteSequence>(), false);
+ it.seek(testRange, new HashSet<>(), false);
assertTrue(it.hasTop());
assertTrue(it.getTopValue().equals(new Value("00".getBytes())));
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/VisibilityFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/VisibilityFilterTest.java
index 6e0972b..a0401f0 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/VisibilityFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/VisibilityFilterTest.java
@@ -20,7 +20,6 @@ import java.io.IOException;
import java.util.HashSet;
import java.util.TreeMap;
-import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
@@ -44,7 +43,7 @@ public class VisibilityFilterTest extends TestCase {
Level prevLevel = Logger.getLogger(VisibilityFilter.class).getLevel();
Logger.getLogger(VisibilityFilter.class).setLevel(Level.FATAL);
- filter.seek(new Range(), new HashSet<ByteSequence>(), false);
+ filter.seek(new Range(), new HashSet<>(), false);
assertFalse(filter.hasTop());
Logger.getLogger(VisibilityFilter.class).setLevel(prevLevel);
@@ -58,7 +57,7 @@ public class VisibilityFilterTest extends TestCase {
tm.put(new Key("r1", "cf1", "cq3", ""), new Value(new byte[0]));
SortedKeyValueIterator<Key,Value> filter = VisibilityFilter.wrap(new SortedMapIterator(tm), Authorizations.EMPTY, "".getBytes());
- filter.seek(new Range(), new HashSet<ByteSequence>(), false);
+ filter.seek(new Range(), new HashSet<>(), false);
assertTrue(filter.hasTop());
assertEquals(new Key("r1", "cf1", "cq1", ""), filter.getTopKey());
filter.next();
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
index 15c424b..d9e9617 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
@@ -85,28 +85,28 @@ public class RowDeletingIteratorTest extends TestCase {
RowDeletingIterator rdi = new RowDeletingIterator();
rdi.init(new SortedMapIterator(tm1), null, new TestIE(IteratorScope.scan, false));
- rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(), new ArrayList<>(), false);
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
for (int i = 0; i < 5; i++) {
- rdi.seek(new Range(newKey("r1", "cf1", "cq" + i, 5), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "cf1", "cq" + i, 5), null), new ArrayList<>(), false);
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
}
- rdi.seek(new Range(newKey("r11", "cf1", "cq1", 5), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r11", "cf1", "cq1", 5), null), new ArrayList<>(), false);
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
put(tm1, "r2", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE);
- rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(), new ArrayList<>(), false);
assertFalse(rdi.hasTop());
for (int i = 0; i < 5; i++) {
- rdi.seek(new Range(newKey("r1", "cf1", "cq" + i, 5), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "cf1", "cq" + i, 5), null), new ArrayList<>(), false);
assertFalse(rdi.hasTop());
}
put(tm1, "r0", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(), new ArrayList<>(), false);
testAssertions(rdi, "r0", "cf1", "cq1", 5, "v1");
rdi.next();
assertFalse(rdi.hasTop());
@@ -126,31 +126,31 @@ public class RowDeletingIteratorTest extends TestCase {
RowDeletingIterator rdi = new RowDeletingIterator();
rdi.init(new SortedMapIterator(tm1), null, new TestIE(IteratorScope.scan, false));
- rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(), new ArrayList<>(), false);
testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
testAssertions(rdi, "r1", "cf1", "cq5", 15, "v1");
rdi.next();
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(newKey("r1", "cf1", "cq1", 5), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "cf1", "cq1", 5), null), new ArrayList<>(), false);
testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
testAssertions(rdi, "r1", "cf1", "cq5", 15, "v1");
rdi.next();
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(newKey("r1", "cf1", "cq4", 5), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "cf1", "cq4", 5), null), new ArrayList<>(), false);
testAssertions(rdi, "r1", "cf1", "cq5", 15, "v1");
rdi.next();
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(newKey("r1", "cf1", "cq5", 20), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "cf1", "cq5", 20), null), new ArrayList<>(), false);
testAssertions(rdi, "r1", "cf1", "cq5", 15, "v1");
rdi.next();
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(newKey("r1", "cf1", "cq9", 20), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "cf1", "cq9", 20), null), new ArrayList<>(), false);
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
}
@@ -196,19 +196,19 @@ public class RowDeletingIteratorTest extends TestCase {
RowDeletingIterator rdi = new RowDeletingIterator();
rdi.init(new SortedMapIterator(tm1), null, new TestIE(IteratorScope.minc, false));
- rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(), new ArrayList<>(), false);
testAssertions(rdi, "r1", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE.toString());
rdi.next();
testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(newKey("r1", "cf1", "cq3", 20), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "cf1", "cq3", 20), null), new ArrayList<>(), false);
testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(newKey("r1", "", "", 42), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "", "", 42), null), new ArrayList<>(), false);
testAssertions(rdi, "r1", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE.toString());
rdi.next();
testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
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 d531517..5d0aec6 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
@@ -33,7 +33,6 @@ import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.accumulo.core.client.impl.BaseIteratorEnvironment;
-import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
@@ -137,7 +136,7 @@ public class RowEncodingIteratorTest {
Map<String,String> bigBufferOpts = new HashMap<>();
bigBufferOpts.put(RowEncodingIterator.MAX_BUFFER_SIZE_OPT, "3K");
iter.init(src, bigBufferOpts, new DummyIteratorEnv());
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertTrue(iter.hasTop());
assertEquals(map1, RowEncodingIteratorImpl.decodeRow(iter.getTopKey(), iter.getTopValue()));
@@ -145,7 +144,7 @@ public class RowEncodingIteratorTest {
// simulate something continuing using the last key from the iterator
// this is what client and server code will do
range = new Range(iter.getTopKey(), false, range.getEndKey(), range.isEndKeyInclusive());
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertTrue(iter.hasTop());
assertEquals(map2, RowEncodingIteratorImpl.decodeRow(iter.getTopKey(), iter.getTopValue()));
@@ -171,7 +170,7 @@ public class RowEncodingIteratorTest {
Map<String,String> bigBufferOpts = new HashMap<>();
bigBufferOpts.put(RowEncodingIterator.MAX_BUFFER_SIZE_OPT, "1K");
iter.init(src, bigBufferOpts, new DummyIteratorEnv());
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
// BufferOverflowException should be thrown as RowEncodingIterator can't fit the whole row into its buffer.
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
index 4294eb3..59a6a9b 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
@@ -65,13 +65,13 @@ public class RowFilterTest {
}
// ensure that seeks are confined to the row
- rowIterator.seek(new Range(null, false, firstKey == null ? null : firstKey.getRow(), false), new HashSet<ByteSequence>(), false);
+ rowIterator.seek(new Range(null, false, firstKey == null ? null : firstKey.getRow(), false), new HashSet<>(), false);
while (rowIterator.hasTop()) {
sum2 += Integer.parseInt(rowIterator.getTopValue().toString());
rowIterator.next();
}
- rowIterator.seek(new Range(firstKey == null ? null : firstKey.getRow(), false, null, true), new HashSet<ByteSequence>(), false);
+ rowIterator.seek(new Range(firstKey == null ? null : firstKey.getRow(), false, null, true), new HashSet<>(), false);
while (rowIterator.hasTop()) {
sum2 += Integer.parseInt(rowIterator.getTopValue().toString());
rowIterator.next();
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
index 7ff08ec..1280859 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
@@ -159,7 +159,7 @@ public class TransformingIteratorTest {
public void testVisbilityFiltering() throws Exception {
// Should return nothing since we produced visibilities that can't be seen
setUpTransformIterator(BadVisKeyTransformingIterator.class);
- checkExpected(new TreeMap<Key,Value>());
+ checkExpected(new TreeMap<>());
// Do a "reverse" on the visibility (vis1 -> vis2, vis2 -> vis3, vis3 -> vis0)
// Source data has vis1, vis2, vis3 so vis0 is a new one that is introduced.
@@ -183,11 +183,11 @@ public class TransformingIteratorTest {
public void testCreatingIllegalVisbility() throws Exception {
// illegal visibility created by transform should be filtered on scan, even if evaluation is done
setUpTransformIterator(IllegalVisKeyTransformingIterator.class, false);
- checkExpected(new TreeMap<Key,Value>());
+ checkExpected(new TreeMap<>());
// ensure illegal vis is supressed when evaluations is done
setUpTransformIterator(IllegalVisKeyTransformingIterator.class);
- checkExpected(new TreeMap<Key,Value>());
+ checkExpected(new TreeMap<>());
}
@Test
@@ -232,7 +232,7 @@ public class TransformingIteratorTest {
// Set a range that's after all data and make sure we don't
// somehow return something.
setUpTransformIterator(ColFamReversingKeyTransformingIterator.class);
- checkExpected(new Range(new Key("row4"), null), new TreeMap<Key,Value>());
+ checkExpected(new Range(new Key("row4"), null), new TreeMap<>());
}
@Test
@@ -298,7 +298,7 @@ public class TransformingIteratorTest {
IntersectingIterator.setColumnFamilies(iicfg, new Text[] {new Text("foo"), new Text("dog"), new Text("cat")});
iiIter.init(titer, iicfg.getOptions(), null);
- iiIter.seek(new Range(), new HashSet<ByteSequence>(), false);
+ iiIter.seek(new Range(), new HashSet<>(), false);
assertTrue(iiIter.hasTop());
Key docKey = iiIter.getTopKey();
@@ -356,7 +356,7 @@ public class TransformingIteratorTest {
public void testCompactionAndIllegalVisibility() throws Exception {
setUpTransformIterator(IllegalVisCompactionKeyTransformingIterator.class);
try {
- checkExpected(new TreeMap<Key,Value>());
+ checkExpected(new TreeMap<>());
assertTrue(false);
} catch (Exception e) {
@@ -367,7 +367,7 @@ public class TransformingIteratorTest {
public void testDupes() throws Exception {
setUpTransformIterator(DupeTransformingIterator.class);
- titer.seek(new Range(), new HashSet<ByteSequence>(), false);
+ titer.seek(new Range(), new HashSet<>(), false);
int count = 0;
while (titer.hasTop()) {
@@ -419,7 +419,7 @@ public class TransformingIteratorTest {
}
private void checkExpected(Range range, TreeMap<Key,Value> expectedEntries) throws IOException {
- checkExpected(range, new HashSet<ByteSequence>(), expectedEntries);
+ checkExpected(range, new HashSet<>(), expectedEntries);
}
private void checkExpected(TreeMap<Key,Value> expectedEntries, String... fa) throws IOException {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeColumnFamilyIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeColumnFamilyIteratorTest.java
index c9c6f16..f865d73 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeColumnFamilyIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeColumnFamilyIteratorTest.java
@@ -41,7 +41,6 @@ import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
-import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
@@ -89,7 +88,7 @@ public class WholeColumnFamilyIteratorTest extends TestCase {
SortedMapIterator source = new SortedMapIterator(map);
WholeColumnFamilyIterator iter = new WholeColumnFamilyIterator(source);
SortedMap<Key,Value> resultMap = new TreeMap<>();
- iter.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ iter.seek(new Range(), new ArrayList<>(), false);
int numRows = 0;
while (iter.hasTop()) {
numRows++;
@@ -111,7 +110,7 @@ public class WholeColumnFamilyIteratorTest extends TestCase {
}
};
resultMap.clear();
- iter2.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ iter2.seek(new Range(), new ArrayList<>(), false);
numRows = 0;
while (iter2.hasTop()) {
numRows++;
@@ -150,7 +149,7 @@ public class WholeColumnFamilyIteratorTest extends TestCase {
WholeColumnFamilyIterator iter = new WholeColumnFamilyIterator(source);
Range range = new Range(new Text("row1"), true, new Text("row2"), true);
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertTrue(iter.hasTop());
assertEquals(map1, WholeColumnFamilyIterator.decodeColumnFamily(iter.getTopKey(), iter.getTopValue()));
@@ -158,7 +157,7 @@ public class WholeColumnFamilyIteratorTest extends TestCase {
// simulate something continuing using the last key from the iterator
// this is what client and server code will do
range = new Range(iter.getTopKey(), false, range.getEndKey(), range.isEndKeyInclusive());
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertTrue(iter.hasTop());
assertEquals(map2, WholeColumnFamilyIterator.decodeColumnFamily(iter.getTopKey(), iter.getTopValue()));
@@ -186,7 +185,7 @@ public class WholeColumnFamilyIteratorTest extends TestCase {
WholeColumnFamilyIterator iter = new WholeColumnFamilyIterator(source);
Range range = new Range(new Text("row1"), true, new Text("row2"), true);
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertTrue(iter.hasTop());
assertEquals(map1, WholeColumnFamilyIterator.decodeColumnFamily(iter.getTopKey(), iter.getTopValue()));
@@ -194,7 +193,7 @@ public class WholeColumnFamilyIteratorTest extends TestCase {
// simulate something continuing using the last key from the iterator
// this is what client and server code will do
range = new Range(iter.getTopKey(), false, range.getEndKey(), range.isEndKeyInclusive());
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertFalse(iter.hasTop());
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeRowIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeRowIteratorTest.java
index 8d37d6c..d755f14 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeRowIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeRowIteratorTest.java
@@ -30,7 +30,6 @@ import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
-import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
@@ -88,7 +87,7 @@ public class WholeRowIteratorTest {
SortedMapIterator source = new SortedMapIterator(map);
WholeRowIterator iter = new WholeRowIterator(source);
SortedMap<Key,Value> resultMap = new TreeMap<>();
- iter.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ iter.seek(new Range(), new ArrayList<>(), false);
int numRows = 0;
while (iter.hasTop()) {
numRows++;
@@ -107,7 +106,7 @@ public class WholeRowIteratorTest {
}
};
resultMap.clear();
- iter2.seek(new Range(), new ArrayList<ByteSequence>(), false);
+ iter2.seek(new Range(), new ArrayList<>(), false);
numRows = 0;
while (iter2.hasTop()) {
numRows++;
@@ -147,7 +146,7 @@ public class WholeRowIteratorTest {
WholeRowIterator iter = new WholeRowIterator(source);
Range range = new Range(new Text("row1"), true, new Text("row2"), true);
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertTrue(iter.hasTop());
assertEquals(map1, WholeRowIterator.decodeRow(iter.getTopKey(), iter.getTopValue()));
@@ -155,7 +154,7 @@ public class WholeRowIteratorTest {
// simulate something continuing using the last key from the iterator
// this is what client and server code will do
range = new Range(iter.getTopKey(), false, range.getEndKey(), range.isEndKeyInclusive());
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertTrue(iter.hasTop());
assertEquals(map2, WholeRowIterator.decodeRow(iter.getTopKey(), iter.getTopValue()));
@@ -184,7 +183,7 @@ public class WholeRowIteratorTest {
WholeRowIterator iter = new WholeRowIterator(source);
Range range = new Range(new Text("row1"), true, new Text("row2"), true);
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertTrue(iter.hasTop());
assertEquals(map1, WholeRowIterator.decodeRow(iter.getTopKey(), iter.getTopValue()));
@@ -192,7 +191,7 @@ public class WholeRowIteratorTest {
// simulate something continuing using the last key from the iterator
// this is what client and server code will do
range = new Range(iter.getTopKey(), false, range.getEndKey(), range.isEndKeyInclusive());
- iter.seek(range, new ArrayList<ByteSequence>(), false);
+ iter.seek(range, new ArrayList<>(), false);
assertFalse(iter.hasTop());
diff --git a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java
index 1d72b7b..4ae1944 100644
--- a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java
@@ -60,15 +60,13 @@ public class ReplicationConfigurationUtilTest {
@Test
public void rootTableExtentEmptyConf() {
KeyExtent extent = new KeyExtent(RootTable.ID, null, null);
- Assert.assertFalse("The root table should never be replicated",
- ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<String,String>())));
+ Assert.assertFalse("The root table should never be replicated", ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
}
@Test
public void metadataTableExtentEmptyConf() {
KeyExtent extent = new KeyExtent(MetadataTable.ID, null, null);
- Assert.assertFalse("The metadata table should never be replicated",
- ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<String,String>())));
+ Assert.assertFalse("The metadata table should never be replicated", ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
}
@Test
@@ -80,6 +78,6 @@ public class ReplicationConfigurationUtilTest {
@Test
public void regularNonEnabledTable() {
KeyExtent extent = new KeyExtent(Table.ID.of("1"), new Text("b"), new Text("a"));
- Assert.assertFalse("Table should not be replicated", ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<String,String>())));
+ Assert.assertFalse("Table should not be replicated", ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java b/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
index 7568aba..597aac3 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
@@ -40,11 +40,11 @@ public class PartitionerTest {
PreAllocatedArray<Map<ByteSequence,MutableLong>> groups = new PreAllocatedArray<>(2);
- groups.set(0, new HashMap<ByteSequence,MutableLong>());
+ groups.set(0, new HashMap<>());
groups.get(0).put(new ArrayByteSequence("cf1"), new MutableLong(1));
groups.get(0).put(new ArrayByteSequence("cf2"), new MutableLong(1));
- groups.set(1, new HashMap<ByteSequence,MutableLong>());
+ groups.set(1, new HashMap<>());
groups.get(1).put(new ArrayByteSequence("cf3"), new MutableLong(1));
Partitioner p1 = new Partitioner(groups);
@@ -72,7 +72,7 @@ public class PartitionerTest {
PreAllocatedArray<List<Mutation>> partitioned = new PreAllocatedArray<>(3);
for (int i = 0; i < partitioned.length; i++) {
- partitioned.set(i, new ArrayList<Mutation>());
+ partitioned.set(i, new ArrayList<>());
}
p1.partition(mutations, partitioned);
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
index afe7d37..0ae16e3 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
@@ -389,9 +389,7 @@ public class ZooCache {
try {
data = zooKeeper.getData(zPath, watcher, stat);
zstat = new ZcStat(stat);
- } catch (KeeperException.BadVersionException e1) {
- throw new ConcurrentModificationException();
- } catch (KeeperException.NoNodeException e2) {
+ } catch (KeeperException.BadVersionException | KeeperException.NoNodeException e1) {
throw new ConcurrentModificationException();
}
if (log.isTraceEnabled()) {
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
index 9cd5b8d..fe3fb64 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
@@ -219,9 +219,7 @@ public class ZooLock implements Watcher {
if (restat == null) {
lockAsync(myLock, lw);
}
- } catch (KeeperException e) {
- lw.failedToAcquireLock(new Exception("Failed to renew watch on other master node"));
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
lw.failedToAcquireLock(new Exception("Failed to renew watch on other master node"));
}
}
@@ -295,9 +293,7 @@ public class ZooLock implements Watcher {
lockAsync(asyncLock, lw);
- } catch (KeeperException e) {
- lw.failedToAcquireLock(e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
lw.failedToAcquireLock(e);
}
}
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooQueueLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooQueueLock.java
index 25c735b..69e0884 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooQueueLock.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooQueueLock.java
@@ -101,10 +101,8 @@ public class ZooQueueLock implements QueueLock {
try {
// try to delete the parent if it has no children
zoo.delete(path, -1);
- } catch (NotEmptyException nee) {
+ } catch (NotEmptyException | NoNodeException nee) {
// the path had other lock nodes, no big deal
- } catch (NoNodeException nne) {
- // someone else deleted the lock path
}
} catch (Exception ex) {
throw new RuntimeException(ex);
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
index 6825d0b..bd07b99 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
@@ -197,9 +197,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
if (null != masterProcess) {
try {
cluster.stopProcessWithTimeout(masterProcess, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("Master did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("Master did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -212,9 +210,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
if (null != gcProcess) {
try {
cluster.stopProcessWithTimeout(gcProcess, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("Garbage collector did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("Garbage collector did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -227,9 +223,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
if (null != zooKeeperProcess) {
try {
cluster.stopProcessWithTimeout(zooKeeperProcess, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("ZooKeeper did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("ZooKeeper did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -244,9 +238,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
for (Process tserver : tabletServerProcesses) {
try {
cluster.stopProcessWithTimeout(tserver, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("TabletServer did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("TabletServer did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -261,9 +253,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
if (monitor != null) {
try {
cluster.stopProcessWithTimeout(monitor, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("Monitor did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("Monitor did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -276,9 +266,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
if (tracer != null) {
try {
cluster.stopProcessWithTimeout(tracer, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("Tracer did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("Tracer did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -315,9 +303,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
if (procRef.getProcess().equals(masterProcess)) {
try {
cluster.stopProcessWithTimeout(masterProcess, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("Master did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("Master did not fully stop after 30 seconds", e);
}
masterProcess = null;
@@ -331,9 +317,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
tabletServerProcesses.remove(tserver);
try {
cluster.stopProcessWithTimeout(tserver, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("TabletServer did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("TabletServer did not fully stop after 30 seconds", e);
}
found = true;
@@ -346,9 +330,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
if (procRef.getProcess().equals(zooKeeperProcess)) {
try {
cluster.stopProcessWithTimeout(zooKeeperProcess, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("ZooKeeper did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("ZooKeeper did not fully stop after 30 seconds", e);
}
zooKeeperProcess = null;
@@ -359,9 +341,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
if (procRef.getProcess().equals(gcProcess)) {
try {
cluster.stopProcessWithTimeout(gcProcess, 30, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- log.warn("GarbageCollector did not fully stop after 30 seconds", e);
- } catch (TimeoutException e) {
+ } catch (ExecutionException | TimeoutException e) {
log.warn("GarbageCollector did not fully stop after 30 seconds", e);
}
gcProcess = null;
diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
index 9478cc6..3255e13 100644
--- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
+++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
@@ -649,7 +649,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
try {
Map<String,Set<Text>> groups = new HashMap<>();
for (Entry<String,Set<String>> groupEntry : groupStrings.entrySet()) {
- groups.put(groupEntry.getKey(), new HashSet<Text>());
+ groups.put(groupEntry.getKey(), new HashSet<>());
for (String val : groupEntry.getValue()) {
groups.get(groupEntry.getKey()).add(new Text(val));
}
@@ -1194,7 +1194,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
// synchronized to prevent race conditions
synchronized (batchScanner) {
ScanResult ret = new ScanResult();
- ret.setResults(new ArrayList<KeyValue>());
+ ret.setResults(new ArrayList<>());
int numRead = 0;
try {
while (batchScanner.hasNext() && numRead < k) {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
index b39996b..dd8b3a9 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
@@ -169,8 +169,7 @@ public class Accumulo {
String procFile = "/proc/sys/vm/swappiness";
File swappiness = new File(procFile);
if (swappiness.exists() && swappiness.canRead()) {
- InputStream is = new FileInputStream(procFile);
- try {
+ try (InputStream is = new FileInputStream(procFile)) {
byte[] buffer = new byte[10];
int bytes = is.read(buffer);
String setting = new String(buffer, 0, bytes, UTF_8);
@@ -179,8 +178,6 @@ public class Accumulo {
log.warn("System swappiness setting is greater than ten ({}) which can cause time-sensitive operations to be delayed. "
+ " Accumulo is time sensitive because it needs to maintain distributed lock agreement.", setting);
}
- } finally {
- is.close();
}
}
} catch (Throwable t) {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
index 46d9514..1dc6a8d 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
@@ -479,9 +479,7 @@ public class BulkImporter {
try {
List<KeyExtent> failures = assignMapFiles(context, location, assignmentsPerTablet);
handleFailures(failures, "Not Serving Tablet");
- } catch (AccumuloException e) {
- handleFailures(assignmentsPerTablet.keySet(), e.getMessage());
- } catch (AccumuloSecurityException e) {
+ } catch (AccumuloException | AccumuloSecurityException e) {
handleFailures(assignmentsPerTablet.keySet(), e.getMessage());
}
}
@@ -642,9 +640,8 @@ public class BulkImporter {
String filename = file.toString();
// log.debug(filename + " finding overlapping tablets " + startRow + " -> " + endRow);
FileSystem fs = vm.getVolumeByPath(file).getFileSystem();
- FileSKVIterator reader = FileOperations.getInstance().newReaderBuilder().forFile(filename, fs, fs.getConf())
- .withTableConfiguration(context.getConfiguration()).seekToBeginning().build();
- try {
+ try (FileSKVIterator reader = FileOperations.getInstance().newReaderBuilder().forFile(filename, fs, fs.getConf())
+ .withTableConfiguration(context.getConfiguration()).seekToBeginning().build()) {
Text row = startRow;
if (row == null)
row = new Text();
@@ -666,8 +663,6 @@ public class BulkImporter {
} else
break;
}
- } finally {
- reader.close();
}
// log.debug(filename + " to be sent to " + result);
return result;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
index 9c6884d..1c683df 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
@@ -345,16 +345,7 @@ public class ClientServiceHandler implements ClientService.Iface {
Class test = AccumuloVFSClassLoader.loadClass(className, shouldMatch);
test.newInstance();
return true;
- } catch (ClassCastException e) {
- log.warn("Error checking object types", e);
- return false;
- } catch (ClassNotFoundException e) {
- log.warn("Error checking object types", e);
- return false;
- } catch (InstantiationException e) {
- log.warn("Error checking object types", e);
- return false;
- } catch (IllegalAccessException e) {
+ } catch (ClassCastException | IllegalAccessException | InstantiationException | ClassNotFoundException e) {
log.warn("Error checking object types", e);
return false;
}
@@ -452,11 +443,7 @@ public class ClientServiceHandler implements ClientService.Iface {
} catch (AccumuloSecurityException e) {
throw e.asThriftException();
- } catch (AccumuloException e) {
- throw new TException(e);
- } catch (IOException e) {
- throw new TException(e);
- } catch (TableNotFoundException e) {
+ } catch (AccumuloException | TableNotFoundException | IOException e) {
throw new TException(e);
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java b/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
index 060615c..6386a88 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
@@ -176,9 +176,7 @@ public class MetadataConstraints implements Constraint {
if (dfv.getSize() < 0 || dfv.getNumEntries() < 0) {
violations = addViolation(violations, 1);
}
- } catch (NumberFormatException nfe) {
- violations = addViolation(violations, 1);
- } catch (ArrayIndexOutOfBoundsException aiooe) {
+ } catch (NumberFormatException | ArrayIndexOutOfBoundsException nfe) {
violations = addViolation(violations, 1);
}
} else if (columnFamily.equals(ScanFileColumnFamily.NAME)) {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
index ab48edf..46a0ab9 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
@@ -353,11 +353,8 @@ public class VolumeUtil {
}
private static String hash(FileSystem fs, Path dir, String name) throws IOException {
- FSDataInputStream in = fs.open(new Path(dir, name));
- try {
+ try (FSDataInputStream in = fs.open(new Path(dir, name))) {
return DigestUtils.shaHex(in);
- } finally {
- in.close();
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
index 8198418..1b0f3ba 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
@@ -423,9 +423,7 @@ public class Initialize implements KeywordExecutable {
private static boolean zookeeperAvailable() {
try {
return zoo.exists("/");
- } catch (KeeperException e) {
- return false;
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
return false;
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
index 01a3550..59f1c6d 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
@@ -89,12 +89,9 @@ public class LiveTServerSet implements Watcher {
public void assignTablet(ZooLock lock, KeyExtent extent) throws TException {
if (extent.isMeta()) {
// see ACCUMULO-3597
- TTransport transport = ThriftUtil.createTransport(address, context);
- try {
+ try (TTransport transport = ThriftUtil.createTransport(address, context)) {
TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport);
loadTablet(client, lock, extent);
- } finally {
- transport.close();
}
} else {
TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, context);
@@ -270,10 +267,8 @@ public class LiveTServerSet implements Watcher {
private void deleteServerNode(String serverNode) throws InterruptedException, KeeperException {
try {
ZooReaderWriter.getInstance().delete(serverNode, -1);
- } catch (NotEmptyException ex) {
+ } catch (NotEmptyException | NoNodeException ex) {
// race condition: tserver created the lock after our last check; we'll see it at the next check
- } catch (NoNodeException nne) {
- // someone else deleted it
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java
index b27cb36..bc41f98 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java
@@ -136,9 +136,7 @@ public class TableLoadBalancer extends TabletBalancer {
if (tops == null)
try {
tops = this.context.getConnector().tableOperations();
- } catch (AccumuloException e) {
- log.error("Unable to access table operations from within table balancer", e);
- } catch (AccumuloSecurityException e) {
+ } catch (AccumuloException | AccumuloSecurityException e) {
log.error("Unable to access table operations from within table balancer", e);
}
return tops;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
index c549adc..fdf0f5f 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
@@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.impl.ClientContext;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.metadata.MetadataTable;
@@ -92,9 +91,6 @@ public class MetaDataStateStore extends TabletStateStore {
try {
return context.getConnector().createBatchWriter(targetTableName,
new BatchWriterConfig().setMaxMemory(MAX_MEMORY).setMaxLatency(LATENCY, TimeUnit.MILLISECONDS).setMaxWriteThreads(THREADS));
- } catch (TableNotFoundException e) {
- // ya, I don't think so
- throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
index 5d6052f..704fead 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
@@ -189,9 +189,7 @@ public class MetaDataTableScanner implements ClosableIterator<TabletLocationStat
try {
Entry<Key,Value> e = iter.next();
return createTabletLocationState(e.getKey(), e.getValue());
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- } catch (BadLocationStateException ex) {
+ } catch (IOException | BadLocationStateException ex) {
throw new RuntimeException(ex);
}
}
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 8bb179f..99bc37d 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
@@ -70,7 +70,7 @@ public class ProblemReports implements Iterable<ProblemReport> {
* make the thread pool use a bounded queue to avoid the case where problem reports are not being processed because the whole system is in a really bad state
* (like HDFS is down) and everything is reporting lots of problems, but problem reports can not be processed
*/
- private ExecutorService reportExecutor = new ThreadPoolExecutor(0, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(500), new NamingThreadFactory(
+ private ExecutorService reportExecutor = new ThreadPoolExecutor(0, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>(500), new NamingThreadFactory(
"acu-problem-reporter"));
private final AccumuloServerContext context;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicaSystemHelper.java b/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicaSystemHelper.java
index 5643117..849781e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicaSystemHelper.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicaSystemHelper.java
@@ -59,14 +59,11 @@ public class ReplicaSystemHelper {
*/
public void recordNewStatus(Path filePath, Status status, ReplicationTarget target) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException {
- BatchWriter bw = context.getConnector().createBatchWriter(ReplicationTable.NAME, new BatchWriterConfig());
- try {
+ try (BatchWriter bw = context.getConnector().createBatchWriter(ReplicationTable.NAME, new BatchWriterConfig())) {
log.debug("Recording new status for {}, {}", filePath.toString(), ProtobufUtil.toString(status));
Mutation m = new Mutation(filePath.toString());
WorkSection.add(m, target.toText(), ProtobufUtil.toValue(status));
bw.addMutation(m);
- } finally {
- bw.close();
}
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
index 718f9df..3fa621c 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
@@ -78,13 +78,7 @@ public final class ZKAuthenticator implements Authenticator {
constructUser(principal, ZKSecurityTool.createPass(token));
}
- } catch (KeeperException e) {
- log.error("{}", e.getMessage(), e);
- throw new RuntimeException(e);
- } catch (InterruptedException e) {
- log.error("{}", e.getMessage(), e);
- throw new RuntimeException(e);
- } catch (AccumuloException e) {
+ } catch (KeeperException | AccumuloException | InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
index 0f25949..c966e92 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
@@ -102,10 +102,7 @@ public class ZKAuthorizor implements Authorizor {
initUser(rootuser);
zoo.putPersistentData(ZKUserPath + "/" + rootuser + ZKUserAuths, ZKSecurityTool.convertAuthorizations(Authorizations.EMPTY), NodeExistsPolicy.FAIL);
- } catch (KeeperException e) {
- log.error("{}", e.getMessage(), e);
- throw new RuntimeException(e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
index b9d0fa5..9f3ea00 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
@@ -401,10 +401,7 @@ public class ZKPermHandler implements PermissionHandler {
createTablePerm(rootuser, entry.getKey(), entry.getValue());
for (Entry<Namespace.ID,Set<NamespacePermission>> entry : namespacePerms.entrySet())
createNamespacePerm(rootuser, entry.getKey(), entry.getValue());
- } catch (KeeperException e) {
- log.error("{}", e.getMessage(), e);
- throw new RuntimeException(e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/AccumuloStatus.java b/server/base/src/main/java/org/apache/accumulo/server/util/AccumuloStatus.java
index 5d95d68..04dce39 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/AccumuloStatus.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/AccumuloStatus.java
@@ -42,9 +42,7 @@ public class AccumuloStatus {
return false;
if (!reader.getChildren(rootPath + Constants.ZGC_LOCK).isEmpty())
return false;
- } catch (KeeperException e) {
- throw new IOException("Issues contacting ZooKeeper to get Accumulo status.", e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
throw new IOException("Issues contacting ZooKeeper to get Accumulo status.", e);
}
return true;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
index 5f02893..c4933dd 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
@@ -578,11 +578,8 @@ public class Admin implements KeywordExecutable {
}
}
File siteBackup = new File(outputDirectory, ACCUMULO_SITE_BACKUP_FILE);
- FileOutputStream fos = new FileOutputStream(siteBackup);
- try {
+ try (FileOutputStream fos = new FileOutputStream(siteBackup)) {
conf.writeXml(fos);
- } finally {
- fos.close();
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java b/server/base/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
index 5e9959c..ffbd881 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
@@ -70,12 +70,9 @@ public class FileSystemMonitor {
static List<Mount> parse(String procFile) throws IOException {
FileReader fr = new FileReader(procFile);
- BufferedReader br = new BufferedReader(fr);
- try {
+ try (BufferedReader br = new BufferedReader(fr)) {
return getMountsFromFile(br);
- } finally {
- br.close();
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java b/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
index 31b5221..f0a0f27 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
@@ -106,11 +106,8 @@ public class FindOfflineTablets {
range = new KeyExtent(tableId, null, null).toMetadataRange();
}
- MetaDataTableScanner metaScanner = new MetaDataTableScanner(context, range, MetadataTable.NAME);
- try {
+ try (MetaDataTableScanner metaScanner = new MetaDataTableScanner(context, range, MetadataTable.NAME)) {
return checkTablets(metaScanner, tservers);
- } finally {
- metaScanner.close();
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
index fee711b..fa0dc97 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
@@ -181,8 +181,8 @@ public class MasterMetadataUtil {
}
}
- MetadataTableUtil.splitDatafiles(metadataPrevEndRow, splitRatio, new HashMap<FileRef,FileUtil.FileInfo>(), origDatafileSizes, lowDatafileSizes,
- highDatafileSizes, highDatafilesToRemove);
+ MetadataTableUtil.splitDatafiles(metadataPrevEndRow, splitRatio, new HashMap<>(), origDatafileSizes, lowDatafileSizes, highDatafileSizes,
+ highDatafilesToRemove);
MetadataTableUtil.finishSplit(metadataEntry, highDatafileSizes, highDatafilesToRemove, context, lock);
@@ -195,9 +195,7 @@ public class MasterMetadataUtil {
while (true) {
try {
return new TServerInstance(address, zooLock.getSessionId());
- } catch (KeeperException e) {
- log.error("{}", e.getMessage(), e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
log.error("{}", e.getMessage(), e);
}
sleepUninterruptibly(1, TimeUnit.SECONDS);
@@ -278,9 +276,7 @@ public class MasterMetadataUtil {
zk.recursiveDelete(zpath, NodeMissingPolicy.SKIP);
}
break;
- } catch (KeeperException e) {
- log.error("{}", e.getMessage(), e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
log.error("{}", e.getMessage(), e);
}
sleepUninterruptibly(1, TimeUnit.SECONDS);
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
index e69c86d..a4d77d9 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
@@ -154,16 +154,12 @@ public class MetadataTableUtil {
try {
t.update(m);
return;
- } catch (AccumuloException e) {
- log.error("{}", e.getMessage(), e);
- } catch (AccumuloSecurityException e) {
+ } catch (AccumuloException | TableNotFoundException | AccumuloSecurityException e) {
log.error("{}", e.getMessage(), e);
} catch (ConstraintViolationException e) {
log.error("{}", e.getMessage(), e);
// retrying when a CVE occurs is probably futile and can cause problems, see ACCUMULO-3096
throw new RuntimeException(e);
- } catch (TableNotFoundException e) {
- log.error("{}", e.getMessage(), e);
}
sleepUninterruptibly(1, TimeUnit.SECONDS);
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java
index 9ddde7d..20c1403 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java
@@ -161,13 +161,7 @@ public class ReplicationTableUtil {
try {
t.update(m);
return;
- } catch (AccumuloException e) {
- log.error(e.toString(), e);
- } catch (AccumuloSecurityException e) {
- log.error(e.toString(), e);
- } catch (ConstraintViolationException e) {
- log.error(e.toString(), e);
- } catch (TableNotFoundException e) {
+ } catch (AccumuloException | TableNotFoundException | ConstraintViolationException | AccumuloSecurityException e) {
log.error(e.toString(), e);
}
sleepUninterruptibly(1, TimeUnit.SECONDS);
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferences.java b/server/gc/src/main/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferences.java
index aba80ac..da48e8e 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferences.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferences.java
@@ -55,7 +55,6 @@ import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.thrift.TException;
-import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -289,9 +288,6 @@ public class CloseWriteAheadLogReferences implements Runnable {
try {
tserverClient = ThriftUtil.getClient(new TabletClientService.Client.Factory(), server, context);
return tserverClient.getActiveLogs(tinfo, context.rpcCreds());
- } catch (TTransportException e) {
- log.warn("Failed to fetch active write-ahead logs from " + server, e);
- return null;
} catch (TException e) {
log.warn("Failed to fetch active write-ahead logs from " + server, e);
return null;
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index 9de5221..12be028 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -1246,9 +1246,7 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
store.ageOff();
}
}, 63000, 63000);
- } catch (KeeperException e) {
- throw new IOException(e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
throw new IOException(e);
}
diff --git a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
index 273784b..9c3c638 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
@@ -245,10 +245,8 @@ public class MasterClientServiceHandler extends FateServiceHandler implements Ma
if (tabletCount == 0 && !Tables.exists(master.getInstance(), tableId))
throw new ThriftTableOperationException(tableId.canonicalID(), null, TableOperation.FLUSH, TableOperationExceptionType.NOTFOUND, null);
- } catch (AccumuloException e) {
+ } catch (AccumuloException | TabletDeletedException e) {
Master.log.debug("Failed to scan {} table to wait for flush {}", MetadataTable.NAME, tableId, e);
- } catch (TabletDeletedException tde) {
- Master.log.debug("Failed to scan {} table to wait for flush {}", MetadataTable.NAME, tableId, tde);
} catch (AccumuloSecurityException e) {
Master.log.warn("{}", e.getMessage(), e);
throw new ThriftSecurityException();
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CleanUp.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CleanUp.java
index 45df864..fc42045 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CleanUp.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CleanUp.java
@@ -123,8 +123,7 @@ class CleanUp extends MasterRepo {
try {
// look for other tables that references this table's files
Connector conn = master.getConnector();
- BatchScanner bs = conn.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 8);
- try {
+ try (BatchScanner bs = conn.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 8)) {
Range allTables = MetadataSchema.TabletsSection.getRange();
Range tableRange = MetadataSchema.TabletsSection.getRange(tableId);
Range beforeTable = new Range(allTables.getStartKey(), true, tableRange.getStartKey(), false);
@@ -140,8 +139,6 @@ class CleanUp extends MasterRepo {
refCount++;
}
}
- } finally {
- bs.close();
}
} catch (Exception e) {
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java
index 58c24e3..0b22345 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java
@@ -198,14 +198,11 @@ class LoadFiles extends MasterRepo {
}
FSDataOutputStream failFile = fs.create(new Path(errorDir, BulkImport.FAILURES_TXT), true);
- BufferedWriter out = new BufferedWriter(new OutputStreamWriter(failFile, UTF_8));
- try {
+ try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(failFile, UTF_8))) {
for (String f : filesToLoad) {
out.write(f);
out.write("\n");
}
- } finally {
- out.close();
}
// return the next step, which will perform cleanup
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index 55f1787..650b93e 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@ -391,7 +391,7 @@ public class Monitor implements HighlyAvailableService {
if (req > 0)
hitRate.add(new Pair<>(currentTime, cacheHits.calculateCount() / (double) cacheReq.calculateCount()));
else
- hitRate.add(new Pair<Long,Double>(currentTime, null));
+ hitRate.add(new Pair<>(currentTime, null));
}
private static GCStatus fetchGcStatus() {
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/SpanTree.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/SpanTree.java
index 05c3212..11e852e 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/SpanTree.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/SpanTree.java
@@ -35,7 +35,7 @@ public class SpanTree {
public void addNode(RemoteSpan span) {
nodes.put(span.spanId, span);
if (parentChildren.get(span.parentId) == null)
- parentChildren.put(span.parentId, new ArrayList<Long>());
+ parentChildren.put(span.parentId, new ArrayList<>());
parentChildren.get(span.parentId).add(span.spanId);
}
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
index 0296f61..a5db1bf 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
@@ -300,15 +300,11 @@ public class TraceServer implements Watcher {
resetWriter();
}
}
- } catch (MutationsRejectedException exception) {
+ } catch (MutationsRejectedException | RuntimeException exception) {
log.warn("Problem flushing traces, resetting writer. Set log level to DEBUG to see stacktrace. cause: " + exception);
log.debug("flushing traces failed due to exception", exception);
resetWriter();
/* XXX e.g. if the writer was closed between when we grabbed it and when we called flush. */
- } catch (RuntimeException exception) {
- log.warn("Problem flushing traces, resetting writer. Set log level to DEBUG to see stacktrace. cause: " + exception);
- log.debug("flushing traces failed due to exception", exception);
- resetWriter();
}
}
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
index cba5c76..04f79ef 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
@@ -311,7 +311,7 @@ public class InMemoryMap {
partitioner = new LocalityGroupUtil.Partitioner(this.groupFams);
for (int i = 0; i < partitioned.length; i++) {
- partitioned.set(i, new ArrayList<Mutation>());
+ partitioned.set(i, new ArrayList<>());
}
}
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletIteratorEnvironment.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletIteratorEnvironment.java
index 445391e..f274811 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletIteratorEnvironment.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletIteratorEnvironment.java
@@ -85,7 +85,7 @@ public class TabletIteratorEnvironment implements IteratorEnvironment {
public TabletIteratorEnvironment(IteratorScope scope, AccumuloConfiguration config, ScanFileManager trm, Map<FileRef,DataFileValue> files,
Authorizations authorizations, SamplerConfigurationImpl samplerConfig) {
- this(scope, config, trm, files, authorizations, samplerConfig, new ArrayList<SortedKeyValueIterator<Key,Value>>());
+ this(scope, config, trm, files, authorizations, samplerConfig, new ArrayList<>());
}
public TabletIteratorEnvironment(IteratorScope scope, boolean fullMajC, AccumuloConfiguration config) {
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 87fce6c..0466c75 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
@@ -810,7 +810,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
us.authTimes.addStat(t2 - t1);
us.currentTablet = onlineTablets.get(keyExtent);
if (us.currentTablet != null) {
- us.queuedMutations.put(us.currentTablet, new ArrayList<Mutation>());
+ us.queuedMutations.put(us.currentTablet, new ArrayList<>());
} else {
// not serving tablet, so report all mutations as
// failures
@@ -978,9 +978,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
us.walogTimes.addStat(t2 - t1);
updateWalogWriteTime((t2 - t1));
break;
- } catch (IOException ex) {
- log.warn("logging mutations failed, retrying");
- } catch (FSError ex) { // happens when DFS is localFS
+ } catch (IOException | FSError ex) {
log.warn("logging mutations failed, retrying");
} catch (Throwable t) {
log.error("Unknown exception logging mutations, counts for mutations in flight not decremented!", t);
@@ -1022,7 +1020,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
} finally {
us.queuedMutations.clear();
if (us.currentTablet != null) {
- us.queuedMutations.put(us.currentTablet, new ArrayList<Mutation>());
+ us.queuedMutations.put(us.currentTablet, new ArrayList<>());
}
updateTotalQueuedMutationSize(-us.queuedMutationSize);
us.queuedMutationSize = 0;
@@ -1267,9 +1265,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
long t2 = System.currentTimeMillis();
updateWalogWriteTime(t2 - t1);
break;
- } catch (IOException ex) {
- log.warn("logging mutations failed, retrying");
- } catch (FSError ex) { // happens when DFS is localFS
+ } catch (IOException | FSError ex) {
log.warn("logging mutations failed, retrying");
} catch (Throwable t) {
log.error("Unknown exception logging mutations, counts for mutations in flight not decremented!", t);
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
index be1e019..2e03a67 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
@@ -143,7 +143,7 @@ public class TabletServerResourceManager {
}
private ExecutorService createEs(Property max, String name) {
- return createEs(max, name, new LinkedBlockingQueue<Runnable>());
+ return createEs(max, name, new LinkedBlockingQueue<>());
}
private ExecutorService createIdlingEs(Property max, String name, long timeout, TimeUnit timeUnit) {
@@ -161,7 +161,7 @@ public class TabletServerResourceManager {
}
private ExecutorService createEs(int min, int max, int timeout, String name) {
- return addEs(name, new ThreadPoolExecutor(min, max, timeout, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamingThreadFactory(name)));
+ return addEs(name, new ThreadPoolExecutor(min, max, timeout, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamingThreadFactory(name)));
}
public TabletServerResourceManager(TabletServer tserver, VolumeManager fs) {
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java
index c999c09..9860758 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java
@@ -43,7 +43,7 @@ class WriteTracker {
WriteTracker() {
for (TabletType ttype : TabletType.values()) {
- inProgressWrites.put(ttype, new TreeSet<Long>());
+ inProgressWrites.put(ttype, new TreeSet<>());
}
}
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java
index c8869bc..70064f2 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java
@@ -243,10 +243,7 @@ public class Compactor implements Callable<CompactionStats> {
majCStats.setFileSize(mfwTmp.getLength());
return majCStats;
- } catch (IOException e) {
- log.error("{}", e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
+ } catch (IOException | RuntimeException e) {
log.error("{}", e.getMessage(), e);
throw e;
} finally {
@@ -267,10 +264,8 @@ public class Compactor implements Callable<CompactionStats> {
log.error("Unable to delete {}", outputFile);
}
}
- } catch (IOException e) {
+ } catch (IOException | RuntimeException e) {
log.warn("{}", e.getMessage(), e);
- } catch (RuntimeException exception) {
- log.warn("{}", exception.getMessage(), exception);
}
}
}
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java
index bf3ba86..04b0236 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java
@@ -99,7 +99,7 @@ public class Scanner {
if (results.getResults() == null) {
range = null;
- return new ScanBatch(new ArrayList<KVEntry>(), false);
+ return new ScanBatch(new ArrayList<>(), false);
} else if (results.getContinueKey() == null) {
return new ScanBatch(results.getResults(), false);
} else {
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index 647587c..82132cd 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -868,11 +868,7 @@ public class Tablet implements TabletCommitter {
span.stop();
}
return new DataFileValue(stats.getFileSize(), stats.getEntriesWritten());
- } catch (Exception e) {
- failed = true;
- throw new RuntimeException(e);
- } catch (Error e) {
- // Weird errors like "OutOfMemoryError" when trying to create the thread for the compaction
+ } catch (Exception | Error e) {
failed = true;
throw new RuntimeException(e);
} finally {
@@ -1043,10 +1039,8 @@ public class Tablet implements TabletCommitter {
String zTablePath = Constants.ZROOT + "/" + tabletServer.getInstance().getInstanceID() + Constants.ZTABLES + "/" + extent.getTableId()
+ Constants.ZTABLE_FLUSH_ID;
return Long.parseLong(new String(ZooReaderWriter.getInstance().getData(zTablePath, null), UTF_8));
- } catch (InterruptedException e) {
+ } catch (InterruptedException | NumberFormatException e) {
throw new RuntimeException(e);
- } catch (NumberFormatException nfe) {
- throw new RuntimeException(nfe);
} catch (KeeperException ke) {
if (ke instanceof NoNodeException) {
throw (NoNodeException) ke;
@@ -1062,9 +1056,7 @@ public class Tablet implements TabletCommitter {
try {
return Long.parseLong(new String(ZooReaderWriter.getInstance().getData(zTablePath, null), UTF_8));
- } catch (KeeperException e) {
- throw new RuntimeException(e);
- } catch (InterruptedException e) {
+ } catch (KeeperException | InterruptedException e) {
throw new RuntimeException(e);
}
}
@@ -1099,18 +1091,14 @@ public class Tablet implements TabletCommitter {
}
return new Pair<>(compactID, compactionConfig);
- } catch (InterruptedException e) {
+ } catch (InterruptedException | DecoderException | NumberFormatException e) {
throw new RuntimeException(e);
- } catch (NumberFormatException nfe) {
- throw new RuntimeException(nfe);
} catch (KeeperException ke) {
if (ke instanceof NoNodeException) {
throw (NoNodeException) ke;
} else {
throw new RuntimeException(ke);
}
- } catch (DecoderException e) {
- throw new RuntimeException(e);
}
}
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index b8b4eac..708561e 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -654,13 +654,10 @@ public class Shell extends ShellOptions implements KeywordExecutable {
ShellCompletor userCompletor = null;
if (execFile != null) {
- java.util.Scanner scanner = new java.util.Scanner(execFile, UTF_8.name());
- try {
+ try (java.util.Scanner scanner = new java.util.Scanner(execFile, UTF_8.name())) {
while (scanner.hasNextLine() && !hasExited()) {
execCommand(scanner.nextLine(), true, isVerbose());
}
- } finally {
- scanner.close();
}
} else if (execCommand != null) {
for (String command : execCommand.split("\n")) {
diff --git a/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java b/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java
index 0cdaf18..9ec9670 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/ShellUtil.java
@@ -43,17 +43,14 @@ public class ShellUtil {
*/
public static List<Text> scanFile(String filename, boolean decode) throws FileNotFoundException {
String line;
- Scanner file = new Scanner(new File(filename), UTF_8.name());
List<Text> result = new ArrayList<>();
- try {
+ try (Scanner file = new Scanner(new File(filename), UTF_8.name())) {
while (file.hasNextLine()) {
line = file.nextLine();
if (!line.isEmpty()) {
result.add(decode ? new Text(Base64.getDecoder().decode(line)) : new Text(line));
}
}
- } finally {
- file.close();
}
return result;
}
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ExecfileCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ExecfileCommand.java
index 9d6278e..5bf0aaf 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ExecfileCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ExecfileCommand.java
@@ -37,13 +37,10 @@ public class ExecfileCommand extends Command {
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
- Scanner scanner = new Scanner(new File(cl.getArgs()[0]), UTF_8.name());
- try {
+ try (Scanner scanner = new Scanner(new File(cl.getArgs()[0]), UTF_8.name())) {
while (scanner.hasNextLine()) {
shellState.execCommand(scanner.nextLine(), true, cl.hasOption(verboseOption.getOpt()));
}
- } finally {
- scanner.close();
}
return 0;
}
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
index cae7af2..e6d9560 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
@@ -62,9 +62,7 @@ public class GetSplitsCommand extends Command {
final boolean encode = cl.hasOption(base64Opt.getOpt());
final boolean verbose = cl.hasOption(verboseOpt.getOpt());
- final PrintLine p = outputFile == null ? new PrintShell(shellState.getReader()) : new PrintFile(outputFile);
-
- try {
+ try (PrintLine p = outputFile == null ? new PrintShell(shellState.getReader()) : new PrintFile(outputFile)) {
if (!verbose) {
for (Text row : maxSplits > 0 ? shellState.getConnector().tableOperations().listSplits(tableName, maxSplits) : shellState.getConnector()
.tableOperations().listSplits(tableName)) {
@@ -91,8 +89,6 @@ public class GetSplitsCommand extends Command {
}
}
- } finally {
- p.close();
}
return 0;
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
index fffdf21..a3bdf72 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
@@ -210,9 +210,7 @@ public class SetIterCommand extends Command {
msg.append("; class not found.");
}
throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e.getMessage());
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
throw new IllegalArgumentException(e.getMessage());
} catch (ClassCastException e) {
StringBuilder msg = new StringBuilder(50);
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ShellPluginConfigurationCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ShellPluginConfigurationCommand.java
index 3ccf592..1274e2f 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ShellPluginConfigurationCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ShellPluginConfigurationCommand.java
@@ -94,9 +94,7 @@ public abstract class ShellPluginConfigurationCommand extends Command {
Iterator<Entry<String,String>> props;
try {
props = shellState.getConnector().tableOperations().getProperties(tableName).iterator();
- } catch (AccumuloException e) {
- return null;
- } catch (TableNotFoundException e) {
+ } catch (AccumuloException | TableNotFoundException e) {
return null;
}
diff --git a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
index 9f44d15..16c37d2 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
@@ -88,13 +88,10 @@ public class MockShell extends Shell {
printInfo();
if (execFile != null) {
- java.util.Scanner scanner = new java.util.Scanner(execFile, UTF_8.name());
- try {
+ try (java.util.Scanner scanner = new java.util.Scanner(execFile, UTF_8.name())) {
while (scanner.hasNextLine() && !hasExited()) {
execCommand(scanner.nextLine(), true, isVerbose());
}
- } finally {
- scanner.close();
}
} else if (execCommand != null) {
for (String command : execCommand.split("\n")) {
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
index 9bc8e70..d8b3876 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
@@ -118,7 +118,7 @@ public class AccumuloVFSClassLoader {
}
static FileObject[] resolve(FileSystemManager vfs, String uris) throws FileSystemException {
- return resolve(vfs, uris, new ArrayList<FileObject>());
+ return resolve(vfs, uris, new ArrayList<>());
}
static FileObject[] resolve(FileSystemManager vfs, String uris, ArrayList<FileObject> pathsToMonitor) throws FileSystemException {
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java
index fe20d8f..ebae7fd 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java
@@ -29,8 +29,7 @@ public class MiniDFSUtil {
// with the correct permissions.
try {
Process p = Runtime.getRuntime().exec("/bin/sh -c umask");
- BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream()));
- try {
+ try (BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
String line = bri.readLine();
p.waitFor();
@@ -43,8 +42,6 @@ public class MiniDFSUtil {
int newPermission = 0777 ^ umask;
return String.format("%03o", newPermission);
- } finally {
- bri.close();
}
} catch (Exception e) {
throw new RuntimeException("Error getting umask from O/S", e);
diff --git a/test/src/main/java/org/apache/accumulo/test/CompactionRateLimitingIT.java b/test/src/main/java/org/apache/accumulo/test/CompactionRateLimitingIT.java
index 075dd30..af216d0 100644
--- a/test/src/main/java/org/apache/accumulo/test/CompactionRateLimitingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CompactionRateLimitingIT.java
@@ -47,8 +47,7 @@ public class CompactionRateLimitingIT extends ConfigurableMacBase {
String tableName = getUniqueNames(1)[0];
Connector conn = getCluster().getConnector("root", new PasswordToken(ROOT_PASSWORD));
conn.tableOperations().create(tableName);
- BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig());
- try {
+ try (BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig())) {
Random r = new Random();
while (bytesWritten < BYTES_TO_WRITE) {
byte[] rowKey = new byte[32];
@@ -66,8 +65,6 @@ public class CompactionRateLimitingIT extends ConfigurableMacBase {
bytesWritten += rowKey.length + qual.length + value.length;
}
- } finally {
- bw.close();
}
conn.tableOperations().flush(tableName, null, null, true);
diff --git a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
index 95ee5bf..21c3799 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -431,7 +431,7 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
conn.tableOperations().create(tableName);
conn.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName());
- conn.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<String,String>(), new HashSet<String>());
+ conn.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<>(), new HashSet<>());
try (ConditionalWriter cw = conn.createConditionalWriter(tableName + "_clone", new ConditionalWriterConfig());
Scanner scanner = conn.createScanner(tableName + "_clone", new Authorizations())) {
@@ -863,7 +863,7 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
conn.tableOperations().create(tableName);
conn.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName());
- conn.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<String,String>(), new HashSet<String>());
+ conn.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<>(), new HashSet<>());
conn.securityOperations().changeUserAuthorizations(getAdminPrincipal(), new Authorizations("A", "B"));
diff --git a/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java b/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java
index 797f106..cec70f8 100644
--- a/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java
@@ -291,7 +291,7 @@ public class InMemoryMapIT {
List<MemKey> memKeys = new ArrayList<>();
try {
- skvi.seek(new Range(), new ArrayList<ByteSequence>(), false); // everything
+ skvi.seek(new Range(), new ArrayList<>(), false); // everything
while (skvi.hasTop()) {
memKeys.add((MemKey) skvi.getTopKey());
skvi.next();
diff --git a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
index 85b55b5..2c3b317 100644
--- a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
@@ -1131,7 +1131,7 @@ public class NamespacesIT extends AccumuloClusterHarness {
fail();
break;
case 1:
- ops.addSplits(tableName, new TreeSet<Text>());
+ ops.addSplits(tableName, new TreeSet<>());
fail();
break;
case 2:
diff --git a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
index e622997..0e49d59 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
@@ -83,9 +83,7 @@ public class TestMultiTableIngest {
Connector connector;
try {
connector = opts.getConnector();
- } catch (AccumuloException e) {
- throw new RuntimeException(e);
- } catch (AccumuloSecurityException e) {
+ } catch (AccumuloException | AccumuloSecurityException e) {
throw new RuntimeException(e);
}
for (int i = 0; i < opts.tables; i++) {
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index 69fd794..e9473fc 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -505,7 +505,7 @@ public class VolumeIT extends ConfigurableMacBase {
String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
Assert.assertTrue(rootTabletDir.startsWith(v2.toString()));
- conn.tableOperations().clone(tableNames[0], tableNames[1], true, new HashMap<String,String>(), new HashSet<String>());
+ conn.tableOperations().clone(tableNames[0], tableNames[1], true, new HashMap<>(), new HashSet<>());
conn.tableOperations().flush(MetadataTable.NAME, null, null, true);
conn.tableOperations().flush(RootTable.NAME, null, null, true);
@@ -566,7 +566,7 @@ public class VolumeIT extends ConfigurableMacBase {
String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
Assert.assertTrue(rootTabletDir.startsWith(v8.toString()) || rootTabletDir.startsWith(v9.toString()));
- getConnector().tableOperations().clone(tableNames[1], tableNames[2], true, new HashMap<String,String>(), new HashSet<String>());
+ getConnector().tableOperations().clone(tableNames[1], tableNames[2], true, new HashMap<>(), new HashSet<>());
getConnector().tableOperations().flush(MetadataTable.NAME, null, null, true);
getConnector().tableOperations().flush(RootTable.NAME, null, null, true);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
index 52fc57f..d2171b4 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
@@ -255,16 +255,13 @@ public class ConcurrentDeleteTableIT extends AccumuloClusterHarness {
}
private void writeData(Connector c, String table) throws TableNotFoundException, MutationsRejectedException {
- BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig());
- try {
+ try (BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig())) {
Random rand = new Random();
for (int i = 0; i < 1000; i++) {
Mutation m = new Mutation(String.format("%09x", rand.nextInt(100000 * 1000)));
m.put("m", "order", "" + i);
bw.addMutation(m);
}
- } finally {
- bw.close();
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
index 5712112..072c85c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
@@ -447,9 +447,8 @@ public class ReadWriteIT extends AccumuloClusterHarness {
for (Entry<Key,Value> entry : bscanner) {
foundFile = true;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintStream newOut = new PrintStream(baos);
PrintStream oldOut = System.out;
- try {
+ try (PrintStream newOut = new PrintStream(baos)) {
System.setOut(newOut);
List<String> args = new ArrayList<>();
args.add(entry.getKey().getColumnQualifier().toString());
@@ -467,7 +466,6 @@ public class ReadWriteIT extends AccumuloClusterHarness {
assertTrue(stdout.contains("Locality group : g1"));
assertTrue(stdout.contains("families : [colf]"));
} finally {
- newOut.close();
System.setOut(oldOut);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanIdIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanIdIT.java
index 3b3a1ed..980993b 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ScanIdIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanIdIT.java
@@ -296,11 +296,7 @@ public class ScanIdIT extends AccumuloClusterHarness {
log.trace("Split {}", split);
}
- } catch (AccumuloSecurityException e) {
- throw new IllegalStateException("Initialization failed. Could not add splits to " + tableName, e);
- } catch (TableNotFoundException e) {
- throw new IllegalStateException("Initialization failed. Could not add splits to " + tableName, e);
- } catch (AccumuloException e) {
+ } catch (AccumuloSecurityException | AccumuloException | TableNotFoundException e) {
throw new IllegalStateException("Initialization failed. Could not add splits to " + tableName, e);
}
@@ -354,9 +350,7 @@ public class ScanIdIT extends AccumuloClusterHarness {
}
bw.close();
- } catch (TableNotFoundException ex) {
- throw new IllegalStateException("Initialization failed. Could not create test data", ex);
- } catch (MutationsRejectedException ex) {
+ } catch (TableNotFoundException | MutationsRejectedException ex) {
throw new IllegalStateException("Initialization failed. Could not create test data", ex);
}
}
@@ -377,11 +371,7 @@ public class ScanIdIT extends AccumuloClusterHarness {
connector.tableOperations().attachIterator(tablename, slowIter, EnumSet.of(IteratorUtil.IteratorScope.scan));
- } catch (AccumuloException ex) {
- throw new IllegalStateException("Initialization failed. Could not attach slow iterator", ex);
- } catch (TableNotFoundException ex) {
- throw new IllegalStateException("Initialization failed. Could not attach slow iterator", ex);
- } catch (AccumuloSecurityException ex) {
+ } catch (AccumuloException | AccumuloSecurityException | TableNotFoundException ex) {
throw new IllegalStateException("Initialization failed. Could not attach slow iterator", ex);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
index c8d0fda..99d9def 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
@@ -60,7 +60,6 @@ import org.apache.accumulo.server.fs.FileRef;
import org.apache.accumulo.server.master.state.Assignment;
import org.apache.accumulo.server.master.state.TServerInstance;
import org.apache.accumulo.server.tablets.TabletTime;
-import org.apache.accumulo.server.util.FileUtil;
import org.apache.accumulo.server.util.MasterMetadataUtil;
import org.apache.accumulo.server.util.MetadataTableUtil;
import org.apache.accumulo.server.zookeeper.TransactionWatcher;
@@ -167,8 +166,7 @@ public class SplitRecoveryIT extends ConfigurableMacBase {
SortedMap<FileRef,DataFileValue> highDatafileSizes = new TreeMap<>();
List<FileRef> highDatafilesToRemove = new ArrayList<>();
- MetadataTableUtil.splitDatafiles(midRow, splitRatio, new HashMap<FileRef,FileUtil.FileInfo>(), mapFiles, lowDatafileSizes, highDatafileSizes,
- highDatafilesToRemove);
+ MetadataTableUtil.splitDatafiles(midRow, splitRatio, new HashMap<>(), mapFiles, lowDatafileSizes, highDatafileSizes, highDatafilesToRemove);
MetadataTableUtil.splitTablet(high, extent.getPrevEndRow(), splitRatio, context, zl);
TServerInstance instance = new TServerInstance(location, zl.getSessionId());
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
index f17ac83..b4f1d11 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
@@ -127,7 +127,7 @@ public class SummaryIT extends AccumuloClusterHarness {
}
private void addSplits(final String table, Connector c, String... splits) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
- c.tableOperations().addSplits(table, new TreeSet<Text>(Lists.transform(Arrays.asList(splits), Text::new)));
+ c.tableOperations().addSplits(table, new TreeSet<>(Lists.transform(Arrays.asList(splits), Text::new)));
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java
index fc0937f..954a39f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java
@@ -55,8 +55,7 @@ public class WatchTheWatchCountIT extends ConfigurableMacBase {
long total = 0;
final HostAndPort hostAndPort = HostAndPort.fromString(zooKeepers);
for (int i = 0; i < 5; i++) {
- Socket socket = new Socket(hostAndPort.getHost(), hostAndPort.getPort());
- try {
+ try (Socket socket = new Socket(hostAndPort.getHost(), hostAndPort.getPort())) {
socket.getOutputStream().write("wchs\n".getBytes(), 0, 5);
byte[] buffer = new byte[1024];
int n = socket.getInputStream().read(buffer);
@@ -68,8 +67,6 @@ public class WatchTheWatchCountIT extends ConfigurableMacBase {
}
log.debug("Expected number of watchers to be contained in ({}, {}), but actually was {}. Sleeping and retrying", MIN, MAX, total);
Thread.sleep(5000);
- } finally {
- socket.close();
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WriteLotsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WriteLotsIT.java
index 2c5a2d1..c38f178 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/WriteLotsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/WriteLotsIT.java
@@ -45,7 +45,7 @@ public class WriteLotsIT extends AccumuloClusterHarness {
final AtomicReference<Exception> ref = new AtomicReference<>();
final ClientConfiguration clientConfig = getCluster().getClientConfig();
final int THREADS = 5;
- ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, THREADS, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(THREADS));
+ ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, THREADS, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(THREADS));
for (int i = 0; i < THREADS; i++) {
final int index = i;
Runnable r = new Runnable() {
diff --git a/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java b/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
index d8f2903..67f5e62 100644
--- a/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
@@ -92,7 +92,7 @@ public class CloseWriteAheadLogReferencesIT extends ConfigurableMacBase {
expect(mockInst.getInstanceID()).andReturn(testName.getMethodName()).anyTimes();
expect(mockInst.getZooKeepers()).andReturn("localhost").anyTimes();
expect(mockInst.getZooKeepersSessionTimeOut()).andReturn(30000).anyTimes();
- final AccumuloConfiguration systemConf = new ConfigurationCopy(new HashMap<String,String>());
+ final AccumuloConfiguration systemConf = new ConfigurationCopy(new HashMap<>());
ServerConfigurationFactory factory = createMock(ServerConfigurationFactory.class);
expect(factory.getSystemConfiguration()).andReturn(systemConf).anyTimes();
expect(factory.getSiteConfiguration()).andReturn(siteConfig).anyTimes();
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
index 8040beb..4d0de28 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
@@ -422,7 +422,7 @@ public class CollectTabletStats {
Authorizations authorizations, byte[] defaultLabels, HashSet<Column> columnSet, List<IterInfo> ssiList, Map<String,Map<String,String>> ssio,
boolean useTableIterators, TableConfiguration conf) throws IOException {
- SortedMapIterator smi = new SortedMapIterator(new TreeMap<Key,Value>());
+ SortedMapIterator smi = new SortedMapIterator(new TreeMap<>());
List<SortedKeyValueIterator<Key,Value>> iters = new ArrayList<>(mapfiles.size() + 1);
@@ -486,7 +486,7 @@ public class CollectTabletStats {
List<IterInfo> emptyIterinfo = Collections.emptyList();
Map<String,Map<String,String>> emptySsio = Collections.emptyMap();
TableConfiguration tconf = aconf.getTableConfiguration(ke.getTableId());
- reader = createScanIterator(ke, readers, auths, new byte[] {}, new HashSet<Column>(), emptyIterinfo, emptySsio, useTableIterators, tconf);
+ reader = createScanIterator(ke, readers, auths, new byte[] {}, new HashSet<>(), emptyIterinfo, emptySsio, useTableIterators, tconf);
HashSet<ByteSequence> columnSet = createColumnBSS(columns);
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
index cb9ee98..af8afd4 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
@@ -113,7 +113,7 @@ public class NullTserver {
@Override
public UpdateErrors closeUpdate(TInfo tinfo, long updateID) {
- return new UpdateErrors(new HashMap<TKeyExtent,Long>(), new ArrayList<TConstraintViolationSummary>(), new HashMap<TKeyExtent,SecurityErrorCode>());
+ return new UpdateErrors(new HashMap<>(), new ArrayList<>(), new HashMap<>());
}
@Override
diff --git a/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java b/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java
index 21cb599..0355c53 100644
--- a/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java
+++ b/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java
@@ -123,7 +123,7 @@ public class TestProxyNamespaceOperations {
@Test
public void namespaceIterators() throws TException {
- IteratorSetting setting = new IteratorSetting(40, "DebugTheThings", "org.apache.accumulo.core.iterators.DebugIterator", new HashMap<String,String>());
+ IteratorSetting setting = new IteratorSetting(40, "DebugTheThings", "org.apache.accumulo.core.iterators.DebugIterator", new HashMap<>());
Set<IteratorScope> scopes = new HashSet<>();
scopes.add(IteratorScope.SCAN);
tpc.proxy().attachNamespaceIterator(userpass, testnamespace, setting, scopes);
@@ -138,7 +138,7 @@ public class TestProxyNamespaceOperations {
@Test(expected = AccumuloException.class)
public void namespaceIteratorConflict() throws TException {
- IteratorSetting setting = new IteratorSetting(40, "DebugTheThings", "org.apache.accumulo.core.iterators.DebugIterator", new HashMap<String,String>());
+ IteratorSetting setting = new IteratorSetting(40, "DebugTheThings", "org.apache.accumulo.core.iterators.DebugIterator", new HashMap<>());
Set<IteratorScope> scopes = new HashSet<>();
scopes.add(IteratorScope.SCAN);
tpc.proxy().attachNamespaceIterator(userpass, testnamespace, setting, scopes);
--
To stop receiving notification emails like this one, please contact
mmiller@apache.org.