db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1482862 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/compatibility/ functionTests/tests/derbynet/ functionTests/tests/engine/ functionTests/tests/i18n/ functionTests/tests/largedata/ functionTests/tes...
Date Wed, 15 May 2013 14:21:39 GMT
Author: kahatlen
Date: Wed May 15 14:21:39 2013
New Revision: 1482862

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

Fix unchecked warnings in test packages:

  - engine
  - i18n
  - store
  - tools

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStartTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ErrorStreamTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ModuleLoadingTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/RestrictiveFilePermissionsTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/multi/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby3980DeadlockTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/MaxLogNumberRecovery.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjConnNameTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/HarnessJavaTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml Wed May 15 14:21:39 2013
@@ -65,6 +65,7 @@
               <pathelement path="${junit}"/>
             </classpath>
             <include name="${this.dir}/*.java"/>
+            <compilerarg value="-Xlint"/>
         </javac>
     </target>	
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStartTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStartTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStartTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStartTest.java Wed May 15 14:21:39 2013
@@ -28,8 +28,6 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -156,13 +154,8 @@ public class DerbyNetAutoStartTest exten
         final PrintStream realSystemErr = System.err;
         ByteArrayOutputStream serverOutputBOS = new ByteArrayOutputStream();
         final PrintStream serverOutputOut = new PrintStream( serverOutputBOS);
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-            public Void run() {
-                System.setOut(new PrintStream(serverOutputOut));
-                System.setErr(new PrintStream(serverOutputOut));
-                return null;
-            }
-        });
+        setSystemOut(new PrintStream(serverOutputOut));
+        setSystemErr(new PrintStream(serverOutputOut));
 
         try {
             try
@@ -179,13 +172,8 @@ public class DerbyNetAutoStartTest exten
             }
         } finally {
             // Restore the original out streams
-            AccessController.doPrivileged(new PrivilegedAction<Void>() {
-                public Void run() {
-                    System.setOut(realSystemOut);
-                    System.setErr(realSystemErr);
-                    return null;
-                }
-            });
+            setSystemOut(realSystemOut);
+            setSystemErr(realSystemErr);
         }
 
         // Verify the server - use default port - is not up

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ErrorStreamTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ErrorStreamTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ErrorStreamTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ErrorStreamTest.java Wed May 15 14:21:39 2013
@@ -34,6 +34,7 @@ import java.security.PrivilegedActionExc
 import java.security.PrivilegedExceptionAction;
 import java.sql.SQLException;
 import junit.framework.Test;
+import org.apache.derbyTesting.functionTests.util.PrivilegedFileOpsForTests;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
@@ -385,26 +386,11 @@ public class ErrorStreamTest extends Bas
         }
     }
 
-
-    private static void assertIsDirectory(final File f) throws IOException {
-        try {
-            AccessController.doPrivileged (new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
-                    assertTrue("assertIsDirectory failed: " +
-                          f.getCanonicalPath(), f.isDirectory());
-                    return null;
-                }
-            });
-        } catch (PrivilegedActionException e) {
-            // e.getException() should be an instance of IOException.
-            throw (IOException) e.getException();
-        }
-    }
-
     private static void assertNotDirectory(final File f) throws IOException {
         try {
-            AccessController.doPrivileged (new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
+            AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<Void>() {
+                public Void run() throws IOException {
                     assertFalse("assertNotDirectory failed: " +
                           f.getCanonicalPath(), f.isDirectory());
                     return null;
@@ -417,25 +403,19 @@ public class ErrorStreamTest extends Bas
     }
 
     private static void assertIsEmpty(final File f) throws IOException {
-        try {
-            AccessController.doPrivileged (new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
-                    assertTrue("assertIsEmpty failed: " + f.getCanonicalPath(),
-                          (f.exists() && (f.length() == 0)));
-                    return null;
-                }
-            });
-        } catch (PrivilegedActionException e) {
-            // e.getException() should be an instance of IOException.
-            throw (IOException) e.getException();
-        }
+        String path = getCanonicalPath(f);
+        assertTrue(path + " doesn't exist",
+                PrivilegedFileOpsForTests.exists(f));
+        assertEquals(path + " is not empty",
+                0, PrivilegedFileOpsForTests.length(f));
     }
 
 
     private static void assertNotEmpty(final File f) throws IOException {
         try {
-            AccessController.doPrivileged (new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
+            AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<Void>() {
+                public Void run() throws IOException {
                     assertTrue("assertNotEmpty failed: " + f.getCanonicalPath()
                           + " does not exist.", f.exists());
                     FileInputStream fis = new FileInputStream(f);
@@ -453,52 +433,27 @@ public class ErrorStreamTest extends Bas
     }
 
     private static void assertIsExisting(final File f) throws IOException {
-        try {
-            AccessController.doPrivileged (new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
-                    assertTrue("assertIsExisting failed: " +
-                          f.getCanonicalPath(), f.exists());
-                    return null;
-                }
-            });
-        } catch (PrivilegedActionException e) {
-            // e.getException() should be an instance of IOException.
-            throw (IOException) e.getException();
-        }
+        String path = getCanonicalPath(f);
+        assertTrue(path + " doesn't exist",
+                PrivilegedFileOpsForTests.exists(f));
     }
 
 
     private static void assertNotExisting(final File f) throws IOException {
-        try {
-            AccessController.doPrivileged (new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
-                    assertFalse("assertNotExisting failed: " +
-                          f.getCanonicalPath(), f.exists());
-                    return null;
-                }
-            });
-        } catch (PrivilegedActionException e) {
-            // e.getException() should be an instance of IOException.
-            throw (IOException) e.getException();
-        }
+        String path = getCanonicalPath(f);
+        assertFalse(path + " exists",
+                PrivilegedFileOpsForTests.exists(f));
     }
 
     private static boolean deleteFile(final File f) {
-        Boolean deleted = (Boolean) AccessController.doPrivileged(
-              new PrivilegedAction() {
-            public Object run() {
-                return new Boolean(f.delete());
-            }
-        });
-        return deleted.booleanValue();
+        return PrivilegedFileOpsForTests.delete(f);
     }
 
     private static String getCanonicalPath(final File f) throws IOException {
-        String path = null;
         try {
-            path = (String) AccessController.doPrivileged(
-                  new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
+            return AccessController.doPrivileged(
+                  new PrivilegedExceptionAction<String>() {
+                public String run() throws IOException {
                     return f.getCanonicalPath();
                 }
             });
@@ -506,12 +461,11 @@ public class ErrorStreamTest extends Bas
             // e.getException() should be an instance of IOException.
             throw (IOException) e.getException();
         }
-        return path;
     }
 
     private static void makeDirIfNotExisting(final String filename) {
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
                 File f = new File(filename);
                 if(!f.exists()) {
                     f.mkdir();
@@ -521,22 +475,12 @@ public class ErrorStreamTest extends Bas
         });
     }
 
-    private static void setSystemErr(final PrintStream err) {
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                System.setErr(err);
-                return null;
-            }
-        });
-    }
-
     private static FileOutputStream newFileOutputStream(final File f)
     throws FileNotFoundException {
-        FileOutputStream outStream = null;
         try {
-            outStream = (FileOutputStream) AccessController.doPrivileged(
-                  new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
+            return AccessController.doPrivileged(
+                  new PrivilegedExceptionAction<FileOutputStream>() {
+                public FileOutputStream run() throws FileNotFoundException {
                     return new FileOutputStream(f);
                 }
             });
@@ -544,7 +488,6 @@ public class ErrorStreamTest extends Bas
                 // e.getException() should be a FileNotFoundException.
                 throw (FileNotFoundException) e.getException();
             }
-        return outStream;
     }
 
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ModuleLoadingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ModuleLoadingTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ModuleLoadingTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ModuleLoadingTest.java Wed May 15 14:21:39 2013
@@ -67,7 +67,7 @@ public class ModuleLoadingTest extends B
         // Active threads count.
         final int[] activeThreads = new int[1];
         // List of exceptions/throwables thrown by the forked threads.
-        final ArrayList exceptions = new ArrayList();
+        final ArrayList<Throwable> exceptions = new ArrayList<Throwable>();
 
         Thread[] threads = new Thread[numThreads];
 
@@ -132,7 +132,7 @@ public class ModuleLoadingTest extends B
         // At least one of the threads failed. Re-throw the first error
         // reported.
         if (!exceptions.isEmpty()) {
-            throw (Throwable) exceptions.get(0);
+            throw exceptions.get(0);
         }
     }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/RestrictiveFilePermissionsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/RestrictiveFilePermissionsTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/RestrictiveFilePermissionsTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/RestrictiveFilePermissionsTest.java Wed May 15 14:21:39 2013
@@ -498,21 +498,19 @@ public class RestrictiveFilePermissionsT
     private static boolean initialized = false;
 
     // Reflection helper objects for calling into Java >= 7
-    private static Class filesClz;
-    private static Class pathClz;
-    private static Class pathsClz;
-    private static Class aclEntryClz;
-    private static Class aclFileAttributeViewClz;
-    private static Class posixFileAttributeViewClz;
-    private static Class posixFileAttributesClz;
-    private static Class posixFilePermissionClz;
-    private static Class userPrincipalClz;
-    private static Class linkOptionArrayClz;
-    private static Class linkOptionClz;
-    private static Class stringArrayClz;
-    private static Class aclEntryBuilderClz;
-    private static Class aclEntryTypeClz;
-    private static Class fileStoreClz;
+    private static Class<?> filesClz;
+    private static Class<?> pathClz;
+    private static Class<?> pathsClz;
+    private static Class<?> aclEntryClz;
+    private static Class<?> aclFileAttributeViewClz;
+    private static Class<?> posixFileAttributeViewClz;
+    private static Class<?> posixFileAttributesClz;
+    private static Class<?> posixFilePermissionClz;
+    private static Class<?> userPrincipalClz;
+    private static Class<?> linkOptionArrayClz;
+    private static Class<?> linkOptionClz;
+    private static Class<?> stringArrayClz;
+    private static Class<?> fileStoreClz;
 
     private static Method get;
     private static Method getFileAttributeView;
@@ -532,7 +530,7 @@ public class RestrictiveFilePermissionsT
     private static Field OTHERS_EXECUTE;
     private static Field OTHERS_READ;
     private static Field OTHERS_WRITE;
-    private static Set unwantedPermissions;
+    private static Set<Object> unwantedPermissions;
     /**
      * Check that the file has access only for the owner. Will throw (JUnit
      * failure) if permissions are not strict.
@@ -580,8 +578,9 @@ public class RestrictiveFilePermissionsT
             // visit immediately contained file in this directory also
             checkAccessToOwner(file, false, expectedOutcome);
 
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws Exception {
+            AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<Void>() {
+                public Void run() throws Exception {
                     File [] files = file.listFiles();
                     for (int i = 0; i < files.length; i++){
                         checkAccessToOwner(
@@ -591,11 +590,10 @@ public class RestrictiveFilePermissionsT
                 }});
         }
 
-        Boolean result =
-            (Boolean)AccessController.
-            doPrivileged(new PrivilegedExceptionAction() {
+        return AccessController.
+            doPrivileged(new PrivilegedExceptionAction<Boolean>() {
 
-                public Object run() throws Exception {
+                public Boolean run() throws Exception {
                     // lazy initialization
                     if (!initialized) {
                         initialized = true;
@@ -629,10 +627,6 @@ public class RestrictiveFilePermissionsT
                             "java.nio.file.LinkOption");
                         stringArrayClz = Class.forName(
                             "[Ljava.lang.String;");
-                        aclEntryBuilderClz = Class.forName(
-                            "java.nio.file.attribute.AclEntry$Builder");
-                        aclEntryTypeClz = Class.forName(
-                            "java.nio.file.attribute.AclEntryType");
                         fileStoreClz = Class.forName(
                             "java.nio.file.FileStore");
 
@@ -681,7 +675,7 @@ public class RestrictiveFilePermissionsT
                             posixFilePermissionClz.getField("OTHERS_READ");
                         OTHERS_WRITE =
                             posixFilePermissionClz.getField("OTHERS_WRITE");
-                        unwantedPermissions = new HashSet();
+                        unwantedPermissions = new HashSet<Object>();
                         unwantedPermissions.add(GROUP_EXECUTE.get(null));
                         unwantedPermissions.add(GROUP_READ.get(null));
                         unwantedPermissions.add(GROUP_WRITE.get(null));
@@ -839,7 +833,5 @@ public class RestrictiveFilePermissionsT
                         return Boolean.FALSE;
                     }
                 }});
-
-        return result.booleanValue();
     }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml Wed May 15 14:21:39 2013
@@ -84,6 +84,7 @@
            <pathelement path="${junit}"/>
         </classpath>
         <include name="${this.dir}/*.java"/>
+        <compilerarg value="-Xlint"/>
      </javac>
   </target>
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java Wed May 15 14:21:39 2013
@@ -21,13 +21,8 @@
 
 package org.apache.derbyTesting.functionTests.tests.i18n;
 
-import java.util.Locale;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.sql.DriverManager;
-import java.sql.Connection;
 import java.sql.SQLException;
+import org.apache.derbyTesting.junit.LocaleTestSetup;
 
 public class DefaultLocale { 
 
@@ -75,16 +70,8 @@ public class DefaultLocale { 
 		// called through a SQL statement and thus a generated
 		// class. The generated class on the stack has no permissions
 		// granted to it. Needs write permission on user.language
-		AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-            	java.util.Locale.setDefault(new java.util.Locale(Locale.trim(),Code.trim()));
-                return null; // nothing to return
-            }
-        });		
-		
+        LocaleTestSetup.setDefaultLocale(
+                new java.util.Locale(Locale.trim(), Code.trim()));
 	}
 
-
-
-
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java Wed May 15 14:21:39 2013
@@ -20,8 +20,6 @@
 
 package org.apache.derbyTesting.functionTests.tests.i18n;
 
-import java.io.File;
-import java.security.AccessController;
 import java.util.Properties;
 
 import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
@@ -118,58 +116,8 @@ public final class LocalizedAttributeScr
         // not be saved in the 'fail' directory.
         // We can't rely on an additionalDatabaseDecorator because 'detest'
         // is not just a logical, but a physical db name.
-        AccessController.doPrivileged(new java.security.PrivilegedAction() {
-            public Object run() {
-                    removeDatabase("detest");
-                return null;
-            }
-            
-            void removeDatabase(String dbName)
-            {
-                //TestConfiguration config = TestConfiguration.getCurrent();
-                dbName = dbName.replace('/', File.separatorChar);
-                String dsh = getSystemProperty("derby.system.home");
-                if (dsh == null) {
-                    fail("not implemented");
-                } else {
-                    dbName = dsh + File.separator + dbName;
-                }
-                removeDirectory(dbName);
-            }
-
-            void removeDirectory(String path)
-            {
-                final File dir = new File(path);
-                removeDir(dir);
-            }
-
-            private void removeDir(File dir) {
-                
-                // Check if anything to do!
-                // Database may not have been created.
-                if (!dir.exists())
-                    return;
-
-                String[] list = dir.list();
-
-                // Some JVMs return null for File.list() when the
-                // directory is empty.
-                if (list != null) {
-                    for (int i = 0; i < list.length; i++) {
-                        File entry = new File(dir, list[i]);
-
-                        if (entry.isDirectory()) {
-                            removeDir(entry);
-                        } else {
-                            entry.delete();
-                            //assertTrue(entry.getPath(), entry.delete());
-                        }
-                    }
-                }
-                dir.delete();
-                //assertTrue(dir.getPath(), dir.delete());
-            }
-        });
+        removeDirectory(
+            TestConfiguration.getCurrent().getDatabasePath("detest"));
         super.tearDown();
     }    
 }
\ No newline at end of file

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/build.xml Wed May 15 14:21:39 2013
@@ -84,6 +84,7 @@
         <pathelement path="${junit}"/>
       </classpath>
       <include name="${this.dir}/*.java"/>
+      <compilerarg value="-Xlint"/>
     </javac>
   </target>
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml Wed May 15 14:21:39 2013
@@ -58,6 +58,7 @@
         <pathelement path="${junit}"/>
       </classpath>
       <include name="${derby.testing.functest.dir}/tests/largedata/*.java"/>
+      <compilerarg value="-Xlint"/>
     </javac>
   </target>
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/build.xml Wed May 15 14:21:39 2013
@@ -53,6 +53,7 @@
                 <pathelement path="${junit}"/>
             </classpath>
             <include name="${this.dir}/*.java"/>
+            <compilerarg value="-Xlint"/>
         </javac>
         <copy todir="${out.dir}/${derby.testing.functest.dir}/tests/management">
           <fileset dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/management"

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/multi/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/multi/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/multi/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/multi/build.xml Wed May 15 14:21:39 2013
@@ -58,6 +58,7 @@
         <pathelement path="${junit}"/>
       </classpath>
       <include name="${derby.testing.functest.dir}/tests/multi/*.java"/>
+      <compilerarg value="-Xlint"/>
     </javac>
   </target>
   

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/nist/build.xml Wed May 15 14:21:39 2013
@@ -92,6 +92,7 @@
 	        <pathelement path="${junit}"/>
 	      </classpath>
 	      <include name="${derby.testing.functest.dir}/tests/nist/*.java"/>
+              <compilerarg value="-Xlint"/>
 	    </javac>
 	  </target>
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/build.xml Wed May 15 14:21:39 2013
@@ -84,6 +84,7 @@
         <pathelement path="${junit}"/>
       </classpath>
       <include name="${this.dir}/*.java"/>
+      <compilerarg value="-Xlint"/>
     </javac>
   </target>
     <target name="copyfiles">

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby3980DeadlockTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby3980DeadlockTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby3980DeadlockTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby3980DeadlockTest.java Wed May 15 14:21:39 2013
@@ -25,7 +25,6 @@ import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Properties;
 
@@ -47,7 +46,8 @@ import org.apache.derbyTesting.junit.Tes
  */
 public class Derby3980DeadlockTest extends BaseJDBCTestCase {
     private final int THREAD_COUNT = 2;
-    private final LinkedList listExceptions = new LinkedList();
+    private final LinkedList<Throwable> listExceptions =
+            new LinkedList<Throwable>();
     private final Object syncObject = new Object();
     private int startedCount = 0;
     private static final String fprefix = "javacore";
@@ -73,9 +73,12 @@ public class Derby3980DeadlockTest exten
     private void checkExceptions() {        
         //Due to timing, you might see ERROR 40XL1: A lock could not be obtained
         //instead of ERROR 40001 (DERBY-3980)
-        for( Iterator i = listExceptions.iterator(); i.hasNext(); ) {
-            SQLException e = (SQLException) i.next();
-            assertSQLState("40001",e);
+        for (Throwable t : listExceptions) {
+            if (t instanceof SQLException) {
+                assertSQLState("40001", (SQLException) t);
+            } else {
+                fail("Unexpected exception", t);
+            }
         }
         assertEquals("Expected 1 exception, got" + listExceptions.size(),
                 1,listExceptions.size());

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/MaxLogNumberRecovery.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/MaxLogNumberRecovery.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/MaxLogNumberRecovery.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/MaxLogNumberRecovery.java Wed May 15 14:21:39 2013
@@ -97,9 +97,9 @@ public class MaxLogNumberRecovery extend
     {
     
     AccessController.doPrivileged
-        (new java.security.PrivilegedAction(){
+        (new java.security.PrivilegedAction<Void>(){
             
-            public Object run(){
+            public Void run(){
             System.setProperty( name, value);
             return null;
             

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java Wed May 15 14:21:39 2013
@@ -181,18 +181,19 @@ public class TestDiskHashtable 
 
         boolean[] isDuplicate = new boolean[ rows.length];
         boolean[] found = new boolean[ rows.length];
-        HashMap simpleHash = new HashMap( rows.length);
+        HashMap<Object, Vector<DataValueDescriptor[]>> simpleHash =
+            new HashMap<Object, Vector<DataValueDescriptor[]>>(rows.length);
 
-        testElements( removeDups, dht, keyCols, 0, rows, simpleHash, isDuplicate, found);
+        testElements( removeDups, dht, 0, rows, isDuplicate, found);
 
         for( int i = 0; i < rows.length; i++)
         {
             Object key = KeyHasher.buildHashKey( rows[i], keyCols);
-            Vector al = (Vector) simpleHash.get( key);
+            Vector<DataValueDescriptor[]> al = simpleHash.get( key);
             isDuplicate[i] = (al != null);
             if( al == null)
             {
-                al = new Vector(4);
+                al = new Vector<DataValueDescriptor[]>(4);
                 simpleHash.put( key, al);
             }
             if( (!removeDups) || !isDuplicate[i])
@@ -208,7 +209,7 @@ public class TestDiskHashtable 
                     REPORT_FAILURE( "  get returned wrong value on key " + j);
             }
 
-            testElements( removeDups, dht, keyCols, i+1, rows, simpleHash, isDuplicate, found);
+            testElements( removeDups, dht, i+1, rows, isDuplicate, found);
         }
         // Remove them
         for( int i = 0; i < rows.length; i++)
@@ -220,7 +221,7 @@ public class TestDiskHashtable 
             if( dht.get( key) != null)
                 REPORT_FAILURE( "  remove did not delete key " + i);
         }
-        testElements( removeDups, dht, keyCols, 0, rows, simpleHash, isDuplicate, found);
+        testElements( removeDups, dht, 0, rows, isDuplicate, found);
 
         testLargeTable( dht, keyCols, rows[0]);
         dht.close();
@@ -314,10 +315,8 @@ public class TestDiskHashtable 
 
     private void testElements( boolean removeDups,
                                DiskHashtable dht,
-                               int[] keyCols,
                                int rowCount,
                                DataValueDescriptor[][] rows,
-                               HashMap simpleHash,
                                boolean[] isDuplicate,
                                boolean[] found)
         throws StandardException

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/build.xml Wed May 15 14:21:39 2013
@@ -83,6 +83,7 @@
         <pathelement path="${junit}"/>
       </classpath>
       <include name="${this.dir}/*.java"/>
+      <compilerarg value="-Xlint"/>
     </javac>
   </target>
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjConnNameTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjConnNameTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjConnNameTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjConnNameTest.java Wed May 15 14:21:39 2013
@@ -21,9 +21,6 @@
 */
 package org.apache.derbyTesting.functionTests.tests.tools;
 
-import java.io.File;
-
-import java.security.AccessController;
 import java.util.Properties;
 
 import junit.framework.Test;
@@ -33,8 +30,8 @@ import junit.framework.TestSuite;
 import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
 import org.apache.derbyTesting.junit.JDBC;
-import org.apache.derbyTesting.junit.SecurityManagerSetup;
 import org.apache.derbyTesting.junit.SystemPropertyTestSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 
 
@@ -77,58 +74,8 @@ public class IjConnNameTest extends Scri
         // attempt to get rid of the extra database.
         // this also will get done if there are failures, and the database will
         // not be saved in the 'fail' directory.
-        AccessController.doPrivileged(new java.security.PrivilegedAction() {
-            public Object run() {
-                    removeDatabase("lemming" );
-                return null;
-            }
-            
-            void removeDatabase(String dbName)
-            {
-                //TestConfiguration config = TestConfiguration.getCurrent();
-                dbName = dbName.replace('/', File.separatorChar);
-                String dsh = getSystemProperty("derby.system.home");
-                if (dsh == null) {
-                    fail("not implemented");
-                } else {
-                    dbName = dsh + File.separator + dbName;
-                }
-                removeDirectory(dbName);
-            }
-
-            void removeDirectory(String path)
-            {
-                final File dir = new File(path);
-                removeDir(dir);
-            }
-
-            private void removeDir(File dir) {
-                
-                // Check if anything to do!
-                // Database may not have been created.
-                if (!dir.exists())
-                    return;
-
-                String[] list = dir.list();
-
-                // Some JVMs return null for File.list() when the
-                // directory is empty.
-                if (list != null) {
-                    for (int i = 0; i < list.length; i++) {
-                        File entry = new File(dir, list[i]);
-
-                        if (entry.isDirectory()) {
-                            removeDir(entry);
-                        } else {
-                            entry.delete();
-                            //assertTrue(entry.getPath(), entry.delete());
-                        }
-                    }
-                }
-                dir.delete();
-                //assertTrue(dir.getPath(), dir.delete());
-            }
-        });
+        removeDirectory(
+            TestConfiguration.getCurrent().getDatabasePath("lemming"));
         super.tearDown();
     }   
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.java Wed May 15 14:21:39 2013
@@ -23,8 +23,6 @@
 package org.apache.derbyTesting.functionTests.tests.tools;
 
 import java.io.PrintStream;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -46,13 +44,8 @@ public class IjSecurityManagerTest exten
 	    final PrintStream out = System.out;
 	    
 	    /* Mute the test */
-	    AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                System.setOut(new PrintStream(new TestNullOutputStream()));
-                return null;
-            }
-        });
-	    
+        setSystemOut(new PrintStream(new TestNullOutputStream()));
+
 	    try {
 	        /* Run ij */
 	        ij.main(new String[]{"extinout/IjSecurityManagerTest.sql"});
@@ -60,12 +53,7 @@ public class IjSecurityManagerTest exten
 	        fail("Failed to run ij under security manager.",e);
 	    } finally {
 	        /* Restore the original out stream */
-	        AccessController.doPrivileged(new PrivilegedAction() {
-	            public Object run() {
-	                System.setOut(out);
-	                return null;
-	            }
-	        });
+            setSystemOut(out);
 	    }
 	}
 	

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java Wed May 15 14:21:39 2013
@@ -26,10 +26,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.io.OutputStream;
 import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.security.AccessController;
 import java.util.Locale;
 
 import junit.framework.Test;
@@ -225,23 +222,6 @@ public class SysinfoCPCheckTest extends 
         return true;
     }
 
-    /**
-     * Need to capture System.out so that we can compare it.
-     * @param out
-     */
-    private void setSystemOut(final PrintStream out)
-    {
-        AccessController.doPrivileged
-        (new java.security.PrivilegedAction(){
-
-            public Object run(){
-                System.setOut(out);
-                return null;
-            }
-        }
-        );       
-    }
-
     ByteArrayOutputStream getOutputStream() {
         return new ByteArrayOutputStream(20 * 1024);
     }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java Wed May 15 14:21:39 2013
@@ -168,7 +168,7 @@ public class SysinfoLocaleTest extends B
         }
         URLClassLoader loader = new URLClassLoader(urls, null);
 
-        Class copy = Class.forName(className, true, loader);
+        Class<?> copy = Class.forName(className, true, loader);
         Method main = copy.getMethod("main", new Class[] { String[].class });
         main.invoke(null, new Object[] { new String[0] });
     }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml Wed May 15 14:21:39 2013
@@ -83,7 +83,7 @@
         <pathelement path="${compile.classpath};${junit}"/>
       </classpath>
       <include name="${this.dir}/*.java"/>
-      <!--exclude name=""/-->
+      <compilerarg value="-Xlint"/>
     </javac>
   </target>
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java Wed May 15 14:21:39 2013
@@ -25,21 +25,13 @@ import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.Connection;
 import java.sql.Statement;
-import java.sql.PreparedStatement;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.Timestamp;
-
-import java.io.PrintWriter;
-import java.io.FileOutputStream;
-import java.io.FileNotFoundException;
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.File;
 
 import org.apache.derby.tools.dblook;
-import org.apache.derby.tools.ij;
 import org.apache.derby.catalog.DependableFinder;
 import org.apache.derbyTesting.functionTests.util.TestUtil;
 
@@ -48,9 +40,7 @@ import org.apache.derbyTesting.functionT
 import java.util.HashMap;
 import java.util.TreeMap;
 import java.util.Set;
-import java.util.Iterator;
 import java.util.ArrayList;
-import java.util.StringTokenizer;
 
 public class dblook_test {
 
@@ -750,7 +740,7 @@ public class dblook_test {
 
 		// Load any id-to-name mappings that will be useful
 		// when dumping the catalogs.
-		HashMap idToNameMap = loadIdMappings(stmt, conn);
+		HashMap<String, String> idToNameMap = loadIdMappings(stmt);
 
 		// Go through and dump all system catalog information,
 		// filtering out database-dependent id's so that they
@@ -902,7 +892,7 @@ public class dblook_test {
 	 ****/
 
 	private void dumpResultSet (ResultSet rs,
-		HashMap idToNameMap, Connection conn)
+		HashMap<String, String> idToNameMap, Connection conn)
 		throws Exception
 	{
 
@@ -921,9 +911,10 @@ public class dblook_test {
 		// which is why we use object names.
 		StringBuffer uniqueName = new StringBuffer();
 
-		TreeMap orderedRows = new TreeMap();
-		ArrayList rowValues = new ArrayList();
-		ArrayList duplicateRowIds = new ArrayList();
+		TreeMap<String, ArrayList<String>> orderedRows =
+                new TreeMap<String, ArrayList<String>>();
+		ArrayList<String> rowValues = new ArrayList<String>();
+		ArrayList<String> duplicateRowIds = new ArrayList<String>();
 		ResultSetMetaData rsmd = rs.getMetaData();
 		int cols = rsmd.getColumnCount();
 		while (rs.next()) {
@@ -932,7 +923,7 @@ public class dblook_test {
 
 				String colName = rsmd.getColumnName(i);
 				String value = rs.getString(i);
-				String mappedName = (String)idToNameMap.get(value);
+				String mappedName = idToNameMap.get(value);
 
 				if ((colName.indexOf("SCHEMAID") != -1) &&
 					(mappedName != null) &&
@@ -1022,8 +1013,8 @@ public class dblook_test {
 				// id.
 					handleDuplicateRow(rowValues, null, orderedRows);
 				else {
-					ArrayList oldRow = (ArrayList)(orderedRows.put(
-						uniqueName.toString(), rowValues));
+					ArrayList<String> oldRow = orderedRows.put(
+						uniqueName.toString(), rowValues);
 					if (oldRow != null) {
 					// Duplicate row id.
 						duplicateRowIds.add(uniqueName.toString());
@@ -1035,23 +1026,19 @@ public class dblook_test {
 			}
 
 			uniqueName = new StringBuffer();
-			rowValues = new ArrayList();
+			rowValues = new ArrayList<String>();
 
 		}
 
 		// Now, print out all of the data in this result set
 		// using the order of the unique names that we created.
-		Set objectNames = orderedRows.keySet();
-		for (Iterator itr = objectNames.iterator();
-			itr.hasNext(); ) {
-
-			String row = (String)itr.next();
-			ArrayList colData = (ArrayList)orderedRows.get(row);
-			for (int i = 0; i < colData.size(); i++)
-				writeOut((String)colData.get(i));
-			writeOut("----");
-
-		}
+        Set<String> objectNames = orderedRows.keySet();
+        for (String row : objectNames) {
+            ArrayList<String> colData = orderedRows.get(row);
+            for (int i = 0; i < colData.size(); i++)
+                writeOut((String)colData.get(i));
+            writeOut("----");
+        }
 
 		orderedRows = null;
 		rs.close();
@@ -1082,7 +1069,7 @@ public class dblook_test {
 	 ****/
 
 	private String dumpColumnData(String colName,
-		String value, String mappedName, ArrayList rowVals)
+		String value, String mappedName, ArrayList<String> rowVals)
 	{
 
 		if (mappedName == null) {
@@ -1174,8 +1161,8 @@ public class dblook_test {
 	 ****/
 
 	private void handleDuplicateRow(
-		ArrayList newRow, ArrayList oldRow,
-		TreeMap orderedRows)
+		ArrayList<String> newRow, ArrayList<String> oldRow,
+		TreeMap<String, ArrayList<String>> orderedRows)
 	{
 
 		// Add the received rows (old and new) with
@@ -1185,8 +1172,7 @@ public class dblook_test {
 		for (int i = 0; i < newRow.size(); i++)
 			newRowId.append((String)newRow.get(i));
 
-		Object obj = (ArrayList)(orderedRows.put(
-						newRowId.toString(), newRow));
+		ArrayList<String> obj = orderedRows.put(newRowId.toString(), newRow);
 		if (obj != null)
 		// entire row is a duplicate.
 			orderedRows.put(newRowId.toString() + 
@@ -1198,8 +1184,7 @@ public class dblook_test {
 			for (int i = 0; i < oldRow.size(); i++)
 				oldRowId.append((String)oldRow.get(i));
 
-			obj = (ArrayList)(orderedRows.put(
-				oldRowId.toString(), oldRow));
+			obj = orderedRows.put(oldRowId.toString(), oldRow);
 			if (obj != null)
 			// entire row is a duplicate.
 				orderedRows.put(oldRowId.toString() +
@@ -1299,10 +1284,10 @@ public class dblook_test {
 	 *  name mappings has been returned.
 	 ****/
 
-	private HashMap loadIdMappings(Statement stmt,
-		Connection conn) throws Exception {
+    private HashMap<String, String> loadIdMappings(Statement stmt)
+            throws Exception {
 
-		HashMap idToNameMap = new HashMap();
+		HashMap<String, String> idToNameMap = new HashMap<String, String>();
 
 		// Table ids.
 		ResultSet rs = stmt.executeQuery(

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.java Wed May 15 14:21:39 2013
@@ -77,7 +77,7 @@ public class derbyrunjartest extends Bas
               derbyrunloc = derbyrunloc.substring(1);
         }
 
-        ArrayList cmdArgs = new ArrayList();
+        ArrayList<String> cmdArgs = new ArrayList<String>();
 
         // Invoke java -jar derbyrun.jar if we are running from jars, or
         // with fully qualified class name if we are running from classes.
@@ -90,7 +90,7 @@ public class derbyrunjartest extends Bas
 
         cmdArgs.addAll(Arrays.asList(toolArgs));
 
-        String[] cmd = (String[]) cmdArgs.toArray(new String[cmdArgs.size()]);
+        String[] cmd = cmdArgs.toArray(new String[cmdArgs.size()]);
         assertExecJavaCmdAsExpected(output, cmd, exitCode);
     }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/HarnessJavaTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/HarnessJavaTest.java?rev=1482862&r1=1482861&r2=1482862&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/HarnessJavaTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/HarnessJavaTest.java Wed May 15 14:21:39 2013
@@ -22,7 +22,6 @@ package org.apache.derbyTesting.function
 
 import java.io.PrintStream;
 import java.lang.reflect.Method;
-import java.security.AccessController;
 import java.util.Properties;
 
 import junit.framework.Test;
@@ -137,23 +136,4 @@ public abstract class HarnessJavaTest ex
         
         return dtest;
     }
-    
-    /**
-     * Need to capture System.out so that we can compare it.
-     * @param out
-     */
-    private void setSystemOut(final PrintStream out)
-    {
-        AccessController.doPrivileged
-        (new java.security.PrivilegedAction(){
-            
-            public Object run(){
-            System.setOut(out);
-            return null;
-            
-            }
-            
-        }
-         );       
-    }
 }

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=1482862&r1=1482861&r2=1482862&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 Wed May 15 14:21:39 2013
@@ -233,7 +233,35 @@ public abstract class BaseTestCase
     }
 
     private final static PrintStream out = System.out;
-    
+
+    /**
+     * Change the value of {@code System.out}.
+     *
+     * @param out the new stream
+     */
+    protected void setSystemOut(final PrintStream out) {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                System.setOut(out);
+                return null;
+            }
+        });
+    }
+
+    /**
+     * Change the value of {@code System.err}.
+     *
+     * @param err the new stream
+     */
+    protected void setSystemErr(final PrintStream err) {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                System.setErr(err);
+                return null;
+            }
+        });
+    }
+
     /**
      * Set system property
      *



Mime
View raw message