reader: improve some error messages (#52)

Change-Id: I974377a676908a9f46c26c45d7a41c7e913298b0
diff --git a/src/main/java/com/baidu/hugegraph/loader/reader/file/AbstractFileReader.java b/src/main/java/com/baidu/hugegraph/loader/reader/file/AbstractFileReader.java
index 66b0393..a9352ba 100644
--- a/src/main/java/com/baidu/hugegraph/loader/reader/file/AbstractFileReader.java
+++ b/src/main/java/com/baidu/hugegraph/loader/reader/file/AbstractFileReader.java
@@ -47,7 +47,7 @@
 
 public abstract class AbstractFileReader implements InputReader {
 
-    private static final Logger LOG = Log.logger(AbstractFileReader.class);
+    protected static final Logger LOG = Log.logger(AbstractFileReader.class);
 
     private static final int BUF_SIZE = 5 * 1024 * 1024;
 
@@ -71,6 +71,7 @@
 
     @Override
     public void init() {
+        LOG.info("Opening source {}", this.source);
         try {
             this.readers = this.openReaders();
         } catch (IOException e) {
@@ -93,7 +94,7 @@
     @Override
     public Line next() {
         if (!this.hasNext()) {
-            throw new NoSuchElementException("Reach end of file");
+            throw new NoSuchElementException("Reached the end of file");
         }
         Line line = this.nextLine;
         this.nextLine = null;
@@ -117,7 +118,7 @@
         try {
             rawLine = this.readNextLine();
         } catch (IOException e) {
-            throw new LoadException("Read next line error", e);
+            throw new LoadException("Error while reading the next line", e);
         }
         if (rawLine == null) {
             return null;
@@ -166,7 +167,7 @@
     private static BufferedReader createBufferedReader(InputStream stream,
                                                        FileSource source)
                                                        throws Exception {
-        E.checkNotNull(stream, "InputStream");
+        E.checkNotNull(stream, "stream");
         try {
             Reader csr = createCompressReader(stream, source);
             return new BufferedReader(csr, BUF_SIZE);
diff --git a/src/main/java/com/baidu/hugegraph/loader/reader/file/FileReader.java b/src/main/java/com/baidu/hugegraph/loader/reader/file/FileReader.java
index 5f7ad03..b012a08 100644
--- a/src/main/java/com/baidu/hugegraph/loader/reader/file/FileReader.java
+++ b/src/main/java/com/baidu/hugegraph/loader/reader/file/FileReader.java
@@ -51,7 +51,7 @@
             File[] subFiles = file.listFiles();
             if (subFiles == null) {
                 throw new LoadException(
-                          "Error when list files of path '%s'", file);
+                          "Error while listing the files of path '%s'", file);
             }
             for (File subFile : subFiles) {
                 files.add(new ReadableFile(subFile));
@@ -63,7 +63,7 @@
     private static void checkExistAndReadable(File file) {
         if (!file.exists()) {
             throw new LoadException(
-                      "Please ensure the file or directory exist: '%s'", file);
+                      "Please ensure the file or directory exists: '%s'", file);
         }
         if (!file.canRead()) {
             throw new LoadException(
diff --git a/src/main/java/com/baidu/hugegraph/loader/reader/hdfs/HDFSReader.java b/src/main/java/com/baidu/hugegraph/loader/reader/hdfs/HDFSReader.java
index 4433e23..6d949c8 100644
--- a/src/main/java/com/baidu/hugegraph/loader/reader/hdfs/HDFSReader.java
+++ b/src/main/java/com/baidu/hugegraph/loader/reader/hdfs/HDFSReader.java
@@ -48,11 +48,10 @@
     public HDFSReader(HDFSSource source) {
         super(source);
         Configuration config = this.loadConfiguration();
-        LOG.info("Opening readers for hdfs source {}", source);
         try {
             this.hdfs = FileSystem.get(URI.create(source.path()), config);
         } catch (IOException e) {
-            throw new LoadException("Failed to create hdfs file system", e);
+            throw new LoadException("Failed to create HDFS file system", e);
         }
         Path path = new Path(source.path());
         checkExist(this.hdfs, path);
@@ -119,12 +118,12 @@
         try {
             if (!fs.exists(path)) {
                 throw new LoadException(
-                          "Please ensure the file or directory exist: '%s'",
+                          "Please ensure the file or directory exists: '%s'",
                           path);
             }
         } catch (IOException e) {
             throw new LoadException(
-                      "Some exception occured when check hdfs path '%s' exist",
+                      "An exception occurred while checking HDFS path: '%s'",
                       path);
         }
     }
diff --git a/src/main/java/com/baidu/hugegraph/loader/reader/jdbc/JDBCReader.java b/src/main/java/com/baidu/hugegraph/loader/reader/jdbc/JDBCReader.java
index 23c07dd..e690091 100644
--- a/src/main/java/com/baidu/hugegraph/loader/reader/jdbc/JDBCReader.java
+++ b/src/main/java/com/baidu/hugegraph/loader/reader/jdbc/JDBCReader.java
@@ -68,7 +68,7 @@
                 this.batch = this.fetcher.nextBatch();
                 this.offset = 0;
             } catch (Exception e) {
-                throw new LoadException("Read next row error", e);
+                throw new LoadException("Error while reading the next row", e);
             }
         }
         return this.batch != null;
@@ -77,7 +77,7 @@
     @Override
     public Line next() {
         if (!this.hasNext()) {
-            throw new NoSuchElementException("Reach end of table");
+            throw new NoSuchElementException("Reached end of table");
         }
         return this.batch.get(this.offset++);
     }