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 2015/01/01 16:15:14 UTC

svn commit: r1648851 - in /lucene/dev/trunk: lucene/ lucene/core/src/java/org/apache/lucene/index/ lucene/core/src/java/org/apache/lucene/store/ lucene/core/src/test/org/apache/lucene/index/ lucene/core/src/test/org/apache/lucene/store/ lucene/replicat...

Author: rmuir
Date: Thu Jan  1 15:15:13 2015
New Revision: 1648851

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

Added:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestTrackingDirectoryWrapper.java   (with props)
Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/Directory.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java
    lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java
    lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapShooter.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Thu Jan  1 15:15:13 2015
@@ -329,6 +329,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/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java Thu Jan  1 15:15:13 2015
@@ -2634,7 +2634,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/trunk/lucene/core/src/java/org/apache/lucene/store/Directory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/Directory.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/Directory.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/Directory.java Thu Jan  1 15:15:13 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/trunk/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/RAMDirectory.java Thu Jan  1 15:15:13 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/trunk/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/RateLimitedDirectoryWrapper.java Thu Jan  1 15:15:13 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/trunk/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/TrackingDirectoryWrapper.java Thu Jan  1 15:15:13 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/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java Thu Jan  1 15:15:13 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/trunk/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java Thu Jan  1 15:15:13 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) {

Added: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestTrackingDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestTrackingDirectoryWrapper.java?rev=1648851&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestTrackingDirectoryWrapper.java (added)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestTrackingDirectoryWrapper.java Thu Jan  1 15:15:13 2015
@@ -0,0 +1,67 @@
+package org.apache.lucene.store;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Collections;
+
+public class TestTrackingDirectoryWrapper extends BaseDirectoryTestCase {
+
+  @Override
+  protected Directory getDirectory(Path path) throws IOException {
+    return new TrackingDirectoryWrapper(new RAMDirectory());
+  }
+  
+  public void testTrackEmpty() throws IOException {
+    TrackingDirectoryWrapper dir = new TrackingDirectoryWrapper(new RAMDirectory());
+    assertEquals(Collections.emptySet(), dir.getCreatedFiles());
+  }
+
+  public void testTrackCreate() throws IOException {
+    TrackingDirectoryWrapper dir = new TrackingDirectoryWrapper(new RAMDirectory());
+    dir.createOutput("foo", newIOContext(random())).close();
+    assertEquals(asSet("foo"), dir.getCreatedFiles());
+  }
+  
+  public void testTrackDelete() throws IOException {
+    TrackingDirectoryWrapper dir = new TrackingDirectoryWrapper(new RAMDirectory());
+    dir.createOutput("foo", newIOContext(random())).close();
+    assertEquals(asSet("foo"), dir.getCreatedFiles());
+    dir.deleteFile("foo");
+    assertEquals(Collections.emptySet(), dir.getCreatedFiles());
+  }
+  
+  public void testTrackRename() throws IOException {
+    TrackingDirectoryWrapper dir = new TrackingDirectoryWrapper(new RAMDirectory());
+    dir.createOutput("foo", newIOContext(random())).close();
+    assertEquals(asSet("foo"), dir.getCreatedFiles());
+    dir.renameFile("foo", "bar");
+    assertEquals(asSet("bar"), dir.getCreatedFiles());
+  }
+  
+  public void testTrackCopyFrom() throws IOException {
+    TrackingDirectoryWrapper source = new TrackingDirectoryWrapper(new RAMDirectory());
+    TrackingDirectoryWrapper dest = new TrackingDirectoryWrapper(new RAMDirectory());
+    source.createOutput("foo", newIOContext(random())).close();
+    assertEquals(asSet("foo"), source.getCreatedFiles());
+    dest.copyFrom(source, "foo", "bar", newIOContext(random()));
+    assertEquals(asSet("bar"), dest.getCreatedFiles());
+    assertEquals(asSet("foo"), source.getCreatedFiles());
+  }
+}

Modified: lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java (original)
+++ lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexAndTaxonomyReplicationHandler.java Thu Jan  1 15:15:13 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/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java (original)
+++ lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/IndexReplicationHandler.java Thu Jan  1 15:15:13 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/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java Thu Jan  1 15:15:13 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/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java Thu Jan  1 15:15:13 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/trunk/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java Thu Jan  1 15:15:13 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/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Thu Jan  1 15:15:13 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/trunk/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java Thu Jan  1 15:15:13 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/trunk/solr/core/src/java/org/apache/solr/handler/SnapShooter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapShooter.java?rev=1648851&r1=1648850&r2=1648851&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapShooter.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapShooter.java Thu Jan  1 15:15:13 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);
       }
     }
   }