lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1648854 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/ lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/ lucene/core/ lucene/core/src/java/org/apache/luce...
Date Thu, 01 Jan 2015 15:29:33 GMT
Author: rmuir
Date: Thu Jan  1 15:29:32 2015
New Revision: 1648854

URL: http://svn.apache.org/r1648854
Log:
LUCENE-6146: Replaced Directory.copy() with Directory.copyFrom()

Added:
    lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/store/TestTrackingDirectoryWrapper.java
      - copied unchanged from r1648851, lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestTrackingDirectoryWrapper.java
Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java
    lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40CompoundFormat.java
    lucene/dev/branches/branch_5x/lucene/core/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/Directory.java
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java
    lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java
    lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java
    lucene/dev/branches/branch_5x/lucene/replicator/   (props changed)
    lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java
    lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java
    lucene/dev/branches/branch_5x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
    lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java
    lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
    lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/SnapShooter.java

Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Thu Jan  1 15:29:32 2015
@@ -300,6 +300,9 @@ API Changes
 * LUCENE-6150: Remove staleFiles set and onIndexOutputClosed() from FSDirectory.
   (Uwe Schindler, Robert Muir, Mike McCandless)
 
+* LUCENE-6146: Replaced Directory.copy() with Directory.copyFrom().
+  (Robert Muir)
+
 Bug Fixes
 
 * LUCENE-5650: Enforce read-only access to any path outside the temporary

Modified: lucene/dev/branches/branch_5x/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java
Thu Jan  1 15:29:32 2015
@@ -49,7 +49,7 @@ public final class Lucene40CompoundForma
     String fileName = IndexFileNames.segmentFileName(si.name, "", COMPOUND_FILE_EXTENSION);
     try (Directory cfs = new Lucene40CompoundReader(dir, fileName, context, true)) {
       for (String file : files) {
-        dir.copy(cfs, file, file, context);
+        cfs.copyFrom(dir, file, file, context);
         checkAbort.work(dir.fileLength(file));
       }
     }

Modified: lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40CompoundFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40CompoundFormat.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40CompoundFormat.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40CompoundFormat.java
Thu Jan  1 15:29:32 2015
@@ -69,8 +69,8 @@ public class TestLucene40CompoundFormat
     out.close();
     out1.close();
     nested.close();
-    newDir.copy(csw, "b.cfs", "b.cfs", newIOContext(random()));
-    newDir.copy(csw, "b.cfe", "b.cfe", newIOContext(random()));
+    csw.copyFrom(newDir, "b.cfs", "b.cfs", newIOContext(random()));
+    csw.copyFrom(newDir, "b.cfe", "b.cfe", newIOContext(random()));
     newDir.deleteFile("b.cfs");
     newDir.deleteFile("b.cfe");
     csw.close();
@@ -109,7 +109,7 @@ public class TestLucene40CompoundFormat
       assertEquals("d.cfs", listAll[0]);
     }
     createSequenceFile(dir, "d1", (byte) 0, 15);
-    dir.copy(csw, "d1", "d1", newIOContext(random()));
+    csw.copyFrom(dir, "d1", "d1", newIOContext(random()));
     String[] listAll = newDir.listAll();
     assertEquals(1, listAll.length);
     assertEquals("d.cfs", listAll[0]);

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
Thu Jan  1 15:29:32 2015
@@ -2639,7 +2639,7 @@ public class IndexWriter implements Clos
 
         assert !slowFileExists(directory, newFileName): "file \"" + newFileName + "\" already
exists; newInfo.files=" + newInfo.files();
 
-        info.info.dir.copy(directory, file, newFileName, context);
+        directory.copyFrom(info.info.dir, file, newFileName, context);
       }
       success = true;
     } finally {

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/Directory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/Directory.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/Directory.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/Directory.java
Thu Jan  1 15:29:32 2015
@@ -126,7 +126,7 @@ public abstract class Directory implemen
   }
 
   /**
-   * Copies the file <i>src</i> to {@link Directory} <i>to</i> under
the new
+   * Copies the file <i>src</i> in <i>from</i> to this directory
under the new
    * file name <i>dest</i>.
    * <p>
    * If you want to copy the entire source directory to the destination one, you
@@ -135,31 +135,22 @@ public abstract class Directory implemen
    * <pre class="prettyprint">
    * Directory to; // the directory to copy to
    * for (String file : dir.listAll()) {
-   *   dir.copy(to, file, newFile, IOContext.DEFAULT); // newFile can be either file, or
a new name
+   *   to.copyFrom(dir, file, newFile, IOContext.DEFAULT); // newFile can be either file,
or a new name
    * }
    * </pre>
    * <p>
    * <b>NOTE:</b> this method does not check whether <i>dest</i>
exist and will
    * overwrite it if it does.
    */
-  public void copy(Directory to, String src, String dest, IOContext context) throws IOException
{
-    IndexOutput os = null;
-    IndexInput is = null;
+  public void copyFrom(Directory from, String src, String dest, IOContext context) throws
IOException {
     boolean success = false;
-    try {
-      os = to.createOutput(dest, context);
-      is = openInput(src, context);
+    try (IndexInput is = from.openInput(src, context);
+         IndexOutput os = createOutput(dest, context)) {
       os.copyBytes(is, is.length());
       success = true;
     } finally {
-      if (success) {
-        IOUtils.close(os, is);
-      } else {
-        IOUtils.closeWhileHandlingException(os, is);
-        try {
-          to.deleteFile(dest);
-        } catch (Throwable t) {
-        }
+      if (!success) {
+        IOUtils.deleteFilesIgnoringExceptions(this, dest);
       }
     }
   }

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
Thu Jan  1 15:29:32 2015
@@ -94,7 +94,7 @@ public class RAMDirectory extends BaseDi
   private RAMDirectory(Directory dir, boolean closeDir, IOContext context) throws IOException
{
     this();
     for (String file : dir.listAll()) {
-      dir.copy(this, file, file, context);
+      copyFrom(dir, file, file, context);
     }
     if (closeDir) {
       dir.close();

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java
Thu Jan  1 15:29:32 2015
@@ -51,9 +51,9 @@ public final class RateLimitedDirectoryW
   }
 
   @Override
-  public void copy(Directory to, String src, String dest, IOContext context) throws IOException
{
+  public void copyFrom(Directory from, String src, String dest, IOContext context) throws
IOException {
     ensureOpen();
-    in.copy(to, src, dest, context);
+    in.copyFrom(from, src, dest, context);
   }
   
   private RateLimiter getRateLimiter(IOContext.Context context) {

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java
Thu Jan  1 15:29:32 2015
@@ -34,20 +34,30 @@ public final class TrackingDirectoryWrap
 
   @Override
   public void deleteFile(String name) throws IOException {
-    createdFileNames.remove(name);
     in.deleteFile(name);
+    createdFileNames.remove(name);
   }
 
   @Override
   public IndexOutput createOutput(String name, IOContext context) throws IOException {
+    IndexOutput output = in.createOutput(name, context);
     createdFileNames.add(name);
-    return in.createOutput(name, context);
+    return output;
   }
 
   @Override
-  public void copy(Directory to, String src, String dest, IOContext context) throws IOException
{
+  public void copyFrom(Directory from, String src, String dest, IOContext context) throws
IOException {
+    in.copyFrom(from, src, dest, context);
     createdFileNames.add(dest);
-    in.copy(to, src, dest, context);
+  }
+
+  @Override
+  public void renameFile(String source, String dest) throws IOException {
+    in.renameFile(source, dest);
+    synchronized (createdFileNames) {
+      createdFileNames.add(dest);
+      createdFileNames.remove(source);
+    }
   }
 
   // maybe clone before returning.... all callers are

Modified: lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java
Thu Jan  1 15:29:32 2015
@@ -135,7 +135,7 @@ public class TestIndexWriterOutOfFileDes
         dirCopy = newMockFSDirectory(createTempDir("TestIndexWriterOutOfFileDescriptors.copy"));
         Set<String> files = new HashSet<>();
         for (String file : dir.listAll()) {
-          dir.copy(dirCopy, file, file, IOContext.DEFAULT);
+          dirCopy.copyFrom(dir, file, file, IOContext.DEFAULT);
           files.add(file);
         }
         dirCopy.sync(files);

Modified: lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java
Thu Jan  1 15:29:32 2015
@@ -19,20 +19,25 @@ package org.apache.lucene.store;
 
 import java.io.IOException;
 import java.lang.reflect.Method;
+import java.nio.file.Path;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Test;
 
-public class TestFilterDirectory extends LuceneTestCase {
+public class TestFilterDirectory extends BaseDirectoryTestCase {
 
+  @Override
+  protected Directory getDirectory(Path path) throws IOException {
+    return new FilterDirectory(new RAMDirectory());
+  }
+  
   @Test
   public void testOverrides() throws Exception {
     // verify that all methods of Directory are overridden by FilterDirectory,
     // except those under the 'exclude' list
     Set<Method> exclude = new HashSet<>();
-    exclude.add(Directory.class.getMethod("copy", Directory.class, String.class, String.class,
IOContext.class));
+    exclude.add(Directory.class.getMethod("copyFrom", Directory.class, String.class, String.class,
IOContext.class));
     exclude.add(Directory.class.getMethod("openChecksumInput", String.class, IOContext.class));
     for (Method m : FilterDirectory.class.getMethods()) {
       if (m.getDeclaringClass() == Directory.class) {

Modified: lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java
Thu Jan  1 15:29:32 2015
@@ -132,9 +132,9 @@ public class IndexAndTaxonomyReplication
       // reader sees a more advanced taxonomy than the index.
       
       if (taxoSegmentsFile != null) {
-        taxoClientDir.copy(taxoDir, taxoSegmentsFile, taxoPendingFile, IOContext.READONCE);
+        taxoDir.copyFrom(taxoClientDir, taxoSegmentsFile, taxoPendingFile, IOContext.READONCE);
       }
-      indexClientDir.copy(indexDir, indexSegmentsFile, indexPendingFile, IOContext.READONCE);
+      indexDir.copyFrom(indexClientDir, indexSegmentsFile, indexPendingFile, IOContext.READONCE);
       
       if (taxoSegmentsFile != null) {
         taxoDir.sync(Collections.singletonList(taxoPendingFile));

Modified: lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java
Thu Jan  1 15:29:32 2015
@@ -173,7 +173,7 @@ public class IndexReplicationHandler imp
   public static void copyFiles(Directory source, Directory target, List<String> files)
throws IOException {
     if (!source.equals(target)) {
       for (String file : files) {
-        source.copy(target, file, file, IOContext.READONCE);
+        target.copyFrom(source, file, file, IOContext.READONCE);
       }
     }
   }
@@ -232,7 +232,7 @@ public class IndexReplicationHandler imp
       indexDir.sync(files);
       
       // now copy and fsync segmentsFile as pending, then rename (simulating lucene commit)
-      clientDir.copy(indexDir, segmentsFile, pendingSegmentsFile, IOContext.READONCE);
+      indexDir.copyFrom(clientDir, segmentsFile, pendingSegmentsFile, IOContext.READONCE);
       indexDir.sync(Collections.singletonList(pendingSegmentsFile));
       indexDir.renameFile(pendingSegmentsFile, segmentsFile);
       

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
Thu Jan  1 15:29:32 2015
@@ -46,7 +46,7 @@ public abstract class BaseDirectoryTestC
   
   // first some basic tests for the directory api
   
-  public void testCopy() throws Exception {
+  public void testCopyFrom() throws Exception {
     Directory source = getDirectory(createTempDir("testCopy"));
     Directory dest = newDirectory();
     
@@ -57,7 +57,7 @@ public abstract class BaseDirectoryTestC
     output.writeBytes(bytes, bytes.length);
     output.close();
     
-    source.copy(dest, "foobar", "foobaz", newIOContext(random()));
+    dest.copyFrom(source, "foobar", "foobaz", newIOContext(random()));
     assertTrue(slowFileExists(dest, "foobaz"));
     
     IndexInput input = dest.openInput("foobaz", newIOContext(random()));
@@ -71,7 +71,7 @@ public abstract class BaseDirectoryTestC
     IOUtils.close(source, dest);
   }
   
-  public void testCopyDestination() throws Exception {
+  public void testCopyFromDestination() throws Exception {
     Directory source = newDirectory();
     Directory dest = getDirectory(createTempDir("testCopyDestination"));
     
@@ -82,7 +82,7 @@ public abstract class BaseDirectoryTestC
     output.writeBytes(bytes, bytes.length);
     output.close();
     
-    source.copy(dest, "foobar", "foobaz", newIOContext(random()));
+    dest.copyFrom(source, "foobar", "foobaz", newIOContext(random()));
     assertTrue(slowFileExists(dest, "foobaz"));
     
     IndexInput input = dest.openInput("foobaz", newIOContext(random()));
@@ -141,7 +141,7 @@ public abstract class BaseDirectoryTestC
     output2.writeString("bogus!");
     output2.close();
     
-    source.copy(dest, "foobar", "foobaz", newIOContext(random()));
+    dest.copyFrom(source, "foobar", "foobaz", newIOContext(random()));
     assertTrue(slowFileExists(dest, "foobaz"));
     
     IndexInput input = dest.openInput("foobaz", newIOContext(random()));

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java
Thu Jan  1 15:29:32 2015
@@ -73,8 +73,9 @@ public class BaseDirectoryWrapper extend
     return crossCheckTermVectorsOnClose;
   }
 
+  // why does this class override this method?
   @Override
-  public void copy(Directory to, String src, String dest, IOContext context) throws IOException
{
-    in.copy(to, src, dest, context);
+  public void copyFrom(Directory from, String src, String dest, IOContext context) throws
IOException {
+    in.copyFrom(from, src, dest, context);
   }
 }

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
Thu Jan  1 15:29:32 2015
@@ -1048,11 +1048,13 @@ public class MockDirectoryWrapper extend
     }
   }
 
+  // TODO: why does this class override this method?
+  // we should use the default implementation so all of our checks work?
   @Override
-  public synchronized void copy(Directory to, String src, String dest, IOContext context)
throws IOException {
+  public synchronized void copyFrom(Directory from, String src, String dest, IOContext context)
throws IOException {
     maybeYield();
     // randomize the IOContext here?
-    in.copy(to, src, dest, context);
+    in.copyFrom(from, src, dest, context);
   }
   
   /** Use this when throwing fake {@code IOException},

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Thu Jan  1 15:29:32 2015
@@ -1337,7 +1337,7 @@ public abstract class LuceneTestCase ext
   public static BaseDirectoryWrapper newDirectory(Random r, Directory d) throws IOException
{
     Directory impl = newDirectoryImpl(r, TEST_DIRECTORY);
     for (String file : d.listAll()) {
-     d.copy(impl, file, file, newIOContext(r));
+     impl.copyFrom(d, file, file, newIOContext(r));
     }
     return wrapDirectory(r, impl, rarely(r));
   }

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
Thu Jan  1 15:29:32 2015
@@ -142,7 +142,7 @@ public abstract class DirectoryFactory i
    * @throws IOException If there is a low-level I/O error.
    */
   public void move(Directory fromDir, Directory toDir, String fileName, IOContext ioContext)
throws IOException {
-    fromDir.copy(toDir, fileName, fileName, ioContext);
+    toDir.copyFrom(fromDir, fileName, fileName, ioContext);
     fromDir.deleteFile(fileName);
   }
   

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/SnapShooter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/SnapShooter.java?rev=1648854&r1=1648853&r2=1648854&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/SnapShooter.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/SnapShooter.java
Thu Jan  1 15:29:32 2015
@@ -226,7 +226,7 @@ public class SnapShooter {
   private static void copyFiles(Directory sourceDir, Collection<String> files, File
destDir) throws IOException {
     try (FSDirectory dir = new SimpleFSDirectory(destDir.toPath(), NoLockFactory.INSTANCE))
{
       for (String indexFile : files) {
-        sourceDir.copy(dir, indexFile, indexFile, DirectoryFactory.IOCONTEXT_NO_CACHE);
+        dir.copyFrom(sourceDir, indexFile, indexFile, DirectoryFactory.IOCONTEXT_NO_CACHE);
       }
     }
   }



Mime
View raw message