# HG changeset patch # User lancea # Date 1322872434 18000 # Node ID f9ad1aadf3fa68c8073281dacbbb15a670d2c00d # Parent ffb869e392cfab97e67d595c7184359e00cd421d 7116445: Miscellaneous warnings in the JDBC/RowSet classes Reviewed-by: smarks, chegar diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java Fri Dec 02 19:33:54 2011 -0500 @@ -357,7 +357,7 @@ // 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 @@ * @param env a Hashtable 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 @@ // 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 @@ iMatchColumns = new Vector(10); for(int i = 0; i < 10 ; i++) { - iMatchColumns.add(i,Integer.valueOf(-1)); + iMatchColumns.add(i, -1); } strMatchColumns = new Vector(10); @@ -540,7 +539,7 @@ */ 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 @@ obj = new SerialArray((java.sql.Array)obj); } - ((Row)currentRow).initColumnObject(i, obj); + currentRow.initColumnObject(i, obj); } rowsFetched++; rvh.add(currentRow); @@ -881,7 +880,7 @@ 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 @@ 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 @@ * @see javax.sql.rowset.spi.SyncProvider */ public void acceptChanges(Connection con) throws SyncProviderException{ - setConnection(con); acceptChanges(); - } /** @@ -957,7 +954,7 @@ */ 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 @@ TreeMap tMap = new TreeMap<>(); for (int i = 0; i c = map.get(s.getSQLTypeName()); if (c != null) { // create new instance of the class SQLData obj = null; @@ -3091,7 +3088,7 @@ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); } - return (java.io.Reader)charStream; + return charStream; } /** @@ -4006,7 +4003,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ * @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 @@ } for( int i = 0;i < columnIdxes.length ;i++) { - iMatchColumns.set(i,Integer.valueOf(-1)); + iMatchColumns.set(i, -1); } } @@ -6998,7 +6995,7 @@ 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 @@ } } for(int i = 0 ;i < columnIdxes.length; i++) { - iMatchColumns.add(i,Integer.valueOf(columnIdxes[i])); + iMatchColumns.add(i,columnIdxes[i]); } } @@ -7094,7 +7091,7 @@ 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 @@ 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 @@ 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 @@ obj = new SerialArray((java.sql.Array)obj, map); } - ((Row)currentRow).initColumnObject(i, obj); + currentRow.initColumnObject(i, obj); } rowsFetched++; maxRowsreached++; diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java Fri Dec 02 19:33:54 2011 -0500 @@ -66,6 +66,7 @@ * @param env a Hashtable containing a desired synchconizatation provider * name-value pair. */ + @SuppressWarnings("rawtypes") public FilteredRowSetImpl(Hashtable env) throws SQLException { super(env); } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Fri Dec 02 19:33:54 2011 -0500 @@ -695,6 +695,7 @@ return ps; } + @SuppressWarnings("deprecation") private void decodeParams(Object[] params, PreparedStatement ps) throws SQLException { @@ -761,14 +762,17 @@ 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 @@ 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 @@ 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. diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java --- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java Fri Dec 02 19:33:54 2011 -0500 @@ -135,6 +135,7 @@ * @return an enumeration of keys which have messages tranlated to * corresponding locales. */ + @SuppressWarnings("rawtypes") public Enumeration getKeys() { return propResBundle.getKeys(); } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java Fri Dec 02 19:33:54 2011 -0500 @@ -233,7 +233,7 @@ } int[] indexes = new int[indices.size()]; for(int i=0; iArrayList will hold the values of SyncResolver.* */ - private ArrayList status; + private ArrayList status; /** * This will check whether the same field value has changed both @@ -305,7 +305,7 @@ 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 @@ 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 @@ 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 @@ * 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 cols = new Vector<>(); String updateExec = updateCmd; Object orig; Object curr; @@ -566,14 +566,14 @@ * 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> 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 @@ updateExec += ", "; } updateExec += crs.getMetaData().getColumnName(i); - cols.add(Integer.valueOf(i)); + cols.add(i); updateExec += " = ? "; first = false; @@ -698,7 +698,7 @@ updateExec += ", "; } updateExec += crs.getMetaData().getColumnName(i); - cols.add(Integer.valueOf(i)); + cols.add(i); updateExec += " = ? "; flag = false; } else { @@ -749,7 +749,7 @@ // 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 diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/internal/Row.java --- a/jdk/src/share/classes/com/sun/rowset/internal/Row.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/internal/Row.java Fri Dec 02 19:33:54 2011 -0500 @@ -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 @@ import java.sql.*; import java.io.*; -import java.math.*; import java.lang.*; -import java.lang.reflect.*; import java.util.*; /** @@ -48,6 +46,8 @@ */ public class Row extends BaseRow implements Serializable, Cloneable { +static final long serialVersionUID = 5047859032611314762L; + /** * An array containing the current column values for this Row * object. @@ -115,9 +115,7 @@ */ 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; diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java --- a/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java Fri Dec 02 19:33:54 2011 -0500 @@ -65,7 +65,7 @@ * 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 @@ * 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 @@ * @see #toCollection(String) * @see java.util.TreeMap */ + @SuppressWarnings("rawtypes") public Collection toCollection() throws SQLException { throw new UnsupportedOperationException(); } @@ -878,6 +880,7 @@ * @see #toCollection(String) * @see java.util.Vector */ + @SuppressWarnings("rawtypes") public Collection toCollection(int column) throws SQLException { throw new UnsupportedOperationException(); } @@ -900,6 +903,7 @@ * @see #toCollection(int) * @see java.util.Vector */ + @SuppressWarnings("rawtypes") public Collection toCollection(String column) throws SQLException { throw new UnsupportedOperationException(); } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java --- a/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java Fri Dec 02 19:33:54 2011 -0500 @@ -55,7 +55,7 @@ * object will use for storing the tags to be used for writing the calling * WebRowSet object as an XML document. */ - private java.util.Stack stack; + private java.util.Stack stack; private JdbcRowSetResourceBundle resBundle; @@ -94,7 +94,7 @@ 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 @@ 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 @@ //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 @@ } private String getTag() { - return (String)stack.pop(); + return stack.pop(); } private void writeNull() throws java.io.IOException { diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java --- a/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java Fri Dec 02 19:33:54 2011 -0500 @@ -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 @@ public class XmlReaderContentHandler extends DefaultHandler { - private HashMap propMap; - private HashMap colDefMap; - private HashMap dataMap; + private HashMap propMap; + private HashMap colDefMap; + private HashMap dataMap; - private HashMap typeMap; + private HashMap> typeMap; - private Vector updates; - private Vector keyCols; + private Vector updates; + private Vector keyCols; private String columnValue; private String propertyValue; @@ -438,7 +438,7 @@ initMaps(); // allocate the collection for the updates - updates = new Vector(); + updates = new Vector<>(); // start out with the empty string columnValue = ""; @@ -477,21 +477,21 @@ private void initMaps() { int items, i; - propMap = new HashMap(); + propMap = new HashMap<>(); items = properties.length; for (i=0;i(); items = colDef.length; for (i=0;i(); items = data.length; for (i=0;i(); } public void startDocument() throws SAXException { @@ -549,14 +549,14 @@ 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 @@ 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 @@ * * @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 @@ } 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 @@ 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 @@ 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 @@ break; case PropColumnTag: if (keyCols == null) - keyCols = new Vector(); + keyCols = new Vector<>(); keyCols.add(s); break; case MapTag: diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/java/sql/Date.java --- a/jdk/src/share/classes/java/sql/Date.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/java/sql/Date.java Fri Dec 02 19:33:54 2011 -0500 @@ -150,6 +150,7 @@ *

* @return a String in yyyy-mm-dd format */ + @SuppressWarnings("deprecation") public String toString () { int year = super.getYear() + 1900; int month = super.getMonth() + 1; diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/java/sql/DriverManager.java --- a/jdk/src/share/classes/java/sql/DriverManager.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/java/sql/DriverManager.java Fri Dec 02 19:33:54 2011 -0500 @@ -80,7 +80,7 @@ // List of registered JDBC drivers - private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList(); + private final static CopyOnWriteArrayList 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 @@ * @return the list of JDBC Drivers loaded by the caller's class loader */ public static java.util.Enumeration getDrivers() { - java.util.Vector result = new java.util.Vector(); + java.util.Vector result = new java.util.Vector<>(); // Gets the classloader of the code that called this method, may // be null. @@ -621,15 +621,18 @@ 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 + "]"); } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/java/sql/Time.java --- a/jdk/src/share/classes/java/sql/Time.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/java/sql/Time.java Fri Dec 02 19:33:54 2011 -0500 @@ -115,6 +115,7 @@ * * @return a String in hh:mm:ss format */ + @SuppressWarnings("deprecation") public String toString () { int hour = super.getHours(); int minute = super.getMinutes(); diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/java/sql/Timestamp.java --- a/jdk/src/share/classes/java/sql/Timestamp.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/java/sql/Timestamp.java Fri Dec 02 19:33:54 2011 -0500 @@ -271,6 +271,7 @@ * @return a String object in * yyyy-mm-dd hh:mm:ss.fffffffff format */ + @SuppressWarnings("deprecation") public String toString () { int year = super.getYear() + 1900; diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/StatementEvent.java --- a/jdk/src/share/classes/javax/sql/StatementEvent.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/StatementEvent.java Fri Dec 02 19:33:54 2011 -0500 @@ -42,6 +42,7 @@ */ public class StatementEvent extends EventObject { + static final long serialVersionUID = -8089573731826608315L; private SQLException exception; private PreparedStatement statement; diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java --- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Fri Dec 02 19:33:54 2011 -0500 @@ -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 @@ 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 @@ 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 @@ 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); } } } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java --- a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java Fri Dec 02 19:33:54 2011 -0500 @@ -97,7 +97,7 @@ */ 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 @@ *@serial */ public boolean writable = true; + + static final long serialVersionUID = 5490834817919311283L; } } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java --- a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java Fri Dec 02 19:33:54 2011 -0500 @@ -181,7 +181,7 @@ 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 @@ * 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) { diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java Fri Dec 02 19:33:54 2011 -0500 @@ -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 @@ * SQLData (the Java class that defines how the UDT * will be mapped). */ - private Map map; + private Map> map; /** @@ -279,7 +275,7 @@ if (attrib == null) { lastValueWasNull = true; - return (int)0; + return 0; } else { lastValueWasNull = false; return attrib.intValue(); @@ -591,7 +587,7 @@ * 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 @@ 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 @@ SQLInputImpl sqlInput = new SQLInputImpl(attribs, map); // read the values... obj.readSQL(sqlInput, s.getSQLTypeName()); - return (Object)obj; + return obj; } } - return (Object)attrib; + return attrib; } } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java Fri Dec 02 19:33:54 2011 -0500 @@ -60,6 +60,7 @@ * A reference to an existing vector that * contains the attributes of a Struct object. */ + @SuppressWarnings("rawtypes") private Vector attribs; /** @@ -70,6 +71,7 @@ * method will in turn call the appropriate * SQLOutputImpl writer methods. */ + @SuppressWarnings("rawtypes") private Map map; /** @@ -121,6 +123,7 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * use by a SQLData 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 @@ * @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 @@ * @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 @@ * @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 @@ * @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"); } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java Fri Dec 02 19:33:54 2011 -0500 @@ -186,10 +186,8 @@ 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 @@ 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: - ; } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Fri Dec 02 19:33:54 2011 -0500 @@ -207,7 +207,7 @@ */ public java.io.InputStream getBinaryStream() throws SerialException { InputStream stream = new ByteArrayInputStream(buf); - return (java.io.InputStream)stream; + return stream; } /** diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java Fri Dec 02 19:33:54 2011 -0500 @@ -142,14 +142,14 @@ * object. When there are multiple warnings, each warning is chained to the * previous warning. */ - java.util.Vector chain; + java.util.Vector 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); } diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java Fri Dec 02 19:33:54 2011 -0500 @@ -109,7 +109,7 @@ public Object getObject(java.util.Map> map) throws SerialException { - map = new Hashtable(map); + map = new Hashtable>(map); if (object != null) { return map.get(object); } else { diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java Fri Dec 02 19:33:54 2011 -0500 @@ -139,7 +139,7 @@ //set the type name SQLTypeName = in.getSQLTypeName(); - Vector tmp = new Vector(); + Vector tmp = new Vector<>(); in.writeSQL(new SQLOutputImpl(tmp, map)); attribs = tmp.toArray(); @@ -220,7 +220,7 @@ * 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> map) throws SerialException { try { diff -r ffb869e392cf -r f9ad1aadf3fa jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java Fri Dec 02 16:29:19 2011 -0800 +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java Fri Dec 02 19:33:54 2011 -0500 @@ -257,7 +257,7 @@ * See section 2.0 of the class comment for SyncFactory for an * explanation of how a provider can be added to this registry. */ - private static Hashtable implementations; + private static Hashtable implementations; /** * Internal sync object used to maintain the SPI as a singleton */ @@ -344,7 +344,7 @@ Properties properties = new Properties(); if (implementations == null) { - implementations = new Hashtable(); + implementations = new Hashtable<>(); try { @@ -445,7 +445,7 @@ 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 @@ } // Attempt to invoke classname from registered SyncProvider list - Class c = null; + Class c = null; try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); @@ -740,7 +740,7 @@ */ 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 @@ * 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 ?