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

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 8ffe4cbecb Avoid two Path types in MiniAccumuloConfigImpl
8ffe4cbecb is described below

commit 8ffe4cbecbdbb46158e276e2ddf32aa7c6fbdd3c
Author: Christopher Tubbs <[email protected]>
AuthorDate: Tue Sep 23 21:47:48 2025 -0400

    Avoid two Path types in MiniAccumuloConfigImpl
    
    Recent commits changed the way Paths/Files/URLs/URIs were converted in
    MiniAccumuloConfigImpl. This changes it back to the previous way of
    doing things in the main branch that avoids the confusing use of both
    org.apache.hadoop.fs.Path and java.nio.file.Path in the same file, in
    order to avoid rolling back the improvements done in #5547.
    
    Instead of using both Path types, this version adds a resource as a URL
    instead of as a Hadoop Path type to the Configuration.
---
 .../accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java  | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java
 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java
index 1a7a64ff4a..620d4883b8 100644
--- 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java
+++ 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java
@@ -28,6 +28,8 @@ import static 
org.apache.accumulo.minicluster.ServerType.ZOOKEEPER;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.MalformedURLException;
 import java.nio.file.Path;
 import java.util.EnumMap;
 import java.util.HashMap;
@@ -261,10 +263,15 @@ public class MiniAccumuloConfigImpl {
   Configuration buildHadoopConfiguration() {
     Configuration conf = new Configuration(false);
     if (hadoopConfDir != null) {
-      File coreSite = hadoopConfDir.toPath().resolve("core-site.xml").toFile();
-      File hdfsSite = hadoopConfDir.toPath().resolve("hdfs-site.xml").toFile();
-      conf.addResource(new org.apache.hadoop.fs.Path(coreSite.toURI()));
-      conf.addResource(new org.apache.hadoop.fs.Path(hdfsSite.toURI()));
+      Path coreSite = hadoopConfDir.toPath().resolve("core-site.xml");
+      Path hdfsSite = hadoopConfDir.toPath().resolve("hdfs-site.xml");
+
+      try {
+        conf.addResource(coreSite.toUri().toURL());
+        conf.addResource(hdfsSite.toUri().toURL());
+      } catch (MalformedURLException e) {
+        throw new UncheckedIOException(e);
+      }
     }
     return conf;
   }

Reply via email to