You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by el...@apache.org on 2023/03/07 18:58:59 UTC

[solr] branch main updated: SOLR-16686: Fix 'bin/solr zk cp' to work with a bare destination filename.

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

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


The following commit(s) were added to refs/heads/main by this push:
     new bccf03690f5 SOLR-16686:  Fix 'bin/solr zk cp' to work with a bare destination filename.
bccf03690f5 is described below

commit bccf03690f5521839e27e3630fbdf4e64255e0c9
Author: Shawn Heisey <el...@apache.org>
AuthorDate: Tue Mar 7 11:56:57 2023 -0700

    SOLR-16686:  Fix 'bin/solr zk cp' to work with a bare destination filename.
---
 solr/CHANGES.txt                                                  | 8 ++++++++
 .../src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java | 5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index abde885dcee..d249b0ab014 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -34,6 +34,14 @@ Other Changes
   Previously, the modules would come transitively.
   (David Smiley)
 
+==================  9.3.0 ==================
+
+Bug Fixes
+---------------------
+
+* SOLR-16686: Using bin/solr to copy a file from ZK to local fails if the local filename does not have a path.
+  (Shawn Heisey)
+
 ==================  9.2.0 ==================
 
 New Features
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java
index 4b12cbea817..04cadcefbc3 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java
@@ -182,7 +182,10 @@ public class ZkMaintenanceUtils {
     }
     byte[] data = zkClient.getData(src, null, null, true);
     Path filename = Paths.get(dst);
-    Files.createDirectories(filename.getParent());
+    Path parentDir = filename.getParent();
+    if (parentDir != null) {
+      Files.createDirectories(filename.getParent());
+    }
     log.info("Writing file {}", filename);
     Files.write(filename, data);
   }