You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2017/11/09 03:40:28 UTC

[2/2] systemml git commit: [MINOR] Fix robustness empty filename handling for JMLC and MLContext

[MINOR] Fix robustness empty filename handling for JMLC and MLContext 

Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/a66126d4
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/a66126d4
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/a66126d4

Branch: refs/heads/master
Commit: a66126d49d6f64136d86074cfb6ec666d7c6375a
Parents: f366c46
Author: Matthias Boehm <mb...@gmail.com>
Authored: Wed Nov 8 19:41:32 2017 -0800
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Wed Nov 8 19:41:32 2017 -0800

----------------------------------------------------------------------
 src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/a66126d4/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java b/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java
index eb2b141..2e66437 100644
--- a/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java
+++ b/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java
@@ -105,7 +105,7 @@ public class MapReduceTool
 
 	public static boolean existsFileOnHDFS(String fname) {
 		//robustness for empty strings (e.g., JMLC, MLContext)
-		if( fname == null || fname.isEmpty() )
+		if( fname == null || fname.isEmpty() || fname.trim().isEmpty() )
 			return false;
 		
 		try {
@@ -121,7 +121,7 @@ public class MapReduceTool
 	
 	public static boolean isDirectory(String fname) {
 		//robustness for empty strings (e.g., JMLC, MLContext)
-		if( fname == null || fname.isEmpty() )
+		if( fname == null || fname.isEmpty() || fname.trim().isEmpty() )
 			return false;
 		
 		try {
@@ -176,7 +176,7 @@ public class MapReduceTool
 
 	public static boolean isHDFSFileEmpty(String dir) throws IOException {
 		//robustness for empty strings (e.g., JMLC, MLContext)
-		if( dir == null || dir.isEmpty() )
+		if( dir == null || dir.isEmpty() || dir.trim().isEmpty())
 			return false;
 		Path path = new Path(dir);
 		FileSystem fs = IOUtilFunctions.getFileSystem(path);