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 2018/08/28 04:01:10 UTC
[accumulo] branch master updated: Upgrade findbugs to spotbugs
(#615)
This is an automated email from the ASF dual-hosted git repository.
ctubbsii 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 9ee0030 Upgrade findbugs to spotbugs (#615)
9ee0030 is described below
commit 9ee0030530e0a0ce43e04a592a1771e12d6cfe78
Author: Mike Miller <mm...@apache.org>
AuthorDate: Tue Aug 28 00:01:08 2018 -0400
Upgrade findbugs to spotbugs (#615)
* Upgrade findbugs to spotbugs 3.1.3
* Rename all findbugs to spotbugs
Remove remaining references to findbugs (from @ctubbsii):
* Add more information about spotbugs false positive to PropertyType
* Fix RFileTest with assertion to address return types from file system operations
* Fix ShellServerIT by adding a simple comment to ensure the expected
exception block is limited to the expected exception type and isn't empty
(also make use of static Assert imports consistent for this class)
---
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
contrib/{README.findbugs => README.spotbugs} | 0
.../apache/accumulo/core/conf/PropertyType.java | 8 +-
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
.../accumulo/core/client/rfile/RFileTest.java | 143 +++++++++++----------
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
pom.xml | 23 ++--
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
.../org/apache/accumulo/test/InMemoryMapIT.java | 2 +-
.../org/apache/accumulo/test/ShellServerIT.java | 63 +++++----
.../main/{findbugs => spotbugs}/exclude-filter.xml | 0
17 files changed, 120 insertions(+), 119 deletions(-)
diff --git a/client/mapreduce/src/main/findbugs/exclude-filter.xml b/client/mapreduce/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from client/mapreduce/src/main/findbugs/exclude-filter.xml
rename to client/mapreduce/src/main/spotbugs/exclude-filter.xml
diff --git a/contrib/README.findbugs b/contrib/README.spotbugs
similarity index 100%
rename from contrib/README.findbugs
rename to contrib/README.spotbugs
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
index 2eaf4e5..295ed69 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
@@ -129,7 +129,10 @@ public enum PropertyType {
URI("uri", x -> true, "A valid URI");
private String shortname, format;
- // made this transient because findbugs was complaining
+ // Field is transient because enums are Serializable, but Predicates aren't necessarily,
+ // and our lambdas certainly aren't; This shouldn't matter because enum serialization doesn't
+ // store fields, so this is a false positive in our spotbugs version
+ // see https://github.com/spotbugs/spotbugs/issues/740
private transient Predicate<String> predicate;
private PropertyType(String shortname, Predicate<String> predicate, String formatDescription) {
@@ -158,6 +161,9 @@ public enum PropertyType {
* @return true if value is valid or null, or if this type has no regex
*/
public boolean isValidFormat(String value) {
+ // this can't happen because enum fields aren't serialized, so it doesn't matter if the
+ // predicate was transient or not, but it's probably not hurting anything to check and provide
+ // the helpful error message for troubleshooting, just in case
Preconditions.checkState(predicate != null,
"Predicate was null, maybe this enum was serialized????");
return predicate.test(value);
diff --git a/core/src/main/findbugs/exclude-filter.xml b/core/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from core/src/main/findbugs/exclude-filter.xml
rename to core/src/main/spotbugs/exclude-filter.xml
diff --git a/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileTest.java
index 8fbdca3..6bfd658 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileTest.java
@@ -17,6 +17,11 @@
package org.apache.accumulo.core.client.rfile;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.IOException;
import java.util.AbstractMap;
@@ -60,21 +65,17 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Assert;
import org.junit.Test;
import com.google.common.collect.ImmutableMap;
public class RFileTest {
- // method created to foil findbugs... it was complaining ret val not used when it did not matter
- private void foo(boolean b) {}
-
private String createTmpTestFile() throws IOException {
File dir = new File(System.getProperty("user.dir") + "/target/rfile-test");
- foo(dir.mkdirs());
+ assertTrue(dir.mkdirs() || dir.isDirectory());
File testFile = File.createTempFile("test", ".rf", dir);
- foo(testFile.delete());
+ assertTrue(testFile.delete() || !testFile.exists());
return testFile.getAbsolutePath();
}
@@ -153,22 +154,22 @@ public class RFileTest {
while (scnIter1.hasNext() || scnIter2.hasNext()) {
if (scnIter1.hasNext()) {
- Assert.assertTrue(mapIter1.hasNext());
- Assert.assertEquals(scnIter1.next(), mapIter1.next());
+ assertTrue(mapIter1.hasNext());
+ assertEquals(scnIter1.next(), mapIter1.next());
} else {
- Assert.assertFalse(mapIter1.hasNext());
+ assertFalse(mapIter1.hasNext());
}
if (scnIter2.hasNext()) {
- Assert.assertTrue(mapIter2.hasNext());
- Assert.assertEquals(scnIter2.next(), mapIter2.next());
+ assertTrue(mapIter2.hasNext());
+ assertEquals(scnIter2.next(), mapIter2.next());
} else {
- Assert.assertFalse(mapIter2.hasNext());
+ assertFalse(mapIter2.hasNext());
}
}
- Assert.assertFalse(mapIter1.hasNext());
- Assert.assertFalse(mapIter2.hasNext());
+ assertFalse(mapIter1.hasNext());
+ assertFalse(mapIter2.hasNext());
scanner.close();
}
@@ -195,11 +196,11 @@ public class RFileTest {
TreeMap<Key,Value> expected = new TreeMap<>(testData1);
expected.putAll(testData2);
- Assert.assertEquals(expected, toMap(scanner));
+ assertEquals(expected, toMap(scanner));
Range range = new Range(rowStr(3), true, rowStr(14), true);
scanner.setRange(range);
- Assert.assertEquals(expected.subMap(range.getStartKey(), range.getEndKey()), toMap(scanner));
+ assertEquals(expected.subMap(range.getStartKey(), range.getEndKey()), toMap(scanner));
scanner.close();
}
@@ -230,12 +231,12 @@ public class RFileTest {
}
// if settings are used then should create multiple index entries
- Assert.assertTrue(count > 10);
+ assertTrue(count > 10);
reader.close();
Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).build();
- Assert.assertEquals(testData1, toMap(scanner));
+ assertEquals(testData1, toMap(scanner));
scanner.close();
}
@@ -265,31 +266,31 @@ public class RFileTest {
scanner.fetchColumnFamily(new Text(colStr(0)));
scanner.fetchColumnFamily(new Text(colStr(1)));
- Assert.assertEquals(testData1, toMap(scanner));
+ assertEquals(testData1, toMap(scanner));
scanner.clearColumns();
scanner.fetchColumnFamily(new Text(colStr(2)));
- Assert.assertEquals(testData2, toMap(scanner));
+ assertEquals(testData2, toMap(scanner));
scanner.clearColumns();
for (int i = 3; i < 10; i++) {
scanner.fetchColumnFamily(new Text(colStr(i)));
}
- Assert.assertEquals(defaultData, toMap(scanner));
+ assertEquals(defaultData, toMap(scanner));
scanner.clearColumns();
- Assert.assertEquals(createTestData(10, 10, 10), toMap(scanner));
+ assertEquals(createTestData(10, 10, 10), toMap(scanner));
scanner.close();
Reader reader = getReader(localFs, testFile);
Map<String,ArrayList<ByteSequence>> lGroups = reader.getLocalityGroupCF();
- Assert.assertTrue(lGroups.containsKey("z"));
- Assert.assertEquals(2, lGroups.get("z").size());
- Assert.assertTrue(lGroups.get("z").contains(new ArrayByteSequence(colStr(0))));
- Assert.assertTrue(lGroups.get("z").contains(new ArrayByteSequence(colStr(1))));
- Assert.assertTrue(lGroups.containsKey("h"));
- Assert.assertEquals(Arrays.asList(new ArrayByteSequence(colStr(2))), lGroups.get("h"));
+ assertTrue(lGroups.containsKey("z"));
+ assertEquals(2, lGroups.get("z").size());
+ assertTrue(lGroups.get("z").contains(new ArrayByteSequence(colStr(0))));
+ assertTrue(lGroups.get("z").contains(new ArrayByteSequence(colStr(1))));
+ assertTrue(lGroups.containsKey("h"));
+ assertEquals(Arrays.asList(new ArrayByteSequence(colStr(2))), lGroups.get("h"));
reader.close();
}
@@ -306,7 +307,7 @@ public class RFileTest {
Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).build();
scanner.addScanIterator(is);
- Assert.assertEquals(createTestData(7, 2, 0, 10, 10), toMap(scanner));
+ assertEquals(createTestData(7, 2, 0, 10, 10), toMap(scanner));
scanner.close();
}
@@ -332,20 +333,20 @@ public class RFileTest {
Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs)
.withAuthorizations(new Authorizations("A")).build();
- Assert.assertEquals(ImmutableMap.of(k2, v2, k3, v3), toMap(scanner));
- Assert.assertEquals(new Authorizations("A"), scanner.getAuthorizations());
+ assertEquals(ImmutableMap.of(k2, v2, k3, v3), toMap(scanner));
+ assertEquals(new Authorizations("A"), scanner.getAuthorizations());
scanner.close();
scanner = RFile.newScanner().from(testFile).withFileSystem(localFs)
.withAuthorizations(new Authorizations("A", "B")).build();
- Assert.assertEquals(ImmutableMap.of(k1, v1, k2, v2, k3, v3), toMap(scanner));
- Assert.assertEquals(new Authorizations("A", "B"), scanner.getAuthorizations());
+ assertEquals(ImmutableMap.of(k1, v1, k2, v2, k3, v3), toMap(scanner));
+ assertEquals(new Authorizations("A", "B"), scanner.getAuthorizations());
scanner.close();
scanner = RFile.newScanner().from(testFile).withFileSystem(localFs)
.withAuthorizations(new Authorizations("B")).build();
- Assert.assertEquals(ImmutableMap.of(k3, v3), toMap(scanner));
- Assert.assertEquals(new Authorizations("B"), scanner.getAuthorizations());
+ assertEquals(ImmutableMap.of(k3, v3), toMap(scanner));
+ assertEquals(new Authorizations("B"), scanner.getAuthorizations());
scanner.close();
}
@@ -370,14 +371,14 @@ public class RFileTest {
writer.close();
Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).build();
- Assert.assertFalse(scanner.iterator().hasNext());
+ assertFalse(scanner.iterator().hasNext());
scanner.close();
scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).withoutSystemIterators()
.build();
- Assert.assertEquals(ImmutableMap.of(k2, v2, k1, v1), toMap(scanner));
+ assertEquals(ImmutableMap.of(k2, v2, k1, v1), toMap(scanner));
scanner.setRange(new Range("r2"));
- Assert.assertFalse(scanner.iterator().hasNext());
+ assertFalse(scanner.iterator().hasNext());
scanner.close();
}
@@ -391,25 +392,25 @@ public class RFileTest {
Range bounds = new Range(rowStr(3), false, null, true);
Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).withBounds(bounds)
.build();
- Assert.assertEquals(createTestData(4, 6, 0, 10, 10), toMap(scanner));
+ assertEquals(createTestData(4, 6, 0, 10, 10), toMap(scanner));
scanner.close();
// set an upper bound row
bounds = new Range(null, false, rowStr(7), true);
scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).withBounds(bounds).build();
- Assert.assertEquals(createTestData(8, 10, 10), toMap(scanner));
+ assertEquals(createTestData(8, 10, 10), toMap(scanner));
scanner.close();
// set row bounds
bounds = new Range(rowStr(3), false, rowStr(7), true);
scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).withBounds(bounds).build();
- Assert.assertEquals(createTestData(4, 4, 0, 10, 10), toMap(scanner));
+ assertEquals(createTestData(4, 4, 0, 10, 10), toMap(scanner));
scanner.close();
// set a row family bound
bounds = Range.exact(rowStr(3), colStr(5));
scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).withBounds(bounds).build();
- Assert.assertEquals(createTestData(3, 1, 5, 1, 10), toMap(scanner));
+ assertEquals(createTestData(3, 1, 5, 1, 10), toMap(scanner));
scanner.close();
}
@@ -437,11 +438,11 @@ public class RFileTest {
// pass in table config that has versioning iterator configured
Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs)
.withTableProperties(ntc.getProperties()).build();
- Assert.assertEquals(ImmutableMap.of(k2, v2), toMap(scanner));
+ assertEquals(ImmutableMap.of(k2, v2), toMap(scanner));
scanner.close();
scanner = RFile.newScanner().from(testFile).withFileSystem(localFs).build();
- Assert.assertEquals(ImmutableMap.of(k2, v2, k1, v1), toMap(scanner));
+ assertEquals(ImmutableMap.of(k2, v2, k1, v1), toMap(scanner));
scanner.close();
}
@@ -474,13 +475,13 @@ public class RFileTest {
}
}
- Assert.assertTrue(sampleData.size() < testData1.size());
+ assertTrue(sampleData.size() < testData1.size());
- Assert.assertEquals(sampleData, toMap(scanner));
+ assertEquals(sampleData, toMap(scanner));
scanner.clearSamplerConfiguration();
- Assert.assertEquals(testData1, toMap(scanner));
+ assertEquals(testData1, toMap(scanner));
}
@@ -500,7 +501,7 @@ public class RFileTest {
scanner.close();
scanner = RFile.newScanner().from(testFile2).withFileSystem(localFs).build();
- Assert.assertEquals(testData, toMap(scanner));
+ assertEquals(testData, toMap(scanner));
scanner.close();
}
@@ -519,9 +520,9 @@ public class RFileTest {
int r = rand.nextInt(10000);
scanner.setRange(new Range(rowStr(r)));
Iterator<Entry<Key,Value>> iter = scanner.iterator();
- Assert.assertTrue(iter.hasNext());
- Assert.assertEquals(rowStr(r), iter.next().getKey().getRow().toString());
- Assert.assertFalse(iter.hasNext());
+ assertTrue(iter.hasNext());
+ assertEquals(rowStr(r), iter.next().getKey().getRow().toString());
+ assertFalse(iter.hasNext());
}
scanner.close();
@@ -545,30 +546,30 @@ public class RFileTest {
// verify summary data
Collection<Summary> summaries = RFile.summaries().from(testFile).withFileSystem(localFs).read();
- Assert.assertEquals(2, summaries.size());
+ assertEquals(2, summaries.size());
for (Summary summary : summaries) {
- Assert.assertEquals(0, summary.getFileStatistics().getInaccurate());
- Assert.assertEquals(1, summary.getFileStatistics().getTotal());
+ assertEquals(0, summary.getFileStatistics().getInaccurate());
+ assertEquals(1, summary.getFileStatistics().getTotal());
String className = summary.getSummarizerConfiguration().getClassName();
CounterSummary counterSummary = new CounterSummary(summary);
if (className.equals(FamilySummarizer.class.getName())) {
Map<String,Long> counters = counterSummary.getCounters();
Map<String,Long> expected = ImmutableMap.of("0000", 200L, "0001", 200L, "0002", 200L,
"0003", 200L);
- Assert.assertEquals(expected, counters);
+ assertEquals(expected, counters);
} else if (className.equals(VisibilitySummarizer.class.getName())) {
Map<String,Long> counters = counterSummary.getCounters();
Map<String,Long> expected = ImmutableMap.of("A&B", 400L, "A&B&C", 400L);
- Assert.assertEquals(expected, counters);
+ assertEquals(expected, counters);
} else {
- Assert.fail("Unexpected classname " + className);
+ fail("Unexpected classname " + className);
}
}
// check if writing summary data impacted normal rfile functionality
Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs)
.withAuthorizations(new Authorizations("A", "B", "C")).build();
- Assert.assertEquals(testData1, toMap(scanner));
+ assertEquals(testData1, toMap(scanner));
scanner.close();
String testFile2 = createTmpTestFile();
@@ -580,23 +581,23 @@ public class RFileTest {
// verify reading summaries from multiple files works
summaries = RFile.summaries().from(testFile, testFile2).withFileSystem(localFs).read();
- Assert.assertEquals(2, summaries.size());
+ assertEquals(2, summaries.size());
for (Summary summary : summaries) {
- Assert.assertEquals(0, summary.getFileStatistics().getInaccurate());
- Assert.assertEquals(2, summary.getFileStatistics().getTotal());
+ assertEquals(0, summary.getFileStatistics().getInaccurate());
+ assertEquals(2, summary.getFileStatistics().getTotal());
String className = summary.getSummarizerConfiguration().getClassName();
CounterSummary counterSummary = new CounterSummary(summary);
if (className.equals(FamilySummarizer.class.getName())) {
Map<String,Long> counters = counterSummary.getCounters();
Map<String,Long> expected = ImmutableMap.of("0000", 400L, "0001", 400L, "0002", 400L,
"0003", 400L);
- Assert.assertEquals(expected, counters);
+ assertEquals(expected, counters);
} else if (className.equals(VisibilitySummarizer.class.getName())) {
Map<String,Long> counters = counterSummary.getCounters();
Map<String,Long> expected = ImmutableMap.of("A&B", 800L, "A&B&C", 800L);
- Assert.assertEquals(expected, counters);
+ assertEquals(expected, counters);
} else {
- Assert.fail("Unexpected classname " + className);
+ fail("Unexpected classname " + className);
}
}
@@ -671,19 +672,19 @@ public class RFileTest {
}
private void checkSummaries(Collection<Summary> summaries, Map<String,Long> expected, int extra) {
- Assert.assertEquals(1, summaries.size());
+ assertEquals(1, summaries.size());
for (Summary summary : summaries) {
- Assert.assertEquals(extra, summary.getFileStatistics().getInaccurate());
- Assert.assertEquals(extra, summary.getFileStatistics().getExtra());
- Assert.assertEquals(2, summary.getFileStatistics().getTotal());
+ assertEquals(extra, summary.getFileStatistics().getInaccurate());
+ assertEquals(extra, summary.getFileStatistics().getExtra());
+ assertEquals(2, summary.getFileStatistics().getTotal());
String className = summary.getSummarizerConfiguration().getClassName();
CounterSummary counterSummary = new CounterSummary(summary);
if (className.equals(VisibilitySummarizer.class.getName())) {
Map<String,Long> counters = counterSummary.getCounters();
- Assert.assertEquals(expected, counters);
+ assertEquals(expected, counters);
} else {
- Assert.fail("Unexpected classname " + className);
+ fail("Unexpected classname " + className);
}
}
}
@@ -837,7 +838,7 @@ public class RFileTest {
Scanner scanner = RFile.newScanner().from(files.toArray(new String[files.size()]))
.withFileSystem(localFs).withIndexCache(1000000).withDataCache(10000000).build();
- Assert.assertEquals(testData, toMap(scanner));
+ assertEquals(testData, toMap(scanner));
scanner.close();
}
}
diff --git a/minicluster/src/main/findbugs/exclude-filter.xml b/minicluster/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from minicluster/src/main/findbugs/exclude-filter.xml
rename to minicluster/src/main/spotbugs/exclude-filter.xml
diff --git a/pom.xml b/pom.xml
index 9f6f0ae..d980bb1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,7 +122,6 @@
<extraReleaseArguments />
<failsafe.excludedGroups />
<failsafe.groups />
- <findbugs.version>3.0.5</findbugs.version>
<!-- surefire/failsafe plugin option -->
<forkCount>1</forkCount>
<hadoop.version>3.0.2</hadoop.version>
@@ -793,9 +792,9 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>${findbugs.version}</version>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ <version>3.1.3</version>
<configuration>
<xmlOutput>true</xmlOutput>
<effort>Max</effort>
@@ -1322,11 +1321,11 @@
</executions>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
<executions>
<execution>
- <id>run-findbugs</id>
+ <id>run-spotbugs</id>
<goals>
<goal>check</goal>
</goals>
@@ -1385,7 +1384,6 @@
<apilyzer.skip>true</apilyzer.skip>
<checkstyle.skip>true</checkstyle.skip>
<enforcer.skip>true</enforcer.skip>
- <findbugs.skip>true</findbugs.skip>
<formatter.skip>true</formatter.skip>
<impsort.skip>true</impsort.skip>
<maven.plugin.skip>true</maven.plugin.skip>
@@ -1395,6 +1393,7 @@
<skipITs>true</skipITs>
<skipTests>true</skipTests>
<sort.skip>true</sort.skip>
+ <spotbugs.skip>true</spotbugs.skip>
<warbucks.skip>true</warbucks.skip>
</properties>
</profile>
@@ -1588,9 +1587,9 @@
<properties>
<!-- some properties to make the release build a bit faster -->
<checkstyle.skip>true</checkstyle.skip>
- <findbugs.skip>true</findbugs.skip>
<skipITs>true</skipITs>
<skipTests>true</skipTests>
+ <spotbugs.skip>true</spotbugs.skip>
</properties>
</profile>
<profile>
@@ -1697,14 +1696,14 @@
</build>
</profile>
<profile>
- <id>add-findbugs-excludes</id>
+ <id>add-spotbugs-excludes</id>
<activation>
<file>
- <exists>src/main/findbugs/exclude-filter.xml</exists>
+ <exists>src/main/spotbugs/exclude-filter.xml</exists>
</file>
</activation>
<properties>
- <findbugs.excludeFilterFile>src/main/findbugs/exclude-filter.xml</findbugs.excludeFilterFile>
+ <spotbugs.excludeFilterFile>src/main/spotbugs/exclude-filter.xml</spotbugs.excludeFilterFile>
</properties>
</profile>
<profile>
diff --git a/proxy/src/main/findbugs/exclude-filter.xml b/proxy/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from proxy/src/main/findbugs/exclude-filter.xml
rename to proxy/src/main/spotbugs/exclude-filter.xml
diff --git a/server/base/src/main/findbugs/exclude-filter.xml b/server/base/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from server/base/src/main/findbugs/exclude-filter.xml
rename to server/base/src/main/spotbugs/exclude-filter.xml
diff --git a/server/gc/src/main/findbugs/exclude-filter.xml b/server/gc/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from server/gc/src/main/findbugs/exclude-filter.xml
rename to server/gc/src/main/spotbugs/exclude-filter.xml
diff --git a/server/master/src/main/findbugs/exclude-filter.xml b/server/master/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from server/master/src/main/findbugs/exclude-filter.xml
rename to server/master/src/main/spotbugs/exclude-filter.xml
diff --git a/server/tracer/src/main/findbugs/exclude-filter.xml b/server/tracer/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from server/tracer/src/main/findbugs/exclude-filter.xml
rename to server/tracer/src/main/spotbugs/exclude-filter.xml
diff --git a/server/tserver/src/main/findbugs/exclude-filter.xml b/server/tserver/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from server/tserver/src/main/findbugs/exclude-filter.xml
rename to server/tserver/src/main/spotbugs/exclude-filter.xml
diff --git a/shell/src/main/findbugs/exclude-filter.xml b/shell/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from shell/src/main/findbugs/exclude-filter.xml
rename to shell/src/main/spotbugs/exclude-filter.xml
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 dac4442..9b59e3c 100644
--- a/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java
@@ -98,7 +98,7 @@ public class InMemoryMapIT {
fail("Missing the native library from " + nativeMapLocation.getAbsolutePath()
+ "\nYou need to build the libaccumulo binary first. "
+ "\nTry running 'mvn clean verify -Dit.test=InMemoryMapIT -Dtest=foo"
- + " -DfailIfNoTests=false -Dfindbugs.skip -Dcheckstyle.skip'");
+ + " -DfailIfNoTests=false -Dspotbugs.skip -Dcheckstyle.skip'");
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
index 73bee7d..6ba505b 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
@@ -85,7 +85,6 @@ import org.apache.hadoop.io.Text;
import org.apache.hadoop.tools.DistCp;
import org.junit.After;
import org.junit.AfterClass;
-import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -855,14 +854,13 @@ public class ShellServerIT extends SharedMiniClusterBase {
Connector connector = getConnector();
for (Entry<String,String> entry : connector.tableOperations().getProperties(table)) {
if (entry.getKey().equals("table.custom.description"))
- Assert.assertEquals("Initial property was not set correctly", "description",
- entry.getValue());
+ assertEquals("Initial property was not set correctly", "description", entry.getValue());
if (entry.getKey().equals("table.custom.testProp"))
- Assert.assertEquals("Initial property was not set correctly", "testProp", entry.getValue());
+ assertEquals("Initial property was not set correctly", "testProp", entry.getValue());
if (entry.getKey().equals(Property.TABLE_SPLIT_THRESHOLD.getKey()))
- Assert.assertEquals("Initial property was not set correctly", "10K", entry.getValue());
+ assertEquals("Initial property was not set correctly", "10K", entry.getValue());
}
ts.exec("deletetable -f " + table);
@@ -1776,14 +1774,12 @@ public class ShellServerIT extends SharedMiniClusterBase {
}
@Test
- public void scansWithClassLoaderContext() throws Exception {
+ public void scansWithClassLoaderContext() throws IOException {
try {
Class.forName(VALUE_REVERSING_ITERATOR);
fail("ValueReversingIterator already on the classpath");
- } catch (Exception e) {
- // Do nothing here, This is success. The following line is here
- // so that findbugs doesn't have a stroke.
- assertTrue(true);
+ } catch (ClassNotFoundException e) {
+ // expected; iterator is already on the class path
}
ts.exec("createtable t");
// Assert that the TabletServer does not know anything about our class
@@ -1916,7 +1912,7 @@ public class ShellServerIT extends SharedMiniClusterBase {
private static final String COLUMN_FAMILY_COUNTER_ITERATOR = "org.apache.accumulo.core.iterators"
+ ".ColumnFamilyCounter";
- private void setupRealContextPath() throws Exception {
+ private void setupRealContextPath() throws IOException {
// Copy the test iterators jar to tmp
Path baseDir = new Path(System.getProperty("user.dir"));
Path targetDir = new Path(baseDir, "target");
@@ -1926,7 +1922,7 @@ public class ShellServerIT extends SharedMiniClusterBase {
fs.copyFromLocalFile(jarPath, dstPath);
}
- private void setupFakeContextPath() throws Exception {
+ private void setupFakeContextPath() throws IOException {
// Copy the test iterators jar to tmp
Path baseDir = new Path(System.getProperty("user.dir"));
Path targetDir = new Path(baseDir, "target");
@@ -2005,12 +2001,11 @@ public class ShellServerIT extends SharedMiniClusterBase {
}
private static void assertMatches(String output, String pattern) {
- Assert.assertTrue("Pattern " + pattern + " did not match output : " + output,
- output.matches(pattern));
+ assertTrue("Pattern " + pattern + " did not match output : " + output, output.matches(pattern));
}
private static void assertNotContains(String output, String subsequence) {
- Assert.assertFalse("Expected '" + subsequence + "' would not occur in output : " + output,
+ assertFalse("Expected '" + subsequence + "' would not occur in output : " + output,
output.contains(subsequence));
}
@@ -2140,8 +2135,8 @@ public class ShellServerIT extends SharedMiniClusterBase {
Map<String,Set<Text>> lMap = connector.tableOperations().getLocalityGroups(table);
Set<Text> expectedColFams = new HashSet<>(Arrays.asList(new Text("fam1"), new Text("fam2")));
for (Entry<String,Set<Text>> entry : lMap.entrySet()) {
- Assert.assertEquals("locg1", entry.getKey());
- Assert.assertTrue(entry.getValue().containsAll(expectedColFams));
+ assertEquals("locg1", entry.getKey());
+ assertTrue(entry.getValue().containsAll(expectedColFams));
}
ts.exec("deletetable -f " + table);
}
@@ -2157,12 +2152,12 @@ public class ShellServerIT extends SharedMiniClusterBase {
ts.exec("createtable " + table + " -l locg1=fam1,fam2 locg2=colfam1", true);
Connector connector = getConnector();
Map<String,Set<Text>> lMap = connector.tableOperations().getLocalityGroups(table);
- Assert.assertTrue(lMap.keySet().contains("locg1"));
- Assert.assertTrue(lMap.keySet().contains("locg2"));
+ assertTrue(lMap.keySet().contains("locg1"));
+ assertTrue(lMap.keySet().contains("locg2"));
Set<Text> expectedColFams1 = new HashSet<>(Arrays.asList(new Text("fam1"), new Text("fam2")));
Set<Text> expectedColFams2 = new HashSet<>(Arrays.asList(new Text("colfam1")));
- Assert.assertTrue(lMap.get("locg1").containsAll(expectedColFams1));
- Assert.assertTrue(lMap.get("locg2").containsAll(expectedColFams2));
+ assertTrue(lMap.get("locg1").containsAll(expectedColFams1));
+ assertTrue(lMap.get("locg2").containsAll(expectedColFams2));
ts.exec("deletetable -f " + table);
}
@@ -2192,12 +2187,12 @@ public class ShellServerIT extends SharedMiniClusterBase {
// the fact that setshelliter extends setiter, which does require a table argument.
ts.exec("createtable " + tmpTable, true);
String output = ts.exec("tables");
- Assert.assertTrue(output.contains(tmpTable));
+ assertTrue(output.contains(tmpTable));
ts.input.set("\n5000\n\n");
ts.exec("setshelliter -n itname -p 10 -pn profile1 -ageoff", true);
output = ts.exec("listshelliter");
- Assert.assertTrue(output.contains("Profile : profile1"));
+ assertTrue(output.contains("Profile : profile1"));
// create table making use of the iterator profile
ts.exec("createtable " + table + " -i profile1:scan,minc", true);
@@ -2225,17 +2220,17 @@ public class ShellServerIT extends SharedMiniClusterBase {
// the fact that setshelliter extends setiter, which does require a table argument.
ts.exec("createtable " + tmpTable, true);
String output = ts.exec("tables");
- Assert.assertTrue(output.contains(tmpTable));
+ assertTrue(output.contains(tmpTable));
ts.input.set("\n5000\n\n");
ts.exec("setshelliter -n itname -p 10 -pn profile1 -ageoff", true);
output = ts.exec("listshelliter");
- Assert.assertTrue(output.contains("Profile : profile1"));
+ assertTrue(output.contains("Profile : profile1"));
ts.input.set("2\n");
ts.exec("setshelliter -n iter2 -p 11 -pn profile2 -vers", true);
output = ts.exec("listshelliter");
- Assert.assertTrue(output.contains("Profile : profile2"));
+ assertTrue(output.contains("Profile : profile2"));
// create table making use of the iterator profiles
ts.exec("createtable " + table + " -i profile1:scan,minc profile2:all ", true);
@@ -2244,12 +2239,12 @@ public class ShellServerIT extends SharedMiniClusterBase {
ts.exec("sleep 6", true);
ts.exec("scan", true, "", true);
output = ts.exec("listiter -t " + table + " -all");
- Assert.assertTrue(output.contains("Iterator itname, scan scope options"));
- Assert.assertTrue(output.contains("Iterator itname, minc scope options"));
- Assert.assertFalse(output.contains("Iterator itname, majc scope options"));
- Assert.assertTrue(output.contains("Iterator iter2, scan scope options"));
- Assert.assertTrue(output.contains("Iterator iter2, minc scope options"));
- Assert.assertTrue(output.contains("Iterator iter2, majc scope options"));
+ assertTrue(output.contains("Iterator itname, scan scope options"));
+ assertTrue(output.contains("Iterator itname, minc scope options"));
+ assertFalse(output.contains("Iterator itname, majc scope options"));
+ assertTrue(output.contains("Iterator iter2, scan scope options"));
+ assertTrue(output.contains("Iterator iter2, minc scope options"));
+ assertTrue(output.contains("Iterator iter2, majc scope options"));
ts.exec("deletetable -f " + table);
ts.exec("deletetable -f " + tmpTable);
}
@@ -2260,11 +2255,11 @@ public class ShellServerIT extends SharedMiniClusterBase {
final String table = name.getMethodName();
ts.exec("createtable " + tmpTable, true);
String output = ts.exec("tables");
- Assert.assertTrue(output.contains(tmpTable));
+ assertTrue(output.contains(tmpTable));
ts.input.set("\n5000\n\n");
ts.exec("setshelliter -n itname -p 10 -pn profile1 -ageoff", true);
output = ts.exec("listshelliter");
- Assert.assertTrue(output.contains("Profile : profile1"));
+ assertTrue(output.contains("Profile : profile1"));
// test various bad argument calls
ts.exec("createtable " + table + " -i noprofile:scan,minc", false);
ts.exec("createtable " + table + " -i profile1:scan,minc,all,majc", false);
diff --git a/test/src/main/findbugs/exclude-filter.xml b/test/src/main/spotbugs/exclude-filter.xml
similarity index 100%
rename from test/src/main/findbugs/exclude-filter.xml
rename to test/src/main/spotbugs/exclude-filter.xml