提交 e9fa0107 编写于 作者: L lancea

7116445: Miscellaneous warnings in the JDBC/RowSet classes

Reviewed-by: smarks, chegar
上级 f0d5072b
...@@ -357,7 +357,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -357,7 +357,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
// set the Reader, this maybe overridden latter // set the Reader, this maybe overridden latter
provider = provider =
(SyncProvider)SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER); SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER);
if (!(provider instanceof RIOptimisticProvider)) { if (!(provider instanceof RIOptimisticProvider)) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidp").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidp").toString());
...@@ -445,11 +445,10 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -445,11 +445,10 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
* @param env a <code>Hashtable</code> object with a list of desired * @param env a <code>Hashtable</code> object with a list of desired
* synchronization providers * synchronization providers
* @throws SQLException if the requested provider cannot be found by the * @throws SQLException if the requested provider cannot be found by the
* synchonization factory * synchronization factory
* @see SyncProvider * @see SyncProvider
*/ */
public CachedRowSetImpl(@SuppressWarnings("rawtypes") Hashtable env) throws SQLException {
public CachedRowSetImpl(Hashtable env) throws SQLException {
try { try {
...@@ -467,7 +466,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -467,7 +466,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
// set the Reader, this maybe overridden latter // set the Reader, this maybe overridden latter
provider = provider =
(SyncProvider)SyncFactory.getInstance(providerName); SyncFactory.getInstance(providerName);
rowSetReader = provider.getRowSetReader(); rowSetReader = provider.getRowSetReader();
rowSetWriter = provider.getRowSetWriter(); rowSetWriter = provider.getRowSetWriter();
...@@ -525,7 +524,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -525,7 +524,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
iMatchColumns = new Vector<Integer>(10); iMatchColumns = new Vector<Integer>(10);
for(int i = 0; i < 10 ; i++) { for(int i = 0; i < 10 ; i++) {
iMatchColumns.add(i,Integer.valueOf(-1)); iMatchColumns.add(i, -1);
} }
strMatchColumns = new Vector<String>(10); strMatchColumns = new Vector<String>(10);
...@@ -540,7 +539,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -540,7 +539,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/ */
private void checkTransactionalWriter() { private void checkTransactionalWriter() {
if (rowSetWriter != null) { if (rowSetWriter != null) {
Class c = rowSetWriter.getClass(); Class<?> c = rowSetWriter.getClass();
if (c != null) { if (c != null) {
Class[] theInterfaces = c.getInterfaces(); Class[] theInterfaces = c.getInterfaces();
for (int i = 0; i < theInterfaces.length; i++) { for (int i = 0; i < theInterfaces.length; i++) {
...@@ -685,7 +684,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -685,7 +684,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
obj = new SerialArray((java.sql.Array)obj); obj = new SerialArray((java.sql.Array)obj);
} }
((Row)currentRow).initColumnObject(i, obj); currentRow.initColumnObject(i, obj);
} }
rowsFetched++; rowsFetched++;
rvh.add(currentRow); rvh.add(currentRow);
...@@ -881,7 +880,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -881,7 +880,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
cursorPos = saveCursorPos; cursorPos = saveCursorPos;
} }
if ((tXWriter) && this.COMMIT_ON_ACCEPT_CHANGES) { if (tXWriter) {
// do commit/rollback's here // do commit/rollback's here
if (!conflict) { if (!conflict) {
tWriter = (TransactionalWriter)rowSetWriter; tWriter = (TransactionalWriter)rowSetWriter;
...@@ -901,7 +900,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -901,7 +900,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
if (success == true) { if (success == true) {
setOriginal(); setOriginal();
} else if (!(success) && !(this.COMMIT_ON_ACCEPT_CHANGES)) { } else if (!(success) ) {
throw new SyncProviderException(resBundle.handleGetObject("cachedrowsetimpl.accfailed").toString()); throw new SyncProviderException(resBundle.handleGetObject("cachedrowsetimpl.accfailed").toString());
} }
...@@ -938,10 +937,8 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -938,10 +937,8 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
* @see javax.sql.rowset.spi.SyncProvider * @see javax.sql.rowset.spi.SyncProvider
*/ */
public void acceptChanges(Connection con) throws SyncProviderException{ public void acceptChanges(Connection con) throws SyncProviderException{
setConnection(con); setConnection(con);
acceptChanges(); acceptChanges();
} }
/** /**
...@@ -957,7 +954,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -957,7 +954,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/ */
public void restoreOriginal() throws SQLException { public void restoreOriginal() throws SQLException {
Row currentRow; Row currentRow;
for (Iterator i = rvh.iterator(); i.hasNext();) { for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
currentRow = (Row)i.next(); currentRow = (Row)i.next();
if (currentRow.getInserted() == true) { if (currentRow.getInserted() == true) {
i.remove(); i.remove();
...@@ -1287,7 +1284,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -1287,7 +1284,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
TreeMap<Integer, Object> tMap = new TreeMap<>(); TreeMap<Integer, Object> tMap = new TreeMap<>();
for (int i = 0; i<numRows; i++) { for (int i = 0; i<numRows; i++) {
tMap.put(Integer.valueOf(i), rvh.get(i)); tMap.put(i, rvh.get(i));
} }
return (tMap.values()); return (tMap.values());
...@@ -1379,7 +1376,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -1379,7 +1376,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/ */
public void setSyncProvider(String providerStr) throws SQLException { public void setSyncProvider(String providerStr) throws SQLException {
provider = provider =
(SyncProvider)SyncFactory.getInstance(providerStr); SyncFactory.getInstance(providerStr);
rowSetReader = provider.getRowSetReader(); rowSetReader = provider.getRowSetReader();
rowSetWriter = provider.getRowSetWriter(); rowSetWriter = provider.getRowSetWriter();
...@@ -1880,7 +1877,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -1880,7 +1877,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
// check for SQL NULL // check for SQL NULL
if (value == null) { if (value == null) {
setLastValueNull(true); setLastValueNull(true);
return (int)0; return 0;
} }
try { try {
...@@ -2353,7 +2350,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -2353,7 +2350,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
throw new SQLException(ex.getMessage()); throw new SQLException(ex.getMessage());
} }
return (java.io.InputStream)asciiStream; return asciiStream;
} }
/** /**
...@@ -2399,7 +2396,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -2399,7 +2396,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
unicodeStream = new StringBufferInputStream(value.toString()); unicodeStream = new StringBufferInputStream(value.toString());
return (java.io.InputStream)unicodeStream; return unicodeStream;
} }
/** /**
...@@ -2454,7 +2451,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -2454,7 +2451,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
binaryStream = new ByteArrayInputStream((byte[])value); binaryStream = new ByteArrayInputStream((byte[])value);
return (java.io.InputStream)binaryStream; return binaryStream;
} }
...@@ -2958,7 +2955,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -2958,7 +2955,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
Struct s = (Struct)value; Struct s = (Struct)value;
map = getTypeMap(); map = getTypeMap();
// look up the class in the map // look up the class in the map
Class c = (Class)map.get(s.getSQLTypeName()); Class<?> c = map.get(s.getSQLTypeName());
if (c != null) { if (c != null) {
// create new instance of the class // create new instance of the class
SQLData obj = null; SQLData obj = null;
...@@ -3091,7 +3088,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -3091,7 +3088,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
} }
return (java.io.Reader)charStream; return charStream;
} }
/** /**
...@@ -4006,7 +4003,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -4006,7 +4003,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
switch (trgType) { switch (trgType) {
case java.sql.Types.BIT: case java.sql.Types.BIT:
Integer i = Integer.valueOf(srcObj.toString().trim()); Integer i = Integer.valueOf(srcObj.toString().trim());
return i.equals(Integer.valueOf((int)0)) ? return i.equals(0) ?
Boolean.valueOf(false) : Boolean.valueOf(false) :
Boolean.valueOf(true); Boolean.valueOf(true);
case java.sql.Types.TINYINT: case java.sql.Types.TINYINT:
...@@ -4173,7 +4170,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -4173,7 +4170,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
switch (trgType) { switch (trgType) {
case java.sql.Types.BIT: case java.sql.Types.BIT:
Integer i = Integer.valueOf(srcObj.toString().trim()); Integer i = Integer.valueOf(srcObj.toString().trim());
return i.equals(Integer.valueOf((int)0)) ? return i.equals(0) ?
Boolean.valueOf(false) : Boolean.valueOf(false) :
Boolean.valueOf(true); Boolean.valueOf(true);
case java.sql.Types.BOOLEAN: case java.sql.Types.BOOLEAN:
...@@ -4358,7 +4355,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -4358,7 +4355,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
checkIndex(columnIndex); checkIndex(columnIndex);
// make sure the cursor is on a valid row // make sure the cursor is on a valid row
checkCursor(); checkCursor();
Object obj = convertNumeric(Integer.valueOf(x), Object obj = convertNumeric(x,
java.sql.Types.INTEGER, java.sql.Types.INTEGER,
RowSetMD.getColumnType(columnIndex)); RowSetMD.getColumnType(columnIndex));
...@@ -5709,7 +5706,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -5709,7 +5706,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
Struct s = (Struct)value; Struct s = (Struct)value;
// look up the class in the map // look up the class in the map
Class c = (Class)map.get(s.getSQLTypeName()); Class<?> c = map.get(s.getSQLTypeName());
if (c != null) { if (c != null) {
// create new instance of the class // create new instance of the class
SQLData obj = null; SQLData obj = null;
...@@ -6293,7 +6290,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -6293,7 +6290,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
int colCount = RowSetMD.getColumnCount(); int colCount = RowSetMD.getColumnCount();
Row orig; Row orig;
for (Iterator i = rvh.iterator(); i.hasNext();) { for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
orig = new Row(colCount, ((Row)i.next()).getOrigRow()); orig = new Row(colCount, ((Row)i.next()).getOrigRow());
crs.rvh.add(orig); crs.rvh.add(orig);
} }
...@@ -6379,7 +6376,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -6379,7 +6376,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
* @throws SQLException if an error occurs * @throws SQLException if an error occurs
*/ */
public void setOriginal() throws SQLException { public void setOriginal() throws SQLException {
for (Iterator i = rvh.iterator(); i.hasNext();) { for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
Row row = (Row)i.next(); Row row = (Row)i.next();
makeRowOriginal(row); makeRowOriginal(row);
// remove deleted rows from the collection. // remove deleted rows from the collection.
...@@ -6930,7 +6927,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -6930,7 +6927,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
} }
for( int i = 0;i < columnIdxes.length ;i++) { for( int i = 0;i < columnIdxes.length ;i++) {
iMatchColumns.set(i,Integer.valueOf(-1)); iMatchColumns.set(i, -1);
} }
} }
...@@ -6998,7 +6995,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -6998,7 +6995,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
int [] i_temp = new int[iMatchColumns.size()]; int [] i_temp = new int[iMatchColumns.size()];
int i_val; int i_val;
i_val = ((Integer)iMatchColumns.get(0)).intValue(); i_val = iMatchColumns.get(0);
if( i_val == -1 ) { if( i_val == -1 ) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString());
...@@ -7039,7 +7036,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -7039,7 +7036,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
} }
} }
for(int i = 0 ;i < columnIdxes.length; i++) { for(int i = 0 ;i < columnIdxes.length; i++) {
iMatchColumns.add(i,Integer.valueOf(columnIdxes[i])); iMatchColumns.add(i,columnIdxes[i]);
} }
} }
...@@ -7094,7 +7091,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -7094,7 +7091,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString());
} else { } else {
// set iMatchColumn // set iMatchColumn
iMatchColumns.set(0, Integer.valueOf(columnIdx)); iMatchColumns.set(0, columnIdx);
//strMatchColumn = null; //strMatchColumn = null;
} }
} }
...@@ -7147,7 +7144,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -7147,7 +7144,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString());
} else { } else {
// that is, we are unsetting it. // that is, we are unsetting it.
iMatchColumns.set(0, Integer.valueOf(-1)); iMatchColumns.set(0, -1);
} }
} }
...@@ -7171,7 +7168,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -7171,7 +7168,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
if(!((strMatchColumns.get(0)).equals(columnName))) { if(!((strMatchColumns.get(0)).equals(columnName))) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString());
} else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) { } else if(iMatchColumns.get(0) > 0) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString());
} else { } else {
strMatchColumns.set(0, null); // that is, we are unsetting it. strMatchColumns.set(0, null); // that is, we are unsetting it.
...@@ -7369,7 +7366,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern ...@@ -7369,7 +7366,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
obj = new SerialArray((java.sql.Array)obj, map); obj = new SerialArray((java.sql.Array)obj, map);
} }
((Row)currentRow).initColumnObject(i, obj); currentRow.initColumnObject(i, obj);
} }
rowsFetched++; rowsFetched++;
maxRowsreached++; maxRowsreached++;
......
...@@ -66,6 +66,7 @@ public class FilteredRowSetImpl extends WebRowSetImpl implements Serializable, C ...@@ -66,6 +66,7 @@ public class FilteredRowSetImpl extends WebRowSetImpl implements Serializable, C
* @param env a Hashtable containing a desired synchconizatation provider * @param env a Hashtable containing a desired synchconizatation provider
* name-value pair. * name-value pair.
*/ */
@SuppressWarnings("rawtypes")
public FilteredRowSetImpl(Hashtable env) throws SQLException { public FilteredRowSetImpl(Hashtable env) throws SQLException {
super(env); super(env);
} }
......
...@@ -695,6 +695,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -695,6 +695,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
return ps; return ps;
} }
@SuppressWarnings("deprecation")
private void decodeParams(Object[] params, PreparedStatement ps) private void decodeParams(Object[] params, PreparedStatement ps)
throws SQLException { throws SQLException {
...@@ -761,14 +762,17 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -761,14 +762,17 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
ps.setUnicodeStream(i + 1, ps.setUnicodeStream(i + 1,
(java.io.InputStream)param[0], (java.io.InputStream)param[0],
((Integer)param[1]).intValue()); ((Integer)param[1]).intValue());
break;
case JdbcRowSetImpl.BINARY_STREAM_PARAM: case JdbcRowSetImpl.BINARY_STREAM_PARAM:
ps.setBinaryStream(i + 1, ps.setBinaryStream(i + 1,
(java.io.InputStream)param[0], (java.io.InputStream)param[0],
((Integer)param[1]).intValue()); ((Integer)param[1]).intValue());
break;
case JdbcRowSetImpl.ASCII_STREAM_PARAM: case JdbcRowSetImpl.ASCII_STREAM_PARAM:
ps.setAsciiStream(i + 1, ps.setAsciiStream(i + 1,
(java.io.InputStream)param[0], (java.io.InputStream)param[0],
((Integer)param[1]).intValue()); ((Integer)param[1]).intValue());
break;
default: default:
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString());
} }
...@@ -3822,7 +3826,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -3822,7 +3826,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
int [] i_temp = new int[iMatchColumns.size()]; int [] i_temp = new int[iMatchColumns.size()];
int i_val; int i_val;
i_val = ((Integer)iMatchColumns.get(0)).intValue(); i_val = iMatchColumns.get(0);
if( i_val == -1 ) { if( i_val == -1 ) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.setmatchcols").toString()); throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.setmatchcols").toString());
...@@ -3996,7 +4000,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -3996,7 +4000,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
if(!((strMatchColumns.get(0)).equals(columnName))) { if(!((strMatchColumns.get(0)).equals(columnName))) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.unsetmatch").toString()); throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.unsetmatch").toString());
} else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) { } else if(iMatchColumns.get(0) > 0) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.usecolid").toString()); throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.usecolid").toString());
} else { } else {
strMatchColumns.set(0, null); // that is, we are unsetting it. strMatchColumns.set(0, null); // that is, we are unsetting it.
......
...@@ -135,6 +135,7 @@ public class JdbcRowSetResourceBundle implements Serializable { ...@@ -135,6 +135,7 @@ public class JdbcRowSetResourceBundle implements Serializable {
* @return an enumeration of keys which have messages tranlated to * @return an enumeration of keys which have messages tranlated to
* corresponding locales. * corresponding locales.
*/ */
@SuppressWarnings("rawtypes")
public Enumeration getKeys() { public Enumeration getKeys() {
return propResBundle.getKeys(); return propResBundle.getKeys();
} }
......
...@@ -233,7 +233,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet { ...@@ -233,7 +233,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
} }
int[] indexes = new int[indices.size()]; int[] indexes = new int[indices.size()];
for(int i=0; i<indices.size();i++) for(int i=0; i<indices.size();i++)
indexes[i] = ((Integer)indices.get(i)).intValue(); indexes[i] = indices.get(i);
cRowset.setMatchColumn(indexes); cRowset.setMatchColumn(indexes);
// Set the match column here because join will be // Set the match column here because join will be
// based on columnId, // based on columnId,
...@@ -413,6 +413,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet { ...@@ -413,6 +413,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
* @throws SQLException if an error occours generating a collection * @throws SQLException if an error occours generating a collection
* of the originating RowSets contained within the JOIN. * of the originating RowSets contained within the JOIN.
*/ */
@SuppressWarnings("rawtypes")
public Collection getRowSets() throws SQLException { public Collection getRowSets() throws SQLException {
return vecRowSetsInJOIN; return vecRowSetsInJOIN;
} }
...@@ -893,7 +894,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet { ...@@ -893,7 +894,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
sz = vecRowSetsInJOIN.size(); sz = vecRowSetsInJOIN.size();
for(int i=0;i<sz; i++) { for(int i=0;i<sz; i++) {
crs = (CachedRowSetImpl)vecRowSetsInJOIN.get(i); crs = vecRowSetsInJOIN.get(i);
cols = crs.getMetaData().getColumnCount(); cols = crs.getMetaData().getColumnCount();
tabName = tabName.concat(crs.getTableName()); tabName = tabName.concat(crs.getTableName());
strTabName = strTabName.concat(tabName+", "); strTabName = strTabName.concat(tabName+", ");
...@@ -928,7 +929,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet { ...@@ -928,7 +929,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
// rowset1.getMatchColumnName() == rowset2.getMatchColumnName() // rowset1.getMatchColumnName() == rowset2.getMatchColumnName()
for(int i=0;i<sz; i++) { for(int i=0;i<sz; i++) {
strWhereClause = strWhereClause.concat( strWhereClause = strWhereClause.concat(
((CachedRowSetImpl)vecRowSetsInJOIN.get(i)).getMatchColumnNames()[0]); vecRowSetsInJOIN.get(i).getMatchColumnNames()[0]);
if(i%2!=0) { if(i%2!=0) {
strWhereClause = strWhereClause.concat("="); strWhereClause = strWhereClause.concat("=");
} else { } else {
...@@ -4175,7 +4176,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet { ...@@ -4175,7 +4176,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
// Default JoinRowSet type // Default JoinRowSet type
this.setJoinType(JoinRowSet.INNER_JOIN); this.setJoinType(JoinRowSet.INNER_JOIN);
} }
Integer i = (Integer)(vecJoinType.get(vecJoinType.size()-1)); Integer i = vecJoinType.get(vecJoinType.size()-1);
return i.intValue(); return i.intValue();
} }
......
/* /*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -101,6 +101,7 @@ public class WebRowSetImpl extends CachedRowSetImpl implements WebRowSet { ...@@ -101,6 +101,7 @@ public class WebRowSetImpl extends CachedRowSetImpl implements WebRowSet {
* synchronization providers for the relational and XML providers; or * synchronization providers for the relational and XML providers; or
* if the Hashtanle is null * if the Hashtanle is null
*/ */
@SuppressWarnings("rawtypes")
public WebRowSetImpl(Hashtable env) throws SQLException { public WebRowSetImpl(Hashtable env) throws SQLException {
try { try {
...@@ -117,7 +118,7 @@ public class WebRowSetImpl extends CachedRowSetImpl implements WebRowSet { ...@@ -117,7 +118,7 @@ public class WebRowSetImpl extends CachedRowSetImpl implements WebRowSet {
(String)env.get(javax.sql.rowset.spi.SyncFactory.ROWSET_SYNC_PROVIDER); (String)env.get(javax.sql.rowset.spi.SyncFactory.ROWSET_SYNC_PROVIDER);
// set the Reader, this maybe overridden latter // set the Reader, this maybe overridden latter
provider = (SyncProvider)SyncFactory.getInstance(providerName); provider = SyncFactory.getInstance(providerName);
// xmlReader = provider.getRowSetReader(); // xmlReader = provider.getRowSetReader();
// xmlWriter = provider.getRowSetWriter(); // xmlWriter = provider.getRowSetWriter();
......
...@@ -363,6 +363,7 @@ public class CachedRowSetReader implements RowSetReader, Serializable { ...@@ -363,6 +363,7 @@ public class CachedRowSetReader implements RowSetReader, Serializable {
* the given parameters are to be set * the given parameters are to be set
* @throws SQLException if an access error occurs * @throws SQLException if an access error occurs
*/ */
@SuppressWarnings("deprecation")
private void decodeParams(Object[] params, private void decodeParams(Object[] params,
PreparedStatement pstmt) throws SQLException { PreparedStatement pstmt) throws SQLException {
// There is a corresponding decodeParams in JdbcRowSetImpl // There is a corresponding decodeParams in JdbcRowSetImpl
...@@ -428,14 +429,17 @@ public class CachedRowSetReader implements RowSetReader, Serializable { ...@@ -428,14 +429,17 @@ public class CachedRowSetReader implements RowSetReader, Serializable {
pstmt.setUnicodeStream(i + 1, pstmt.setUnicodeStream(i + 1,
(java.io.InputStream)param[0], (java.io.InputStream)param[0],
((Integer)param[1]).intValue()); ((Integer)param[1]).intValue());
break;
case CachedRowSetImpl.BINARY_STREAM_PARAM: case CachedRowSetImpl.BINARY_STREAM_PARAM:
pstmt.setBinaryStream(i + 1, pstmt.setBinaryStream(i + 1,
(java.io.InputStream)param[0], (java.io.InputStream)param[0],
((Integer)param[1]).intValue()); ((Integer)param[1]).intValue());
break;
case CachedRowSetImpl.ASCII_STREAM_PARAM: case CachedRowSetImpl.ASCII_STREAM_PARAM:
pstmt.setAsciiStream(i + 1, pstmt.setAsciiStream(i + 1,
(java.io.InputStream)param[0], (java.io.InputStream)param[0],
((Integer)param[1]).intValue()); ((Integer)param[1]).intValue());
break;
default: default:
throw new SQLException(resBundle.handleGetObject("crsreader.paramtype").toString()); throw new SQLException(resBundle.handleGetObject("crsreader.paramtype").toString());
} }
......
...@@ -183,7 +183,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -183,7 +183,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
/** /**
* This <code>ArrayList<code> will hold the values of SyncResolver.* * This <code>ArrayList<code> will hold the values of SyncResolver.*
*/ */
private ArrayList status; private ArrayList<Integer> status;
/** /**
* This will check whether the same field value has changed both * This will check whether the same field value has changed both
...@@ -305,7 +305,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -305,7 +305,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
iColCount = rsmdWrite.getColumnCount(); iColCount = rsmdWrite.getColumnCount();
int sz= crs.size()+1; int sz= crs.size()+1;
status = new ArrayList(sz); status = new ArrayList<>(sz);
status.add(0,null); status.add(0,null);
rsmdResolv.setColumnCount(iColCount); rsmdResolv.setColumnCount(iColCount);
...@@ -338,11 +338,11 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -338,11 +338,11 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
if (crs.rowDeleted()) { if (crs.rowDeleted()) {
// The row has been deleted. // The row has been deleted.
if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) { if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) {
status.add(rows, Integer.valueOf(SyncResolver.DELETE_ROW_CONFLICT)); status.add(rows, SyncResolver.DELETE_ROW_CONFLICT);
} else { } else {
// delete happened without any occurrence of conflicts // delete happened without any occurrence of conflicts
// so update status accordingly // so update status accordingly
status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT)); status.add(rows, SyncResolver.NO_ROW_CONFLICT);
} }
} else if (crs.rowInserted()) { } else if (crs.rowInserted()) {
...@@ -350,20 +350,20 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -350,20 +350,20 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
pstmtIns = con.prepareStatement(insertCmd); pstmtIns = con.prepareStatement(insertCmd);
if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) { if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) {
status.add(rows, Integer.valueOf(SyncResolver.INSERT_ROW_CONFLICT)); status.add(rows, SyncResolver.INSERT_ROW_CONFLICT);
} else { } else {
// insert happened without any occurrence of conflicts // insert happened without any occurrence of conflicts
// so update status accordingly // so update status accordingly
status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT)); status.add(rows, SyncResolver.NO_ROW_CONFLICT);
} }
} else if (crs.rowUpdated()) { } else if (crs.rowUpdated()) {
// The row has been updated. // The row has been updated.
if ( conflict = (updateOriginalRow(crs)) == true) { if ( conflict = (updateOriginalRow(crs)) == true) {
status.add(rows, Integer.valueOf(SyncResolver.UPDATE_ROW_CONFLICT)); status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT);
} else { } else {
// update happened without any occurrence of conflicts // update happened without any occurrence of conflicts
// so update status accordingly // so update status accordingly
status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT)); status.add(rows, SyncResolver.NO_ROW_CONFLICT);
} }
} else { } else {
...@@ -375,7 +375,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -375,7 +375,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
* that is fine. * that is fine.
**/ **/
int icolCount = crs.getMetaData().getColumnCount(); int icolCount = crs.getMetaData().getColumnCount();
status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT)); status.add(rows, SyncResolver.NO_ROW_CONFLICT);
this.crsResolve.moveToInsertRow(); this.crsResolve.moveToInsertRow();
for(int cols=0;cols<iColCount;cols++) { for(int cols=0;cols<iColCount;cols++) {
...@@ -398,7 +398,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -398,7 +398,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
boolean boolConf = false; boolean boolConf = false;
for (int j=1;j<status.size();j++){ for (int j=1;j<status.size();j++){
// ignore status for index = 0 which is set to null // ignore status for index = 0 which is set to null
if(! ((status.get(j)).equals(Integer.valueOf(SyncResolver.NO_ROW_CONFLICT)))) { if(! ((status.get(j)).equals(SyncResolver.NO_ROW_CONFLICT))) {
// there is at least one conflict which needs to be resolved // there is at least one conflict which needs to be resolved
boolConf = true; boolConf = true;
break; break;
...@@ -540,7 +540,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -540,7 +540,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// how many fields need to be updated // how many fields need to be updated
int colsNotChanged = 0; int colsNotChanged = 0;
Vector cols = new Vector(); Vector<Integer> cols = new Vector<>();
String updateExec = updateCmd; String updateExec = updateCmd;
Object orig; Object orig;
Object curr; Object curr;
...@@ -566,14 +566,14 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -566,14 +566,14 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
* into a CachedRowSet so that comparison of the column values * into a CachedRowSet so that comparison of the column values
* from the ResultSet and CachedRowSet are possible * from the ResultSet and CachedRowSet are possible
*/ */
Map map = (crs.getTypeMap() == null)?con.getTypeMap():crs.getTypeMap(); Map<String, Class<?>> map = (crs.getTypeMap() == null)?con.getTypeMap():crs.getTypeMap();
if (rsval instanceof Struct) { if (rsval instanceof Struct) {
Struct s = (Struct)rsval; Struct s = (Struct)rsval;
// look up the class in the map // look up the class in the map
Class c = null; Class<?> c = null;
c = (Class)map.get(s.getSQLTypeName()); c = map.get(s.getSQLTypeName());
if (c != null) { if (c != null) {
// create new instance of the class // create new instance of the class
SQLData obj = null; SQLData obj = null;
...@@ -652,7 +652,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -652,7 +652,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
updateExec += ", "; updateExec += ", ";
} }
updateExec += crs.getMetaData().getColumnName(i); updateExec += crs.getMetaData().getColumnName(i);
cols.add(Integer.valueOf(i)); cols.add(i);
updateExec += " = ? "; updateExec += " = ? ";
first = false; first = false;
...@@ -698,7 +698,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -698,7 +698,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
updateExec += ", "; updateExec += ", ";
} }
updateExec += crs.getMetaData().getColumnName(i); updateExec += crs.getMetaData().getColumnName(i);
cols.add(Integer.valueOf(i)); cols.add(i);
updateExec += " = ? "; updateExec += " = ? ";
flag = false; flag = false;
} else { } else {
...@@ -749,7 +749,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -749,7 +749,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// Comments needed here // Comments needed here
for (i = 0; i < cols.size(); i++) { for (i = 0; i < cols.size(); i++) {
Object obj = crs.getObject(((Integer)cols.get(i)).intValue()); Object obj = crs.getObject(cols.get(i));
if (obj != null) if (obj != null)
pstmt.setObject(i + 1, obj); pstmt.setObject(i + 1, obj);
else else
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -27,9 +27,7 @@ package com.sun.rowset.internal; ...@@ -27,9 +27,7 @@ package com.sun.rowset.internal;
import java.sql.*; import java.sql.*;
import java.io.*; import java.io.*;
import java.math.*;
import java.lang.*; import java.lang.*;
import java.lang.reflect.*;
import java.util.*; import java.util.*;
/** /**
...@@ -48,6 +46,8 @@ import java.util.*; ...@@ -48,6 +46,8 @@ import java.util.*;
*/ */
public class Row extends BaseRow implements Serializable, Cloneable { public class Row extends BaseRow implements Serializable, Cloneable {
static final long serialVersionUID = 5047859032611314762L;
/** /**
* An array containing the current column values for this <code>Row</code> * An array containing the current column values for this <code>Row</code>
* object. * object.
...@@ -115,9 +115,7 @@ public class Row extends BaseRow implements Serializable, Cloneable { ...@@ -115,9 +115,7 @@ public class Row extends BaseRow implements Serializable, Cloneable {
*/ */
public Row(int numCols, Object[] vals) { public Row(int numCols, Object[] vals) {
origVals = new Object[numCols]; origVals = new Object[numCols];
for (int i=0; i < numCols; i++) { System.arraycopy(vals, 0, origVals, 0, numCols);
origVals[i] = vals[i];
}
currentVals = new Object[numCols]; currentVals = new Object[numCols];
colsChanged = new BitSet(numCols); colsChanged = new BitSet(numCols);
this.numCols = numCols; this.numCols = numCols;
......
...@@ -65,7 +65,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver { ...@@ -65,7 +65,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* This ArrayList will contain the status of a row * This ArrayList will contain the status of a row
* from the SyncResolver.* values else it will be null. * from the SyncResolver.* values else it will be null.
*/ */
private ArrayList stats; private ArrayList<?> stats;
/** /**
* The RowSetWriter associated with the original * The RowSetWriter associated with the original
...@@ -429,6 +429,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver { ...@@ -429,6 +429,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* This is used to set the status of each row * This is used to set the status of each row
* to either of the values SyncResolver.*_CONFLICT * to either of the values SyncResolver.*_CONFLICT
**/ **/
@SuppressWarnings("rawtypes")
void setStatus(ArrayList status){ void setStatus(ArrayList status){
stats = status; stats = status;
} }
...@@ -856,6 +857,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver { ...@@ -856,6 +857,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* @see #toCollection(String) * @see #toCollection(String)
* @see java.util.TreeMap * @see java.util.TreeMap
*/ */
@SuppressWarnings("rawtypes")
public Collection toCollection() throws SQLException { public Collection toCollection() throws SQLException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
...@@ -878,6 +880,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver { ...@@ -878,6 +880,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* @see #toCollection(String) * @see #toCollection(String)
* @see java.util.Vector * @see java.util.Vector
*/ */
@SuppressWarnings("rawtypes")
public Collection toCollection(int column) throws SQLException { public Collection toCollection(int column) throws SQLException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
...@@ -900,6 +903,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver { ...@@ -900,6 +903,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* @see #toCollection(int) * @see #toCollection(int)
* @see java.util.Vector * @see java.util.Vector
*/ */
@SuppressWarnings("rawtypes")
public Collection toCollection(String column) throws SQLException { public Collection toCollection(String column) throws SQLException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
......
...@@ -55,7 +55,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable { ...@@ -55,7 +55,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
* object will use for storing the tags to be used for writing the calling * object will use for storing the tags to be used for writing the calling
* <code>WebRowSet</code> object as an XML document. * <code>WebRowSet</code> object as an XML document.
*/ */
private java.util.Stack stack; private java.util.Stack<String> stack;
private JdbcRowSetResourceBundle resBundle; private JdbcRowSetResourceBundle resBundle;
...@@ -94,7 +94,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable { ...@@ -94,7 +94,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
throws SQLException { throws SQLException {
// create a new stack for tag checking. // create a new stack for tag checking.
stack = new java.util.Stack(); stack = new java.util.Stack<>();
writer = wrt; writer = wrt;
writeRowSet(caller); writeRowSet(caller);
} }
...@@ -127,7 +127,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable { ...@@ -127,7 +127,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
throws SQLException { throws SQLException {
// create a new stack for tag checking. // create a new stack for tag checking.
stack = new java.util.Stack(); stack = new java.util.Stack<>();
writer = new OutputStreamWriter(oStream); writer = new OutputStreamWriter(oStream);
writeRowSet(caller); writeRowSet(caller);
} }
...@@ -205,10 +205,10 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable { ...@@ -205,10 +205,10 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
//Changed to beginSection and endSection for maps for proper indentation //Changed to beginSection and endSection for maps for proper indentation
beginSection("map"); beginSection("map");
java.util.Map typeMap = caller.getTypeMap(); java.util.Map<?,?> typeMap = caller.getTypeMap();
if (typeMap != null) { if (typeMap != null) {
Iterator i = typeMap.keySet().iterator(); Iterator<?> i = typeMap.keySet().iterator();
Class c; Class<?> c;
String type; String type;
while (i.hasNext()) { while (i.hasNext()) {
type = (String)i.next(); type = (String)i.next();
...@@ -532,7 +532,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable { ...@@ -532,7 +532,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
} }
private String getTag() { private String getTag() {
return (String)stack.pop(); return stack.pop();
} }
private void writeNull() throws java.io.IOException { private void writeNull() throws java.io.IOException {
......
/* /*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -71,14 +71,14 @@ import java.text.MessageFormat; ...@@ -71,14 +71,14 @@ import java.text.MessageFormat;
public class XmlReaderContentHandler extends DefaultHandler { public class XmlReaderContentHandler extends DefaultHandler {
private HashMap propMap; private HashMap <String, Integer> propMap;
private HashMap colDefMap; private HashMap <String, Integer> colDefMap;
private HashMap dataMap; private HashMap <String, Integer> dataMap;
private HashMap typeMap; private HashMap<String,Class<?>> typeMap;
private Vector updates; private Vector<Object[]> updates;
private Vector keyCols; private Vector<String> keyCols;
private String columnValue; private String columnValue;
private String propertyValue; private String propertyValue;
...@@ -438,7 +438,7 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -438,7 +438,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
initMaps(); initMaps();
// allocate the collection for the updates // allocate the collection for the updates
updates = new Vector(); updates = new Vector<>();
// start out with the empty string // start out with the empty string
columnValue = ""; columnValue = "";
...@@ -477,21 +477,21 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -477,21 +477,21 @@ public class XmlReaderContentHandler extends DefaultHandler {
private void initMaps() { private void initMaps() {
int items, i; int items, i;
propMap = new HashMap(); propMap = new HashMap<>();
items = properties.length; items = properties.length;
for (i=0;i<items;i++) { for (i=0;i<items;i++) {
propMap.put(properties[i], Integer.valueOf(i)); propMap.put(properties[i], Integer.valueOf(i));
} }
colDefMap = new HashMap(); colDefMap = new HashMap<>();
items = colDef.length; items = colDef.length;
for (i=0;i<items;i++) { for (i=0;i<items;i++) {
colDefMap.put(colDef[i], Integer.valueOf(i)); colDefMap.put(colDef[i], Integer.valueOf(i));
} }
dataMap = new HashMap(); dataMap = new HashMap<>();
items = data.length; items = data.length;
for (i=0;i<items;i++) { for (i=0;i<items;i++) {
...@@ -499,7 +499,7 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -499,7 +499,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
} }
//Initialize connection map here //Initialize connection map here
typeMap = new HashMap(); typeMap = new HashMap<>();
} }
public void startDocument() throws SAXException { public void startDocument() throws SAXException {
...@@ -549,14 +549,14 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -549,14 +549,14 @@ public class XmlReaderContentHandler extends DefaultHandler {
case PROPERTIES: case PROPERTIES:
tempCommand = ""; tempCommand = "";
tag = ((Integer)propMap.get(name)).intValue(); tag = propMap.get(name);
if (tag == PropNullTag) if (tag == PropNullTag)
setNullValue(true); setNullValue(true);
else else
setTag(tag); setTag(tag);
break; break;
case METADATA: case METADATA:
tag = ((Integer)colDefMap.get(name)).intValue(); tag = colDefMap.get(name);
if (tag == MetaNullTag) if (tag == MetaNullTag)
setNullValue(true); setNullValue(true);
...@@ -573,10 +573,10 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -573,10 +573,10 @@ public class XmlReaderContentHandler extends DefaultHandler {
tempUpdate = ""; tempUpdate = "";
if(dataMap.get(name) == null) { if(dataMap.get(name) == null) {
tag = NullTag; tag = NullTag;
} else if(((Integer)dataMap.get(name)).intValue() == EmptyStringTag) { } else if(dataMap.get(name) == EmptyStringTag) {
tag = EmptyStringTag; tag = EmptyStringTag;
} else { } else {
tag = ((Integer)dataMap.get(name)).intValue(); tag = dataMap.get(name);
} }
if (tag == NullTag) { if (tag == NullTag) {
...@@ -630,6 +630,7 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -630,6 +630,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
* *
* @exception SAXException if a general SAX error occurs * @exception SAXException if a general SAX error occurs
*/ */
@SuppressWarnings("fallthrough")
public void endElement(String uri, String lName, String qName) throws SAXException { public void endElement(String uri, String lName, String qName) throws SAXException {
int tag; int tag;
...@@ -644,13 +645,13 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -644,13 +645,13 @@ public class XmlReaderContentHandler extends DefaultHandler {
} }
try { try {
tag = ((Integer)propMap.get(name)).intValue(); tag = propMap.get(name);
switch (tag) { switch (tag) {
case KeycolsTag: case KeycolsTag:
if (keyCols != null) { if (keyCols != null) {
int i[] = new int[keyCols.size()]; int i[] = new int[keyCols.size()];
for (int j = 0; j < i.length; j++) for (int j = 0; j < i.length; j++)
i[j] = Integer.parseInt((String)keyCols.elementAt(j)); i[j] = Integer.parseInt(keyCols.elementAt(j));
rs.setKeyColumns(i); rs.setKeyColumns(i);
} }
break; break;
...@@ -723,7 +724,7 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -723,7 +724,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
if(dataMap.get(name) == null) { if(dataMap.get(name) == null) {
tag = NullTag; tag = NullTag;
} else { } else {
tag = ((Integer)dataMap.get(name)).intValue(); tag = dataMap.get(name);
} }
switch (tag) { switch (tag) {
case ColTag: case ColTag:
...@@ -820,7 +821,7 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -820,7 +821,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
if (updates.size() > 0) { if (updates.size() > 0) {
try { try {
Object upd[]; Object upd[];
Iterator i = updates.iterator(); Iterator<?> i = updates.iterator();
while (i.hasNext()) { while (i.hasNext()) {
upd = (Object [])i.next(); upd = (Object [])i.next();
idx = ((Integer)upd[0]).intValue(); idx = ((Integer)upd[0]).intValue();
...@@ -1075,7 +1076,7 @@ public class XmlReaderContentHandler extends DefaultHandler { ...@@ -1075,7 +1076,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
break; break;
case PropColumnTag: case PropColumnTag:
if (keyCols == null) if (keyCols == null)
keyCols = new Vector(); keyCols = new Vector<>();
keyCols.add(s); keyCols.add(s);
break; break;
case MapTag: case MapTag:
......
...@@ -150,6 +150,7 @@ public class Date extends java.util.Date { ...@@ -150,6 +150,7 @@ public class Date extends java.util.Date {
* <P> * <P>
* @return a String in yyyy-mm-dd format * @return a String in yyyy-mm-dd format
*/ */
@SuppressWarnings("deprecation")
public String toString () { public String toString () {
int year = super.getYear() + 1900; int year = super.getYear() + 1900;
int month = super.getMonth() + 1; int month = super.getMonth() + 1;
......
...@@ -80,7 +80,7 @@ public class DriverManager { ...@@ -80,7 +80,7 @@ public class DriverManager {
// List of registered JDBC drivers // List of registered JDBC drivers
private final static CopyOnWriteArrayList<DriverInfo> registeredDrivers = new CopyOnWriteArrayList<DriverInfo>(); private final static CopyOnWriteArrayList<DriverInfo> registeredDrivers = new CopyOnWriteArrayList<>();
private static volatile int loginTimeout = 0; private static volatile int loginTimeout = 0;
private static volatile java.io.PrintWriter logWriter = null; private static volatile java.io.PrintWriter logWriter = null;
private static volatile java.io.PrintStream logStream = null; private static volatile java.io.PrintStream logStream = null;
...@@ -357,7 +357,7 @@ public class DriverManager { ...@@ -357,7 +357,7 @@ public class DriverManager {
* @return the list of JDBC Drivers loaded by the caller's class loader * @return the list of JDBC Drivers loaded by the caller's class loader
*/ */
public static java.util.Enumeration<Driver> getDrivers() { public static java.util.Enumeration<Driver> getDrivers() {
java.util.Vector<Driver> result = new java.util.Vector<Driver>(); java.util.Vector<Driver> result = new java.util.Vector<>();
// Gets the classloader of the code that called this method, may // Gets the classloader of the code that called this method, may
// be null. // be null.
...@@ -621,15 +621,18 @@ class DriverInfo { ...@@ -621,15 +621,18 @@ class DriverInfo {
this.driver = driver; this.driver = driver;
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
return (other instanceof DriverInfo) return (other instanceof DriverInfo)
&& this.driver == ((DriverInfo) other).driver; && this.driver == ((DriverInfo) other).driver;
} }
@Override
public int hashCode() { public int hashCode() {
return driver.hashCode(); return driver.hashCode();
} }
@Override
public String toString() { public String toString() {
return ("driver[className=" + driver + "]"); return ("driver[className=" + driver + "]");
} }
......
...@@ -115,6 +115,7 @@ public class Time extends java.util.Date { ...@@ -115,6 +115,7 @@ public class Time extends java.util.Date {
* *
* @return a <code>String</code> in hh:mm:ss format * @return a <code>String</code> in hh:mm:ss format
*/ */
@SuppressWarnings("deprecation")
public String toString () { public String toString () {
int hour = super.getHours(); int hour = super.getHours();
int minute = super.getMinutes(); int minute = super.getMinutes();
......
...@@ -271,6 +271,7 @@ public class Timestamp extends java.util.Date { ...@@ -271,6 +271,7 @@ public class Timestamp extends java.util.Date {
* @return a <code>String</code> object in * @return a <code>String</code> object in
* <code>yyyy-mm-dd hh:mm:ss.fffffffff</code> format * <code>yyyy-mm-dd hh:mm:ss.fffffffff</code> format
*/ */
@SuppressWarnings("deprecation")
public String toString () { public String toString () {
int year = super.getYear() + 1900; int year = super.getYear() + 1900;
......
...@@ -42,6 +42,7 @@ import java.util.EventObject; ...@@ -42,6 +42,7 @@ import java.util.EventObject;
*/ */
public class StatementEvent extends EventObject { public class StatementEvent extends EventObject {
static final long serialVersionUID = -8089573731826608315L;
private SQLException exception; private SQLException exception;
private PreparedStatement statement; private PreparedStatement statement;
......
/* /*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -619,8 +619,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable { ...@@ -619,8 +619,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
checkforRowSetInterface(); checkforRowSetInterface();
if (listeners.isEmpty() == false) { if (listeners.isEmpty() == false) {
RowSetEvent event = new RowSetEvent((RowSet)this); RowSetEvent event = new RowSetEvent((RowSet)this);
for (Iterator i = listeners.iterator(); i.hasNext(); ) { for (RowSetListener rsl : listeners) {
((RowSetListener)i.next()).cursorMoved(event); rsl.cursorMoved(event);
} }
} }
} }
...@@ -644,8 +644,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable { ...@@ -644,8 +644,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
checkforRowSetInterface(); checkforRowSetInterface();
if (listeners.isEmpty() == false) { if (listeners.isEmpty() == false) {
RowSetEvent event = new RowSetEvent((RowSet)this); RowSetEvent event = new RowSetEvent((RowSet)this);
for (Iterator i = listeners.iterator(); i.hasNext(); ) { for (RowSetListener rsl : listeners) {
((RowSetListener)i.next()).rowChanged(event); rsl.rowChanged(event);
} }
} }
} }
...@@ -669,8 +669,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable { ...@@ -669,8 +669,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
checkforRowSetInterface(); checkforRowSetInterface();
if (listeners.isEmpty() == false) { if (listeners.isEmpty() == false) {
RowSetEvent event = new RowSetEvent((RowSet)this); RowSetEvent event = new RowSetEvent((RowSet)this);
for (Iterator i = listeners.iterator(); i.hasNext(); ) { for (RowSetListener rsl : listeners) {
((RowSetListener)i.next()).rowSetChanged(event); rsl.rowSetChanged(event);
} }
} }
} }
......
...@@ -97,7 +97,7 @@ public class RowSetMetaDataImpl implements RowSetMetaData, Serializable { ...@@ -97,7 +97,7 @@ public class RowSetMetaDataImpl implements RowSetMetaData, Serializable {
*/ */
private void checkColType(int SQLType) throws SQLException { private void checkColType(int SQLType) throws SQLException {
try { try {
Class c = java.sql.Types.class; Class<?> c = java.sql.Types.class;
Field[] publicFields = c.getFields(); Field[] publicFields = c.getFields();
int fieldValue = 0; int fieldValue = 0;
for (int i = 0; i < publicFields.length; i++) { for (int i = 0; i < publicFields.length; i++) {
...@@ -1091,5 +1091,7 @@ public class RowSetMetaDataImpl implements RowSetMetaData, Serializable { ...@@ -1091,5 +1091,7 @@ public class RowSetMetaDataImpl implements RowSetMetaData, Serializable {
*@serial *@serial
*/ */
public boolean writable = true; public boolean writable = true;
static final long serialVersionUID = 5490834817919311283L;
} }
} }
...@@ -181,7 +181,7 @@ public class RowSetProvider { ...@@ -181,7 +181,7 @@ public class RowSetProvider {
trace("***In newInstance()"); trace("***In newInstance()");
try { try {
Class providerClass = getFactoryClass(factoryClassName, cl, false); Class<?> providerClass = getFactoryClass(factoryClassName, cl, false);
RowSetFactory instance = (RowSetFactory) providerClass.newInstance(); RowSetFactory instance = (RowSetFactory) providerClass.newInstance();
if (debug) { if (debug) {
trace("Created new instance of " + providerClass + trace("Created new instance of " + providerClass +
...@@ -229,7 +229,7 @@ public class RowSetProvider { ...@@ -229,7 +229,7 @@ public class RowSetProvider {
* context class loader followed by the current class loader. * context class loader followed by the current class loader.
* @return The class which was loaded * @return The class which was loaded
*/ */
static private Class getFactoryClass(String factoryClassName, ClassLoader cl, static private Class<?> getFactoryClass(String factoryClassName, ClassLoader cl,
boolean doFallback) throws ClassNotFoundException { boolean doFallback) throws ClassNotFoundException {
try { try {
if (cl == null) { if (cl == null) {
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -22,13 +22,9 @@ ...@@ -22,13 +22,9 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package javax.sql.rowset.serial; package javax.sql.rowset.serial;
import java.sql.*; import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.math.*;
import java.util.Map; import java.util.Map;
/** /**
...@@ -91,7 +87,7 @@ public class SQLInputImpl implements SQLInput { ...@@ -91,7 +87,7 @@ public class SQLInputImpl implements SQLInput {
* <code>SQLData</code> (the Java class that defines how the UDT * <code>SQLData</code> (the Java class that defines how the UDT
* will be mapped). * will be mapped).
*/ */
private Map map; private Map<String,Class<?>> map;
/** /**
...@@ -279,7 +275,7 @@ public class SQLInputImpl implements SQLInput { ...@@ -279,7 +275,7 @@ public class SQLInputImpl implements SQLInput {
if (attrib == null) { if (attrib == null) {
lastValueWasNull = true; lastValueWasNull = true;
return (int)0; return 0;
} else { } else {
lastValueWasNull = false; lastValueWasNull = false;
return attrib.intValue(); return attrib.intValue();
...@@ -591,7 +587,7 @@ public class SQLInputImpl implements SQLInput { ...@@ -591,7 +587,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream. * position; or if there are no further values in the stream.
*/ */
public Object readObject() throws SQLException { public Object readObject() throws SQLException {
Object attrib = (Object)getNextAttribute(); Object attrib = getNextAttribute();
if (attrib == null) { if (attrib == null) {
lastValueWasNull = true; lastValueWasNull = true;
...@@ -601,7 +597,7 @@ public class SQLInputImpl implements SQLInput { ...@@ -601,7 +597,7 @@ public class SQLInputImpl implements SQLInput {
if (attrib instanceof Struct) { if (attrib instanceof Struct) {
Struct s = (Struct)attrib; Struct s = (Struct)attrib;
// look up the class in the map // look up the class in the map
Class c = (Class)map.get(s.getSQLTypeName()); Class<?> c = map.get(s.getSQLTypeName());
if (c != null) { if (c != null) {
// create new instance of the class // create new instance of the class
SQLData obj = null; SQLData obj = null;
...@@ -620,10 +616,10 @@ public class SQLInputImpl implements SQLInput { ...@@ -620,10 +616,10 @@ public class SQLInputImpl implements SQLInput {
SQLInputImpl sqlInput = new SQLInputImpl(attribs, map); SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
// read the values... // read the values...
obj.readSQL(sqlInput, s.getSQLTypeName()); obj.readSQL(sqlInput, s.getSQLTypeName());
return (Object)obj; return obj;
} }
} }
return (Object)attrib; return attrib;
} }
} }
......
...@@ -60,6 +60,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -60,6 +60,7 @@ public class SQLOutputImpl implements SQLOutput {
* A reference to an existing vector that * A reference to an existing vector that
* contains the attributes of a <code>Struct</code> object. * contains the attributes of a <code>Struct</code> object.
*/ */
@SuppressWarnings("rawtypes")
private Vector attribs; private Vector attribs;
/** /**
...@@ -70,6 +71,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -70,6 +71,7 @@ public class SQLOutputImpl implements SQLOutput {
* method will in turn call the appropriate * method will in turn call the appropriate
* <code>SQLOutputImpl</code> writer methods. * <code>SQLOutputImpl</code> writer methods.
*/ */
@SuppressWarnings("rawtypes")
private Map map; private Map map;
/** /**
...@@ -121,6 +123,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -121,6 +123,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeString(String x) throws SQLException { public void writeString(String x) throws SQLException {
//System.out.println("Adding :"+x); //System.out.println("Adding :"+x);
attribs.add(x); attribs.add(x);
...@@ -136,6 +139,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -136,6 +139,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeBoolean(boolean x) throws SQLException { public void writeBoolean(boolean x) throws SQLException {
attribs.add(Boolean.valueOf(x)); attribs.add(Boolean.valueOf(x));
} }
...@@ -150,6 +154,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -150,6 +154,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeByte(byte x) throws SQLException { public void writeByte(byte x) throws SQLException {
attribs.add(Byte.valueOf(x)); attribs.add(Byte.valueOf(x));
} }
...@@ -164,6 +169,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -164,6 +169,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeShort(short x) throws SQLException { public void writeShort(short x) throws SQLException {
attribs.add(Short.valueOf(x)); attribs.add(Short.valueOf(x));
} }
...@@ -178,6 +184,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -178,6 +184,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeInt(int x) throws SQLException { public void writeInt(int x) throws SQLException {
attribs.add(Integer.valueOf(x)); attribs.add(Integer.valueOf(x));
} }
...@@ -192,6 +199,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -192,6 +199,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeLong(long x) throws SQLException { public void writeLong(long x) throws SQLException {
attribs.add(Long.valueOf(x)); attribs.add(Long.valueOf(x));
} }
...@@ -206,6 +214,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -206,6 +214,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeFloat(float x) throws SQLException { public void writeFloat(float x) throws SQLException {
attribs.add(new Float(x)); attribs.add(new Float(x));
} }
...@@ -220,6 +229,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -220,6 +229,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeDouble(double x) throws SQLException{ public void writeDouble(double x) throws SQLException{
attribs.add(new Double(x)); attribs.add(new Double(x));
} }
...@@ -234,6 +244,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -234,6 +244,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeBigDecimal(java.math.BigDecimal x) throws SQLException{ public void writeBigDecimal(java.math.BigDecimal x) throws SQLException{
attribs.add(x); attribs.add(x);
} }
...@@ -249,6 +260,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -249,6 +260,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeBytes(byte[] x) throws SQLException { public void writeBytes(byte[] x) throws SQLException {
attribs.add(x); attribs.add(x);
} }
...@@ -263,6 +275,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -263,6 +275,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeDate(java.sql.Date x) throws SQLException { public void writeDate(java.sql.Date x) throws SQLException {
attribs.add(x); attribs.add(x);
} }
...@@ -277,6 +290,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -277,6 +290,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeTime(java.sql.Time x) throws SQLException { public void writeTime(java.sql.Time x) throws SQLException {
attribs.add(x); attribs.add(x);
} }
...@@ -291,6 +305,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -291,6 +305,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeTimestamp(java.sql.Timestamp x) throws SQLException { public void writeTimestamp(java.sql.Timestamp x) throws SQLException {
attribs.add(x); attribs.add(x);
} }
...@@ -305,6 +320,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -305,6 +320,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeCharacterStream(java.io.Reader x) throws SQLException { public void writeCharacterStream(java.io.Reader x) throws SQLException {
BufferedReader bufReader = new BufferedReader(x); BufferedReader bufReader = new BufferedReader(x);
try { try {
...@@ -334,6 +350,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -334,6 +350,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeAsciiStream(java.io.InputStream x) throws SQLException { public void writeAsciiStream(java.io.InputStream x) throws SQLException {
BufferedReader bufReader = new BufferedReader(new InputStreamReader(x)); BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
try { try {
...@@ -363,6 +380,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -363,6 +380,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeBinaryStream(java.io.InputStream x) throws SQLException { public void writeBinaryStream(java.io.InputStream x) throws SQLException {
BufferedReader bufReader = new BufferedReader(new InputStreamReader(x)); BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
try { try {
...@@ -414,6 +432,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -414,6 +432,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeObject(SQLData x) throws SQLException { public void writeObject(SQLData x) throws SQLException {
/* /*
...@@ -434,7 +453,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -434,7 +453,7 @@ public class SQLOutputImpl implements SQLOutput {
* the name of this class otherwise we don't know * the name of this class otherwise we don't know
* what to re-instantiate during readSQL() * what to re-instantiate during readSQL()
*/ */
attribs.add(new SerialStruct((SQLData)x, map)); attribs.add(new SerialStruct(x, map));
} }
/** /**
...@@ -448,6 +467,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -448,6 +467,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeRef(Ref x) throws SQLException { public void writeRef(Ref x) throws SQLException {
if (x == null) { if (x == null) {
attribs.add(x); attribs.add(x);
...@@ -467,6 +487,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -467,6 +487,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeBlob(Blob x) throws SQLException { public void writeBlob(Blob x) throws SQLException {
if (x == null) { if (x == null) {
attribs.add(x); attribs.add(x);
...@@ -486,6 +507,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -486,6 +507,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeClob(Clob x) throws SQLException { public void writeClob(Clob x) throws SQLException {
if (x == null) { if (x == null) {
attribs.add(x); attribs.add(x);
...@@ -511,6 +533,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -511,6 +533,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeStruct(Struct x) throws SQLException { public void writeStruct(Struct x) throws SQLException {
SerialStruct s = new SerialStruct(x,map);; SerialStruct s = new SerialStruct(x,map);;
attribs.add(s); attribs.add(s);
...@@ -528,6 +551,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -528,6 +551,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeArray(Array x) throws SQLException { public void writeArray(Array x) throws SQLException {
if (x == null) { if (x == null) {
attribs.add(x); attribs.add(x);
...@@ -547,6 +571,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -547,6 +571,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a <code>SQLData</code> object attempting to write the attribute * use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database. * values of a UDT to the database.
*/ */
@SuppressWarnings("unchecked")
public void writeURL(java.net.URL url) throws SQLException { public void writeURL(java.net.URL url) throws SQLException {
if (url == null) { if (url == null) {
attribs.add(url); attribs.add(url);
...@@ -570,6 +595,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -570,6 +595,7 @@ public class SQLOutputImpl implements SQLOutput {
* @exception SQLException if a database access error occurs * @exception SQLException if a database access error occurs
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("unchecked")
public void writeNString(String x) throws SQLException { public void writeNString(String x) throws SQLException {
throw new UnsupportedOperationException("Operation not supported"); throw new UnsupportedOperationException("Operation not supported");
} }
...@@ -583,6 +609,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -583,6 +609,7 @@ public class SQLOutputImpl implements SQLOutput {
* @exception SQLException if a database access error occurs * @exception SQLException if a database access error occurs
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("unchecked")
public void writeNClob(NClob x) throws SQLException { public void writeNClob(NClob x) throws SQLException {
throw new UnsupportedOperationException("Operation not supported"); throw new UnsupportedOperationException("Operation not supported");
} }
...@@ -597,6 +624,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -597,6 +624,7 @@ public class SQLOutputImpl implements SQLOutput {
* @exception SQLException if a database access error occurs * @exception SQLException if a database access error occurs
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("unchecked")
public void writeRowId(RowId x) throws SQLException { public void writeRowId(RowId x) throws SQLException {
throw new UnsupportedOperationException("Operation not supported"); throw new UnsupportedOperationException("Operation not supported");
} }
...@@ -611,6 +639,7 @@ public class SQLOutputImpl implements SQLOutput { ...@@ -611,6 +639,7 @@ public class SQLOutputImpl implements SQLOutput {
* @exception SQLException if a database access error occurs * @exception SQLException if a database access error occurs
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("unchecked")
public void writeSQLXML(SQLXML x) throws SQLException { public void writeSQLXML(SQLXML x) throws SQLException {
throw new UnsupportedOperationException("Operation not supported"); throw new UnsupportedOperationException("Operation not supported");
} }
......
...@@ -186,10 +186,8 @@ public class SerialArray implements Array, Serializable, Cloneable { ...@@ -186,10 +186,8 @@ public class SerialArray implements Array, Serializable, Cloneable {
case java.sql.Types.JAVA_OBJECT: case java.sql.Types.JAVA_OBJECT:
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
elements[i] = new SerialJavaObject((Object)elements[i]); elements[i] = new SerialJavaObject(elements[i]);
} }
default:
;
} }
} }
...@@ -285,11 +283,10 @@ public class SerialArray implements Array, Serializable, Cloneable { ...@@ -285,11 +283,10 @@ public class SerialArray implements Array, Serializable, Cloneable {
case java.sql.Types.JAVA_OBJECT: case java.sql.Types.JAVA_OBJECT:
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
elements[i] = new SerialJavaObject((Object)elements[i]); elements[i] = new SerialJavaObject(elements[i]);
} }
break;
default:
;
} }
......
...@@ -207,7 +207,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable { ...@@ -207,7 +207,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
*/ */
public java.io.InputStream getBinaryStream() throws SerialException { public java.io.InputStream getBinaryStream() throws SerialException {
InputStream stream = new ByteArrayInputStream(buf); InputStream stream = new ByteArrayInputStream(buf);
return (java.io.InputStream)stream; return stream;
} }
/** /**
......
...@@ -142,14 +142,14 @@ public class SerialJavaObject implements Serializable, Cloneable { ...@@ -142,14 +142,14 @@ public class SerialJavaObject implements Serializable, Cloneable {
* object. When there are multiple warnings, each warning is chained to the * object. When there are multiple warnings, each warning is chained to the
* previous warning. * previous warning.
*/ */
java.util.Vector chain; java.util.Vector<RowSetWarning> chain;
/** /**
* Registers the given warning. * Registers the given warning.
*/ */
private void setWarning(RowSetWarning e) { private void setWarning(RowSetWarning e) {
if (chain == null) { if (chain == null) {
chain = new java.util.Vector(); chain = new java.util.Vector<>();
} }
chain.add(e); chain.add(e);
} }
......
...@@ -109,7 +109,7 @@ public class SerialRef implements Ref, Serializable, Cloneable { ...@@ -109,7 +109,7 @@ public class SerialRef implements Ref, Serializable, Cloneable {
public Object getObject(java.util.Map<String,Class<?>> map) public Object getObject(java.util.Map<String,Class<?>> map)
throws SerialException throws SerialException
{ {
map = new Hashtable(map); map = new Hashtable<String, Class<?>>(map);
if (object != null) { if (object != null) {
return map.get(object); return map.get(object);
} else { } else {
......
...@@ -139,7 +139,7 @@ public class SerialStruct implements Struct, Serializable, Cloneable { ...@@ -139,7 +139,7 @@ public class SerialStruct implements Struct, Serializable, Cloneable {
//set the type name //set the type name
SQLTypeName = in.getSQLTypeName(); SQLTypeName = in.getSQLTypeName();
Vector tmp = new Vector(); Vector<Object> tmp = new Vector<>();
in.writeSQL(new SQLOutputImpl(tmp, map)); in.writeSQL(new SQLOutputImpl(tmp, map));
attribs = tmp.toArray(); attribs = tmp.toArray();
...@@ -220,7 +220,7 @@ public class SerialStruct implements Struct, Serializable, Cloneable { ...@@ -220,7 +220,7 @@ public class SerialStruct implements Struct, Serializable, Cloneable {
* that defines how the UDT is to be mapped * that defines how the UDT is to be mapped
* @throws SerialException if an error occurs * @throws SerialException if an error occurs
*/ */
private void mapToSerial(Map map) throws SerialException { private void mapToSerial(Map<String,Class<?>> map) throws SerialException {
try { try {
......
...@@ -257,7 +257,7 @@ public class SyncFactory { ...@@ -257,7 +257,7 @@ public class SyncFactory {
* See section 2.0 of the class comment for <code>SyncFactory</code> for an * See section 2.0 of the class comment for <code>SyncFactory</code> for an
* explanation of how a provider can be added to this registry. * explanation of how a provider can be added to this registry.
*/ */
private static Hashtable implementations; private static Hashtable<String, SyncProvider> implementations;
/** /**
* Internal sync object used to maintain the SPI as a singleton * Internal sync object used to maintain the SPI as a singleton
*/ */
...@@ -344,7 +344,7 @@ public class SyncFactory { ...@@ -344,7 +344,7 @@ public class SyncFactory {
Properties properties = new Properties(); Properties properties = new Properties();
if (implementations == null) { if (implementations == null) {
implementations = new Hashtable(); implementations = new Hashtable<>();
try { try {
...@@ -445,7 +445,7 @@ public class SyncFactory { ...@@ -445,7 +445,7 @@ public class SyncFactory {
String key = null; String key = null;
String[] propertyNames = null; String[] propertyNames = null;
for (Enumeration e = p.propertyNames(); e.hasMoreElements();) { for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
String str = (String) e.nextElement(); String str = (String) e.nextElement();
...@@ -541,7 +541,7 @@ public class SyncFactory { ...@@ -541,7 +541,7 @@ public class SyncFactory {
} }
// Attempt to invoke classname from registered SyncProvider list // Attempt to invoke classname from registered SyncProvider list
Class c = null; Class<?> c = null;
try { try {
ClassLoader cl = Thread.currentThread().getContextClassLoader(); ClassLoader cl = Thread.currentThread().getContextClassLoader();
...@@ -740,7 +740,7 @@ public class SyncFactory { ...@@ -740,7 +740,7 @@ public class SyncFactory {
*/ */
private static Properties parseJNDIContext() throws NamingException { private static Properties parseJNDIContext() throws NamingException {
NamingEnumeration bindings = ic.listBindings(""); NamingEnumeration<?> bindings = ic.listBindings("");
Properties properties = new Properties(); Properties properties = new Properties();
// Hunt one level below context for available SyncProvider objects // Hunt one level below context for available SyncProvider objects
...@@ -755,7 +755,7 @@ public class SyncFactory { ...@@ -755,7 +755,7 @@ public class SyncFactory {
* scan the current context using a re-entrant call to this method until all * scan the current context using a re-entrant call to this method until all
* bindings have been enumerated. * bindings have been enumerated.
*/ */
private static void enumerateBindings(NamingEnumeration bindings, private static void enumerateBindings(NamingEnumeration<?> bindings,
Properties properties) throws NamingException { Properties properties) throws NamingException {
boolean syncProviderObj = false; // move to parameters ? boolean syncProviderObj = false; // move to parameters ?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册