[prev in list] [next in list] [prev in thread] [next in thread] 

List:       monetdb-checkins
Subject:    monetdb-java: default - Replace String methods  equals("")  and ...
From:       Martin van Dinther <commits+martin.van.dinther=monetdbsolutions.com () monetdb ! org>
Date:       2016-09-29 13:29:48
Message-ID: hg.a27ee2cb14a0.1475155788.-8529207749000363243 () monetdb2 ! cwi-incubator ! nl
[Download RAW message or body]

Changeset: a27ee2cb14a0 for monetdb-java
URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=a27ee2cb14a0
Modified Files:
	src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
	src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
	src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
Branch: default
Log Message:

Replace String methods  equals("")  and  "".equals(  with  isEmpty()


diffs (83 lines):

diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java \
                b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -179,15 +179,15 @@ public class MonetConnection extends Mon
 			sockTimeout = 0;
 		}
 		// check input arguments
-		if (hostname == null || hostname.trim().equals(""))
+		if (hostname == null || hostname.trim().isEmpty())
 			throw new IllegalArgumentException("hostname should not be null or empty");
 		if (port == 0)
 			throw new IllegalArgumentException("port should not be 0");
-		if (username == null || username.trim().equals(""))
+		if (username == null || username.trim().isEmpty())
 			throw new IllegalArgumentException("user should not be null or empty");
-		if (password == null || password.trim().equals(""))
+		if (password == null || password.trim().isEmpty())
 			throw new IllegalArgumentException("password should not be null or empty");
-		if (language == null || language.trim().equals("")) {
+		if (language == null || language.trim().isEmpty()) {
 			language = "sql";
 			addWarning("No language given, defaulting to 'sql'", "M1M05");
 		}
@@ -1116,7 +1116,7 @@ public class MonetConnection extends Mon
 	 * NOTE: If this method is called during a transaction, the
 	 * transaction is committed.
 	 *
- 	 * @param autoCommit true to enable auto-commit mode; false to disable it
+	 * @param autoCommit true to enable auto-commit mode; false to disable it
 	 * @throws SQLException if a database access error occurs
 	 * @see #getAutoCommit()
 	 */
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in \
                b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
@@ -68,7 +68,7 @@ final public class MonetDriver implement
 	static {
 		try {
 			DriverManager.registerDriver(new MonetDriver());
- 		} catch (SQLException e) {
+		} catch (SQLException e) {
 			e.printStackTrace();
 		}
 	}
@@ -147,7 +147,7 @@ final public class MonetDriver implement
 		String uri_path = uri.getPath();
 		if (uri_path != null && uri_path.length() != 0) {
 			uri_path = uri_path.substring(1);
-			if (!uri_path.trim().equals(""))
+			if (!uri_path.trim().isEmpty())
 				info.put("database", uri_path);
 		}
 
@@ -358,9 +358,9 @@ final public class MonetDriver implement
 		if (TypeMapppingSQL == null) {
 			// first time, compose TypeMappping SQL string
 			StringBuilder val = new StringBuilder((typeMap.size() * (7 + 7 + 7 + 4)) + 14);
-	 		for (Entry<String, Integer> entry : typeMap.entrySet()) {
+			for (Entry<String, Integer> entry : typeMap.entrySet()) {
 				val.append(" WHEN '").append(entry.getKey()).append("' THEN \
                ").append(entry.getValue().toString());
-	 		}
+			}
 			val.append(" ELSE ").append(Types.OTHER).append(" END");
 			// as the typeMap is static, cache this SQL part for all next calls
 			TypeMapppingSQL = val.toString();
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java \
                b/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
@@ -1277,11 +1277,11 @@ public class MonetResultSet extends Mone
 
 				// we can only call dbmd.getColumns() when we have a specific schema name and \
table name and column name  String schName = getSchemaName(column);
-				if (schName != null && !"".equals(schName)) {
+				if (schName != null && !schName.isEmpty()) {
 					String tblName = getTableName(column);
-					if (tblName != null && !"".equals(tblName)) {
+					if (tblName != null && !tblName.isEmpty()) {
 						String colName = getColumnName(column);
-						if (colName != null && !"".equals(colName)) {
+						if (colName != null && !colName.isEmpty()) {
 							if (conn == null) {
 								// first time, get a Connection object and cache it for all next columns
 								conn = getStatement().getConnection();
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic