This is an automated email from the ASF dual-hosted git repository. reschke pushed a commit to branch OAK-11462 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit bd9bf7ce7ca39b74ebfcbfa47ce8f362fe66c6b4 Author: Julian Reschke <[email protected]> AuthorDate: Thu Feb 6 14:34:21 2025 +0100 OAK-11462: Remove usage of Guava Files.write() - oak-core --- .../oak/plugins/index/datastore/DataStoreTextWriter.java | 2 +- .../oak/plugins/index/importer/IndexImporterTest.java | 11 +++++------ 2 files changed, 6 insertions(+), 7 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 38394983c6..b9ea2643a6 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 @@ -131,7 +131,7 @@ public class DataStoreTextWriter implements TextWriter, Closeable, PreExtractedT File textFile = getFile(stripLength(blobId)); ensureParentExists(textFile); //TODO should we compress - org.apache.jackrabbit.guava.common.io.Files.write(text, textFile, StandardCharsets.UTF_8); + Files.writeString(textFile.toPath(), text); } @Override diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexImporterTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexImporterTest.java index 72d4166108..121c56e038 100644 --- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexImporterTest.java +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexImporterTest.java @@ -16,19 +16,18 @@ * specific language governing permissions and limitations * under the License. */ - package org.apache.jackrabbit.oak.plugins.index.importer; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; -import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; import java.text.MessageFormat; import java.util.Properties; import java.util.Set; -import org.apache.jackrabbit.guava.common.io.Files; import org.apache.felix.inventory.Format; import org.apache.jackrabbit.oak.api.CommitFailedException; import org.apache.jackrabbit.oak.api.Type; @@ -314,7 +313,7 @@ public class IndexImporterTest { info.save(); //Create index definitions json - Files.write(json, new File(indexFolder, INDEX_DEFINITIONS_JSON), StandardCharsets.UTF_8); + Files.writeString(indexFolder.toPath().resolve(INDEX_DEFINITIONS_JSON), json); createIndexFolder(indexFolder, "/oak:index/fooIndex"); @@ -554,11 +553,11 @@ public class IndexImporterTest { private void dumpIndexDefinitions(String... indexPaths) throws IOException { IndexDefinitionPrinter printer = new IndexDefinitionPrinter(store, () -> asList(indexPaths)); printer.setFilter("{\"properties\":[\"*\", \"-:childOrder\"],\"nodes\":[\"*\", \"-:index-definition\"]}"); - File file = new File(temporaryFolder.getRoot(), INDEX_DEFINITIONS_JSON); + Path file = temporaryFolder.getRoot().toPath().resolve(INDEX_DEFINITIONS_JSON); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); printer.print(pw, Format.JSON, false); - Files.write(sw.toString(), file, StandardCharsets.UTF_8); + Files.writeString(file, sw.toString()); } private String importDataIncrementalUpdateBeforeSetupMethod() throws IOException, CommitFailedException {
