This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ba7ebd  Fix sanor kyy (#37)
4ba7ebd is described below

commit 4ba7ebd05d7548977183b84629885f4420fd2d9d
Author: Ring-k <[email protected]>
AuthorDate: Mon Feb 18 21:06:12 2019 +0800

    Fix sanor kyy (#37)
    
    * Update Readme.md, replace old badge
    
    * fix code smell: replace with METHOD_NOT_SUPPORTED_STRING
---
 .../apache/iotdb/jdbc/IoTDBDatabaseMetadata.java   | 297 +++++++++++----------
 .../java/org/apache/iotdb/jdbc/IoTDBDriver.java    |   4 +-
 .../apache/iotdb/jdbc/IoTDBPrepareStatement.java   | 103 +++----
 .../java/org/apache/iotdb/jdbc/IoTDBStatement.java |  68 ++---
 .../src/main/java/org/apache/iotdb/jdbc/Utils.java |  68 +++--
 mvnw.sh                                            |   2 +-
 6 files changed, 287 insertions(+), 255 deletions(-)

diff --git 
a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDatabaseMetadata.java 
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDatabaseMetadata.java
index de8cb89..63e6aa9 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDatabaseMetadata.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDatabaseMetadata.java
@@ -29,11 +29,16 @@ import 
org.apache.iotdb.service.rpc.thrift.TSFetchMetadataReq;
 import org.apache.iotdb.service.rpc.thrift.TSFetchMetadataResp;
 import org.apache.iotdb.service.rpc.thrift.TSIService;
 import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class IoTDBDatabaseMetadata implements DatabaseMetaData {
 
   private IoTDBConnection connection;
   private TSIService.Iface client;
+  private static final Logger LOGGER = LoggerFactory
+          .getLogger(IoTDBDatabaseMetadata.class);
+  private static final String METHOD_NOT_SUPPORTED_STRING = "Method not 
supported";
 
   public IoTDBDatabaseMetadata(IoTDBConnection connection, TSIService.Iface 
client) {
     this.connection = connection;
@@ -122,68 +127,68 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
   @Override
   public boolean isWrapperFor(Class<?> arg0) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public <T> T unwrap(Class<T> iface) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean allProceduresAreCallable() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean allTablesAreSelectable() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean deletesAreDetected(int arg0) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean generatedKeyAlwaysReturned() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getAttributes(String arg0, String arg1, String arg2, String 
arg3)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -191,38 +196,38 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
       boolean arg4)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getCatalogSeparator() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getCatalogTerm() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getCatalogs() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getClientInfoProperties() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getColumnPrivileges(String arg0, String arg1, String arg2,
       String arg3) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -235,7 +240,7 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
       String arg4, String arg5)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -281,57 +286,57 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
   @Override
   public String getDriverName() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getDriverVersion() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getExportedKeys(String arg0, String arg1, String arg2) 
throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getExtraNameCharacters() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getFunctionColumns(String arg0, String arg1, String arg2, 
String arg3)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getFunctions(String arg0, String arg1, String arg2) throws 
SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getIdentifierQuoteString() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getImportedKeys(String arg0, String arg1, String arg2) 
throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getIndexInfo(String arg0, String arg1, String arg2, boolean 
arg3, boolean arg4)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -469,39 +474,39 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
   @Override
   public String getNumericFunctions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getPrimaryKeys(String arg0, String arg1, String arg2) 
throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getProcedureColumns(String arg0, String arg1, String arg2, 
String arg3)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getProcedureTerm() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getProcedures(String arg0, String arg1, String arg2) throws 
SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getPseudoColumns(String catalog, String schemaPattern, 
String tableNamePattern,
       String columnNamePattern) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -513,13 +518,13 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
   @Override
   public RowIdLifetime getRowIdLifetime() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getSQLKeywords() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -531,64 +536,64 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
   @Override
   public String getSchemaTerm() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getSchemas() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getSchemas(String catalog, String schemaPattern) throws 
SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getSearchStringEscape() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getStringFunctions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getSuperTables(String catalog, String schemaPattern, String 
tableNamePattern)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getSuperTypes(String catalog, String schemaPattern, String 
typeNamePattern)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getSystemFunctions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getTablePrivileges(String catalog, String schemaPattern, 
String tableNamePattern)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getTableTypes() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -596,19 +601,19 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
       String[] types)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public String getTimeDateFunctions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getTypeInfo() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -616,7 +621,7 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
       int[] types)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -628,563 +633,564 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
   @Override
   public String getUserName() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ResultSet getVersionColumns(String catalog, String schema, String 
table)
       throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean insertsAreDetected(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean isCatalogAtStart() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean isReadOnly() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean locatorsUpdateCopy() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean nullPlusNonNullIsNull() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean nullsAreSortedAtEnd() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean nullsAreSortedAtStart() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean nullsAreSortedHigh() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean nullsAreSortedLow() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean othersDeletesAreVisible(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean othersInsertsAreVisible(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean othersUpdatesAreVisible(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean ownDeletesAreVisible(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean ownInsertsAreVisible(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean ownUpdatesAreVisible(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean storesLowerCaseIdentifiers() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean storesMixedCaseIdentifiers() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean storesUpperCaseIdentifiers() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsANSI92EntryLevelSQL() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsANSI92FullSQL() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsANSI92IntermediateSQL() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsAlterTableWithAddColumn() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsAlterTableWithDropColumn() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsBatchUpdates() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsCatalogsInDataManipulation() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsCatalogsInProcedureCalls() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsCatalogsInTableDefinitions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsColumnAliasing() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsConvert() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsConvert(int fromType, int toType) throws SQLException 
{
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsCoreSQLGrammar() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsCorrelatedSubqueries() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsDataDefinitionAndDataManipulationTransactions() 
throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsDataManipulationTransactionsOnly() throws 
SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsDifferentTableCorrelationNames() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsExpressionsInOrderBy() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsExtendedSQLGrammar() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsFullOuterJoins() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsGetGeneratedKeys() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsGroupBy() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsGroupByBeyondSelect() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsGroupByUnrelated() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsIntegrityEnhancementFacility() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsLikeEscapeClause() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsLimitedOuterJoins() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsMinimumSQLGrammar() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsMixedCaseIdentifiers() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsMultipleOpenResults() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsMultipleResultSets() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsMultipleTransactions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsNamedParameters() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsNonNullableColumns() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsOrderByUnrelated() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsOuterJoins() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsPositionedDelete() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsPositionedUpdate() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsResultSetConcurrency(int type, int concurrency) 
throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsResultSetHoldability(int holdability) throws 
SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsResultSetType(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSavepoints() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSchemasInDataManipulation() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSchemasInIndexDefinitions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSchemasInProcedureCalls() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSchemasInTableDefinitions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSelectForUpdate() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsStatementPooling() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsStoredProcedures() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSubqueriesInComparisons() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSubqueriesInExists() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSubqueriesInIns() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsSubqueriesInQuantifieds() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsTableCorrelationNames() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsTransactionIsolationLevel(int level) throws 
SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsTransactions() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsUnion() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean supportsUnionAll() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean updatesAreDetected(int type) throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean usesLocalFilePerTable() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean usesLocalFiles() throws SQLException {
     // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
-  /*
+  /**
+   * @deprecated
    * recommend using getMetadataInJson() instead of toString()
    */
   @Deprecated
@@ -1193,6 +1199,7 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
     try {
       return getMetadataInJsonFunc();
     } catch (IoTDBSQLException e) {
+      LOGGER.error("Failed to fetch metadata in json because: ", e);
       System.out.println("Failed to fetch metadata in json because: " + e);
     } catch (TException e) {
       boolean flag = connection.reconnect();
@@ -1201,6 +1208,8 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
         try {
           return getMetadataInJsonFunc();
         } catch (TException e2) {
+          LOGGER.error("Fail to get all timeseries " + "info after 
reconnecting."
+                  + " please check server status", e2);
           System.out.println(
               "Fail to get all timeseries " + "info after reconnecting."
                   + " please check server status");
@@ -1208,6 +1217,8 @@ public class IoTDBDatabaseMetadata implements 
DatabaseMetaData {
           // ignored
         }
       } else {
+        LOGGER.error("Fail to reconnect to server "
+                + "when getting all timeseries info. please check server 
status");
         System.out.println("Fail to reconnect to server "
             + "when getting all timeseries info. please check server status");
       }
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDriver.java 
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDriver.java
index aae8fb7..4a6bfb8 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDriver.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDriver.java
@@ -49,7 +49,7 @@ public class IoTDBDriver implements Driver {
   private final String TSFILE_URL_PREFIX = Config.IOTDB_URL_PREFIX + ".*";
 
   public IoTDBDriver() {
-
+    // This is a constructor.
   }
 
   @Override
@@ -88,7 +88,7 @@ public class IoTDBDriver implements Driver {
   @Override
   public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) 
throws SQLException {
     // TODO Auto-generated method stub
-    return null;
+    return new DriverPropertyInfo[0];
   }
 
   @Override
diff --git 
a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBPrepareStatement.java 
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBPrepareStatement.java
index 45df785..dcbf1b9 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBPrepareStatement.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBPrepareStatement.java
@@ -52,10 +52,12 @@ import org.apache.iotdb.service.rpc.thrift.TS_SessionHandle;
 public class IoTDBPrepareStatement extends IoTDBStatement implements 
PreparedStatement {
 
   private final String sql;
+  private static final String METHOD_NOT_SUPPORTED_STRING = "Method not 
supported";
+
   /**
    * save the SQL parameters as (paramLoc,paramValue) pairs.
    */
-  private final Map<Integer, String> parameters = new HashMap<Integer, 
String>();
+  private final Map<Integer, String> parameters = new HashMap<>();
 
   public IoTDBPrepareStatement(IoTDBConnection connection, Iface client,
       TS_SessionHandle sessionHandle, String sql,
@@ -66,7 +68,7 @@ public class IoTDBPrepareStatement extends IoTDBStatement 
implements PreparedSta
 
   @Override
   public void addBatch() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -91,186 +93,186 @@ public class IoTDBPrepareStatement extends IoTDBStatement 
implements PreparedSta
 
   @Override
   public ResultSetMetaData getMetaData() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public ParameterMetaData getParameterMetaData() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setArray(int parameterIndex, Array x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setAsciiStream(int parameterIndex, InputStream x) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setAsciiStream(int parameterIndex, InputStream x, int length) 
throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setAsciiStream(int parameterIndex, InputStream x, long length) 
throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBigDecimal(int parameterIndex, BigDecimal x) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBinaryStream(int parameterIndex, InputStream x) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBinaryStream(int parameterIndex, InputStream x, int length) 
throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBinaryStream(int parameterIndex, InputStream x, long length) 
throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBlob(int parameterIndex, Blob x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBlob(int parameterIndex, InputStream inputStream) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBlob(int parameterIndex, InputStream inputStream, long length)
       throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBoolean(int parameterIndex, boolean x) throws SQLException {
-    this.parameters.put(parameterIndex, "" + x);
+    this.parameters.put(parameterIndex, Boolean.toString(x));
   }
 
   @Override
   public void setByte(int parameterIndex, byte x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setBytes(int parameterIndex, byte[] x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setCharacterStream(int parameterIndex, Reader reader) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setCharacterStream(int parameterIndex, Reader reader, int length)
       throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setCharacterStream(int parameterIndex, Reader reader, long 
length)
       throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setClob(int parameterIndex, Clob x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setClob(int parameterIndex, Reader reader) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setClob(int parameterIndex, Reader reader, long length) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setDate(int parameterIndex, Date x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setDate(int parameterIndex, Date x, Calendar cal) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setDouble(int parameterIndex, double x) throws SQLException {
-    this.parameters.put(parameterIndex, "" + x);
+    this.parameters.put(parameterIndex, Double.toString(x));
   }
 
   @Override
   public void setFloat(int parameterIndex, float x) throws SQLException {
-    this.parameters.put(parameterIndex, "" + x);
+    this.parameters.put(parameterIndex, Float.toString(x));
   }
 
   @Override
   public void setInt(int parameterIndex, int x) throws SQLException {
-    this.parameters.put(parameterIndex, "" + x);
+    this.parameters.put(parameterIndex, Integer.toString(x));
   }
 
   @Override
   public void setLong(int parameterIndex, long x) throws SQLException {
-    this.parameters.put(parameterIndex, "" + x);
+    this.parameters.put(parameterIndex, Long.toString(x));
   }
 
   @Override
   public void setNCharacterStream(int parameterIndex, Reader value) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setNCharacterStream(int parameterIndex, Reader value, long 
length)
       throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setNClob(int parameterIndex, NClob value) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setNClob(int parameterIndex, Reader reader) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setNClob(int parameterIndex, Reader reader, long length) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setNString(int parameterIndex, String value) throws SQLException 
{
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setNull(int parameterIndex, int sqlType) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setNull(int parameterIndex, int sqlType, String typeName) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -300,49 +302,48 @@ public class IoTDBPrepareStatement extends IoTDBStatement 
implements PreparedSta
 
   @Override
   public void setObject(int parameterIndex, Object x, int targetSqlType) 
throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setObject(int parameterIndex, Object x, int targetSqlType, int 
scaleOrLength)
       throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setRef(int parameterIndex, Ref x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setRowId(int parameterIndex, RowId x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setShort(int parameterIndex, short x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setString(int parameterIndex, String x) throws SQLException {
-    x = x.replace("'", "\\'");
-    this.parameters.put(parameterIndex, "'" + x + "'");
+    this.parameters.put(parameterIndex, "'" + x.replace("'", "\\'") + "'");
   }
 
   @Override
   public void setTime(int parameterIndex, Time x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setTime(int parameterIndex, Time x, Calendar cal) throws 
SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -355,17 +356,17 @@ public class IoTDBPrepareStatement extends IoTDBStatement 
implements PreparedSta
 
   @Override
   public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) 
throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setURL(int parameterIndex, URL x) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setUnicodeStream(int parameterIndex, InputStream x, int length) 
throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   private String createCompleteSql(final String sql, Map<Integer, String> 
parameters)
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java 
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
index c345f5b..0cda242 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
@@ -43,12 +43,17 @@ import 
org.apache.iotdb.service.rpc.thrift.TSOperationHandle;
 import org.apache.iotdb.service.rpc.thrift.TS_SessionHandle;
 import org.apache.iotdb.service.rpc.thrift.TS_StatusCode;
 import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 public class IoTDBStatement implements Statement {
 
   private static final String SHOW_TIMESERIES_COMMAND_LOWERCASE = "show 
timeseries";
   private static final String SHOW_STORAGE_GROUP_COMMAND_LOWERCASE = "show 
storage group";
+  private static final String METHOD_NOT_SUPPORTED_STRING = "Method not 
supported";
+  private static final Logger LOGGER = LoggerFactory
+          .getLogger(IoTDBStatement.class);
   ZoneId zoneId;
   private ResultSet resultSet = null;
   private IoTDBConnection connection;
@@ -131,7 +136,7 @@ public class IoTDBStatement implements Statement {
         Utils.verifySuccess(closeResp.getStatus());
       }
     } catch (Exception e) {
-      throw new SQLException("Error occurs when canceling statement because " 
+ e.getMessage());
+      throw new SQLException("Error occurs when canceling statement because " 
+ e.getMessage(), e);
     }
     isCancelled = true;
   }
@@ -157,7 +162,7 @@ public class IoTDBStatement implements Statement {
         Utils.verifySuccess(closeResp.getStatus());
       }
     } catch (Exception e) {
-      throw new SQLException("Error occurs when closing statement because " + 
e.getMessage());
+      throw new SQLException("Error occurs when closing statement because " + 
e.getMessage(), e);
     }
   }
 
@@ -168,13 +173,12 @@ public class IoTDBStatement implements Statement {
     }
 
     closeClientOperation();
-    // client = null;
     isClosed = true;
   }
 
   @Override
   public void closeOnCompletion() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -192,29 +196,29 @@ public class IoTDBStatement implements Statement {
         } catch (TException e2) {
           throw new SQLException(
               String.format("Fail to execute %s after reconnecting. please 
check server status",
-                  sql));
+                  sql), e2);
         }
       } else {
         throw new SQLException(String
             .format("Fail to reconnect to server when executing %s. please 
check server status",
-                sql));
+                sql), e);
       }
     }
   }
 
   @Override
   public boolean execute(String arg0, int arg1) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean execute(String arg0, int[] arg1) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean execute(String arg0, String[] arg1) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   /**
@@ -270,11 +274,11 @@ public class IoTDBStatement implements Statement {
           return executeBatchSQL();
         } catch (TException e2) {
           throw new SQLException(
-              "Fail to execute batch sqls after reconnecting. please check 
server status");
+              "Fail to execute batch sqls after reconnecting. please check 
server status", e2);
         }
       } else {
         throw new SQLException(
-            "Fail to reconnect to server when executing batch sqls. please 
check server status");
+            "Fail to reconnect to server when executing batch sqls. please 
check server status", e);
       }
     }
   }
@@ -327,12 +331,12 @@ public class IoTDBStatement implements Statement {
           return executeQuerySQL(sql);
         } catch (TException e2) {
           throw new SQLException(
-              "Fail to executeQuery " + sql + "after reconnecting. please 
check server status");
+              "Fail to executeQuery " + sql + "after reconnecting. please 
check server status", e2);
         }
       } else {
         throw new SQLException(
             "Fail to reconnect to server when execute query " + sql
-                + ". please check server status");
+                + ". please check server status", e);
       }
     }
   }
@@ -363,29 +367,29 @@ public class IoTDBStatement implements Statement {
           return executeUpdateSQL(sql);
         } catch (TException e2) {
           throw new SQLException(
-              "Fail to execute update " + sql + "after reconnecting. please 
check server status");
+              "Fail to execute update " + sql + "after reconnecting. please 
check server status", e2);
         }
       } else {
         throw new SQLException(
             "Fail to reconnect to server when execute update " + sql
-                + ". please check server status");
+                + ". please check server status", e);
       }
     }
   }
 
   @Override
   public int executeUpdate(String arg0, int arg1) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public int executeUpdate(String arg0, int[] arg1) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public int executeUpdate(String arg0, String[] arg1) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   private int executeUpdateSQL(String sql) throws TException, 
IoTDBSQLException {
@@ -432,17 +436,17 @@ public class IoTDBStatement implements Statement {
 
   @Override
   public ResultSet getGeneratedKeys() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public int getMaxFieldSize() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setMaxFieldSize(int arg0) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -462,12 +466,12 @@ public class IoTDBStatement implements Statement {
 
   @Override
   public boolean getMoreResults() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public boolean getMoreResults(int arg0) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -492,12 +496,12 @@ public class IoTDBStatement implements Statement {
 
   @Override
   public int getResultSetConcurrency() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public int getResultSetHoldability() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -508,7 +512,7 @@ public class IoTDBStatement implements Statement {
 
   @Override
   public int getUpdateCount() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -518,7 +522,7 @@ public class IoTDBStatement implements Statement {
 
   @Override
   public boolean isCloseOnCompletion() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
@@ -528,22 +532,22 @@ public class IoTDBStatement implements Statement {
 
   @Override
   public boolean isPoolable() throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setPoolable(boolean arg0) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setCursorName(String arg0) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   @Override
   public void setEscapeProcessing(boolean enable) throws SQLException {
-    throw new SQLException("Method not supported");
+    throw new SQLException(METHOD_NOT_SUPPORTED_STRING);
   }
 
   private void checkConnection(String action) throws SQLException {
@@ -578,7 +582,7 @@ public class IoTDBStatement implements Statement {
       return resp.getDataType();
     } catch (TException | IoTDBSQLException e) {
       throw new SQLException(
-          String.format("Cannot get column %s data type because %s", 
columnName, e.getMessage()));
+          String.format("Cannot get column %s data type because %s", 
columnName, e.getMessage()), e);
     }
   }
 
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/Utils.java 
b/jdbc/src/main/java/org/apache/iotdb/jdbc/Utils.java
index 8475550..f00402c 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/Utils.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/Utils.java
@@ -40,6 +40,13 @@ import org.apache.iotdb.tsfile.utils.Binary;
 public class Utils {
 
   /**
+   * Private constructor of Utils Class.
+   */
+  private  Utils(){
+    throw new IllegalAccessError("Utility class");
+  }
+
+  /**
    * Parse JDBC connection URL The only supported format of the URL is:
    * jdbc:iotdb://localhost:6667/.
    */
@@ -55,7 +62,7 @@ public class Utils {
     boolean isUrlLegal = false;
     while (matcher.find()) {
       params.setHost(matcher.group(1));
-      params.setPort(Integer.parseInt((matcher.group(2))));
+      params.setPort(Integer.parseInt(matcher.group(2)));
       isUrlLegal = true;
     }
     if (!isUrlLegal) {
@@ -103,31 +110,7 @@ public class Utils {
         } else {
           TSDataType dataType = TSDataType.valueOf(value.getType());
           Field field = new Field(dataType);
-          switch (dataType) {
-            case BOOLEAN:
-              field.setBoolV(value.isBool_val());
-              break;
-            case INT32:
-              field.setIntV(value.getInt_val());
-              break;
-            case INT64:
-              field.setLongV(value.getLong_val());
-              break;
-            case FLOAT:
-              field.setFloatV((float) value.getFloat_val());
-              break;
-            case DOUBLE:
-              field.setDoubleV(value.getDouble_val());
-              break;
-            case TEXT:
-              field.setBinaryV(new Binary(value.getBinary_val()));
-              ;
-              break;
-            default:
-              throw new UnSupportedDataTypeException(
-                  String.format("data type %s is not supported when convert 
data at client",
-                      dataType));
-          }
+          addFieldAccordingToDataType(field, dataType, value);
           r.getFields().add(field);
         }
       }
@@ -135,4 +118,37 @@ public class Utils {
     }
     return records;
   }
+
+  /**
+   *
+   * @param field -the field need to add new data
+   * @param dataType, -the data type of the new data
+   * @param value, -the value of the new data
+   */
+  private static void addFieldAccordingToDataType(Field field, TSDataType 
dataType, TSDataValue value){
+    switch (dataType) {
+      case BOOLEAN:
+        field.setBoolV(value.isBool_val());
+        break;
+      case INT32:
+        field.setIntV(value.getInt_val());
+        break;
+      case INT64:
+        field.setLongV(value.getLong_val());
+        break;
+      case FLOAT:
+        field.setFloatV((float) value.getFloat_val());
+        break;
+      case DOUBLE:
+        field.setDoubleV(value.getDouble_val());
+        break;
+      case TEXT:
+        field.setBinaryV(new Binary(value.getBinary_val()));
+        break;
+      default:
+        throw new UnSupportedDataTypeException(
+                String.format("data type %s is not supported when convert data 
at client",
+                        dataType));
+    }
+  }
 }
diff --git a/mvnw.sh b/mvnw.sh
old mode 100755
new mode 100644
index 46cba08..0270dbc
--- a/mvnw.sh
+++ b/mvnw.sh
@@ -267,4 +267,4 @@ exec "$JAVACMD" \
   $MAVEN_OPTS \
   -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
   "-Dmaven.home=${M2_HOME}" 
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
-  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
\ No newline at end of file

Reply via email to