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 2013/05/14 09:36:35 UTC

svn commit: r1482234 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/jdbcapi/ functionTests/tests/lang/ functionTests/util/ junit/

Author: kahatlen
Date: Tue May 14 07:36:34 2013
New Revision: 1482234

URL: http://svn.apache.org/r1482234
Log:
DERBY-5840: Clean up compiler warnings introduced by using Java 5 language features

- Clean up deprecation warnings in the tests

- Clean up unchecked conversion warnings in org.apache.derbyTesting.junit

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedTableVTI.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableVTI.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ManyMethods.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ClasspathSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DataSourceConnector.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DerbyDistribution.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/LocaleTestSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerControlWrapper.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ReleaseRepository.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/build.xml

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java Tue May 14 07:36:34 2013
@@ -1678,6 +1678,9 @@ public class ParameterMappingTest extend
             boolean worked;
             SQLException sqleResult = null;
             try {
+                // We want to test that getUnicodeStream() works, even though
+                // it's deprecated. Suppress the compiler warning.
+                @SuppressWarnings("deprecation")
                 InputStream is = rs.getUnicodeStream(1);
                 boolean wn = rs.wasNull();
                 if (isNull) {
@@ -3205,13 +3208,8 @@ public class ParameterMappingTest extend
                 data[4] = (byte) 0x00;
                 data[5] = (byte) 0x32;
 
-                try {
-                    psi.setUnicodeStream(1, new java.io.ByteArrayInputStream(
+                setUnicodeStream(psi, 1, new java.io.ByteArrayInputStream(
                             data), 6);
-                } catch (NoSuchMethodError e) {
-                    // ResultSet.setUnicodeStream not present - correct for
-                    // JSR169
-                }
 
                 if (JDBC.vmSupportsJDBC3()) {
                     psi.executeUpdate();
@@ -3292,6 +3290,17 @@ public class ParameterMappingTest extend
     }
 
     /**
+     * Helper method for calling the deprecated {@code setUnicodeStream()}
+     * method without getting deprecation warnings from the compiler.
+     */
+    @SuppressWarnings("deprecation")
+    private static void setUnicodeStream(PreparedStatement ps,
+                  int parameterIndex, InputStream stream, int length)
+            throws SQLException {
+        ps.setUnicodeStream(parameterIndex, stream, length);
+    }
+
+    /**
      * Do the {@code setObject()} tests for {@code setXXX()}. Test both for
      * the two-argument {@code setObject(int,Object)} method and the
      * three-argument {@code setObject(int,Object,int)} method.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedTableVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedTableVTI.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedTableVTI.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedTableVTI.java Tue May 14 07:36:34 2013
@@ -28,7 +28,6 @@ import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Connection;
 import java.sql.Date;
-import java.sql.DatabaseMetaData;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -36,10 +35,7 @@ import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.sql.Types;
 import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.derby.vti.VTITemplate;
 import org.apache.derby.vti.RestrictedVTI;
@@ -176,7 +172,8 @@ public	class   RestrictedTableVTI extend
     
     public  BigDecimal 	getBigDecimal(int i) throws SQLException
     { return _resultSet.getBigDecimal( mapColumnNumber( i ) ); }
-    
+
+    @Deprecated
     public  BigDecimal 	getBigDecimal(int i, int scale) throws SQLException
     { return _resultSet.getBigDecimal( mapColumnNumber( i ), scale ); }
     

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableVTI.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableVTI.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableVTI.java Tue May 14 07:36:34 2013
@@ -215,6 +215,7 @@ public abstract class TableVTI implement
      *
      * @exception SQLException on unexpected JDBC error
      */
+    @Deprecated
     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
         throw new SQLException("getBigDecimal");
     }
@@ -269,6 +270,7 @@ public abstract class TableVTI implement
      *
      * @exception SQLException on unexpected JDBC error
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {
         throw new SQLException("getUnicodeStream");
     }
@@ -360,6 +362,7 @@ public abstract class TableVTI implement
      *
      * @exception SQLException on unexpected JDBC error
      */
+    @Deprecated
     public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
         return getBigDecimal(findColumn(columnName), scale);
     }
@@ -414,6 +417,7 @@ public abstract class TableVTI implement
      *
      * @exception SQLException on unexpected JDBC error
      */
+    @Deprecated
     public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
         throw new SQLException("getUnicodeStream");
     }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ManyMethods.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ManyMethods.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ManyMethods.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ManyMethods.java Tue May 14 07:36:34 2013
@@ -28,6 +28,7 @@ import java.sql.Timestamp;
 import java.math.BigDecimal;
 
 import java.io.Serializable;
+import java.util.Calendar;
 
 /**
  * This class is for testing method calls on user-defined types.  It has
@@ -504,20 +505,29 @@ public class ManyMethods implements Seri
 
 	public static Date staticDateMethod()
 	{
-		/* July 2, 1997 */
-		return new Date(97, 7, 2);
+        /* August 2, 1997 */
+        Calendar cal = Calendar.getInstance();
+        cal.clear();
+        cal.set(1997, Calendar.AUGUST, 2, 0, 0, 0);
+        return new Date(cal.getTimeInMillis());
 	}
 
 	public static Time staticTimeMethod()
 	{
 		/* 10:58:33 AM */
-		return new Time(10, 58, 33);
+        Calendar cal = Calendar.getInstance();
+        cal.clear();
+        cal.set(1970, Calendar.JANUARY, 1, 10, 58, 33);
+        return new Time(cal.getTimeInMillis());
 	}
 
 	public static Timestamp staticTimestampMethod()
 	{
-		/* July 2, 1997 10:59:15.0 AM */
-		return new Timestamp(97, 7, 2, 10, 59, 15, 0);
+        /* August 2, 1997 10:59:15.0 AM */
+        Calendar cal = Calendar.getInstance();
+        cal.clear();
+        cal.set(1997, Calendar.AUGUST, 2, 10, 59, 15);
+        return new Timestamp(cal.getTimeInMillis());
 	}
 
 	public static ManyMethods staticManyMethods(Integer value)

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java Tue May 14 07:36:34 2013
@@ -61,12 +61,12 @@ public class PrivilegedFileOpsForTests {
         if (file == null) {
             throw new IllegalArgumentException("file cannot be <null>");
         }
-        return ((Long)AccessController.doPrivileged(
-                    new PrivilegedAction() {
-                        public Object run() {
-                            return new Long(file.length());
+        return AccessController.doPrivileged(
+                    new PrivilegedAction<Long>() {
+                        public Long run() {
+                            return file.length();
                         }
-                    })).longValue();
+                    });
     }
 
     /**
@@ -83,9 +83,9 @@ public class PrivilegedFileOpsForTests {
         if (file == null) {
             throw new IllegalArgumentException("file cannot be <null>");
         }
-        return (String)AccessController.doPrivileged(
-                new PrivilegedAction() {
-                    public Object run() throws SecurityException {
+        return AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+                    public String run() throws SecurityException {
                         return file.getAbsolutePath();
                     }});
     }
@@ -108,12 +108,12 @@ public class PrivilegedFileOpsForTests {
             throw new IllegalArgumentException("file cannot be <null>");
         }
         try {
-            return ((FileInputStream)AccessController.doPrivileged(
-                        new PrivilegedExceptionAction() {
-                            public Object run() throws FileNotFoundException {
-                                return new FileInputStream(file);
-                            }
-                        }));
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<FileInputStream>() {
+                public FileInputStream run() throws FileNotFoundException {
+                    return new FileInputStream(file);
+                }
+            });
         } catch (PrivilegedActionException pae) {
             throw (FileNotFoundException)pae.getException();
         }
@@ -132,12 +132,12 @@ public class PrivilegedFileOpsForTests {
         if (file == null) {
             throw new IllegalArgumentException("file cannot be <null>");
         }
-        return ((Boolean)AccessController.doPrivileged(
-                    new PrivilegedAction() {
-                        public Object run() {
-                            return Boolean.valueOf(file.exists());
+        return AccessController.doPrivileged(
+                    new PrivilegedAction<Boolean>() {
+                        public Boolean run() {
+                            return file.exists();
                         }
-                    })).booleanValue();
+                    });
     }
 
     /**
@@ -153,12 +153,12 @@ public class PrivilegedFileOpsForTests {
         if (file == null) {
             throw new IllegalArgumentException("file cannot be <null>");
         }
-        return ((Boolean)AccessController.doPrivileged(
-                    new PrivilegedAction() {
-                        public Object run() {
-                            return Boolean.valueOf(file.delete());
+        return AccessController.doPrivileged(
+                    new PrivilegedAction<Boolean>() {
+                        public Boolean run() {
+                            return file.delete();
                         }
-                    })).booleanValue();
+                    });
     }
 
     /**
@@ -176,9 +176,9 @@ public class PrivilegedFileOpsForTests {
             throw new IllegalArgumentException("file cannot be <null>");
         }
         try {
-            return (FileReader)AccessController.doPrivileged(
-                    new PrivilegedExceptionAction() {
-                        public Object run()
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<FileReader>() {
+                        public FileReader run()
                                 throws FileNotFoundException {
                             return new FileReader(file);
                         }
@@ -204,9 +204,9 @@ public class PrivilegedFileOpsForTests {
             throw new IllegalArgumentException("file cannot be <null>");
         }
         try {
-            return (FileWriter)AccessController.doPrivileged(
-                    new PrivilegedExceptionAction() {
-                        public Object run()
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<FileWriter>() {
+                        public FileWriter run()
                                 throws IOException {
                             return new FileWriter(file);
                         }
@@ -230,8 +230,8 @@ public class PrivilegedFileOpsForTests {
      */    
     public static void copy(final File source, final File target) throws IOException {
         try {
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
+            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
+                public Void run() throws IOException {
                     recursiveCopy(source,target);
                     return null;
                 }
@@ -351,9 +351,9 @@ public class PrivilegedFileOpsForTests {
             throw new IllegalArgumentException("file cannot be <null>");
         }
         try {
-            return (FileOutputStream)AccessController.doPrivileged(
-                    new PrivilegedExceptionAction() {
-                        public Object run()
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<FileOutputStream>() {
+                        public FileOutputStream run()
                                 throws FileNotFoundException {
                             return new FileOutputStream(file, append);
                         }
@@ -380,17 +380,15 @@ public class PrivilegedFileOpsForTests {
         if (!exists(dir)) {
             throw new FileNotFoundException(getAbsolutePath(dir));
         }
-        final ArrayList notDeleted = new ArrayList();
-        AccessController.doPrivileged(new PrivilegedAction() {
-
-            public Object run() {
-                return Boolean.valueOf(deleteRecursively(dir, notDeleted));
+        final ArrayList<File> notDeleted = new ArrayList<File>();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                deleteRecursively(dir, notDeleted);
+                return null;
             }
         });
 
-        File[] failedDeletes = new File[notDeleted.size()];
-        notDeleted.toArray(failedDeletes);
-        return failedDeletes;
+        return notDeleted.toArray(new File[notDeleted.size()]);
     }
 
     /**
@@ -404,7 +402,7 @@ public class PrivilegedFileOpsForTests {
      * @return {@code true} is all delete operations succeeded, {@code false}
      *      otherwise.
      */
-    private static boolean deleteRecursively(File dir, List failedDeletes) {
+    private static boolean deleteRecursively(File dir, List<File> failedDeletes) {
         boolean allDeleted = true;
         if (dir.isDirectory()) {
             File[] files = dir.listFiles();
@@ -431,7 +429,7 @@ public class PrivilegedFileOpsForTests {
      * @param failedDeletes list keeping track of failed deletes
      * @return {@code true} if the delete succeeded, {@code false} otherwise.
      */
-    private static boolean internalDelete(File f, List failedDeletes) {
+    private static boolean internalDelete(File f, List<File> failedDeletes) {
         boolean deleted = f.delete();
         if (!deleted) {
             failedDeletes.add(f);
@@ -446,13 +444,12 @@ public class PrivilegedFileOpsForTests {
      * @return A string with file information (human-readable).
      */
     public static String getFileInfo(final File f) {
-        return (String)AccessController.doPrivileged(new PrivilegedAction() {
-
-            public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
                 if (!f.exists()) {
                     return "(non-existant)";
                 }
-                StringBuffer sb = new StringBuffer();
+                StringBuilder sb = new StringBuilder();
                 sb.append("(isDir=").append(f.isDirectory()).
                         append(", canRead=").append(f.canRead()).
                         append(", canWrite=").append(f.canWrite()).

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Tue May 14 07:36:34 2013
@@ -25,8 +25,6 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Method;
@@ -35,15 +33,14 @@ import java.net.URL;
 import java.sql.*;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import junit.framework.AssertionFailedError;
+import junit.framework.Test;
 
 import org.apache.derby.iapi.sql.execute.RunTimeStatistics;
 import org.apache.derby.impl.jdbc.EmbedConnection;
 import org.apache.derby.tools.ij;
-import org.apache.derbyTesting.functionTests.util.PrivilegedFileOpsForTests;
 import org.apache.derbyTesting.functionTests.util.TestNullOutputStream;
 
 
@@ -71,14 +68,14 @@ public abstract class BaseJDBCTestCase
      * were returned by utility methods and close
      * them at teardown.
      */
-    private List statements;
+    private List<Statement> statements;
 
     /**
      * Maintain a list of connection objects that
      * were returned by utility methods and close
      * them at teardown.
      */
-    private List connections;
+    private List<Connection> connections;
     
     /**
      * Create a test case with the given name.
@@ -158,7 +155,7 @@ public abstract class BaseJDBCTestCase
     private void addStatement(Statement s)
     {
         if (statements == null)
-            statements = new ArrayList();
+            statements = new ArrayList<Statement>();
         statements.add(s);
     }
     
@@ -169,7 +166,7 @@ public abstract class BaseJDBCTestCase
     private void addConnection(Connection c)
     {
         if (connections == null)
-            connections = new ArrayList();
+            connections = new ArrayList<Connection>();
         connections.add(c);     
     }
     
@@ -474,18 +471,14 @@ public abstract class BaseJDBCTestCase
     throws java.lang.Exception
     {
         if (statements != null) {
-            for (Iterator i = statements.iterator(); i.hasNext(); )
-            {
-                Statement s = (Statement) i.next();
+            for (Statement s : statements) {
                 s.close();
             }
             // Allow gc'ing of all those statements.
             statements = null;
         }
         if (connections != null) {
-            for (Iterator i = connections.iterator(); i.hasNext(); )
-            {
-                Connection c = (Connection) i.next();
+            for (Connection c : connections) {
                 JDBC.cleanup(c);
             }
             // Allow gc'ing of all those connections.
@@ -1173,9 +1166,9 @@ public abstract class BaseJDBCTestCase
     private static void assertStatementErrorMinion(
             String[] sqlStates, boolean orderedStates,
             Statement st, String query) {
-        ArrayList statesBag = null;
+        ArrayList<String> statesBag = null;
         if (!orderedStates) {
-            statesBag = new ArrayList(Arrays.asList(sqlStates));
+            statesBag = new ArrayList<String>(Arrays.asList(sqlStates));
         }
         try {
             boolean haveRS = st.execute(query);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Tue May 14 07:36:34 2013
@@ -243,20 +243,14 @@ public abstract class BaseTestCase
     protected static void setSystemProperty(final String name, 
 					    final String value)
     {
-	
-	AccessController.doPrivileged
-	    (new java.security.PrivilegedAction(){
-		    
-		    public Object run(){
-			System.setProperty( name, value);
-			return null;
-			
-		    }
-		    
-		}
-	     );
-	
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                System.setProperty(name, value);
+                return null;
+            }
+        });
     }
+
     /**
      * Remove system property
      *
@@ -264,20 +258,14 @@ public abstract class BaseTestCase
      */
     public static void removeSystemProperty(final String name)
 	{
-	
-	AccessController.doPrivileged
-	    (new java.security.PrivilegedAction(){
-		    
-		    public Object run(){
-			System.getProperties().remove(name);
-			return null;
-			
-		    }
-		    
-		}
-	     );
-	
-    }    
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                System.getProperties().remove(name);
+                return null;
+            }
+        });
+    }
+
     /**
      * Get system property.
      *
@@ -285,17 +273,11 @@ public abstract class BaseTestCase
      */
     protected static String getSystemProperty(final String name)
 	{
-
-	return (String )AccessController.doPrivileged
-	    (new java.security.PrivilegedAction(){
-
-		    public Object run(){
-			return System.getProperty(name);
-
-		    }
-
-		}
-	     );
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
+                return System.getProperty(name);
+            }
+        });
     }
     
     /**
@@ -308,9 +290,8 @@ public abstract class BaseTestCase
      * @return The list indicates files with certain prefix.
      */
     protected static String[] getFilesWith(final File dir, String prefix) {
-        return (String[]) AccessController
-                .doPrivileged(new java.security.PrivilegedAction() {
-                    public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String[]>() {
+                    public String[] run() {
                         //create a FilenameFilter and override its accept-method to file
                         //files start with "javacore"*
                         FilenameFilter filefilter = new FilenameFilter() {
@@ -332,19 +313,12 @@ public abstract class BaseTestCase
      */
     protected static URL getTestResource(final String name)
 	{
-
-	return (URL)AccessController.doPrivileged
-	    (new java.security.PrivilegedAction(){
-
-		    public Object run(){
-			return BaseTestCase.class.getClassLoader().
-			    getResource(name);
-
-		    }
-
-		}
-	     );
-    }  
+        return AccessController.doPrivileged(new PrivilegedAction<URL>() {
+            public URL run() {
+                return BaseTestCase.class.getClassLoader().getResource(name);
+            }
+        });
+    }
   
     /**
      * Open the URL for a a test resource, e.g. a policy
@@ -355,16 +329,12 @@ public abstract class BaseTestCase
     protected static InputStream openTestResource(final URL url)
         throws PrivilegedActionException
     {
-    	return (InputStream)AccessController.doPrivileged
-	    (new java.security.PrivilegedExceptionAction(){
-
-		    public Object run() throws IOException{
-			return url.openStream();
-
-		    }
-
-		}
-	     );    	
+        return AccessController.doPrivileged(
+                new PrivilegedExceptionAction<InputStream>() {
+            public InputStream run() throws IOException {
+                return url.openStream();
+            }
+        });
     }
     
     /**
@@ -542,8 +512,8 @@ public abstract class BaseTestCase
      */
 	public static void assertEquals(final File file1, final File file2) {
 		AccessController.doPrivileged
-        (new PrivilegedAction() {
-        	public Object run() {
+        (new PrivilegedAction<Void>() {
+        	public Void run() {
         		try {
 					InputStream f1 = new BufferedInputStream(new FileInputStream(file1));
 					InputStream f2 = new BufferedInputStream(new FileInputStream(file2));
@@ -622,7 +592,7 @@ public abstract class BaseTestCase
         // Is this an invocation of a jar file with java -jar ...?
         final boolean isJarInvocation = cmd.length > 0 && cmd[0].equals("-jar");
 
-	    ArrayList cmdlist = new ArrayList();
+	    ArrayList<String> cmdlist = new ArrayList<String>();
         cmdlist.add(jvm == null ? getJavaExecutableName() : jvm);
 	    if (isJ9Platform())
 	    {
@@ -703,13 +673,11 @@ public abstract class BaseTestCase
 	        println("command[" + i + "]" + command[i]);
 	    }
 	    try {
-	        return (Process) AccessController
-	        .doPrivileged(new PrivilegedExceptionAction() {
-	            public Object run() throws IOException {
-	                Process result = null;
-	                result = Runtime.getRuntime().exec(
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<Process>() {
+                public Process run() throws IOException {
+                    return Runtime.getRuntime().exec(
                             command, (String[]) null, dir);
-	                return result;
 	            }
 	        });
 	    } catch (PrivilegedActionException pe) {
@@ -950,8 +918,8 @@ public abstract class BaseTestCase
 
         try {
             AccessController.doPrivileged(
-                new PrivilegedExceptionAction() {
-                    public Object run() throws
+                new PrivilegedExceptionAction<Void>() {
+                    public Void run() throws
                         IOException, InterruptedIOException {
 
                         TestConfiguration curr = TestConfiguration.getCurrent();
@@ -1205,7 +1173,7 @@ public abstract class BaseTestCase
         }
     }
     
-    private static void setupForDebuggerAttach(ArrayList cmdlist) {
+    private static void setupForDebuggerAttach(ArrayList<String> cmdlist) {
         if (debugPort == 0) {
             // lazy initialization
             String dbp = getSystemProperty("derby.test.debugPortBase");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ClasspathSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ClasspathSetup.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ClasspathSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ClasspathSetup.java Tue May 14 07:36:34 2013
@@ -22,10 +22,9 @@ package org.apache.derbyTesting.junit;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.security.AccessController;
-import java.security.PrivilegedActionException;
+import java.security.PrivilegedAction;
 
 import junit.extensions.TestSetup;
-import junit.framework.Assert;
 import junit.framework.Test;
 
 /**
@@ -75,13 +74,13 @@ public class ClasspathSetup extends Test
     //
     ///////////////////////////////////////////////////////////////////////////////////
 
-    protected void setUp() throws PrivilegedActionException
+    protected void setUp()
     {
         AccessController.doPrivileged
             (
-             new java.security.PrivilegedExceptionAction()
+             new PrivilegedAction<Void>()
              {
-                 public Object run() throws PrivilegedActionException
+                 public Void run()
                  { 
                      _originalClassLoader = Thread.currentThread().getContextClassLoader();
 
@@ -95,13 +94,13 @@ public class ClasspathSetup extends Test
              );
     }
     
-    protected void tearDown() throws PrivilegedActionException
+    protected void tearDown()
     {
         AccessController.doPrivileged
             (
-             new java.security.PrivilegedExceptionAction()
+             new PrivilegedAction<Void>()
              {
-                 public Object run() throws PrivilegedActionException
+                 public Void run()
                  { 
                      Thread.currentThread().setContextClassLoader( _originalClassLoader );
                      

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java Tue May 14 07:36:34 2013
@@ -21,7 +21,6 @@ package org.apache.derbyTesting.junit;
 
 import java.sql.*;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import junit.framework.Test;
@@ -232,7 +231,7 @@ public class CleanDatabaseTestSetup exte
         // different schemas.
         for (int count = 0; count < 5; count++) {
             // Fetch all the user schemas into a list
-            List schemas = new ArrayList();
+            List<String> schemas = new ArrayList<String>();
             ResultSet rs = dmd.getSchemas();
             while (rs.next()) {
     
@@ -250,8 +249,7 @@ public class CleanDatabaseTestSetup exte
     
             // DROP all the user schemas.
             sqle = null;
-            for (Iterator i = schemas.iterator(); i.hasNext();) {
-                String schema = (String) i.next();
+            for (String schema : schemas) {
                 try {
                     JDBC.dropSchema(dmd, schema);
                 } catch (SQLException e) {
@@ -291,7 +289,7 @@ public class CleanDatabaseTestSetup exte
         // Get the users
         Statement stm = conn.createStatement();
         ResultSet rs = stm.executeQuery( "select username from sys.sysusers" );
-        ArrayList   users = new ArrayList();
+        ArrayList<String> users = new ArrayList<String>();
         
         while ( rs.next() ) { users.add( rs.getString( 1 ) ); }
         rs.close();

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java Tue May 14 07:36:34 2013
@@ -21,12 +21,13 @@ package org.apache.derbyTesting.junit;
 
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.Properties;
 
 import javax.sql.ConnectionPoolDataSource;
 
-import junit.framework.Assert;
 import junit.framework.AssertionFailedError;
 
 /**
@@ -157,8 +158,9 @@ public class ConnectionPoolDataSourceCon
             // a new DataSource with the createDatabase property set.
             if (!"XJ004".equals(e.getSQLState()))
                 throw e;
-            HashMap hm = DataSourceConnector.makeCreateDBAttributes( config );
-            if ( connectionProperties != null ) { hm.putAll( connectionProperties ); }
+            HashMap<String, Object> hm =
+                    DataSourceConnector.makeCreateDBAttributes( config );
+            DataSourceConnector.copyProperties(connectionProperties, hm);
             ConnectionPoolDataSource tmpDs = singleUseDS( hm );
             JDBCDataSource.setBeanProperty(tmpDs, "databaseName", databaseName);
             return tmpDs.getPooledConnection(user, password).getConnection(); 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DataSourceConnector.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DataSourceConnector.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DataSourceConnector.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DataSourceConnector.java Tue May 14 07:36:34 2013
@@ -19,15 +19,14 @@
  */
 package org.apache.derbyTesting.junit;
 
-import java.io.File;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.Properties;
 
 import javax.sql.DataSource;
 
-import junit.framework.Assert;
 
 /**
  * Connection factory using javax.sql.DataSource.
@@ -126,8 +125,8 @@ public class DataSourceConnector impleme
             // a new DataSource with the createDatabase property set.
             if (!"XJ004".equals(e.getSQLState()))
                 throw e;
-            HashMap hm = makeCreateDBAttributes( config );
-            if ( connectionProperties != null ) { hm.putAll( connectionProperties ); }
+            HashMap<String, Object> hm = makeCreateDBAttributes( config );
+            copyProperties(connectionProperties, hm);
             DataSource tmpDs = singleUseDS( hm );
             JDBCDataSource.setBeanProperty(tmpDs, "databaseName", databaseName);
             return tmpDs.getConnection(user, password); 
@@ -166,17 +165,17 @@ public class DataSourceConnector impleme
         return sds;
     }
 
-    static  HashMap makeCreateDBAttributes( TestConfiguration configuration )
+    static HashMap<String, Object> makeCreateDBAttributes( TestConfiguration configuration )
     {
-        HashMap hm = JDBCDataSource.getDataSourceProperties( configuration );
+        HashMap<String, Object> hm = JDBCDataSource.getDataSourceProperties( configuration );
         hm.put( "createDatabase", "create" );
 
         return hm;
     }
 
-    static  HashMap makeShutdownDBAttributes( TestConfiguration configuration )
+    static HashMap<String, Object> makeShutdownDBAttributes( TestConfiguration configuration )
     {
-        HashMap hm = JDBCDataSource.getDataSourceProperties( configuration );
+        HashMap<String, Object> hm = JDBCDataSource.getDataSourceProperties( configuration );
         hm.put( "shutdownDatabase", "shutdown" );
 
         return hm;
@@ -193,4 +192,15 @@ public class DataSourceConnector impleme
         return databaseName;
     }
 
+    /**
+     * Copy attributes from a {@code Properties} object to a {@code Map}.
+     */
+    static void copyProperties(Properties src, Map<String, Object> dest) {
+        if (src != null) {
+            for (String key : src.stringPropertyNames()) {
+                dest.put(key, src.getProperty(key));
+            }
+        }
+    }
+
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DerbyDistribution.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DerbyDistribution.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DerbyDistribution.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DerbyDistribution.java Tue May 14 07:36:34 2013
@@ -43,8 +43,7 @@ import org.apache.derbyTesting.functionT
  * scenarios, it complicates things quite a bit. Generating the JARs when
  * testing on trunk seems like an acceptable price to pay.
  */
-public class DerbyDistribution
-        implements Comparable {
+public class DerbyDistribution implements Comparable<DerbyDistribution> {
 
     private static File[] EMPTY_FILE_ARRAY = new File[] {};
     public static final String JAR_RUN = "derbyrun.jar";
@@ -164,22 +163,6 @@ public class DerbyDistribution
 
     /**
      * Orders this distribution and the other distribution based on the version.
-     * <p>
-     * <em>Implementation note</em>: Remove this method when we can use
-     * Java SE 5.0 features.
-     *
-     * @param o the other distribution
-     * @return {@code 1} if this version is newer, {@code 0} if both
-     *      distributions have the same version, and {@code -1} if the other
-     *      version is newer.
-     * @see #compareTo(org.apache.derbyTesting.junit.DerbyDistribution) 
-     */
-    public int compareTo(Object o) {
-        return compareTo((DerbyDistribution)o);
-    }
-
-    /**
-     * Orders this distribution and the other distribution based on the version.
      *
      * @param o the other distribution
      * @return {@code 1} if this version is newer, {@code 0} if both
@@ -312,7 +295,7 @@ public class DerbyDistribution
                                                 DerbyVersion version) {
         File[] productionJars = getProductionJars(dir);
         File[] testingJars = getTestingJars(dir);
-        List tmpJars = new ArrayList();
+        List<File> tmpJars = new ArrayList<File>();
         tmpJars.addAll(Arrays.asList(productionJars));
         tmpJars.addAll(Arrays.asList(testingJars));
         if (hasRequiredJars(tmpJars)) {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java Tue May 14 07:36:34 2013
@@ -20,12 +20,10 @@
 package org.apache.derbyTesting.junit;
 
 import java.io.File;
-import java.security.AccessController;
 import java.sql.SQLException;
-
 import javax.sql.DataSource;
-
 import junit.framework.Test;
+import org.apache.derbyTesting.functionTests.util.PrivilegedFileOpsForTests;
 
 /**
  * Shutdown and drop the database identified by the logical
@@ -107,22 +105,11 @@ class DropDatabaseSetup extends BaseTest
     }
     
     static void removeDirectory(final File dir) {
-        AccessController.doPrivileged(new java.security.PrivilegedAction() {
-
-            public Object run() {
-                removeDir(dir);
-                return null;
-            }
-        });
-        
-    }
-
-    private static void removeDir(File dir) {
-        
         // Check if anything to do!
         // Database may not have been created.
-        if (!dir.exists())
+        if (!PrivilegedFileOpsForTests.exists(dir)) {
             return;
+        }
 
         BaseTestCase.assertDirectoryDeleted(dir);
     }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java Tue May 14 07:36:34 2013
@@ -379,7 +379,7 @@ public class IndexStatsUtil {
      * @return Mappings from conglomerate id to conglomerate name.
      * @throws SQLException if accessing the system tables fail
      */
-    private Map getIdToNameMap()
+    private Map<String, String> getIdToNameMap()
             throws SQLException {
         if (psGetIdToNameMapConglom == null) {
             psGetIdToNameMapConglom = con.prepareStatement(
@@ -390,7 +390,7 @@ public class IndexStatsUtil {
             psGetIdToNameMapTable = con.prepareStatement(
                     "select TABLEID, TABLENAME from SYS.SYSTABLES");
         }
-        Map map = new HashMap();
+        Map<String, String> map = new HashMap<String, String>();
         ResultSet rs = psGetIdToNameMapConglom.executeQuery();
         while (rs.next()) {
             map.put(rs.getString(1), rs.getString(2));
@@ -412,23 +412,22 @@ public class IndexStatsUtil {
      * @return A list of statistics objects
      * @throws SQLException if accessing the result set fails
      */
-    private IdxStats[] buildStatisticsList(ResultSet rs, Map idToName)
+    private IdxStats[] buildStatisticsList(
+            ResultSet rs, Map<String, String> idToName)
             throws SQLException {
-        List stats = new ArrayList();
+        List<IdxStats> stats = new ArrayList<IdxStats>();
         while (rs.next()) {
             // NOTE: Bad practice to call rs.getString(X) twice, but it works
             //       for Derby with the string type...
             stats.add(new IdxStats(rs.getString(1), rs.getString(2),
-                    (String)idToName.get(rs.getString(2)),
+                    idToName.get(rs.getString(2)),
                     rs.getString(3),
-                    (String)idToName.get(rs.getString(3)),
+                    idToName.get(rs.getString(3)),
                     rs.getTimestamp(4), rs.getInt(7),
                     rs.getString(8)));
         }
         rs.close();
-        IdxStats[] s = new IdxStats[stats.size()];
-        stats.toArray(s);
-        return s;
+        return stats.toArray(new IdxStats[stats.size()]);
     }
 
     /**
@@ -485,13 +484,13 @@ public class IndexStatsUtil {
      */
     private void awaitChange(IdxStats[] current, long timeout)
             throws SQLException {
-        Set oldStats = new HashSet(Arrays.asList(current));
-        Set newStats = null;
+        Set<IdxStats> oldStats = new HashSet<IdxStats>(Arrays.asList(current));
+        Set<IdxStats> newStats = null;
         long start = System.currentTimeMillis();
         // Make sure we run at least once.
         while (System.currentTimeMillis() - start < timeout ||
                 newStats == null) {
-            newStats = new HashSet(Arrays.asList(getStats()));
+            newStats = new HashSet<IdxStats>(Arrays.asList(getStats()));
             newStats.retainAll(oldStats);
             if (newStats.isEmpty()) {
                 return;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java Tue May 14 07:36:34 2013
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.BitSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.ListIterator;
 import java.util.Locale;
 
@@ -120,7 +121,7 @@ public class JDBC {
     static {
         boolean autoCloseable;
         try {
-            Class acClass = Class.forName("java.lang.AutoCloseable");
+            Class<?> acClass = Class.forName("java.lang.AutoCloseable");
             autoCloseable = acClass.isAssignableFrom(ResultSet.class);
         } catch (Throwable t) {
             autoCloseable = false;
@@ -458,7 +459,7 @@ public class JDBC {
 		String dropLeadIn = "DROP " + dropType + " ";
 		
         // First collect the set of DROP SQL statements.
-        ArrayList ddl = new ArrayList();
+        ArrayList<String> ddl = new ArrayList<String>();
 		while (rs.next())
 		{
             String objectName = rs.getString(mdColumn);
@@ -534,11 +535,11 @@ public class JDBC {
             do {
                 hadError = false;
                 didDrop = false;
-                for (ListIterator i = ddl.listIterator(); i.hasNext();) {
-                    Object sql = i.next();
+                for (ListIterator<String> i = ddl.listIterator(); i.hasNext();) {
+                    String sql = i.next();
                     if (sql != null) {
                         try {
-                            s.executeUpdate(sql.toString());
+                            s.executeUpdate(sql);
                             i.set(null);
                             didDrop = true;
                         } catch (SQLException e) {
@@ -1413,11 +1414,12 @@ public class JDBC {
         Assert.assertEquals("Unexpected column count",
                             expectedRows[0].length, rsmd.getColumnCount());
 
-        ArrayList expected = new ArrayList(expectedRows.length);
+        List<List<String>> expected =
+                new ArrayList<List<String>>(expectedRows.length);
         for (int i = 0; i < expectedRows.length; i++) {
             Assert.assertEquals("Different column count in expectedRows",
                                 expectedRows[0].length, expectedRows[i].length);
-            ArrayList row = new ArrayList(expectedRows[i].length);
+            List<String> row = new ArrayList<String>(expectedRows[i].length);
 
             for (int j = 0; j < expectedRows[i].length; j++) {
                 String val = (String) expectedRows[i][j];
@@ -1428,9 +1430,10 @@ public class JDBC {
             expected.add(row);
         }
 
-        ArrayList actual = new ArrayList(expectedRows.length);
+        List<List<String>> actual =
+                new ArrayList<List<String>>(expectedRows.length);
         while (rs.next()) {
-            ArrayList row = new ArrayList(expectedRows[0].length);
+            List<String> row = new ArrayList<String>(expectedRows[0].length);
             for (int i = 1; i <= expectedRows[0].length; i++) {
                 String s = rs.getString(i);
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java Tue May 14 07:36:34 2013
@@ -21,12 +21,11 @@ package org.apache.derbyTesting.junit;
 
 import java.lang.reflect.Method;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Iterator;
 
-import javax.sql.DataSource;
-
 import junit.framework.Assert;
 
 /**
@@ -113,9 +112,9 @@ public class JDBCDataSource {
      * Create a HashMap with the set of Derby DataSource
      * Java bean properties corresponding to the configuration.
      */
-    static HashMap getDataSourceProperties(TestConfiguration config) 
+    static HashMap<String, Object> getDataSourceProperties(TestConfiguration config)
     {
-        HashMap beanProperties = new HashMap();
+        HashMap<String, Object> beanProperties = new HashMap<String, Object>();
         
         if (!config.getJDBCClient().isEmbedded()) {
             beanProperties.put("serverName", config.getHostName());
@@ -145,11 +144,9 @@ public class JDBCDataSource {
      */
     static javax.sql.DataSource getDataSourceObject(String classname, HashMap beanProperties)
     {
-        ClassLoader contextLoader =
-            (ClassLoader) AccessController.doPrivileged
-        (new java.security.PrivilegedAction(){
-            
-            public Object run()  { 
+        ClassLoader contextLoader = AccessController.doPrivileged(
+                new PrivilegedAction<ClassLoader>() {
+            public ClassLoader run() {
                 return Thread.currentThread().getContextClassLoader();
             }
         });

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/LocaleTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/LocaleTestSetup.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/LocaleTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/LocaleTestSetup.java Tue May 14 07:36:34 2013
@@ -20,6 +20,7 @@
 package org.apache.derbyTesting.junit;
 
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Locale;
 
 import junit.extensions.TestSetup;
@@ -43,27 +44,22 @@ public class LocaleTestSetup extends Tes
 	 * Set up the new locale for the test
 	 */
 	protected void setUp() {
-		AccessController.doPrivileged
-        (new java.security.PrivilegedAction() {
-            public Object run() {
-            	Locale.setDefault(newLocale);
-                return null;
-            }
-        }
-        );
+        setDefaultLocale(newLocale);
 	}
 	
 	/**
 	 * Revert the locale back to the old one
 	 */
 	protected void tearDown() {
-		AccessController.doPrivileged
-        (new java.security.PrivilegedAction() {
-            public Object run() {
-            	Locale.setDefault(oldLocale);
+        setDefaultLocale(oldLocale);
+	}
+
+    private static void setDefaultLocale(final Locale locale) {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                Locale.setDefault(locale);
                 return null;
             }
-        }
-        );
-	}
+        });
+    }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerControlWrapper.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerControlWrapper.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerControlWrapper.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerControlWrapper.java Tue May 14 07:36:34 2013
@@ -58,22 +58,22 @@ public class NetworkServerControlWrapper
     NetworkServerControlWrapper()
             throws Exception {
         // Try to load the NetworkServerControl class.
-        Class clazzSC = null;
+        Class<?> clazzSC = null;
         try {
             clazzSC =
                     Class.forName("org.apache.derby.drda.NetworkServerControl");
         } catch (ClassNotFoundException cnfe) {
             BaseTestCase.fail("No runtime support for network server", cnfe);
         }
-        Class clazzTS = Class.forName(
+        Class<?> clazzTS = Class.forName(
                 "org.apache.derbyTesting.junit.NetworkServerTestSetup");
-        Method m = clazzTS.getMethod("getNetworkServerControl", null);
+        Method m = clazzTS.getMethod("getNetworkServerControl");
         // Invoke method to obtain the NSC instance.
-        this.ctrl = m.invoke(null, null);
+        this.ctrl = m.invoke(null);
 
         // Create the NSC method objects.
-        METHODS[PING] = clazzSC.getMethod("ping", null);
-        METHODS[SHUTDOWN] = clazzSC.getMethod("shutdown", null);
+        METHODS[PING] = clazzSC.getMethod("ping");
+        METHODS[SHUTDOWN] = clazzSC.getMethod("shutdown");
         METHODS[START] = clazzSC.getMethod(
                 "start", new Class[] {PrintWriter.class});
     }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java Tue May 14 07:36:34 2013
@@ -34,6 +34,7 @@ import java.security.PrivilegedException
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import junit.framework.AssertionFailedError;
 import junit.framework.Test;
 import org.apache.derby.drda.NetworkServerControl;
 import org.apache.derby.iapi.error.ExceptionUtil;
@@ -293,8 +294,8 @@ final public class NetworkServerTestSetu
     private static void probeServerPort(final int port, final InetAddress addr)
             throws IOException {
         try {
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
+            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
+                public Void run() throws IOException {
                     new ServerSocket(port, 0, addr).close();
                     return null;
                 }
@@ -307,9 +308,9 @@ final public class NetworkServerTestSetu
     private void startWithAPI() throws Exception
     {
             
-            serverOutput = (FileOutputStream)
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            serverOutput = AccessController.doPrivileged(
+                    new PrivilegedAction<FileOutputStream>() {
+                public FileOutputStream run() {
                     File logs = new File("logs");
                     logs.mkdir();
                     File console = new File(logs, "serverConsoleOutput.log");
@@ -344,7 +345,7 @@ final public class NetworkServerTestSetu
 
     private SpawnedProcess startSeparateProcess() throws Exception
     {
-        ArrayList       al = new ArrayList();
+        ArrayList<String> al = new ArrayList<String>();
         boolean         skipHostName = false;
 
         // Loading from classes need to work-around the limitation of the
@@ -482,7 +483,7 @@ final public class NetworkServerTestSetu
     public  static String[] getDefaultStartupArgs( boolean skipHostName )
     {
         TestConfiguration config = TestConfiguration.getCurrent();
-        ArrayList               argsList = new ArrayList();
+        ArrayList<String> argsList = new ArrayList<String>();
 
         argsList.add( "start" );
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ReleaseRepository.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ReleaseRepository.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ReleaseRepository.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ReleaseRepository.java Tue May 14 07:36:34 2013
@@ -114,7 +114,7 @@ public class ReleaseRepository {
      * List of distributions found in the repository. If {@code null}, the
      * repository hasn't been initialized.
      */
-    private List dists;
+    private List<DerbyDistribution> dists;
 
     /**
      * Creates a new, empty repository.
@@ -171,7 +171,7 @@ public class ReleaseRepository {
         traceit("{ReleaseRepository} " + tmpCandDists.length +
                 " candidate releases at " + reposLocation);
 
-        dists = new ArrayList(tmpCandDists.length);
+        dists = new ArrayList<DerbyDistribution>(tmpCandDists.length);
         for (int i=0; i < tmpCandDists.length; i++) {
             File dir = tmpCandDists[i];
             // We extract the version from the directory name.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/RuntimeStatisticsParser.java Tue May 14 07:36:34 2013
@@ -34,7 +34,7 @@ public class RuntimeStatisticsParser {
 	private final boolean lastKeyIndexScan;
     private String statistics = "";
     private boolean scrollInsensitive = false;
-    private final HashSet qualifiers;
+    private final HashSet<Qualifier> qualifiers;
     private String [] startPosition = {"None"};
     private String [] stopPosition = {"None"};
 
@@ -119,8 +119,8 @@ public class RuntimeStatisticsParser {
      *
      * @return set of <code>Qualifier</code>s
      */
-    private HashSet findQualifiers() {
-        HashSet set = new HashSet();
+    private HashSet<Qualifier> findQualifiers() {
+        HashSet<Qualifier> set = new HashSet<Qualifier>();
         int startPos = statistics.indexOf("qualifiers:\n");
         if (startPos >= 0) {
             // start search after "qualifiers:\n"

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java Tue May 14 07:36:34 2013
@@ -99,15 +99,15 @@ public final class SecurityManagerSetup 
 
     static final boolean jacocoEnabled = checkIfJacocoIsRunning();
     private static boolean checkIfJacocoIsRunning() {
-        return ((Boolean)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+                public Boolean run() {
                     if (getURL("org.jacoco.agent.rt.RT") != null) {
                         System.setProperty("jacoco.active", "");
                         return Boolean.TRUE;
                     }
                     return Boolean.FALSE;
                 }
-		})).booleanValue();
+        });
     }
 
 	private final String decoratorPolicyResource;
@@ -270,10 +270,10 @@ public final class SecurityManagerSetup 
 			return;
 		
 		// and install
-        AccessController.doPrivileged(new PrivilegedAction() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
 
 
-                public Object run() {
+                public Void run() {
                     if (sm == null)
                         System.setSecurityManager(new SecurityManager());
                     else
@@ -461,10 +461,9 @@ public final class SecurityManagerSetup 
 	 */
 	static URL getURL(final Class cl)
 	{
-		return (URL)
-            AccessController.doPrivileged(new PrivilegedAction() {
+        return AccessController.doPrivileged(new PrivilegedAction<URL>() {
 
-			public Object run() {
+			public URL run() {
 
                 /* It's possible that the class does not have a "codeSource"
                  * associated with it (ex. if it is embedded within the JVM,
@@ -487,9 +486,9 @@ public final class SecurityManagerSetup 
 
             AccessController.doPrivileged
             (
-             new PrivilegedAction()
+             new PrivilegedAction<Void>()
              {
-                 public Object run() {
+                 public Void run() {
                       System.setSecurityManager(null);
                      return null;
                  }
@@ -588,9 +587,9 @@ public final class SecurityManagerSetup 
         i2.close();
         o.close();
         try {
-            return (String)
-                AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() throws MalformedURLException {
+            return AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<String>() {
+                    public String run() throws MalformedURLException {
                         return mergedPF.toURI().toURL().toExternalForm();
                     }
                 });
@@ -603,9 +602,9 @@ public final class SecurityManagerSetup 
     private static InputStream openStream(final URL resource)
             throws IOException {
         try {
-            return (InputStream)AccessController.doPrivileged(
-                    new PrivilegedExceptionAction(){
-                        public Object run() throws IOException {
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<InputStream>(){
+                        public InputStream run() throws IOException {
                             return resource.openStream();
                         }
                     }
@@ -618,8 +617,8 @@ public final class SecurityManagerSetup 
     /** Creates the specified directory if it doesn't exist. */
     private static void mkdir(final File dir) {
         AccessController.doPrivileged(
-            new PrivilegedAction(){
-                public Object run(){
+            new PrivilegedAction<Void>() {
+                public Void run() {
                     if (!dir.exists() && !dir.mkdir()) {
                         fail("failed to create directory: " + dir.getPath());
                     }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java Tue May 14 07:36:34 2013
@@ -27,11 +27,13 @@ import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 
 import junit.extensions.TestSetup;
-import junit.framework.Assert;
 import junit.framework.Test;
+import org.apache.derbyTesting.functionTests.util.PrivilegedFileOpsForTests;
 
 /**
  * A decorator that copies test resources from the classpath
@@ -132,10 +134,8 @@ public class SupportFilesSetup extends T
     public  static   void privCopyFiles(final String dirName, final String[] resources, final String[] targetNames)
     throws PrivilegedActionException
     {
-        AccessController.doPrivileged
-        (new java.security.PrivilegedExceptionAction(){
-            
-            public Object run() throws IOException, PrivilegedActionException { 
+        AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
+            public Void run() throws IOException, PrivilegedActionException {
               copyFiles(dirName, resources, targetNames);
               return null;
             }
@@ -231,24 +231,16 @@ public class SupportFilesSetup extends T
     
     /**
      * Get the full name of the file.
-     * @param name Base name for the resouce.
+     * @param name Base name for the resource.
      */
-    public static String getReadOnlyFileName(String name)
-        throws Exception
+    public static String getReadOnlyFileName(final String name)
     {
-        final   String  finalName = name;
-        try {
-            return (String) AccessController.doPrivileged
-            (new java.security.PrivilegedExceptionAction(){
-
-                public Object run() throws MalformedURLException{
-                    return getReadOnly(  finalName ).getAbsolutePath();
-                }
+        return AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+            public String run() {
+                return getReadOnly(name).getAbsolutePath();
             }
-             );
-        } catch (PrivilegedActionException e) {
-            throw e.getException();
-        } 
+        });
     }
     /**
      * Obtain a File for the local copy of a read-write resource.
@@ -276,15 +268,12 @@ public class SupportFilesSetup extends T
     private static URL getURL(final File file) throws MalformedURLException
     {
         try {
-            return (URL) AccessController.doPrivileged
-            (new java.security.PrivilegedExceptionAction(){
-
-                public Object run() throws MalformedURLException{
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<URL>() {
+                public URL run() throws MalformedURLException {
                     return file.toURI().toURL();
-
                 }
-            }
-             );
+            });
         } catch (PrivilegedActionException e) {
             throw (MalformedURLException) e.getException();
         } 
@@ -293,18 +282,9 @@ public class SupportFilesSetup extends T
 
     public static void deleteFile(final String fileName) 
     {
-        AccessController.doPrivileged
-            (new java.security.PrivilegedAction() {
-                        
-                    public Object run() {
-                        File delFile = new File(fileName);
-                        if (!delFile.exists())
-                                return null;
-                         Assert.assertTrue(delFile.delete());
-                         return null;
-                    }
-                }
-             );
-            
+        File f = new File(fileName);
+        if (PrivilegedFileOpsForTests.exists(f)) {
+            assertTrue(PrivilegedFileOpsForTests.delete(f));
+        }
     }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Tue May 14 07:36:34 2013
@@ -32,7 +32,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
 import java.util.Iterator;
 
 import junit.extensions.TestSetup;
@@ -183,15 +183,8 @@ public final class TestConfiguration {
         if (!assumeHarness) {
             final   File dsh = new File("system");
 
-            AccessController.doPrivileged
-            (new java.security.PrivilegedAction(){
-                public Object run(){
-                    BaseTestCase.setSystemProperty("derby.system.home",
-                                                   dsh.getAbsolutePath());
-                    return null;
-                }
-            }
-             );            
+            BaseTestCase.setSystemProperty(
+                    "derby.system.home", dsh.getAbsolutePath());
         }
      }
     
@@ -200,8 +193,9 @@ public final class TestConfiguration {
      * allow the potential for multiple tests to be running
      * concurrently with different configurations.
      */
-    private static final ThreadLocal CURRENT_CONFIG = new ThreadLocal() {
-        protected Object initialValue() {
+    private static final ThreadLocal<TestConfiguration>
+            CURRENT_CONFIG = new ThreadLocal<TestConfiguration>() {
+        protected TestConfiguration initialValue() {
             return DEFAULT_CONFIG;
         }
     };
@@ -450,10 +444,9 @@ public final class TestConfiguration {
      * A comparator that orders {@code TestCase}s lexicographically by
      * their names.
      */
-    private static final Comparator TEST_ORDERER = new Comparator() {
-        public int compare(Object o1, Object o2) {
-            TestCase t1 = (TestCase) o1;
-            TestCase t2 = (TestCase) o2;
+    private static final Comparator<TestCase> TEST_ORDERER =
+            new Comparator<TestCase>() {
+        public int compare(TestCase t1, TestCase t2) {
             return t1.getName().compareTo(t2.getName());
         }
     };
@@ -467,7 +460,13 @@ public final class TestConfiguration {
      */
     public static Test orderedSuite(Class testClass) {
         // Extract all tests from the test class and order them.
-        ArrayList tests = Collections.list(new TestSuite(testClass).tests());
+        ArrayList<TestCase> tests = new ArrayList<TestCase>();
+
+        Enumeration e = new TestSuite(testClass).tests();
+        while (e.hasMoreElements()) {
+            tests.add((TestCase) e.nextElement());
+        }
+
         Collections.sort(tests, TEST_ORDERER);
 
         // Build a new test suite with the tests in lexicographic order.
@@ -1329,7 +1328,7 @@ public final class TestConfiguration {
         // If this assert will make failures it might be safely removed
         // since having more physical databases accessible throught the same
         // logical database name will access only the last physical database
-        Assert.assertTrue(logicalDbMapping.put(logicalDbName, dbName) == null);
+        Assert.assertNull(logicalDbMapping.put(logicalDbName, dbName));
 
         if (defaultDb) {
             this.defaultDbName = dbName;
@@ -1419,13 +1418,12 @@ public final class TestConfiguration {
      */
     private static final Properties getSystemProperties() {
         // Fetch system properties in a privileged block.
-        Properties sysProps = (Properties)AccessController.doPrivileged(
-                new PrivilegedAction() {
-                    public Object run() {
-                        return System.getProperties();
-                    }
-                });
-        return sysProps;
+        return AccessController.doPrivileged(
+                new PrivilegedAction<Properties>() {
+            public Properties run() {
+                return System.getProperties();
+            }
+        });
     }
 
     /**
@@ -1896,9 +1894,9 @@ public final class TestConfiguration {
             NetworkServerControlWrapper networkServer =
                     new NetworkServerControlWrapper();
 
- 	    serverOutput = (FileOutputStream)
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+ 	    serverOutput = AccessController.doPrivileged(
+                            new PrivilegedAction<FileOutputStream>() {
+                public FileOutputStream run() {
                     File logs = new File("logs");
                     logs.mkdir();
                     File console = new File(logs, "serverConsoleOutput.log");
@@ -2057,19 +2055,16 @@ public final class TestConfiguration {
         // Create the folder
         // TODO: Dump this configuration in some human readable format
         synchronized (base) {
-            
-            AccessController.doPrivileged
-            (new java.security.PrivilegedAction(){
-                public Object run(){
+            AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+                public Boolean run() {
                     if (folder.exists()) {
                         // do something
-                    }            
-                    return new Boolean(folder.mkdirs());
+                    }
+                    return folder.mkdirs();
                 }
-            }
-             );            
+            });
         }
-               
+
         return folder;
         
     }
@@ -2082,9 +2077,9 @@ public final class TestConfiguration {
     private final String defaultDbName;
     /** Holds the names of all other databases used in a test to perform a proper cleanup.
      * The <code>defaultDbName</code> is also contained here.  */
-    private final ArrayList usedDbNames = new ArrayList();
+    private final ArrayList<String> usedDbNames = new ArrayList<String>();
     /** Contains the mapping of logical database names to physical database names. */
-    private final Hashtable logicalDbMapping = new Hashtable();
+    private final HashMap<String, String> logicalDbMapping = new HashMap<String, String>();
     private final String url;
     private final String userName; 
     private final String userPassword; 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XADataSourceConnector.java Tue May 14 07:36:34 2013
@@ -127,8 +127,9 @@ public class XADataSourceConnector imple
             // a new DataSource with the createDatabase property set.
             if (!"XJ004".equals(e.getSQLState()))
                 throw e;
-            HashMap hm = DataSourceConnector.makeCreateDBAttributes( config );
-            if ( connectionProperties != null ) { hm.putAll( connectionProperties ); }
+            HashMap<String, Object> hm =
+                    DataSourceConnector.makeCreateDBAttributes( config );
+            DataSourceConnector.copyProperties(connectionProperties, hm);
             XADataSource tmpDs = singleUseDS( hm );
             JDBCDataSource.setBeanProperty(tmpDs, "databaseName", databaseName);
             return tmpDs.getXAConnection(user, password).getConnection(); 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java Tue May 14 07:36:34 2013
@@ -266,7 +266,7 @@ public class XML {
         //             .getDOMImplementation().getFeature("+XPath", "3.0");
         //
         try {
-            Class factoryClass =
+            Class<?> factoryClass =
                     Class.forName("javax.xml.parsers.DocumentBuilderFactory");
 
             Method newFactory =
@@ -279,7 +279,7 @@ public class XML {
 
             Object builder = newBuilder.invoke(factory, new Object[0]);
 
-            Class builderClass =
+            Class<?> builderClass =
                     Class.forName("javax.xml.parsers.DocumentBuilder");
 
             Method getImpl = builderClass.getMethod(
@@ -287,7 +287,8 @@ public class XML {
 
             Object impl = getImpl.invoke(builder, new Object[0]);
 
-            Class domImplClass = Class.forName("org.w3c.dom.DOMImplementation");
+            Class<?> domImplClass =
+                    Class.forName("org.w3c.dom.DOMImplementation");
 
             Method getFeature = domImplClass.getMethod(
                     "getFeature", new Class[] {String.class, String.class});
@@ -308,7 +309,7 @@ public class XML {
 
     private static boolean checkJAXPImplementation() {
         try {
-            Class factoryClass =
+            Class<?> factoryClass =
                     Class.forName("javax.xml.parsers.DocumentBuilderFactory");
             Method newFactory =
                     factoryClass.getMethod("newInstance", new Class[0]);
@@ -341,10 +342,10 @@ public class XML {
             return null;
 
         try {
-            Class   jaxpFinderClass = Class.forName( "org.apache.derbyTesting.junit.JAXPFinder" );
-            Method  locatorMethod = jaxpFinderClass.getDeclaredMethod( "getJAXPParserLocation", null );
+            Class<?> jaxpFinderClass = Class.forName("org.apache.derbyTesting.junit.JAXPFinder");
+            Method locatorMethod = jaxpFinderClass.getDeclaredMethod("getJAXPParserLocation");
 
-            return (String) locatorMethod.invoke(  null, null );
+            return (String) locatorMethod.invoke(null);
         }
         catch (Exception e)
         {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/build.xml?rev=1482234&r1=1482233&r2=1482234&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/build.xml Tue May 14 07:36:34 2013
@@ -73,6 +73,7 @@
         <pathelement path="${compile.classpath}"/>
         <pathelement path="${junit}"/>
       </classpath>
+      <compilerarg value="-Xlint"/>
     </javac>
   </target>