Skip to content

Commit 334f401

Browse files
t-rufangwezhang
authored andcommitted
Update based on review comments
1 parent 5fe5946 commit 334f401

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/spark/ui/filesystem/ADLSGen2FileSystem.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import com.microsoft.azure.hdinsight.spark.common.ADLSGen2Deploy;
3232
import com.microsoft.azuretools.azurecommons.helpers.NotNull;
3333
import com.microsoft.azuretools.azurecommons.helpers.Nullable;
34-
import org.apache.commons.lang3.StringUtils;
3534
import rx.Observable;
3635

3736
import java.io.IOException;
@@ -63,8 +62,8 @@ public String getProtocol() {
6362
public VirtualFile[] listFiles(AdlsGen2VirtualFile vf) {
6463
List<AdlsGen2VirtualFile> childrenList = new ArrayList<>();
6564
if (vf.isDirectory()) {
66-
// sample fileSystemRootPath: https://accountName.dfs.core.windows.net/fileSystem
67-
String fileSystemRootPath = StringUtils.stripEnd(rootPathUri.resolve("/").getUrl().toString(), "/");
65+
// sample fileSystemRootPath: https://accountName.dfs.core.windows.net/fileSystem/
66+
String fileSystemRootPath = rootPathUri.resolve("/").getUrl().toString();
6867
// sample directoryParam: sub/path/to
6968
String directoryParam = vf.getAbfsUri().getDirectoryParam();
7069
childrenList = this.op.list(fileSystemRootPath, directoryParam)
@@ -78,7 +77,7 @@ public VirtualFile[] listFiles(AdlsGen2VirtualFile vf) {
7877
.onErrorResumeNext(err -> {
7978
String errorMessage = "Failed to list folders and files with error " + err.getMessage() + ". ";
8079
if (err instanceof ForbiddenHttpErrorStatus) {
81-
errorMessage += ADLSGen2Deploy.getForbiddenErrorHints(fileSystemRootPath);
80+
errorMessage += ADLSGen2Deploy.getForbiddenErrorHints(vf.toString());
8281
}
8382
return Observable.error(new IOException(errorMessage));
8483
}

Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/sdk/storage/adlsgen2/ADLSGen2FSOperation.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.microsoft.azure.hdinsight.sdk.rest.azure.storageaccounts.RemoteFile;
2727
import com.microsoft.azure.hdinsight.sdk.rest.azure.storageaccounts.api.GetRemoteFilesResponse;
2828
import com.microsoft.azuretools.azurecommons.helpers.NotNull;
29+
import org.apache.commons.lang3.StringUtils;
2930
import org.apache.http.NameValuePair;
3031
import org.apache.http.client.methods.HttpPatch;
3132
import org.apache.http.client.methods.HttpPut;
@@ -99,7 +100,11 @@ public Observable<RemoteFile> list(String rootPath, String relativePath) {
99100
.enableRecursive(false)
100101
.setResource("filesystem");
101102

102-
return http.get(rootPath, listReqBuilder.setDirectory(relativePath).build(), null, GetRemoteFilesResponse.class)
103+
return http.get(
104+
StringUtils.stripEnd(rootPath, "/"),
105+
listReqBuilder.setDirectory(relativePath).build(),
106+
null,
107+
GetRemoteFilesResponse.class)
103108
.flatMap(pathList -> Observable.from(pathList.getRemoteFiles()));
104109
}
105110

0 commit comments

Comments
 (0)