db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1482443 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/types/ impl/db/ impl/io/ impl/io/vfmem/ impl/load/ security/
Date Tue, 14 May 2013 16:43:57 GMT
Author: rhillegas
Date: Tue May 14 16:43:56 2013
New Revision: 1482443

URL: http://svn.apache.org/r1482443
Log:
DERBY-6213: Cleanup Java6 related lint warnings in types, load, db, io, and security.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/impl/db/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/impl/io/VFMemoryStorageFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/io/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/impl/io/vfmem/DataStore.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Export.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Import.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportLobFile.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/security/DatabasePermission.java
    db/derby/code/trunk/java/engine/org/apache/derby/security/SystemPermission.java
    db/derby/code/trunk/java/engine/org/apache/derby/security/build.xml

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml Tue May 14 16:43:56
2013
@@ -77,7 +77,7 @@
       </classpath>
       <include name="${derby.dir}/iapi/types/*.java"/>
       <exclude name="${derby.dir}/iapi/types/SqlXmlUtil.java"/>
-      <!-- <compilerarg value="-Xlint:unchecked"/> -->
+      <compilerarg value="-Xlint:unchecked"/>
     </javac>
   </target>
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/db/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/build.xml?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/db/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/db/build.xml Tue May 14 16:43:56
2013
@@ -52,7 +52,7 @@
         <pathelement path="${java16compile.classpath}"/>
       </classpath>
       <include name="${derby.dir}/impl/db/**"/>
-      <!-- <compilerarg value="-Xlint:unchecked"/> -->
+      <compilerarg value="-Xlint:unchecked"/>
     </javac>
   </target>
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/io/VFMemoryStorageFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/io/VFMemoryStorageFactory.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/io/VFMemoryStorageFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/io/VFMemoryStorageFactory.java Tue
May 14 16:43:56 2013
@@ -54,7 +54,7 @@ public class VFMemoryStorageFactory
 
     /** References to the databases created / existing. */
     //@GuardedBy("DATABASES")
-    private static final Map DATABASES = new HashMap();
+    private static final Map<String,DataStore> DATABASES = new HashMap<String,DataStore>();
 
     /**
      * Dummy store used to carry out frequent operations that don't

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/io/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/io/build.xml?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/io/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/io/build.xml Tue May 14 16:43:56
2013
@@ -52,7 +52,7 @@
         <pathelement path="${java16compile.classpath}"/>
       </classpath>
       <include name="${derby.dir}/impl/io/**"/>
-      <!-- <compilerarg value="-Xlint:unchecked"/> -->
+      <compilerarg value="-Xlint:unchecked"/>
     </javac>
   </target>
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/io/vfmem/DataStore.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/io/vfmem/DataStore.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/io/vfmem/DataStore.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/io/vfmem/DataStore.java Tue May
14 16:43:56 2013
@@ -54,7 +54,7 @@ public final class DataStore {
      * The initial size is set to the number of initial files of a Derby
      * database, pluss a few more.
      */
-    private final Map files = new HashMap(80);
+    private final Map<String,DataStoreEntry> files = new HashMap<String,DataStoreEntry>(80);
 
     /**
      * The name of the database this store serves, expected to be the absolute
@@ -119,7 +119,7 @@ public final class DataStore {
             // Make sure the the parent directories exists.
             String[] parents = getParentList(nPath);
             for (int i=parents.length -1; i >= 0; i--) {
-                DataStoreEntry entry = (DataStoreEntry)files.get(parents[i]);
+                DataStoreEntry entry = files.get(parents[i]);
                 if (entry == null) {
                     return null;
                 } else if (!entry.isDirectory()) {
@@ -145,7 +145,7 @@ public final class DataStore {
         synchronized (LOCK) {
             for (int i=parents.length -1; i >= 0; i--) {
                 String subPath = parents[i];
-                DataStoreEntry entry = (DataStoreEntry)files.get(subPath);
+                DataStoreEntry entry = files.get(subPath);
                 if (entry == null) {
                     createEntry(subPath, true);
                 } else if (!entry.isDirectory()) {
@@ -170,7 +170,7 @@ public final class DataStore {
         final String nPath = new File(iPath).getPath();
         DataStoreEntry entry;
         synchronized (LOCK) {
-            entry = (DataStoreEntry)files.remove(nPath);
+            entry = files.remove(nPath);
             if (entry != null) {
                 if (entry.isDirectory()) {
                     String[] children = listChildren(nPath);
@@ -203,7 +203,7 @@ public final class DataStore {
     public DataStoreEntry getEntry(String iPath) {
         synchronized (LOCK) {
             // Use java.io.File to normalize the path.
-            return (DataStoreEntry)files.get(new File(iPath).getPath());
+            return files.get(new File(iPath).getPath());
         }
     }
 
@@ -217,7 +217,7 @@ public final class DataStore {
     public boolean deleteAll(String iPath) {
         final String nPath = new File(iPath).getPath();
         synchronized (LOCK) {
-            DataStoreEntry entry = (DataStoreEntry)files.remove(nPath);
+            DataStoreEntry entry = files.remove(nPath);
             if (entry == null) {
                 // Delete root doesn't exist.
                 return false;
@@ -255,12 +255,12 @@ public final class DataStore {
         if (nPath.charAt(nPath.length() -1) != SEP) {
             nPath += SEP;
         }
-        ArrayList children = new ArrayList();
+        ArrayList<String> children = new ArrayList<String>();
         synchronized (LOCK) {
-            Iterator paths = files.keySet().iterator();
+            Iterator<String> paths = files.keySet().iterator();
             String candidate;
             while (paths.hasNext()) {
-                candidate = (String)paths.next();
+                candidate = paths.next();
                 if (candidate.startsWith(nPath)) {
                     children.add(candidate.substring(nPath.length()));
                 }
@@ -284,8 +284,7 @@ public final class DataStore {
             if (files.containsKey(newPath)) {
                 return false;
             }
-            DataStoreEntry current = (DataStoreEntry)
-                    files.remove(currentPath);
+            DataStoreEntry current = files.remove(currentPath);
             if (current == null) {
                 return false;
             }
@@ -299,9 +298,9 @@ public final class DataStore {
      */
     public void purge() {
         synchronized (LOCK) {
-            Iterator fileIter = files.values().iterator();
+            Iterator<DataStoreEntry> fileIter = files.values().iterator();
             while (fileIter.hasNext()) {
-                ((DataStoreEntry)fileIter.next()).release();
+                (fileIter.next()).release();
             }
             // Clear all the mappings.
             files.clear();
@@ -323,11 +322,11 @@ public final class DataStore {
         if (prefixPath.charAt(prefixPath.length() -1) != SEP) {
             prefixPath += SEP;
         }
-        ArrayList toDelete = new ArrayList();
-        Iterator paths = files.keySet().iterator();
+        ArrayList<String> toDelete = new ArrayList<String>();
+        Iterator<String> paths = files.keySet().iterator();
         // Find all the entries to delete.
         while (paths.hasNext()) {
-            String path = (String)paths.next();
+            String path = paths.next();
             if (path.startsWith(prefixPath)) {
                 toDelete.add(path);
             }
@@ -337,8 +336,7 @@ public final class DataStore {
         // Iterate through all entries found and release them.
         Iterator keys = toDelete.iterator();
         while (keys.hasNext()) {
-            DataStoreEntry entry = (DataStoreEntry)
-                    files.remove((String)keys.next());
+            DataStoreEntry entry = files.remove((String)keys.next());
             entry.release();
         }
         return true;
@@ -365,7 +363,7 @@ public final class DataStore {
      * @return A list of parents.
      */
     private String[] getParentList(String path) {
-        ArrayList parents = new ArrayList();
+        ArrayList<String> parents = new ArrayList<String>();
         String parent = path;
         // Build the list of parents.
         while ((parent = new File(parent).getParent()) != null) {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java Tue May 14
16:43:56 2013
@@ -49,10 +49,10 @@ import org.apache.derby.iapi.jdbc.Engine
  */
 class ColumnInfo {
 
-	private ArrayList vtiColumnNames ;
-    private ArrayList insertColumnNames;
-    private ArrayList columnTypes ;
-    private ArrayList jdbcColumnTypes;
+	private ArrayList<String> vtiColumnNames ;
+    private ArrayList<String> insertColumnNames;
+    private ArrayList<String> columnTypes ;
+    private ArrayList<Integer> jdbcColumnTypes;
 	private int noOfColumns;
 	private ArrayList columnPositions;
 	private boolean createolumnNames = true;
@@ -61,7 +61,7 @@ class ColumnInfo {
 	private Connection conn;
 	private String tableName;
 	private String schemaName;
-    private HashMap udtClassNames;
+    private HashMap<String,String> udtClassNames;
 
 	/**
 	 * Initialize the column type and name  information
@@ -82,11 +82,11 @@ class ColumnInfo {
 		throws SQLException 
 	{
 
-		vtiColumnNames = new ArrayList(1);
-		insertColumnNames = new ArrayList(1);
-		columnTypes = new ArrayList(1);
-        jdbcColumnTypes = new ArrayList(1);
-        udtClassNames = new HashMap();
+		vtiColumnNames = new ArrayList<String>(1);
+		insertColumnNames = new ArrayList<String>(1);
+		columnTypes = new ArrayList<String>(1);
+        jdbcColumnTypes = new ArrayList<Integer>(1);
+        udtClassNames = new HashMap<String,String>();
 		noOfColumns = 0;
 		this.conn = conn;
 
@@ -528,7 +528,8 @@ class ColumnInfo {
         ( String columnTypeNamesString, int noOfColumns )
         throws Exception
     {
-        ArrayList list = (ArrayList) ImportAbstract.destringifyObject( columnTypeNamesString
);
+        @SuppressWarnings({"unchecked"})
+        ArrayList<String> list = (ArrayList<String>) ImportAbstract.destringifyObject(
columnTypeNamesString );
 
         String[] retval = new String[ list.size() ];
 
@@ -554,7 +555,7 @@ class ColumnInfo {
 
         if ( stringMap == null ) { return null; }
         
-        HashMap retval = new HashMap();
+        HashMap<String,Class<?>> retval = new HashMap<String,Class<?>>();
         Iterator entries = stringMap.entrySet().iterator();
 
         while ( entries.hasNext() )
@@ -563,7 +564,7 @@ class ColumnInfo {
             String columnName = (String) entry.getKey();
             String className = (String) entry.getValue();
 
-            Class classValue = Class.forName( className );
+            Class<?> classValue = Class.forName( className );
 
             retval.put( columnName, classValue );
         }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Export.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Export.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Export.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Export.java Tue May 14 16:43:56
2013
@@ -156,9 +156,9 @@ public class Export extends ExportAbstra
      * @throws SecurityException if the required privileges are missing
      */
     private final boolean fileExists(final File file) {
-        return ((Boolean)AccessController.doPrivileged(
-                new PrivilegedAction() {
-                    public Object run() {
+        return (AccessController.doPrivileged(
+                new PrivilegedAction<Boolean>() {
+                    public Boolean run() {
                         return new Boolean(file.exists());
                     }
             })).booleanValue();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ExportWriteData.java Tue May
14 16:43:56 2013
@@ -38,7 +38,7 @@ import org.apache.derby.iapi.services.io
 //FIXED FORMAT: if length of nullstring is greater than column width, throw execption
 
 final class ExportWriteData extends ExportWriteDataAbstract
-	implements java.security.PrivilegedExceptionAction {
+	implements java.security.PrivilegedExceptionAction<Object> {
 
 	private String outputFileName;
 	private String lobsFileName;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Import.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Import.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Import.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/Import.java Tue May 14 16:43:56
2013
@@ -51,7 +51,7 @@ public class Import extends ImportAbstra
     // beginning and the very end of its run. We cannot use Hashmap
     // because different threads may simultaneously put and delete entries.
     //
-    private static  Hashtable   _importers = new Hashtable();
+    private static  Hashtable<Integer,Import>   _importers = new Hashtable<Integer,Import>();
 
     private String inputFileName;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportLobFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportLobFile.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportLobFile.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportLobFile.java Tue May
14 16:43:56 2013
@@ -71,9 +71,9 @@ class ImportLobFile 
         try {
             // open the lob file under a privelged block.
             try {
-                lobRaf = (RandomAccessFile)AccessController.doPrivileged
-                (new java.security.PrivilegedExceptionAction(){
-                        public Object run() throws IOException{
+                lobRaf = AccessController.doPrivileged
+                (new java.security.PrivilegedExceptionAction<RandomAccessFile>(){
+                        public RandomAccessFile run() throws IOException{
                             return new RandomAccessFile(lobFile, "r");
                         }   
                     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java Tue May
14 16:43:56 2013
@@ -33,7 +33,7 @@ import java.net.URL;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import java.sql.SQLException;
 
-final class ImportReadData implements java.security.PrivilegedExceptionAction {
+final class ImportReadData implements java.security.PrivilegedExceptionAction<Object>
{
   //Read data from this file
   private String inputFileName;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/build.xml?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/build.xml Tue May 14 16:43:56
2013
@@ -52,7 +52,7 @@
         <pathelement path="${java16compile.classpath}"/>
       </classpath>
       <include name="${derby.dir}/impl/load/**"/>
-      <!-- <compilerarg value="-Xlint:unchecked"/> -->
+      <compilerarg value="-Xlint:unchecked"/>
     </javac>
   </target>
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/security/DatabasePermission.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/security/DatabasePermission.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/security/DatabasePermission.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/security/DatabasePermission.java Tue
May 14 16:43:56 2013
@@ -119,7 +119,7 @@ final public class DatabasePermission ex
     /**
      * The legal database permission action names.
      */
-    static protected final Set LEGAL_ACTIONS = new HashSet();
+    static protected final Set<String> LEGAL_ACTIONS = new HashSet<String>();
     static {
         // when adding new actions, check: implies(Permission), getActions()
         LEGAL_ACTIONS.add(CREATE);
@@ -310,9 +310,9 @@ final public class DatabasePermission ex
             // doPrivileged() block to allow for confined codebase permission
             // grants
             if (p.startsWith(URL_PATH_RELATIVE_PREFIX)) {
-                final String cwd = (String)AccessController.doPrivileged(
-                    new PrivilegedAction() {
-                        public Object run() {
+                final String cwd = AccessController.doPrivileged(
+                    new PrivilegedAction<String>() {
+                        public String run() {
                             return System.getProperty("user.dir");
                         }
                     });
@@ -327,9 +327,9 @@ final public class DatabasePermission ex
             // block to allow for confined codebase permission grants
             final File f;
             try {
-                f = (File)AccessController.doPrivileged(
-                    new PrivilegedExceptionAction() {
-                        public Object run() throws IOException {
+                f = AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<File>() {
+                        public File run() throws IOException {
                             return (new File(absPath)).getCanonicalFile();
                         }
                     });

Modified: db/derby/code/trunk/java/engine/org/apache/derby/security/SystemPermission.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/security/SystemPermission.java?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/security/SystemPermission.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/security/SystemPermission.java Tue May
14 16:43:56 2013
@@ -91,7 +91,7 @@ final public class SystemPermission exte
     /**
      * The legal system permission names.
      */
-    static private final Set LEGAL_NAMES = new HashSet();    
+    static private final Set<String> LEGAL_NAMES = new HashSet<String>();   

     static {
         // when adding new permissions, check whether to override inherited
         // method: implies(Permission)
@@ -103,7 +103,7 @@ final public class SystemPermission exte
     /**
      * Set of legal actions in their canonical form.
      */
-    static private final List LEGAL_ACTIONS = new ArrayList();
+    static private final List<String> LEGAL_ACTIONS = new ArrayList<String>();
     static {
         LEGAL_ACTIONS.add(CONTROL);
         LEGAL_ACTIONS.add(MONITOR);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/security/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/security/build.xml?rev=1482443&r1=1482442&r2=1482443&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/security/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/security/build.xml Tue May 14 16:43:56
2013
@@ -53,7 +53,7 @@
         <pathelement path="${java16compile.classpath}"/>
       </classpath>
       <include name="${derby.dir}/security/**"/>
-      <!-- <compilerarg value="-Xlint:unchecked"/> -->
+      <compilerarg value="-Xlint:unchecked"/>
     </javac>
   </target>
 



Mime
View raw message