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