You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2016/02/21 16:41:05 UTC

lucene-solr git commit: Prevent warning on empty try-with-resources

Repository: lucene-solr
Updated Branches:
  refs/heads/master 5c024e6af -> 3d34728c4


Prevent warning on empty try-with-resources


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/3d34728c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/3d34728c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/3d34728c

Branch: refs/heads/master
Commit: 3d34728c4bc0936bec0411af98e08f53317d0061
Parents: 5c024e6
Author: Uwe Schindler <us...@apache.org>
Authored: Sun Feb 21 16:39:13 2016 +0100
Committer: Uwe Schindler <us...@apache.org>
Committed: Sun Feb 21 16:40:32 2016 +0100

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/store/BaseDirectoryTestCase.java  | 3 +++
 .../src/java/org/apache/lucene/store/MockDirectoryWrapper.java   | 4 +---
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3d34728c/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
index 5f66074..44c03ea 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
@@ -1213,6 +1213,7 @@ public abstract class BaseDirectoryTestCase extends LuceneTestCase {
           continue;
         }
         try (IndexOutput out = dir.createOutput(candidate, IOContext.DEFAULT)) {
+          out.getFilePointer(); // just fake access to prevent compiler warning
         }
         fsDir.deleteFile(candidate);
         if (fsDir.checkPendingDeletions()) {
@@ -1246,12 +1247,14 @@ public abstract class BaseDirectoryTestCase extends LuceneTestCase {
 
       if (random().nextBoolean()) {
         try (IndexOutput out = fsDir.createOutput(fileName + "z", IOContext.DEFAULT)) {
+          out.getFilePointer(); // just fake access to prevent compiler warning
         }
         // Make sure we can rename onto the deleted file:
         fsDir.renameFile(fileName + "z", fileName);
       } else {
         // write the file again
         try (IndexOutput out = dir.createOutput(fileName, IOContext.DEFAULT)) {
+          out.getFilePointer(); // just fake access to prevent compiler warning
         }
       }
       assertEquals(0, fsDir.fileLength(fileName));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3d34728c/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java b/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
index ef4397f..962062e 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
@@ -19,7 +19,6 @@ package org.apache.lucene.store;
 import java.io.Closeable;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.nio.file.FileSystem;
 import java.nio.file.NoSuchFileException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -46,8 +45,6 @@ import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.NoDeletionPolicy;
 import org.apache.lucene.index.SegmentInfos;
-import org.apache.lucene.mockfile.FilterFileSystem;
-import org.apache.lucene.mockfile.VirusCheckingFS;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
@@ -423,6 +420,7 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
         deleteFile(name);
 
         try (IndexOutput out = in.createOutput(name, LuceneTestCase.newIOContext(randomState))) {
+          out.getFilePointer(); // just fake access to prevent compiler warning
         } catch (IOException ioe) {
           // ignore
         }