db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1133123 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/services/monitor/ engine/org/apache/derby/impl/services/monitor/ engine/org/apache/derby/impl/store/raw/ storeless/org/apache/derby/impl/storeless/
Date Tue, 07 Jun 2011 18:19:34 GMT
Author: dag
Date: Tue Jun  7 18:19:34 2011
New Revision: 1133123

URL: http://svn.apache.org/viewvc?rev=1133123&view=rev
Log:
DERBY-5260 Remove unused "replace" argument to backup variant of StorageFactoryService#saveServiceProperties

The patch "saveServiceProperties-1" removes redundant code.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/PersistentService.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
    db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/StorelessService.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/PersistentService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/PersistentService.java?rev=1133123&r1=1133122&r2=1133123&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/PersistentService.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/PersistentService.java
Tue Jun  7 18:19:34 2011
@@ -142,8 +142,7 @@ public interface PersistentService {
 		@exception StandardException Properties cannot be saved.
 	*/
 	public void saveServiceProperties(String serviceName,
-                                      Properties properties,
-                                      boolean replace)
+                                      Properties properties)
 		throws StandardException;
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java?rev=1133123&r1=1133122&r2=1133123&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
Tue Jun  7 18:19:34 2011
@@ -391,15 +391,18 @@ final class StorageFactoryService implem
         catch( PrivilegedActionException pae) { throw (StandardException) pae.getException();}
 	} // end of saveServiceProperties
 
-	/**
-       Save to a backup file
-       
-		@exception StandardException Properties cannot be saved.
-	*/
+
+    /**
+     * Save service.properties during backup
+     *
+     * @arg serviceName backup location of the service
+     * @arg properties to save
+     *
+     * @exception StandardException Properties cannot be saved.
+     */
 
 	public void saveServiceProperties(final String serviceName, 
-                                      final Properties properties, 
-                                      final boolean replace)
+                                      final Properties properties)
 		throws StandardException {
 
         try
@@ -407,24 +410,13 @@ final class StorageFactoryService implem
             AccessController.doPrivileged(
                 new PrivilegedExceptionAction()
                 {
-                    File backupFile = null;
                     public Object run() throws StandardException
                     {
-
+                        // Since this is the backup location, we cannot use
+                        // storageFactory.newStorageFile as in the other
+                        // variant of this method:
                         File servicePropertiesFile = 
                             new File(serviceName, PersistentService.PROPERTIES_NAME);
-                        if (replace) {
-                            backupFile = 
-                                new File(serviceName, PersistentService.PROPERTIES_NAME.concat("old"));
-                            try {
-                                if(!servicePropertiesFile.renameTo(backupFile)) {
-                                    throw StandardException.newException(
-                                     SQLState.UNABLE_TO_RENAME_FILE, servicePropertiesFile,
backupFile);
-                                }
-                            } catch (SecurityException se) {
-                                throw Monitor.exceptionStartingModule(se);
-                            }
-                        }
 
                         FileOutputStream fos = null;
                         try {
@@ -447,26 +439,9 @@ final class StorageFactoryService implem
                                 fos = null;
                             }
 
-                            if (backupFile != null) {
-                                // need to re-name the old properties file back again
-                                try {
-                                    servicePropertiesFile.delete();
-                                    backupFile.renameTo(servicePropertiesFile);
-                                } catch (SecurityException se) {
-                                }
-                            }
                             throw Monitor.exceptionStartingModule(ioe);
                         }
 		
-		
-                        if (backupFile != null) {
-                            try {
-                                backupFile.delete();
-                                backupFile = null;
-                            } catch (SecurityException se) {
-                                // do nothing
-                            }
-                        }
                         return null;
                     }
                 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java?rev=1133123&r1=1133122&r2=1133123&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java Tue Jun
 7 18:19:34 2011
@@ -875,7 +875,7 @@ public final class RawStore implements R
                 }
             
                 // save the service properties into the backup.
-                ps.saveServiceProperties(backupcopy.getPath(), prop, false);
+                ps.saveServiceProperties(backupcopy.getPath(), prop);
 
             }
             catch(StandardException se) 

Modified: db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/StorelessService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/StorelessService.java?rev=1133123&r1=1133122&r2=1133123&view=diff
==============================================================================
--- db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/StorelessService.java
(original)
+++ db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/StorelessService.java
Tue Jun  7 18:19:34 2011
@@ -65,7 +65,9 @@ public class StorelessService implements
 		
 	}
 
-	public void saveServiceProperties(String serviceName, Properties properties, boolean replace)
throws StandardException {
+    public void saveServiceProperties(String serviceName,
+                                      Properties properties)
+            throws StandardException {
 		// TODO Auto-generated method stub
 		
 	}



Mime
View raw message