This is an automated email from the ASF dual-hosted git repository.
baunsgaard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
The following commit(s) were added to refs/heads/main by this push:
new b1c5f7e [MINOR] Add check that metadata file exist
b1c5f7e is described below
commit b1c5f7ed2606a6245fd581b6110ff1e03615a545
Author: baunsgaard <[email protected]>
AuthorDate: Wed Nov 3 12:06:37 2021 +0100
[MINOR] Add check that metadata file exist
This commit adds a check that the metadata file exists before
checking if it is a dictionary.
---
src/main/java/org/apache/sysds/runtime/meta/MetaDataAll.java | 2 +-
src/main/java/org/apache/sysds/runtime/util/HDFSTool.java | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sysds/runtime/meta/MetaDataAll.java
b/src/main/java/org/apache/sysds/runtime/meta/MetaDataAll.java
index 9132bd4..cb007d2 100644
--- a/src/main/java/org/apache/sysds/runtime/meta/MetaDataAll.java
+++ b/src/main/java/org/apache/sysds/runtime/meta/MetaDataAll.java
@@ -100,7 +100,7 @@ public class MetaDataAll extends DataIdentifier {
{
JSONObject retVal = new JSONObject();
boolean exists = HDFSTool.existsFileOnHDFS(filename);
- boolean isDir = HDFSTool.isDirectory(filename);
+ boolean isDir = exists ? HDFSTool.isDirectory(filename) : false;
// CASE: filename is a directory -- process as a directory
if( exists && isDir )
diff --git a/src/main/java/org/apache/sysds/runtime/util/HDFSTool.java
b/src/main/java/org/apache/sysds/runtime/util/HDFSTool.java
index 46b9b11..9ff4c84 100644
--- a/src/main/java/org/apache/sysds/runtime/util/HDFSTool.java
+++ b/src/main/java/org/apache/sysds/runtime/util/HDFSTool.java
@@ -121,9 +121,8 @@ public class HDFSTool
.getFileSystem(path).getFileStatus(path).isDirectory();
}
catch(Exception ex) {
- LOG.error("Failed check isDirectory.", ex);
+ throw new DMLRuntimeException("Failed to check if file
is directory", ex);
}
- return false;
}
public static FileStatus[] getDirectoryListing(String fname) {