carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvram...@apache.org
Subject [1/2] carbondata git commit: fix null pointer exception by changing null to empty array
Date Wed, 05 Jul 2017 05:54:20 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 49c64f713 -> d9c3b4837


fix null pointer exception by changing null to empty array


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

Branch: refs/heads/master
Commit: 659036fee8dd1645eea31eeab0423bd0d5c03f19
Parents: 49c64f7
Author: Jin Guodong <jelly.guodong.jin@gmail.com>
Authored: Thu Jun 29 12:43:51 2017 +0800
Committer: Venkata Ramana G <ramana.gollamudi@huawei.com>
Committed: Wed Jul 5 11:21:47 2017 +0530

----------------------------------------------------------------------
 .../carbondata/core/datastore/filesystem/AlluxioCarbonFile.java   | 2 +-
 .../carbondata/core/datastore/filesystem/HDFSCarbonFile.java      | 2 +-
 .../carbondata/core/datastore/filesystem/LocalCarbonFile.java     | 2 +-
 .../carbondata/core/datastore/filesystem/ViewFSCarbonFile.java    | 2 +-
 .../core/datastore/filesystem/AlluxioCarbonFileTest.java          | 3 ++-
 .../carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java  | 3 ++-
 .../carbondata/core/datastore/filesystem/LocalCarbonFileTest.java | 3 ++-
 .../core/datastore/filesystem/ViewFsCarbonFileTest.java           | 3 ++-
 8 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/659036fe/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFile.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFile.java
b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFile.java
index 36e4868..c3ccd0c 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFile.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFile.java
@@ -74,7 +74,7 @@ public class AlluxioCarbonFile extends AbstractDFSCarbonFile {
         Path path = fileStatus.getPath();
         listStatus = path.getFileSystem(FileFactory.getConfiguration()).listStatus(path);
       } else {
-        return null;
+        return new CarbonFile[0];
       }
     } catch (IOException e) {
       LOGGER.error("Exception occured: " + e.getMessage());

http://git-wip-us.apache.org/repos/asf/carbondata/blob/659036fe/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java
b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java
index 75d9fc3..19bdc7b 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java
@@ -72,7 +72,7 @@ public class HDFSCarbonFile extends AbstractDFSCarbonFile {
         Path path = fileStatus.getPath();
         listStatus = path.getFileSystem(FileFactory.getConfiguration()).listStatus(path);
       } else {
-        return null;
+        return new CarbonFile[0];
       }
     } catch (IOException e) {
       LOGGER.error("Exception occured: " + e.getMessage());

http://git-wip-us.apache.org/repos/asf/carbondata/blob/659036fe/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
index 9f90713..89a5cd3 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
@@ -123,7 +123,7 @@ public class LocalCarbonFile implements CarbonFile {
   @Override public CarbonFile[] listFiles() {
 
     if (!file.isDirectory()) {
-      return null;
+      return new CarbonFile[0];
     }
     File[] files = file.listFiles();
     if (files == null) {

http://git-wip-us.apache.org/repos/asf/carbondata/blob/659036fe/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/ViewFSCarbonFile.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/ViewFSCarbonFile.java
b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/ViewFSCarbonFile.java
index da15371..e05112d 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/ViewFSCarbonFile.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/ViewFSCarbonFile.java
@@ -71,7 +71,7 @@ public class ViewFSCarbonFile extends AbstractDFSCarbonFile {
         Path path = fileStatus.getPath();
         listStatus = path.getFileSystem(FileFactory.getConfiguration()).listStatus(path);
       } else {
-        return null;
+        return new CarbonFile[0];
       }
     } catch (IOException ex) {
       LOGGER.error("Exception occured" + ex.getMessage());

http://git-wip-us.apache.org/repos/asf/carbondata/blob/659036fe/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java
b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java
index eff0d8b..f55cd67 100644
--- a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java
@@ -35,6 +35,7 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -90,7 +91,7 @@ public class AlluxioCarbonFileTest {
     @Test
     public void testListFilesWithOutDirectoryPermission() {
         alluxioCarbonFile = new AlluxioCarbonFile(fileStatusWithOutDirectoryPermission);
-        assertTrue(alluxioCarbonFile.listFiles() == null);
+        assertArrayEquals(alluxioCarbonFile.listFiles(), new CarbonFile[0]);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/carbondata/blob/659036fe/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java
b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java
index eeecb03..7726693 100644
--- a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java
@@ -39,6 +39,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -132,7 +133,7 @@ public class HDFSCarbonFileTest {
             }
 
         };
-        assertEquals(hdfsCarbonFile.listFiles(), null);
+        assertArrayEquals(hdfsCarbonFile.listFiles(), new CarbonFile[0]);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/carbondata/blob/659036fe/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java
b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java
index 3925e9e..9ae5c34 100644
--- a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java
@@ -30,6 +30,7 @@ import java.io.*;
 import java.nio.channels.ReadableByteChannel;
 import java.util.Objects;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -102,7 +103,7 @@ public class LocalCarbonFileTest {
                 return false;
             }
         };
-        assertTrue(localCarbonFile.listFiles() == null);
+        assertArrayEquals(localCarbonFile.listFiles(), new CarbonFile[0]);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/carbondata/blob/659036fe/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java
b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java
index 3cb8198..ba661b1 100644
--- a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java
@@ -35,6 +35,7 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -91,7 +92,7 @@ public class ViewFsCarbonFileTest {
     @Test
     public void testListFilesWithOutDirectoryPermission() {
         viewFSCarbonFile = new ViewFSCarbonFile(fileStatusWithOutDirectoryPermission);
-        assertTrue(viewFSCarbonFile.listFiles() == null);
+        assertArrayEquals(viewFSCarbonFile.listFiles(), new CarbonFile[0]);
     }
 
     @Test


Mime
View raw message