Closed MuazmaZ closed 3 years ago
@MuazmaZ This looks like a bug to me. Thank you for the details and taking the extra steps to debug. I'll work on establishing a repro and then once I confirm the behavior I'll work on a fix
@rickle-msft the member who reported the issue to me has a PR for the issue: https://github.com/Azure/azure-sdk-for-java/pull/19498. Please take a look.
Thank you for the heads up. I will take a look
Describe the bug Trying to upload the content in a temporary file first then renaming the file for ADLS java SDK During the testing, the files being in the root failed renaming with status code 400 InvalidSourceUri error. When a folder is used everything works fine.
Exception or Stack Trace Add the exception log and stack trace if available
To Reproduce These are the steps can reproduce the problem without going into details until you ask me to:
Debugging the code in the DataLakePathClient.class in renameWithResponse method there is the following line (line 168 for me): String renameSource = "/" + this.dataLakePathAsynchClient.getFileSystemName() + "/" + Utility.urlEncode(this.dataLakePathAsynchClient.getObjectPath());
this.dataLakePathAsynchClient.getObjectPath() returns the path starting with a slash, so if the file is in the root directory the string will be "/testfilesystem/%2Ftemp_testfile" having double slashes. Setting the value in the debugger to "/testfilesystem/temp_testfile'' with one slash the rename finishing successfully.
If the file is not in the root directory it is working correctly as this.dataLakePathAsynchClient.getObjectPath() returns the path without the slash.
Having a slash trimming here would remediate this so I would like to check whether there is a configuration/code I should use if I work with the root directory? Is it an incorrect behavior?
Expected behavior Files in the root should be renamed
Screenshots N/A
Setup (please complete the following information):
Additional context This is for extension created on Apache NiFi ADLS processor: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-azure-nar/1.12.1/org.apache.nifi.processors.azure.storage.PutAzureDataLakeStorage/index.html
Information Checklist Kindly make sure that you have added all the following information above and check off the required fields otherwise we will treat the issuer as an incomplete report