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 19:04:46 UTC

[solr] branch branch_9x 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 branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


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

commit 2a39d7d4dbad9e2fa6d012f452117c0954dabc58
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 ad10963d61f..33f8170fbdd 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -4,6 +4,14 @@ This file lists Solr's raw release notes with details of every change to Solr.
 Most people will find the solr-upgrade-notes.adoc file more approachable.
 https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/upgrade-notes/pages/solr-upgrade-notes.adoc
 
+==================  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);
   }