From fa6e98c1bfdd9a701080a9d09afe518d9d2f3453 Mon Sep 17 00:00:00 2001 From: lancea Date: Fri, 1 Oct 2010 14:36:01 -0400 Subject: [PATCH] 6988993: Address Findbugs warnings for the use of String Constructor Reviewed-by: ohair --- .../com/sun/rowset/CachedRowSetImpl.java | 6 +- .../com/sun/rowset/FilteredRowSetImpl.java | 2 +- .../com/sun/rowset/JoinRowSetImpl.java | 6 +- .../rowset/internal/CachedRowSetWriter.java | 4 +- .../rowset/internal/WebRowSetXmlWriter.java | 2 +- .../internal/XmlReaderContentHandler.java | 12 ++-- .../classes/javax/sql/rowset/BaseRowSet.java | 14 ++--- .../javax/sql/rowset/RowSetMetaDataImpl.java | 59 +++++++++---------- .../javax/sql/rowset/serial/SerialRef.java | 4 +- .../javax/sql/rowset/serial/SerialStruct.java | 8 +-- 10 files changed, 56 insertions(+), 61 deletions(-) diff --git a/src/share/classes/com/sun/rowset/CachedRowSetImpl.java b/src/share/classes/com/sun/rowset/CachedRowSetImpl.java index 1c8f279a4..414476590 100644 --- a/src/share/classes/com/sun/rowset/CachedRowSetImpl.java +++ b/src/share/classes/com/sun/rowset/CachedRowSetImpl.java @@ -4042,7 +4042,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGVARCHAR: - return new String(srcObj.toString()); + return srcObj.toString(); default: throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType); } @@ -4139,7 +4139,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGVARCHAR: - return new String(srcObj.toString()); + return srcObj.toString(); default: throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } @@ -6434,7 +6434,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern if (tabName == null) throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.tablename").toString()); else - tableName = new String(tabName); + tableName = tabName; } /** diff --git a/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java b/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java index a9becf17d..4899aef14 100644 --- a/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java +++ b/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java @@ -1106,7 +1106,7 @@ public class FilteredRowSetImpl extends WebRowSetImpl implements Serializable, C public void updateBytes(int columnIndex , byte []x) throws SQLException { boolean bool; - String val = new String(); + String val = ""; Byte [] obj_arr = new Byte[x.length]; diff --git a/src/share/classes/com/sun/rowset/JoinRowSetImpl.java b/src/share/classes/com/sun/rowset/JoinRowSetImpl.java index a13805868..8284d8559 100644 --- a/src/share/classes/com/sun/rowset/JoinRowSetImpl.java +++ b/src/share/classes/com/sun/rowset/JoinRowSetImpl.java @@ -876,8 +876,8 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet { String strWhereClause = "Select "; String whereClause; - String tabName= null; - String strTabName = null; + String tabName= ""; + String strTabName = ""; int sz,cols; int j; CachedRowSetImpl crs; @@ -891,8 +891,6 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet { // tableNameX.(rowsetX.getMatchColumnName()) == // tableNameZ.(rowsetZ.getMatchColumnName())); - tabName = new String(); - strTabName = new String(); sz = vecRowSetsInJOIN.size(); for(int i=0;iSerialStruct object. */ static final long serialVersionUID = -8322445504027483372L; -- GitLab