This is an automated email from the ASF dual-hosted git repository. reschke pushed a commit to branch OAK-11445 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 93d0274dd5a179c201de20a9294641218990e480 Author: Julian Reschke <[email protected]> AuthorDate: Thu Jan 30 17:11:33 2025 +0100 OAK-11445: Remove usage of Guava Files.toString() - oak-core --- .../oak/plugins/index/datastore/DataStoreTextWriter.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/datastore/DataStoreTextWriter.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/datastore/DataStoreTextWriter.java index 7e413b08ab..d497275a0a 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/datastore/DataStoreTextWriter.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/datastore/DataStoreTextWriter.java @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.apache.jackrabbit.oak.plugins.index.datastore; import java.io.BufferedWriter; @@ -26,11 +25,11 @@ import java.io.FileWriter; import java.io.IOException; import java.lang.ref.SoftReference; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.HashSet; import java.util.Set; import java.util.concurrent.Callable; -import org.apache.jackrabbit.guava.common.io.Files; import org.apache.commons.io.FileUtils; import org.apache.jackrabbit.oak.api.Blob; import org.apache.jackrabbit.oak.commons.conditions.Validate; @@ -110,7 +109,7 @@ public class DataStoreTextWriter implements TextWriter, Closeable, PreExtractedT } else { File textFile = getFile(blobId); if (textFile.exists()) { - String text = Files.toString(textFile, StandardCharsets.UTF_8); + String text = new String(Files.readAllBytes(textFile.toPath()), StandardCharsets.UTF_8); result = new ExtractedText(ExtractionResult.SUCCESS, text); } } @@ -131,7 +130,7 @@ public class DataStoreTextWriter implements TextWriter, Closeable, PreExtractedT File textFile = getFile(stripLength(blobId)); ensureParentExists(textFile); //TODO should we compress - Files.write(text, textFile, StandardCharsets.UTF_8); + org.apache.jackrabbit.guava.common.io.Files.write(text, textFile, StandardCharsets.UTF_8); } @Override @@ -233,7 +232,7 @@ public class DataStoreTextWriter implements TextWriter, Closeable, PreExtractedT private Set<String> loadFromFile(File file) throws IOException { Set<String> result = new HashSet<>(); if (file.exists()) { - result.addAll(Files.readLines(file, StandardCharsets.UTF_8)); + result.addAll(org.apache.jackrabbit.guava.common.io.Files.readLines(file, StandardCharsets.UTF_8)); } return result; }
