You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2012/07/09 13:21:12 UTC
svn commit: r1359069 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility:
JDBCDriverTest.java VersionCombinationConfigurator.java
VersionedNetworkServerTestSetup.java _Suite.java
Author: kahatlen
Date: Mon Jul 9 11:21:11 2012
New Revision: 1359069
URL: http://svn.apache.org/viewvc?rev=1359069&view=rev
Log:
DERBY-5840: Clean up compiler warnings introduced by using Java 5 language features
Simplifications enabled by the original cleanup of the compatibility tests.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java?rev=1359069&r1=1359068&r2=1359069&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java Mon Jul 9 11:21:11 2012
@@ -674,7 +674,7 @@ public class JDBCDriverTest
checkDBMetadata(tableName);
stuffTable(tableName, types, rows);
- readTable(tableName, types, rows, null);
+ readTable(tableName, types, rows);
}
//
@@ -783,7 +783,7 @@ public class JDBCDriverTest
// Verify that we can select all legal datatypes in a table.
//
private void readTable(String tableName, TypeDescriptor[] types,
- Object[][] rows, List<Object> casts )
+ Object[][] rows)
throws SQLException {
PreparedStatement ps = readTableQuery(tableName, types);
ResultSet rs = ps.executeQuery();
@@ -791,7 +791,7 @@ public class JDBCDriverTest
checkRSMD( rs );
rs.close();
// Execute the statement again for each cast / coercion we check.
- checkRows( ps, types, rows, casts );
+ checkRows( ps, types, rows );
ps.close();
}
@@ -879,12 +879,10 @@ public class JDBCDriverTest
* @param ps the query used to obtain the results
* @param types the type descriptions of the columns
* @param rows the values expected to be returned
- * @param casts a list to which objects retrieved from the result rows
- * are added, specify {@code null} if you don't need this
* @throws Exception
*/
private void checkRows(PreparedStatement ps, TypeDescriptor[] types,
- Object[][] rows, List<Object> casts)
+ Object[][] rows)
throws SQLException {
int typeCount = types.length;
@@ -900,7 +898,7 @@ public class JDBCDriverTest
// Make sure we're using the correct type descriptor.
assertEquals(types[colIndex], type);
checkPlainGet(ps, colIndex, type, rows);
- checkCoercions(ps, type, casts);
+ checkCoercions(ps, type);
}
}
}
@@ -940,10 +938,8 @@ public class JDBCDriverTest
*
* @param ps the query used to obtain the rows
* @param type the type description of the column
- * @param casts
*/
- private void checkCoercions(PreparedStatement ps, TypeDescriptor type,
- List<Object> casts)
+ private void checkCoercions(PreparedStatement ps, TypeDescriptor type)
throws SQLException {
String columnName = type.getDerbyTypeName();
T_CN coercionDesc = COERCIONS[ getCoercionIndex(type.getJdbcType()) ];
@@ -961,11 +957,6 @@ public class JDBCDriverTest
while (rs.next()) {
int jdbcType = COERCIONS[i].getJdbcType();
Object retval = getColumn( rs, columnName, jdbcType );
-
- if (casts != null) {
- casts.add(retval);
- }
-
println( "\t" + jdbcType + ":\t" + retval );
}
rs.close();
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java?rev=1359069&r1=1359068&r2=1359069&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java Mon Jul 9 11:21:11 2012
@@ -312,10 +312,8 @@ public class VersionCombinationConfigura
* be obtained.
*/
static URL getClassURL(final Class cl) {
- return (URL)
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
-
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run() {
if (cl.getProtectionDomain().getCodeSource() == null) {
return null;
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java?rev=1359069&r1=1359068&r2=1359069&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java Mon Jul 9 11:21:11 2012
@@ -100,7 +100,7 @@ public class VersionedNetworkServerTestS
Process proc = null;
try {
proc = BaseTestCase.execJavaCmd(null, classpath,
- (String[])cmd.toArray(new String[cmd.size()]), null);
+ cmd.toArray(new String[cmd.size()]), null);
} catch (IOException ioe) {
fail("failed to start server: " + ioe.getMessage());
}
@@ -181,7 +181,7 @@ public class VersionedNetworkServerTestS
Process proc;
try {
proc = BaseTestCase.execJavaCmd(null, dist.getProductionClasspath(),
- (String[])cmd.toArray(new String[cmd.size()]), null);
+ cmd.toArray(new String[cmd.size()]), null);
} catch (IOException ioe) {
return "shutdown process failed to start: " + ioe.getMessage();
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java?rev=1359069&r1=1359068&r2=1359069&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java Mon Jul 9 11:21:11 2012
@@ -85,16 +85,12 @@ public class _Suite
* <strong>NOTE</strong>: If invalid versions are found a warning is simply
* printed to the console.
*
- * We have to suppress warnings here until DerbyVersion can be compiled
- * at Java 5 level.
- *
* @param versions list of Derby versions, i.e '10.8.1.2,10.7.1.1'
* @return A list of parsed Derby versions.
*/
- @SuppressWarnings("unchecked")
private static List<DerbyVersion> parseVersionList(String versions) {
if (versions == null || versions.length() == 0) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
String[] vlist = versions.split(",");
List<DerbyVersion> ret = new ArrayList<DerbyVersion>(vlist.length);