< prev index next >

src/java.sql.rowset/share/classes/com/sun/rowset/JdbcRowSetImpl.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad

@@ -622,11 +622,11 @@
                 Context ctx = new InitialContext();
                 DataSource ds = (DataSource)ctx.lookup
                     (getDataSourceName());
                 //return ds.getConnection(getUsername(),getPassword());
 
-                if(getUsername() != null && !getUsername().equals("")) {
+                if(getUsername() != null && !getUsername().isEmpty()) {
                      return ds.getConnection(getUsername(),getPassword());
                 } else {
                      return ds.getConnection();
                 }
             }

@@ -3871,11 +3871,11 @@
      *         parameter index is out of bounds
      */
     public void setMatchColumn(String[] columnNames) throws SQLException {
 
         for(int j = 0; j < columnNames.length; j++) {
-           if( columnNames[j] == null || columnNames[j].equals("")) {
+           if( columnNames[j] == null || columnNames[j].isEmpty()) {
               throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString());
            }
         }
         for( int i = 0; i < columnNames.length; i++) {
            strMatchColumns.add(i,columnNames[i]);

@@ -3926,11 +3926,11 @@
      * @throws SQLException if an error occurs or the
      *         parameter index is out of bounds
      */
     public void setMatchColumn(String columnName) throws SQLException {
         // validate, if col is ok to be set
-        if(columnName == null || (columnName= columnName.trim()).equals("")) {
+        if(columnName == null || (columnName= columnName.trim()).isEmpty()) {
             throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString());
         } else {
             // set strMatchColumn
             strMatchColumns.set(0, columnName);
             //iMatchColumn = -1;
< prev index next >