changeset 8:a27ee2cb14a0

Replace String methods equals("") and "".equals( with isEmpty()
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 29 Sep 2016 15:29:42 +0200 (2016-09-29)
parents b3ca1157be73
children c37a76cc1e6e
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
diffstat 3 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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()
 	 */
--- 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();
--- 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();