You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/05/20 18:25:02 UTC
[18/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/master
Commit: b577410c677b5adb2f1c0eb1c1f8f6a9061cd0ad
Parents: 6524b07
Author: Christopher Tubbs <ct...@apache.org>
Authored: Wed May 20 11:50:32 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
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<Key,Value> {
// 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 @@
<!-- relative path for Eclipse format; should override in child modules if necessary -->
<eclipseFormatterStyle>${project.parent.basedir}/contrib/Eclipse-Accumulo-Codestyle.xml</eclipseFormatterStyle>
<!-- findbugs-maven-plugin won't work on jdk8 or later; set to 3.0.0 or newer -->
- <findbugs.version>3.0.0</findbugs.version>
+ <findbugs.version>3.0.1</findbugs.version>
<!-- surefire/failsafe plugin option -->
<forkCount>1</forkCount>
<!-- overwritten in hadoop profiles -->
@@ -540,7 +540,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.14</version>
+ <version>2.15</version>
</plugin>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
@@ -1080,7 +1080,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
- <version>6.3</version>
+ <version>6.6</version>
</dependency>
</dependencies>
<executions>
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("<a href='").append(legendUrl).append("'>").append(showLegend ? "Hide" : "Show").append(" Legend</a>\n");
if (showLegend)
- sb.append("<div class='left ").append(showLegend ? "show" : "hide").append("'><dl>\n");
+ sb.append("<div class='left show'><dl>\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<T extends Number> extends CellType<T> {
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<String> actual = new HashSet<String>();
- 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<String> expected = new HashSet<String>();
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<String> result = new ArrayList<String>();
- 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());