Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 21A37102E0 for ; Wed, 20 May 2015 16:24:47 +0000 (UTC) Received: (qmail 10493 invoked by uid 500); 20 May 2015 16:24:47 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 10405 invoked by uid 500); 20 May 2015 16:24:47 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 10322 invoked by uid 99); 20 May 2015 16:24:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 May 2015 16:24:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C7177E02D3; Wed, 20 May 2015 16:24:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctubbsii@apache.org To: commits@accumulo.apache.org Date: Wed, 20 May 2015 16:25:01 -0000 Message-Id: <906e41bf617b428ba97aa35d861c5b1a@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [17/21] accumulo git commit: ACCUMULO-3819 Update findbugs and checkstyle tools ACCUMULO-3819 Update findbugs and checkstyle tools * Bump findbugs and checkstyle build tools to check for more problems. * Fix newly detected problems (mainly lack of checking for null when listing directory contents) to ensure the build passes. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b577410c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b577410c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b577410c Branch: refs/heads/1.7 Commit: b577410c677b5adb2f1c0eb1c1f8f6a9061cd0ad Parents: 6524b07 Author: Christopher Tubbs Authored: Wed May 20 11:50:32 2015 -0400 Committer: Christopher Tubbs Committed: Wed May 20 11:50:32 2015 -0400 ---------------------------------------------------------------------- .../core/client/impl/ConditionalWriterImpl.java | 2 +- .../accumulo/core/file/rfile/bcfile/Utils.java | 2 +- .../iterators/user/IntersectingIterator.java | 19 ++--- .../mapred/AccumuloFileOutputFormatTest.java | 2 + .../mapreduce/AccumuloFileOutputFormatTest.java | 2 + .../accumulo/examples/simple/shard/Index.java | 7 +- .../impl/MiniAccumuloClusterImpl.java | 17 ++-- .../impl/MiniAccumuloConfigImpl.java | 8 +- pom.xml | 6 +- .../accumulo/server/util/SendLogToChainsaw.java | 2 +- .../org/apache/accumulo/monitor/util/Table.java | 2 +- .../monitor/util/celltypes/NumberType.java | 2 +- .../accumulo/tserver/log/LocalWALRecovery.java | 75 ++++++++--------- .../accumulo/tserver/tablet/RootFilesTest.java | 7 +- .../shell/commands/FormatterCommandTest.java | 2 +- .../start/classloader/AccumuloClassLoader.java | 7 +- .../classloader/vfs/UniqueFileReplicator.java | 3 +- .../accumulo/test/continuous/TimeBinner.java | 3 + .../test/continuous/UndefinedAnalyzer.java | 84 ++++++++++---------- .../test/functional/CacheTestWriter.java | 3 + .../apache/accumulo/test/randomwalk/Node.java | 16 ++-- .../apache/accumulo/test/AuditMessageIT.java | 5 +- 22 files changed, 159 insertions(+), 117 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java ---------------------------------------------------------------------- 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 b8375dc..24040e6 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 @@ -182,7 +182,7 @@ class ConditionalWriterImpl implements ConditionalWriter { @Override public int compareTo(Delayed o) { QCMutation oqcm = (QCMutation) o; - return Long.valueOf(resetTime).compareTo(Long.valueOf(oqcm.resetTime)); + return Long.compare(resetTime, oqcm.resetTime); } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/Utils.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/Utils.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/Utils.java index 6cb04a1..5e84f10 100644 --- a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/Utils.java +++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/Utils.java @@ -351,7 +351,7 @@ public final class Utils { @Override public int hashCode() { - return (major << 16 + minor); + return ((major << 16) + minor); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java index 63d6a34..e7338f3 100644 --- a/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java +++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java @@ -232,19 +232,20 @@ public class IntersectingIterator implements SortedKeyValueIterator { // If we are past the target, this is a valid result if (docIDCompare < 0) { break; - } - // if this source is not yet at the currentCQ then advance in this source - if (docIDCompare > 0) { + } else if (docIDCompare > 0) { + // if this source is not yet at the currentCQ then advance in this source + // seek forwards Key seekKey = buildKey(currentPartition, sources[sourceID].term, currentDocID); sources[sourceID].iter.seek(new Range(seekKey, true, null, false), sources[sourceID].seekColfams, true); continue; - } - // if we are equal to the target, this is an invalid result. - // Force the entire process to go to the next row. - // We are advancing column 0 because we forced that column to not contain a ! - // when we did the init() - if (docIDCompare == 0) { + } else { + // docIDCompare == 0 + + // if we are equal to the target, this is an invalid result. + // Force the entire process to go to the next row. + // We are advancing column 0 because we forced that column to not contain a ! + // when we did the init() sources[0].iter.next(); advancedCursor = true; break; http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java index e389c0b..c4a4a29 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java @@ -17,6 +17,7 @@ package org.apache.accumulo.core.client.mapred; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -190,6 +191,7 @@ public class AccumuloFileOutputFormatTest { return file.getName().startsWith("part-m-"); } }); + assertNotNull(files); if (content) { assertEquals(1, files.length); assertTrue(files[0].exists()); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java index abc99c9..b8b3c47 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java @@ -17,6 +17,7 @@ package org.apache.accumulo.core.client.mapreduce; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -178,6 +179,7 @@ public class AccumuloFileOutputFormatTest { return file.getName().startsWith("part-m-"); } }); + assertNotNull(files); if (content) { assertEquals(1, files.length); assertTrue(files[0].exists()); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/Index.java ---------------------------------------------------------------------- diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/Index.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/Index.java index 3564be4..bc76c03 100644 --- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/Index.java +++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/Index.java @@ -70,8 +70,11 @@ public class Index { public static void index(int numPartitions, File src, String splitRegex, BatchWriter bw) throws Exception { if (src.isDirectory()) { - for (File child : src.listFiles()) { - index(numPartitions, child, splitRegex, bw); + File[] files = src.listFiles(); + if (files != null) { + for (File child : files) { + index(numPartitions, child, splitRegex, bw); + } } } else { FileReader fr = new FileReader(src); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java index a21ba64..19aed0b 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java @@ -205,13 +205,18 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster { } private boolean containsSiteFile(File f) { - return f.isDirectory() && f.listFiles(new FileFilter() { + if (!f.isDirectory()) { + return false; + } else { + File[] files = f.listFiles(new FileFilter() { - @Override - public boolean accept(File pathname) { - return pathname.getName().endsWith("site.xml"); - } - }).length > 0; + @Override + public boolean accept(File pathname) { + return pathname.getName().endsWith("site.xml"); + } + }); + return files != null && files.length > 0; + } } private void append(StringBuilder classpathBuilder, URL url) throws URISyntaxException { http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java index eab82ba..ef498bf 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java @@ -108,8 +108,12 @@ public class MiniAccumuloConfigImpl { if (this.getDir().exists() && !this.getDir().isDirectory()) throw new IllegalArgumentException("Must pass in directory, " + this.getDir() + " is a file"); - if (this.getDir().exists() && this.getDir().list().length != 0) - throw new IllegalArgumentException("Directory " + this.getDir() + " is not empty"); + if (this.getDir().exists()) { + String[] children = this.getDir().list(); + if (children != null && children.length != 0) { + throw new IllegalArgumentException("Directory " + this.getDir() + " is not empty"); + } + } if (!initialized) { libDir = new File(dir, "lib"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 33d4df8..19ff679 100644 --- a/pom.xml +++ b/pom.xml @@ -122,7 +122,7 @@ ${project.parent.basedir}/contrib/Eclipse-Accumulo-Codestyle.xml - 3.0.0 + 3.0.1 1 @@ -540,7 +540,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.14 + 2.15 com.github.ekryd.sortpom @@ -1080,7 +1080,7 @@ com.puppycrawl.tools checkstyle - 6.3 + 6.6 http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java b/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java index 2c192cf..c6f78bb 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java @@ -90,7 +90,7 @@ public class SendLogToChainsaw extends XMLLayout { throw new IllegalArgumentException(directory + " is not a directory or is not readable."); } - if (logFiles.length == 0) { + if (logFiles == null || logFiles.length == 0) { throw new IllegalArgumentException("No files match the supplied filter."); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java index b1a4582..522ebb6 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java @@ -160,7 +160,7 @@ public class Table { String legendUrl = String.format("/op?action=toggleLegend&redir=%s&page=%s&table=%s&show=%s", redir, page, table, !showLegend); sb.append("").append(showLegend ? "Hide" : "Show").append(" Legend\n"); if (showLegend) - sb.append("
\n"); + sb.append("
\n"); } for (int i = 0; i < columns.size(); ++i) { TableColumn col = columns.get(i); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java index b2de91e..dfa40eb 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java @@ -73,7 +73,7 @@ public class NumberType extends CellType { else if (o2 == null) return 1; else - return Double.valueOf(o1.doubleValue()).compareTo(o2.doubleValue()); + return Double.compare(o1.doubleValue(), o2.doubleValue()); } public static String commas(long i) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LocalWALRecovery.java ---------------------------------------------------------------------- diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LocalWALRecovery.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LocalWALRecovery.java index 60c8e8d..2667b53 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LocalWALRecovery.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LocalWALRecovery.java @@ -135,47 +135,50 @@ public class LocalWALRecovery implements Runnable { } log.info("Copying WALs to " + options.destination); - for (File file : localDirectory.listFiles()) { - String name = file.getName(); - try { - UUID.fromString(name); - } catch (IllegalArgumentException ex) { - log.info("Ignoring non-log file " + file.getAbsolutePath()); - continue; - } - - LogFileKey key = new LogFileKey(); - LogFileValue value = new LogFileValue(); - - log.info("Openning local log " + file.getAbsolutePath()); - - Path localWal = new Path(file.toURI()); - FileSystem localFs = FileSystem.getLocal(fs.getConf()); - - Reader reader = new SequenceFile.Reader(localFs, localWal, localFs.getConf()); - // Reader reader = new SequenceFile.Reader(localFs.getConf(), SequenceFile.Reader.file(localWal)); - Path tmp = new Path(options.destination + "/" + name + ".copy"); - FSDataOutputStream writer = fs.create(tmp); - while (reader.next(key, value)) { + File[] files = localDirectory.listFiles(); + if (files != null) { + for (File file : files) { + String name = file.getName(); try { - key.write(writer); - value.write(writer); - } catch (EOFException ex) { - break; + UUID.fromString(name); + } catch (IllegalArgumentException ex) { + log.info("Ignoring non-log file " + file.getAbsolutePath()); + continue; } - } - writer.close(); - reader.close(); - fs.rename(tmp, new Path(tmp.getParent(), name)); - if (options.deleteLocal) { - if (file.delete()) { - log.info("Copied and deleted: " + name); + LogFileKey key = new LogFileKey(); + LogFileValue value = new LogFileValue(); + + log.info("Openning local log " + file.getAbsolutePath()); + + Path localWal = new Path(file.toURI()); + FileSystem localFs = FileSystem.getLocal(fs.getConf()); + + Reader reader = new SequenceFile.Reader(localFs, localWal, localFs.getConf()); + // Reader reader = new SequenceFile.Reader(localFs.getConf(), SequenceFile.Reader.file(localWal)); + Path tmp = new Path(options.destination + "/" + name + ".copy"); + FSDataOutputStream writer = fs.create(tmp); + while (reader.next(key, value)) { + try { + key.write(writer); + value.write(writer); + } catch (EOFException ex) { + break; + } + } + writer.close(); + reader.close(); + fs.rename(tmp, new Path(tmp.getParent(), name)); + + if (options.deleteLocal) { + if (file.delete()) { + log.info("Copied and deleted: " + name); + } else { + log.info("Failed to delete: " + name + " (but it is safe for you to delete it manually)."); + } } else { - log.info("Failed to delete: " + name + " (but it is safe for you to delete it manually)."); + log.info("Safe to delete: " + name); } - } else { - log.info("Safe to delete: " + name); } } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java ---------------------------------------------------------------------- diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java index ea8874a..e5d893a 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java @@ -102,8 +102,11 @@ public class RootFilesTest { public void assertFiles(String... files) { HashSet actual = new HashSet(); - for (File file : rootTabletDir.listFiles()) { - actual.add(file.getName()); + File[] children = rootTabletDir.listFiles(); + if (children != null) { + for (File file : children) { + actual.add(file.getName()); + } } HashSet expected = new HashSet(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java b/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java index 866e716..704d0c3 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java @@ -167,7 +167,7 @@ public class FormatterCommandTest { sb.append(key).append(tab); for (byte b : v.get()) { - if ((b >= 48 && b <= 57) || (b >= 97 || b <= 102)) { + if ((b >= 48 && b <= 57) || (b >= 97 && b <= 102)) { sb.append(String.format("0x%x ", Integer.valueOf(b))); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java index 53b36b4..9ebbae0 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java @@ -251,8 +251,11 @@ public class AccumuloClassLoader { return; if (file.isDirectory()) { File[] children = file.listFiles(); - for (File child : children) - findMavenTargetClasses(paths, child, depth + 1); + if (children != null) { + for (File child : children) { + findMavenTargetClasses(paths, child, depth + 1); + } + } } else if ("pom.xml".equals(file.getName())) { paths.add(file.getParentFile().getAbsolutePath() + File.separator + "target" + File.separator + "classes"); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java index 641da8a..85b47df 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java @@ -95,7 +95,8 @@ public class UniqueFileReplicator implements VfsComponent, FileReplicator { } if (tempDir.exists()) { - int numChildren = tempDir.list().length; + String[] list = tempDir.list(); + int numChildren = list == null ? 0 : list.length; if (0 == numChildren && !tempDir.delete()) log.warn("Cannot delete empty directory: " + tempDir); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java b/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java index cfe8551..e40bc8e 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java @@ -94,6 +94,9 @@ public class TimeBinner { switch (operation) { case AMM_HACK1: { + if (opts.dataColumn < 2) { + throw new IllegalArgumentException("--dataColumn must be at least 2"); + } double data_min = Double.parseDouble(tokens[opts.dataColumn - 2]); double data_max = Double.parseDouble(tokens[opts.dataColumn - 1]); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java b/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java index 7d2c65b..00c7eb0 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java @@ -79,8 +79,10 @@ public class UndefinedAnalyzer { } }); - for (File log : ingestLogs) { - parseLog(log); + if (ingestLogs != null) { + for (File log : ingestLogs) { + parseLog(log); + } } } @@ -175,53 +177,55 @@ public class UndefinedAnalyzer { String currentYear = (Calendar.getInstance().get(Calendar.YEAR)) + ""; String currentMonth = (Calendar.getInstance().get(Calendar.MONTH) + 1) + ""; - for (File masterLog : masterLogs) { - - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(masterLog), UTF_8)); - String line; - try { - while ((line = reader.readLine()) != null) { - if (line.contains("TABLET_LOADED")) { - String[] tokens = line.split("\\s+"); - String tablet = tokens[8]; - String server = tokens[10]; - - int pos1 = -1; - int pos2 = -1; - int pos3 = -1; - - for (int i = 0; i < tablet.length(); i++) { - if (tablet.charAt(i) == '<' || tablet.charAt(i) == ';') { - if (pos1 == -1) { - pos1 = i; - } else if (pos2 == -1) { - pos2 = i; - } else { - pos3 = i; + if (masterLogs != null) { + for (File masterLog : masterLogs) { + + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(masterLog), UTF_8)); + String line; + try { + while ((line = reader.readLine()) != null) { + if (line.contains("TABLET_LOADED")) { + String[] tokens = line.split("\\s+"); + String tablet = tokens[8]; + String server = tokens[10]; + + int pos1 = -1; + int pos2 = -1; + int pos3 = -1; + + for (int i = 0; i < tablet.length(); i++) { + if (tablet.charAt(i) == '<' || tablet.charAt(i) == ';') { + if (pos1 == -1) { + pos1 = i; + } else if (pos2 == -1) { + pos2 = i; + } else { + pos3 = i; + } } } - } - if (pos1 > 0 && pos2 > 0 && pos3 == -1) { - String tid = tablet.substring(0, pos1); - String endRow = tablet.charAt(pos1) == '<' ? "8000000000000000" : tablet.substring(pos1 + 1, pos2); - String prevEndRow = tablet.charAt(pos2) == '<' ? "" : tablet.substring(pos2 + 1); - if (tid.equals(tableId)) { - // System.out.println(" "+server+" "+tid+" "+endRow+" "+prevEndRow); - Date date = sdf.parse(tokens[0] + " " + tokens[1] + " " + currentYear + " " + currentMonth); - // System.out.println(" "+date); + if (pos1 > 0 && pos2 > 0 && pos3 == -1) { + String tid = tablet.substring(0, pos1); + String endRow = tablet.charAt(pos1) == '<' ? "8000000000000000" : tablet.substring(pos1 + 1, pos2); + String prevEndRow = tablet.charAt(pos2) == '<' ? "" : tablet.substring(pos2 + 1); + if (tid.equals(tableId)) { + // System.out.println(" "+server+" "+tid+" "+endRow+" "+prevEndRow); + Date date = sdf.parse(tokens[0] + " " + tokens[1] + " " + currentYear + " " + currentMonth); + // System.out.println(" "+date); - assignments.add(new TabletAssignment(tablet, endRow, prevEndRow, server, date.getTime())); + assignments.add(new TabletAssignment(tablet, endRow, prevEndRow, server, date.getTime())); + } + } else if (!tablet.startsWith("!0")) { + System.err.println("Cannot parse tablet " + tablet); } - } else if (!tablet.startsWith("!0")) { - System.err.println("Cannot parse tablet " + tablet); - } + } } + } finally { + reader.close(); } - } finally { - reader.close(); } } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java index 3a3baf0..76e8168 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java @@ -120,6 +120,9 @@ public class CacheTestWriter { while (true) { File[] files = reportDir.listFiles(); + if (files == null) { + throw new IllegalStateException("report directory is inaccessible"); + } System.out.println("files.length " + files.length); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/test/src/main/java/org/apache/accumulo/test/randomwalk/Node.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/Node.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/Node.java index fecced9..6df5aed 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/Node.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/Node.java @@ -77,13 +77,15 @@ public abstract class Node { File zkLib = new File(zkHome); String[] files = zkLib.list(); - for (int i = 0; i < files.length; i++) { - String f = files[i]; - if (f.matches("^zookeeper-.+jar$")) { - if (retval == null) { - retval = String.format("%s/%s", zkLib.getAbsolutePath(), f); - } else { - retval += String.format(",%s/%s", zkLib.getAbsolutePath(), f); + if (files != null) { + for (int i = 0; i < files.length; i++) { + String f = files[i]; + if (f.matches("^zookeeper-.+jar$")) { + if (retval == null) { + retval = String.format("%s/%s", zkLib.getAbsolutePath(), f); + } else { + retval += String.format(",%s/%s", zkLib.getAbsolutePath(), f); + } } } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b577410c/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java b/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java index 00a5749..14361a6 100644 --- a/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java +++ b/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java @@ -18,6 +18,7 @@ package org.apache.accumulo.test; import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.File; @@ -124,7 +125,9 @@ public class AuditMessageIT extends ConfigurableMacIT { System.out.println("Start of captured audit messages for step " + stepName); ArrayList result = new ArrayList(); - for (File file : getCluster().getConfig().getLogDir().listFiles()) { + File[] files = getCluster().getConfig().getLogDir().listFiles(); + assertNotNull(files); + for (File file : files) { // We want to grab the files called .out if (file.getName().contains(".out") && file.isFile() && file.canRead()) { LineIterator it = FileUtils.lineIterator(file, UTF_8.name());