You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2017/12/15 15:37:05 UTC

[GitHub] ctubbsii commented on a change in pull request #341: ACCUMULO-3902 Ensure [Batch]Scanners are closed in ITs

ctubbsii commented on a change in pull request #341: ACCUMULO-3902 Ensure [Batch]Scanners are closed in ITs
URL: https://github.com/apache/accumulo/pull/341#discussion_r157229274
 
 

 ##########
 File path: test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
 ##########
 @@ -428,6 +428,7 @@ public void testDeniedAudits() throws AccumuloSecurityException, AccumuloExcepti
     try {
       Scanner scanner = auditConnector.createScanner(OLD_TEST_TABLE_NAME, auths);
       scanner.iterator().next().getKey();
+      scanner.close();
 
 Review comment:
   I think that in many cases like this, the following try-with-resources syntax is preferred:
   
   ```java
   try (Scanner scanner = auditConnector.createScanner(OLD_TEST_TABLE_NAME, auths)) {
     scanner.iterator().next().getKey();
   }
   ```
   
   This is a simpler syntax that doesn't require an explicit call to the AutoCloseable's close method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services