db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1091774 - in /db/derby/code/branches/10.8/java: engine/org/apache/derby/impl/services/monitor/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 13 Apr 2011 13:34:11 GMT
Author: rhillegas
Date: Wed Apr 13 13:34:11 2011
New Revision: 1091774

URL: http://svn.apache.org/viewvc?rev=1091774&view=rev
Log:
DERBY-4589: Port 1091772 from trunk to 10.8 branch.

Added:
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/HalfCreatedDatabaseTest.java
      - copied unchanged from r1091772, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/HalfCreatedDatabaseTest.java
Modified:
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
    db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java?rev=1091774&r1=1091773&r2=1091774&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
Wed Apr 13 13:34:11 2011
@@ -659,8 +659,11 @@ final class StorageFactoryService implem
                                                                              getDirectoryPath(
name));
                                 }
                                 else
+                                {
+                                    vetService( storageFactory, name );
                                     throw StandardException.newException(SQLState.SERVICE_DIRECTORY_EXISTS_ERROR,
                                                                          getDirectoryPath(
name));
+                                }
                             }
 
                             if (serviceDirectory.mkdirs())
@@ -693,6 +696,22 @@ final class StorageFactoryService implem
         throw StandardException.newException(SQLState.SERVICE_DIRECTORY_CREATE_ERROR, t,
name);
     } // end of createServiceRoot
 
+    /**
+       Verify that the service directory looks ok before objecting that the database
+       already exists.
+    */
+    private void    vetService( StorageFactory storageFactory, String serviceName ) throws
StandardException
+    {
+        // check for existence of service.properties descriptor file
+        StorageFile    service_properties = storageFactory.newStorageFile( PersistentService.PROPERTIES_NAME
);
+
+        if ( !service_properties.exists() )
+        {
+            throw StandardException.newException
+                ( SQLState.MISSING_SERVICE_PROPERTIES, serviceName, PersistentService.PROPERTIES_NAME
);
+        }
+    }
+
     private String getDirectoryPath( String name)
     {
         StringBuffer sb = new StringBuffer();

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml?rev=1091774&r1=1091773&r2=1091774&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml Wed Apr 13 13:34:11
2011
@@ -3691,6 +3691,13 @@ Guide.
             </msg>
 
             <msg>
+                <name>XBM0A.D</name>
+                <text>The database directory '{0}' exists. However, it does not contain
the expected '{1}' file. Perhaps Derby was brought down in the middle of creating this database.
You may want to delete this directory and try creating the database again.</text>
+                <arg>directoryName</arg>
+                <arg>servicePropertiesName</arg>
+            </msg>
+
+            <msg>
                 <name>XBM0G.D</name>
                 <text>Failed to start encryption engine. Please make sure you are running
Java 2 and have downloaded an encryption provider such as jce and put it in your class path.
</text>
             </msg>

Modified: db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=1091774&r1=1091773&r2=1091774&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Wed Apr 13 13:34:11 2011
@@ -164,6 +164,7 @@ public interface SQLState {
 	String SERVICE_MISSING_IMPLEMENTATION		= "XBM02.D";
 	String MISSING_PRODUCT_VERSION				= "XBM05.D";
 	String SERVICE_WRONG_BOOT_PASSWORD			= "XBM06.D";
+	String MISSING_SERVICE_PROPERTIES			= "XBM0A.D";
 	String SERVICE_BOOT_PASSWORD_TOO_SHORT		= "XBM07.D";
 	String MISSING_ENCRYPTION_PROVIDER			= "XBM0G.D";
 	String SERVICE_DIRECTORY_CREATE_ERROR		= "XBM0H.D";

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java?rev=1091774&r1=1091773&r2=1091774&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
Wed Apr 13 13:34:11 2011
@@ -162,6 +162,7 @@ public final class ErrorCodeTest extends
         		{"XBM06","Startup failed. An encrypted database cannot be accessed without the
correct boot password.  ","45000"},
         		{"XBM07","Startup failed. Boot password must be at least 8 bytes long.","45000"},
         		{"XBM08","Could not instantiate {0} StorageFactory class {1}.","45000"},
+        		{"XBM0A","The database directory '{0}' exists. However, it does not contain the
expected '{1}' file. Perhaps Derby was brought down in the middle of creating this database.
You may want to delete this directory and try creating the database again.","45000"},
         		{"XBM0G","Failed to start encryption engine. Please make sure you are running Java
2 and have downloaded an encryption provider such as jce and put it in your class path. ","45000"},
         		{"XBM0H","Directory {0} cannot be created.","45000"},
         		{"XBM0I","Directory {0} cannot be removed.","45000"},

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1091774&r1=1091773&r2=1091774&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Wed Apr 13 13:34:11 2011
@@ -220,6 +220,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(OrderByAndOffsetFetchInSubqueries.suite());
         suite.addTest(Derby5005Test.suite());
         suite.addTest(AutoIncrementTest.suite());
+        suite.addTest(HalfCreatedDatabaseTest.suite());
         return suite;
 	}
 }



Mime
View raw message