You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2025/01/23 09:08:14 UTC

(jackrabbit-oak) branch OAK-11420 created (now 595b334d2f)

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a change to branch OAK-11420
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


      at 595b334d2f OAK-11420: Remove usage of Guava Files.move()

This branch includes the following new commits:

     new 595b334d2f OAK-11420: Remove usage of Guava Files.move()

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(jackrabbit-oak) 01/01: OAK-11420: Remove usage of Guava Files.move()

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch OAK-11420
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 595b334d2f7054a60142a7eb35e24baa188a4431
Author: Julian Reschke <re...@apache.org>
AuthorDate: Thu Jan 23 10:07:47 2025 +0100

    OAK-11420: Remove usage of Guava Files.move()
---
 .../jackrabbit/oak/plugins/blob/datastore/BlobIdTracker.java   | 10 +++++-----
 .../java/org/apache/jackrabbit/oak/commons/FileIOUtils.java    |  8 +++++---
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTracker.java b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTracker.java
index 788b2d476c..67d50298ed 100644
--- a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTracker.java
+++ b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTracker.java
@@ -25,6 +25,8 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
@@ -35,7 +37,6 @@ import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Predicate;
 
 import org.apache.jackrabbit.guava.common.base.Stopwatch;
-import org.apache.jackrabbit.guava.common.io.Files;
 import org.apache.jackrabbit.core.data.DataRecord;
 import org.apache.jackrabbit.oak.commons.collections.ListUtils;
 import org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser;
@@ -49,7 +50,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
-import static org.apache.jackrabbit.guava.common.io.Files.move;
 import static java.io.File.createTempFile;
 import static java.lang.System.currentTimeMillis;
 import static java.util.Collections.emptyIterator;
@@ -449,7 +449,7 @@ public class BlobIdTracker implements Closeable, BlobTracker {
                     }
                 }
 
-                move(removed, delFile);
+                Files.move(removed.toPath(), delFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
                 LOG.trace("removed active delete records");
             } finally {
                 lock.unlock();
@@ -652,7 +652,7 @@ public class BlobIdTracker implements Closeable, BlobTracker {
                 }
 
                 File blobRecs = getBlobRecordsFile();
-                move(temp, blobRecs);
+                Files.move(temp.toPath(), blobRecs.toPath(), StandardCopyOption.REPLACE_EXISTING);
                 LOG.trace("removed records");
             } finally {
                 refLock.unlock();
@@ -736,7 +736,7 @@ public class BlobIdTracker implements Closeable, BlobTracker {
                     LOG.trace("Trying a copy file operation");
                     try {
                         if (renamed.createNewFile()) {
-                            Files.copy(processFile, renamed);
+                            org.apache.jackrabbit.guava.common.io.Files.copy(processFile, renamed);
                             generations.add(renamed);
                             LOG.info("{} File copied to {}", processFile.getAbsolutePath(),
                                 renamed.getAbsolutePath());
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java
index 77eae193de..32ad1c0cbd 100644
--- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java
+++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java
@@ -21,7 +21,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.commons.io.FileUtils.forceDelete;
 import static org.apache.commons.io.IOUtils.copyLarge;
 import static org.apache.jackrabbit.guava.common.io.Closeables.close;
-import static org.apache.jackrabbit.guava.common.io.Files.move;
 import static org.apache.jackrabbit.oak.commons.sort.EscapeUtils.escapeLineBreak;
 import static org.apache.jackrabbit.oak.commons.sort.EscapeUtils.unescapeLineBreaks;
 import static org.apache.jackrabbit.oak.commons.sort.ExternalSort.mergeSortedFiles;
@@ -38,6 +37,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
 import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -73,7 +74,7 @@ public final class FileIOUtils {
     public static void sort(File file) throws IOException {
         File sorted = createTempFile("fleioutilssort", null);
         merge(sortInBatch(file, lexComparator, true), sorted);
-        move(sorted, file);
+        Files.move(sorted.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
     }
 
     /**
@@ -86,7 +87,8 @@ public final class FileIOUtils {
     public static void sort(File file, Comparator<String> comparator) throws IOException {
         File sorted = createTempFile("fleioutilssort", null);
         merge(sortInBatch(file, comparator, true), sorted, comparator);
-        move(sorted, file);
+        System.err.println("XXX: " + sorted + " " + file);
+        Files.move(sorted.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
     }
 
     /**