Fix ant eclipse-warnings in 3.0

Patch by Sam Tunnicliffe; reviewed by Tyler Hobbs for CASSANDRA-12528


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0fd07e83
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0fd07e83
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0fd07e83

Branch: refs/heads/cassandra-3.9
Commit: 0fd07e832be6e9c97ca968977ba2abdf9d5cd809
Parents: 4dbc4f5
Author: Sam Tunnicliffe <s...@beobal.com>
Authored: Wed Aug 24 13:32:30 2016 +0100
Committer: Sam Tunnicliffe <s...@beobal.com>
Committed: Fri Aug 26 10:48:42 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/TimeWindowCompactionStrategy.java      |  3 +++
 src/java/org/apache/cassandra/tools/SSTableExport.java   | 11 +++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0fd07e83/src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategy.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategy.java 
b/src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategy.java
index e2ab7dc..1aae633 100644
--- 
a/src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategy.java
+++ 
b/src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategy.java
@@ -71,6 +71,7 @@ public class TimeWindowCompactionStrategy extends 
AbstractCompactionStrategy
     }
 
     @Override
+    @SuppressWarnings("resource") // transaction is closed by 
AbstractCompactionTask::execute
     public AbstractCompactionTask getNextBackgroundTask(int gcBefore)
     {
         while (true)
@@ -323,6 +324,7 @@ public class TimeWindowCompactionStrategy extends 
AbstractCompactionStrategy
     }
 
     @Override
+    @SuppressWarnings("resource") // transaction is closed by 
AbstractCompactionTask::execute
     public synchronized Collection<AbstractCompactionTask> getMaximalTask(int 
gcBefore, boolean splitOutput)
     {
         Iterable<SSTableReader> filteredSSTables = 
filterSuspectSSTables(sstables);
@@ -335,6 +337,7 @@ public class TimeWindowCompactionStrategy extends 
AbstractCompactionStrategy
     }
 
     @Override
+    @SuppressWarnings("resource") // transaction is closed by 
AbstractCompactionTask::execute
     public synchronized AbstractCompactionTask 
getUserDefinedTask(Collection<SSTableReader> sstables, int gcBefore)
     {
         assert !sstables.isEmpty(); // checked for by CM.submitUserDefined

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0fd07e83/src/java/org/apache/cassandra/tools/SSTableExport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableExport.java 
b/src/java/org/apache/cassandra/tools/SSTableExport.java
index cc6b84b..cff1516 100644
--- a/src/java/org/apache/cassandra/tools/SSTableExport.java
+++ b/src/java/org/apache/cassandra/tools/SSTableExport.java
@@ -180,10 +180,13 @@ public class SSTableExport
             CFMetaData metadata = metadataFromSSTable(desc);
             if (cmd.hasOption(ENUMERATE_KEYS_OPTION))
             {
-                JsonTransformer.keysToJson(null, iterToStream(new 
KeyIterator(desc, metadata)),
-                                                              
cmd.hasOption(RAW_TIMESTAMPS),
-                                                              metadata,
-                                                              System.out);
+                try (KeyIterator iter = new KeyIterator(desc, metadata))
+                {
+                    JsonTransformer.keysToJson(null, iterToStream(iter),
+                                               cmd.hasOption(RAW_TIMESTAMPS),
+                                               metadata,
+                                               System.out);
+                }
             }
             else
             {

Reply via email to