6989139: Address JDBC Findbugs where Number type Constructor are used
Reviewed-by: ohair
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java Mon Oct 04 13:04:09 2010 -0400
@@ -525,7 +525,7 @@
iMatchColumns = new Vector(10);
for(int i = 0; i < 10 ; i++) {
- iMatchColumns.add(i,new Integer(-1));
+ iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
@@ -1299,7 +1299,7 @@
tMap = new TreeMap();
for (int i = 0; i<numRows; i++) {
- tMap.put(new Integer(i), rvh.get(i));
+ tMap.put(Integer.valueOf(i), rvh.get(i));
}
return (tMap.values());
@@ -1811,7 +1811,7 @@
return (byte)0;
}
try {
- return ((new Byte(value.toString())).byteValue());
+ return ((Byte.valueOf(value.toString())).byteValue());
} catch (NumberFormatException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.bytefail").toString(),
new Object[] {value.toString().trim(), columnIndex}));
@@ -1855,7 +1855,7 @@
}
try {
- return ((new Short(value.toString().trim())).shortValue());
+ return ((Short.valueOf(value.toString().trim())).shortValue());
} catch (NumberFormatException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.shortfail").toString(),
new Object[] {value.toString().trim(), columnIndex}));
@@ -1898,7 +1898,7 @@
}
try {
- return ((new Integer(value.toString().trim())).intValue());
+ return ((Integer.valueOf(value.toString().trim())).intValue());
} catch (NumberFormatException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.intfail").toString(),
new Object[] {value.toString().trim(), columnIndex}));
@@ -1941,7 +1941,7 @@
return (long)0;
}
try {
- return ((new Long(value.toString().trim())).longValue());
+ return ((Long.valueOf(value.toString().trim())).longValue());
} catch (NumberFormatException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.longfail").toString(),
new Object[] {value.toString().trim(), columnIndex}));
@@ -4019,18 +4019,18 @@
try {
switch (trgType) {
case java.sql.Types.BIT:
- Integer i = new Integer(srcObj.toString().trim());
- return i.equals(new Integer((int)0)) ?
- new Boolean(false) :
- new Boolean(true);
+ Integer i = Integer.valueOf(srcObj.toString().trim());
+ return i.equals(Integer.valueOf((int)0)) ?
+ Boolean.valueOf(false) :
+ Boolean.valueOf(true);
case java.sql.Types.TINYINT:
- return new Byte(srcObj.toString().trim());
+ return Byte.valueOf(srcObj.toString().trim());
case java.sql.Types.SMALLINT:
- return new Short(srcObj.toString().trim());
+ return Short.valueOf(srcObj.toString().trim());
case java.sql.Types.INTEGER:
- return new Integer(srcObj.toString().trim());
+ return Integer.valueOf(srcObj.toString().trim());
case java.sql.Types.BIGINT:
- return new Long(srcObj.toString().trim());
+ return Long.valueOf(srcObj.toString().trim());
case java.sql.Types.NUMERIC:
case java.sql.Types.DECIMAL:
return new BigDecimal(srcObj.toString().trim());
@@ -4186,12 +4186,12 @@
try {
switch (trgType) {
case java.sql.Types.BIT:
- Integer i = new Integer(srcObj.toString().trim());
- return i.equals(new Integer((int)0)) ?
- new Boolean(false) :
- new Boolean(true);
+ Integer i = Integer.valueOf(srcObj.toString().trim());
+ return i.equals(Integer.valueOf((int)0)) ?
+ Boolean.valueOf(false) :
+ Boolean.valueOf(true);
case java.sql.Types.BOOLEAN:
- return new Boolean(srcObj.toString().trim());
+ return Boolean.valueOf(srcObj.toString().trim());
default:
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType);
}
@@ -4265,7 +4265,7 @@
checkIndex(columnIndex);
// make sure the cursor is on a valid row
checkCursor();
- Object obj = convertBoolean(new Boolean(x),
+ Object obj = convertBoolean(Boolean.valueOf(x),
java.sql.Types.BIT,
RowSetMD.getColumnType(columnIndex));
@@ -4301,7 +4301,7 @@
// make sure the cursor is on a valid row
checkCursor();
- Object obj = convertNumeric(new Byte(x),
+ Object obj = convertNumeric(Byte.valueOf(x),
java.sql.Types.TINYINT,
RowSetMD.getColumnType(columnIndex));
@@ -4337,7 +4337,7 @@
// make sure the cursor is on a valid row
checkCursor();
- Object obj = convertNumeric(new Short(x),
+ Object obj = convertNumeric(Short.valueOf(x),
java.sql.Types.SMALLINT,
RowSetMD.getColumnType(columnIndex));
@@ -4372,7 +4372,7 @@
checkIndex(columnIndex);
// make sure the cursor is on a valid row
checkCursor();
- Object obj = convertNumeric(new Integer(x),
+ Object obj = convertNumeric(Integer.valueOf(x),
java.sql.Types.INTEGER,
RowSetMD.getColumnType(columnIndex));
@@ -4408,7 +4408,7 @@
// make sure the cursor is on a valid row
checkCursor();
- Object obj = convertNumeric(new Long(x),
+ Object obj = convertNumeric(Long.valueOf(x),
java.sql.Types.BIGINT,
RowSetMD.getColumnType(columnIndex));
@@ -6945,7 +6945,7 @@
}
for( int i = 0;i < columnIdxes.length ;i++) {
- iMatchColumns.set(i,new Integer(-1));
+ iMatchColumns.set(i,Integer.valueOf(-1));
}
}
@@ -7054,7 +7054,7 @@
}
}
for(int i = 0 ;i < columnIdxes.length; i++) {
- iMatchColumns.add(i,new Integer(columnIdxes[i]));
+ iMatchColumns.add(i,Integer.valueOf(columnIdxes[i]));
}
}
@@ -7109,7 +7109,7 @@
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString());
} else {
// set iMatchColumn
- iMatchColumns.set(0, new Integer(columnIdx));
+ iMatchColumns.set(0, Integer.valueOf(columnIdx));
//strMatchColumn = null;
}
}
@@ -7131,7 +7131,7 @@
*/
public void setMatchColumn(String columnName) throws SQLException {
// validate, if col is ok to be set
- if(columnName.equals(null) || ((columnName = columnName.trim()) == "" )) {
+ if(columnName == null || (columnName= columnName.trim()).equals("") ) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString());
} else {
// set strMatchColumn
@@ -7156,13 +7156,13 @@
*/
public void unsetMatchColumn(int columnIdx) throws SQLException {
// check if we are unsetting the SAME column
- if(! iMatchColumns.get(0).equals(new Integer(columnIdx) ) ) {
+ if(! iMatchColumns.get(0).equals(Integer.valueOf(columnIdx) ) ) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString());
} else if(strMatchColumns.get(0) != null) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString());
} else {
// that is, we are unsetting it.
- iMatchColumns.set(0, new Integer(-1));
+ iMatchColumns.set(0, Integer.valueOf(-1));
}
}
--- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java Mon Oct 04 13:04:09 2010 -0400
@@ -499,7 +499,7 @@
if(onInsertRow) {
if(p != null) {
- bool = p.evaluate(new Integer(x),columnIndex);
+ bool = p.evaluate(Integer.valueOf(x),columnIndex);
if(!bool) {
throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString());
@@ -566,7 +566,7 @@
if(onInsertRow) {
if(p != null) {
- bool = p.evaluate(new Boolean(x) , columnIndex);
+ bool = p.evaluate(Boolean.valueOf(x) , columnIndex);
if(!bool) {
throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString());
@@ -634,7 +634,7 @@
if(onInsertRow) {
if(p != null) {
- bool = p.evaluate(new Byte(x),columnIndex);
+ bool = p.evaluate(Byte.valueOf(x),columnIndex);
if(!bool) {
throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString());
@@ -703,7 +703,7 @@
if(onInsertRow) {
if(p != null) {
- bool = p.evaluate(new Short(x), columnIndex);
+ bool = p.evaluate(Short.valueOf(x), columnIndex);
if(!bool) {
throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString());
@@ -771,7 +771,7 @@
if(onInsertRow) {
if(p != null) {
- bool = p.evaluate(new Long(x), columnIndex);
+ bool = p.evaluate(Long.valueOf(x), columnIndex);
if(!bool) {
throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString());
@@ -1111,7 +1111,7 @@
Byte [] obj_arr = new Byte[x.length];
for(int i = 0; i < x.length; i++) {
- obj_arr[i] = new Byte(x[i]);
+ obj_arr[i] = Byte.valueOf(x[i]);
val = val.concat(obj_arr[i].toString());
}
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Mon Oct 04 13:04:09 2010 -0400
@@ -215,7 +215,7 @@
iMatchColumns = new Vector(10);
for(int i = 0; i < 10 ; i++) {
- iMatchColumns.add(i,new Integer(-1));
+ iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
@@ -288,7 +288,7 @@
iMatchColumns = new Vector(10);
for(int i = 0; i < 10 ; i++) {
- iMatchColumns.add(i,new Integer(-1));
+ iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
@@ -375,7 +375,7 @@
iMatchColumns = new Vector(10);
for(int i = 0; i < 10 ; i++) {
- iMatchColumns.add(i,new Integer(-1));
+ iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
@@ -465,7 +465,7 @@
iMatchColumns = new Vector(10);
for(int i = 0; i < 10 ; i++) {
- iMatchColumns.add(i,new Integer(-1));
+ iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
@@ -3754,7 +3754,7 @@
}
for( int i = 0;i < columnIdxes.length ;i++) {
- iMatchColumns.set(i,new Integer(-1));
+ iMatchColumns.set(i,Integer.valueOf(-1));
}
}
@@ -3863,7 +3863,7 @@
}
}
for(int i = 0 ;i < columnIdxes.length; i++) {
- iMatchColumns.add(i,new Integer(columnIdxes[i]));
+ iMatchColumns.add(i,Integer.valueOf(columnIdxes[i]));
}
}
@@ -3918,7 +3918,7 @@
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols1").toString());
} else {
// set iMatchColumn
- iMatchColumns.set(0, new Integer(columnIdx));
+ iMatchColumns.set(0, Integer.valueOf(columnIdx));
//strMatchColumn = null;
}
}
@@ -3940,7 +3940,7 @@
*/
public void setMatchColumn(String columnName) throws SQLException {
// validate, if col is ok to be set
- if(columnName.equals(null) || ((columnName = columnName.trim()) == "" )) {
+ if(columnName == null || (columnName= columnName.trim()).equals("")) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString());
} else {
// set strMatchColumn
@@ -3965,13 +3965,13 @@
*/
public void unsetMatchColumn(int columnIdx) throws SQLException {
// check if we are unsetting the SAME column
- if(! iMatchColumns.get(0).equals(new Integer(columnIdx) ) ) {
+ if(! iMatchColumns.get(0).equals(Integer.valueOf(columnIdx) ) ) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.unsetmatch").toString());
} else if(strMatchColumns.get(0) != null) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.usecolname").toString());
} else {
// that is, we are unsetting it.
- iMatchColumns.set(0, new Integer(-1));
+ iMatchColumns.set(0, Integer.valueOf(-1));
}
}
--- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java Mon Oct 04 13:04:09 2010 -0400
@@ -552,7 +552,7 @@
// This 'if' will be removed after all joins are implemented.
throw new SQLException(resBundle.handleGetObject("joinrowsetimpl.notsupported").toString());
} else {
- Integer Intgr = new Integer(JoinRowSet.INNER_JOIN);
+ Integer Intgr = Integer.valueOf(JoinRowSet.INNER_JOIN);
vecJoinType.add(Intgr);
}
} else {
--- a/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java Mon Oct 04 13:04:09 2010 -0400
@@ -338,11 +338,11 @@
if (crs.rowDeleted()) {
// The row has been deleted.
if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) {
- status.add(rows, new Integer(SyncResolver.DELETE_ROW_CONFLICT));
+ status.add(rows, Integer.valueOf(SyncResolver.DELETE_ROW_CONFLICT));
} else {
// delete happened without any occurrence of conflicts
// so update status accordingly
- status.add(rows, new Integer(SyncResolver.NO_ROW_CONFLICT));
+ status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
}
} else if (crs.rowInserted()) {
@@ -350,20 +350,20 @@
pstmtIns = con.prepareStatement(insertCmd);
if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) {
- status.add(rows, new Integer(SyncResolver.INSERT_ROW_CONFLICT));
+ status.add(rows, Integer.valueOf(SyncResolver.INSERT_ROW_CONFLICT));
} else {
// insert happened without any occurrence of conflicts
// so update status accordingly
- status.add(rows, new Integer(SyncResolver.NO_ROW_CONFLICT));
+ status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
}
} else if (crs.rowUpdated()) {
// The row has been updated.
if ( conflict = (updateOriginalRow(crs)) == true) {
- status.add(rows, new Integer(SyncResolver.UPDATE_ROW_CONFLICT));
+ status.add(rows, Integer.valueOf(SyncResolver.UPDATE_ROW_CONFLICT));
} else {
// update happened without any occurrence of conflicts
// so update status accordingly
- status.add(rows, new Integer(SyncResolver.NO_ROW_CONFLICT));
+ status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
}
} else {
@@ -375,7 +375,7 @@
* that is fine.
**/
int icolCount = crs.getMetaData().getColumnCount();
- status.add(rows, new Integer(SyncResolver.NO_ROW_CONFLICT));
+ status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
this.crsResolve.moveToInsertRow();
for(int cols=0;cols<iColCount;cols++) {
@@ -398,7 +398,7 @@
boolean boolConf = false;
for (int j=1;j<status.size();j++){
// ignore status for index = 0 which is set to null
- if(! ((status.get(j)).equals(new Integer(SyncResolver.NO_ROW_CONFLICT)))) {
+ if(! ((status.get(j)).equals(Integer.valueOf(SyncResolver.NO_ROW_CONFLICT)))) {
// there is at least one conflict which needs to be resolved
boolConf = true;
break;
@@ -652,7 +652,7 @@
updateExec += ", ";
}
updateExec += crs.getMetaData().getColumnName(i);
- cols.add(new Integer(i));
+ cols.add(Integer.valueOf(i));
updateExec += " = ? ";
first = false;
@@ -698,7 +698,7 @@
updateExec += ", ";
}
updateExec += crs.getMetaData().getColumnName(i);
- cols.add(new Integer(i));
+ cols.add(Integer.valueOf(i));
updateExec += " = ? ";
flag = false;
} else {
--- a/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java Mon Oct 04 13:04:09 2010 -0400
@@ -387,7 +387,7 @@
if (caller.wasNull())
writeNull();
else
- writeInteger(caller.getInt(idx));
+ writeInteger(i);
break;
case java.sql.Types.BIGINT:
long l = caller.getLong(idx);
@@ -574,7 +574,7 @@
}
private void writeBoolean(boolean b) throws java.io.IOException {
- writer.write(new Boolean(b).toString());
+ writer.write(Boolean.valueOf(b).toString());
}
private void writeFloat(float f) throws java.io.IOException {
--- a/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java Mon Oct 04 13:04:09 2010 -0400
@@ -481,21 +481,21 @@
items = properties.length;
for (i=0;i<items;i++) {
- propMap.put(properties[i], new Integer(i));
+ propMap.put(properties[i], Integer.valueOf(i));
}
colDefMap = new HashMap();
items = colDef.length;
for (i=0;i<items;i++) {
- colDefMap.put(colDef[i], new Integer(i));
+ colDefMap.put(colDef[i], Integer.valueOf(i));
}
dataMap = new HashMap();
items = data.length;
for (i=0;i<items;i++) {
- dataMap.put(data[i], new Integer(i));
+ dataMap.put(data[i], Integer.valueOf(i));
}
//Initialize connection map here
@@ -981,7 +981,7 @@
private boolean getBooleanValue(String s) {
- return new Boolean(s).booleanValue();
+ return Boolean.valueOf(s).booleanValue();
}
private java.math.BigDecimal getBigDecimalValue(String s) {
@@ -1316,7 +1316,7 @@
**/
tempUpdate = tempUpdate.concat(new String(ch,start,len));
- upd[0] = new Integer(idx);
+ upd[0] = Integer.valueOf(idx);
upd[1] = tempUpdate;
//updates.add(upd);
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Mon Oct 04 13:04:09 2010 -0400
@@ -1563,13 +1563,13 @@
nullVal = new Object[2];
nullVal[0] = null;
- nullVal[1] = new Integer(sqlType);
+ nullVal[1] = Integer.valueOf(sqlType);
if (params == null){
throw new SQLException("Set initParams() before setNull");
}
- params.put(new Integer(parameterIndex - 1), nullVal);
+ params.put(Integer.valueOf(parameterIndex - 1), nullVal);
}
/**
@@ -1644,14 +1644,14 @@
nullVal = new Object[3];
nullVal[0] = null;
- nullVal[1] = new Integer(sqlType);
+ nullVal[1] = Integer.valueOf(sqlType);
nullVal[2] = typeName;
if(params == null){
throw new SQLException("Set initParams() before setNull");
}
- params.put(new Integer(parameterIndex - 1), nullVal);
+ params.put(Integer.valueOf(parameterIndex - 1), nullVal);
}
@@ -1686,7 +1686,7 @@
throw new SQLException("Set initParams() before setNull");
}
- params.put(new Integer(parameterIndex - 1), new Boolean(x));
+ params.put(Integer.valueOf(parameterIndex - 1), Boolean.valueOf(x));
}
/**
@@ -1720,7 +1720,7 @@
throw new SQLException("Set initParams() before setByte");
}
- params.put(new Integer(parameterIndex - 1), new Byte(x));
+ params.put(Integer.valueOf(parameterIndex - 1), Byte.valueOf(x));
}
/**
@@ -1754,7 +1754,7 @@
throw new SQLException("Set initParams() before setShort");
}
- params.put(new Integer(parameterIndex - 1), new Short(x));
+ params.put(Integer.valueOf(parameterIndex - 1), Short.valueOf(x));
}
/**
@@ -1786,7 +1786,7 @@
if(params == null){
throw new SQLException("Set initParams() before setInt");
}
- params.put(new Integer(parameterIndex - 1), new Integer(x));
+ params.put(Integer.valueOf(parameterIndex - 1), Integer.valueOf(x));
}
/**
@@ -1818,7 +1818,7 @@
if(params == null){
throw new SQLException("Set initParams() before setLong");
}
- params.put(new Integer(parameterIndex - 1), new Long(x));
+ params.put(Integer.valueOf(parameterIndex - 1), Long.valueOf(x));
}
/**
@@ -1850,7 +1850,7 @@
if(params == null){
throw new SQLException("Set initParams() before setFloat");
}
- params.put(new Integer(parameterIndex - 1), new Float(x));
+ params.put(Integer.valueOf(parameterIndex - 1), new Float(x));
}
/**
@@ -1882,7 +1882,7 @@
if(params == null){
throw new SQLException("Set initParams() before setDouble");
}
- params.put(new Integer(parameterIndex - 1), new Double(x));
+ params.put(Integer.valueOf(parameterIndex - 1), new Double(x));
}
/**
@@ -1914,7 +1914,7 @@
if(params == null){
throw new SQLException("Set initParams() before setBigDecimal");
}
- params.put(new Integer(parameterIndex - 1), x);
+ params.put(Integer.valueOf(parameterIndex - 1), x);
}
/**
@@ -1948,7 +1948,7 @@
if(params == null){
throw new SQLException("Set initParams() before setString");
}
- params.put(new Integer(parameterIndex - 1), x);
+ params.put(Integer.valueOf(parameterIndex - 1), x);
}
/**
@@ -1982,7 +1982,7 @@
if(params == null){
throw new SQLException("Set initParams() before setBytes");
}
- params.put(new Integer(parameterIndex - 1), x);
+ params.put(Integer.valueOf(parameterIndex - 1), x);
}
/**
@@ -2024,7 +2024,7 @@
if(params == null){
throw new SQLException("Set initParams() before setDate");
}
- params.put(new Integer(parameterIndex - 1), x);
+ params.put(Integer.valueOf(parameterIndex - 1), x);
}
/**
@@ -2069,7 +2069,7 @@
throw new SQLException("Set initParams() before setTime");
}
- params.put(new Integer(parameterIndex - 1), x);
+ params.put(Integer.valueOf(parameterIndex - 1), x);
}
/**
@@ -2112,7 +2112,7 @@
throw new SQLException("Set initParams() before setTimestamp");
}
- params.put(new Integer(parameterIndex - 1), x);
+ params.put(Integer.valueOf(parameterIndex - 1), x);
}
/**
@@ -2185,14 +2185,14 @@
asciiStream = new Object[3];
asciiStream[0] = x;
- asciiStream[1] = new Integer(length);
- asciiStream[2] = new Integer(ASCII_STREAM_PARAM);
+ asciiStream[1] = Integer.valueOf(length);
+ asciiStream[2] = Integer.valueOf(ASCII_STREAM_PARAM);
if(params == null){
throw new SQLException("Set initParams() before setAsciiStream");
}
- params.put(new Integer(parameterIndex - 1), asciiStream);
+ params.put(Integer.valueOf(parameterIndex - 1), asciiStream);
}
/**
@@ -2290,13 +2290,13 @@
binaryStream = new Object[3];
binaryStream[0] = x;
- binaryStream[1] = new Integer(length);
- binaryStream[2] = new Integer(BINARY_STREAM_PARAM);
+ binaryStream[1] = Integer.valueOf(length);
+ binaryStream[2] = Integer.valueOf(BINARY_STREAM_PARAM);
if(params == null){
throw new SQLException("Set initParams() before setBinaryStream");
}
- params.put(new Integer(parameterIndex - 1), binaryStream);
+ params.put(Integer.valueOf(parameterIndex - 1), binaryStream);
}
@@ -2396,12 +2396,12 @@
unicodeStream = new Object[3];
unicodeStream[0] = x;
- unicodeStream[1] = new Integer(length);
- unicodeStream[2] = new Integer(UNICODE_STREAM_PARAM);
+ unicodeStream[1] = Integer.valueOf(length);
+ unicodeStream[2] = Integer.valueOf(UNICODE_STREAM_PARAM);
if(params == null){
throw new SQLException("Set initParams() before setUnicodeStream");
}
- params.put(new Integer(parameterIndex - 1), unicodeStream);
+ params.put(Integer.valueOf(parameterIndex - 1), unicodeStream);
}
/**
@@ -2475,11 +2475,11 @@
charStream = new Object[2];
charStream[0] = reader;
- charStream[1] = new Integer(length);
+ charStream[1] = Integer.valueOf(length);
if(params == null){
throw new SQLException("Set initParams() before setCharacterStream");
}
- params.put(new Integer(parameterIndex - 1), charStream);
+ params.put(Integer.valueOf(parameterIndex - 1), charStream);
}
/**
@@ -2591,12 +2591,12 @@
obj = new Object[3];
obj[0] = x;
- obj[1] = new Integer(targetSqlType);
- obj[2] = new Integer(scale);
+ obj[1] = Integer.valueOf(targetSqlType);
+ obj[2] = Integer.valueOf(scale);
if(params == null){
throw new SQLException("Set initParams() before setObject");
}
- params.put(new Integer(parameterIndex - 1), obj);
+ params.put(Integer.valueOf(parameterIndex - 1), obj);
}
/**
@@ -2654,11 +2654,11 @@
obj = new Object[2];
obj[0] = x;
- obj[1] = new Integer(targetSqlType);
+ obj[1] = Integer.valueOf(targetSqlType);
if (params == null){
throw new SQLException("Set initParams() before setObject");
}
- params.put(new Integer(parameterIndex - 1), obj);
+ params.put(Integer.valueOf(parameterIndex - 1), obj);
}
/**
@@ -2726,7 +2726,7 @@
if (params == null) {
throw new SQLException("Set initParams() before setObject");
}
- params.put(new Integer(parameterIndex - 1), x);
+ params.put(Integer.valueOf(parameterIndex - 1), x);
}
/**
@@ -2773,7 +2773,7 @@
if (params == null) {
throw new SQLException("Set initParams() before setRef");
}
- params.put(new Integer(parameterIndex - 1), new SerialRef(ref));
+ params.put(Integer.valueOf(parameterIndex - 1), new SerialRef(ref));
}
/**
@@ -2817,7 +2817,7 @@
if(params == null){
throw new SQLException("Set initParams() before setBlob");
}
- params.put(new Integer(parameterIndex - 1), new SerialBlob(x));
+ params.put(Integer.valueOf(parameterIndex - 1), new SerialBlob(x));
}
/**
@@ -2862,7 +2862,7 @@
if(params == null){
throw new SQLException("Set initParams() before setClob");
}
- params.put(new Integer(parameterIndex - 1), new SerialClob(x));
+ params.put(Integer.valueOf(parameterIndex - 1), new SerialClob(x));
}
/**
@@ -2910,7 +2910,7 @@
if (params == null){
throw new SQLException("Set initParams() before setArray");
}
- params.put(new Integer(parameterIndex - 1), new SerialArray(array));
+ params.put(Integer.valueOf(parameterIndex - 1), new SerialArray(array));
}
/**
@@ -2975,7 +2975,7 @@
if(params == null){
throw new SQLException("Set initParams() before setDate");
}
- params.put(new Integer(parameterIndex - 1), date);
+ params.put(Integer.valueOf(parameterIndex - 1), date);
}
/**
@@ -3041,7 +3041,7 @@
if(params == null){
throw new SQLException("Set initParams() before setTime");
}
- params.put(new Integer(parameterIndex - 1), time);
+ params.put(Integer.valueOf(parameterIndex - 1), time);
}
/**
@@ -3107,7 +3107,7 @@
if(params == null){
throw new SQLException("Set initParams() before setTimestamp");
}
- params.put(new Integer(parameterIndex - 1), timestamp);
+ params.put(Integer.valueOf(parameterIndex - 1), timestamp);
}
/**
@@ -3181,7 +3181,7 @@
Object[] paramsArray = new Object[params.size()];
for (int i = 0; i < params.size(); i++) {
- paramsArray[i] = params.get(new Integer(i));
+ paramsArray[i] = params.get(Integer.valueOf(i));
if (paramsArray[i] == null) {
throw new SQLException("missing parameter: " + (i + 1));
} //end if
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java Mon Oct 04 13:04:09 2010 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -137,7 +137,7 @@
* values of a UDT to the database.
*/
public void writeBoolean(boolean x) throws SQLException {
- attribs.add(new Boolean(x));
+ attribs.add(Boolean.valueOf(x));
}
/**
@@ -151,7 +151,7 @@
* values of a UDT to the database.
*/
public void writeByte(byte x) throws SQLException {
- attribs.add(new Byte(x));
+ attribs.add(Byte.valueOf(x));
}
/**
@@ -165,7 +165,7 @@
* values of a UDT to the database.
*/
public void writeShort(short x) throws SQLException {
- attribs.add(new Short(x));
+ attribs.add(Short.valueOf(x));
}
/**
@@ -179,7 +179,7 @@
* values of a UDT to the database.
*/
public void writeInt(int x) throws SQLException {
- attribs.add(new Integer(x));
+ attribs.add(Integer.valueOf(x));
}
/**
@@ -193,7 +193,7 @@
* values of a UDT to the database.
*/
public void writeLong(long x) throws SQLException {
- attribs.add(new Long(x));
+ attribs.add(Long.valueOf(x));
}
/**
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java Mon Oct 04 14:17:36 2010 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java Mon Oct 04 13:04:09 2010 -0400
@@ -110,7 +110,7 @@
throws SerialException
{
map = new Hashtable(map);
- if (!object.equals(null)) {
+ if (object != null) {
return map.get(object);
} else {
throw new SerialException("The object is not set");