You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/11/08 20:55:54 UTC

svn commit: r1199415 - /lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultStoredFieldsWriter.java

Author: rmuir
Date: Tue Nov  8 19:55:53 2011
New Revision: 1199415

URL: http://svn.apache.org/viewvc?rev=1199415&view=rev
Log:
LUCENE-2621: remove dead code

Modified:
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultStoredFieldsWriter.java

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultStoredFieldsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultStoredFieldsWriter.java?rev=1199415&r1=1199414&r2=1199415&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultStoredFieldsWriter.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultStoredFieldsWriter.java Tue Nov  8 19:55:53 2011
@@ -72,13 +72,13 @@ public final class DefaultStoredFieldsWr
   /** Extension of stored fields index file */
   public static final String FIELDS_INDEX_EXTENSION = "fdx";
 
-  // If null - we were supplied with streams, if notnull - we manage them ourselves
   private Directory directory;
   private String segment;
   private IndexOutput fieldsStream;
   private IndexOutput indexStream;
 
   public DefaultStoredFieldsWriter(Directory directory, String segment, IOContext context) throws IOException {
+    assert directory != null;
     this.directory = directory;
     this.segment = segment;
 
@@ -98,10 +98,6 @@ public final class DefaultStoredFieldsWr
     }
   }
 
-  void setFieldsStream(IndexOutput stream) {
-    this.fieldsStream = stream;
-  }
-
   // Writes the contents of buffer into the fields stream
   // and adds a new entry for this document into the index
   // stream.  This assumes the buffer was already written
@@ -112,29 +108,25 @@ public final class DefaultStoredFieldsWr
   }
 
   public void close() throws IOException {
-    if (directory != null) {
-      try {
-        IOUtils.close(fieldsStream, indexStream);
-      } finally {
-        fieldsStream = indexStream = null;
-      }
+    try {
+      IOUtils.close(fieldsStream, indexStream);
+    } finally {
+      fieldsStream = indexStream = null;
     }
   }
 
   public void abort() {
-    if (directory != null) {
-      try {
-        close();
-      } catch (IOException ignored) {
-      }
-      try {
-        directory.deleteFile(IndexFileNames.segmentFileName(segment, "", FIELDS_EXTENSION));
-      } catch (IOException ignored) {
-      }
-      try {
-        directory.deleteFile(IndexFileNames.segmentFileName(segment, "", FIELDS_INDEX_EXTENSION));
-      } catch (IOException ignored) {
-      }
+    try {
+      close();
+    } catch (IOException ignored) {
+    }
+    try {
+      directory.deleteFile(IndexFileNames.segmentFileName(segment, "", FIELDS_EXTENSION));
+    } catch (IOException ignored) {
+    }
+    try {
+      directory.deleteFile(IndexFileNames.segmentFileName(segment, "", FIELDS_INDEX_EXTENSION));
+    } catch (IOException ignored) {
     }
   }