db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1494947 - in /db/derby/code/branches/10.9: ./ java/engine/org/apache/derby/jdbc/ java/engine/org/apache/derby/loc/ java/shared/org/apache/derby/shared/common/reference/ java/testing/org/apache/derbyTesting/functionTests/tests/engine/
Date Thu, 20 Jun 2013 12:00:30 GMT
Author: kahatlen
Date: Thu Jun 20 12:00:29 2013
New Revision: 1494947

URL: http://svn.apache.org/r1494947
Log:
DERBY-6224: Many test failures on latest JDK 8 EA build because of missing SQLPermission

Merged revisions 1494758 and 1494888 from 10.10.

Added:
    db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ShutdownWithoutDeregisterPermissionTest.java
      - copied unchanged from r1494758, db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ShutdownWithoutDeregisterPermissionTest.java
    db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/noDeregisterPermission.policy
      - copied unchanged from r1494758, db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/engine/noDeregisterPermission.policy
Modified:
    db/derby/code/branches/10.9/   (props changed)
    db/derby/code/branches/10.9/java/engine/org/apache/derby/jdbc/AutoloadedDriver.java
    db/derby/code/branches/10.9/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/branches/10.9/java/shared/org/apache/derby/shared/common/reference/MessageId.java
    db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java
    db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml

Propchange: db/derby/code/branches/10.9/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1493077
  Merged /db/derby/code/branches/10.10:r1494758,1494888

Modified: db/derby/code/branches/10.9/java/engine/org/apache/derby/jdbc/AutoloadedDriver.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/engine/org/apache/derby/jdbc/AutoloadedDriver.java?rev=1494947&r1=1494946&r2=1494947&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/engine/org/apache/derby/jdbc/AutoloadedDriver.java (original)
+++ db/derby/code/branches/10.9/java/engine/org/apache/derby/jdbc/AutoloadedDriver.java Thu
Jun 20 12:00:29 2013
@@ -27,18 +27,17 @@ import java.sql.Connection;
 import java.sql.DriverPropertyInfo;
 import java.sql.SQLException;
 
-import java.io.PrintStream;
+import java.security.AccessControlException;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.Properties;
 
 import org.apache.derby.iapi.reference.MessageId;
-import org.apache.derby.iapi.reference.Attribute;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.i18n.MessageService;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.jdbc.JDBCBoot;
+import org.apache.derby.iapi.services.monitor.Monitor;
 import org.apache.derby.impl.jdbc.Util;
 
 
@@ -281,6 +280,14 @@ public class AutoloadedDriver implements
             });
         } catch (PrivilegedActionException pae) {
             throw (SQLException) pae.getCause();
+        } catch (AccessControlException ace) {
+            // Since no permission was needed for deregisterDriver() before
+            // Java 8, applications may be surprised to find that engine
+            // shutdown fails because of it. For backward compatibility,
+            // don't fail shutdown if the permission is missing. Instead,
+            // log a message saying the driver could not be deregistered.
+            Monitor.logTextMessage(MessageId.CONN_DEREGISTER_NOT_PERMITTED);
+            Monitor.logThrowable(ace);
         }
     }
 

Modified: db/derby/code/branches/10.9/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/engine/org/apache/derby/loc/messages.xml?rev=1494947&r1=1494946&r2=1494947&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/branches/10.9/java/engine/org/apache/derby/loc/messages.xml Thu Jun 20 12:00:29
2013
@@ -8042,6 +8042,11 @@ Shutting down instance {0} on database d
                 <text>There was an XA transaction associated with the connection being
closed. The transaction is going to be rolled back. The transaction Xid is {0}.</text>
                 <arg>transactionXid</arg>
             </msg>
+
+            <msg>
+                <name>J137</name>
+                <text>Could not deregister the JDBC driver when shutting down the Derby
engine. Make sure SQLPermission("deregisterDriver") is granted to derby.jar.</text>
+            </msg>
         </family>
 
 

Modified: db/derby/code/branches/10.9/java/shared/org/apache/derby/shared/common/reference/MessageId.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/shared/org/apache/derby/shared/common/reference/MessageId.java?rev=1494947&r1=1494946&r2=1494947&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/shared/org/apache/derby/shared/common/reference/MessageId.java
(original)
+++ db/derby/code/branches/10.9/java/shared/org/apache/derby/shared/common/reference/MessageId.java
Thu Jun 20 12:00:29 2013
@@ -174,6 +174,9 @@ public interface MessageId {
     String CONN_XA_TRANSACTION_TIMED_OUT                    = "J135";
     String CONN_CLOSE_XA_TRANSACTION_ROLLED_BACK            = "J136";
 
+    /** Shutdown couldn't deregister driver because of missing permission. */
+    String CONN_DEREGISTER_NOT_PERMITTED = "J137";
+
 	/*
 	** Authentication
 	*/

Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java?rev=1494947&r1=1494946&r2=1494947&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java
(original)
+++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java
Thu Jun 20 12:00:29 2013
@@ -24,6 +24,7 @@ package org.apache.derbyTesting.function
 import junit.framework.Test;
 import junit.framework.TestSuite;
 import org.apache.derbyTesting.junit.BaseTestCase;
+import org.apache.derbyTesting.junit.JDBC;
 
 /**
  * Suite to run all JUnit tests in this package:
@@ -52,6 +53,10 @@ public class _Suite extends BaseTestCase
         if (!(isIBMJVM() && isJava7()))
             suite.addTest(RestrictiveFilePermissionsTest.suite());
         suite.addTest(ModuleLoadingTest.suite());
+        if (JDBC.vmSupportsJDBC3()) {
+            // Test that requires DriverManager.
+            suite.addTest(ShutdownWithoutDeregisterPermissionTest.suite());
+        }
 
         return suite;
     }

Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml?rev=1494947&r1=1494946&r2=1494947&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml
(original)
+++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/engine/build.xml
Thu Jun 20 12:00:29 2013
@@ -65,7 +65,7 @@
     <mkdir dir="${out.dir}/${derby.testing.functest.dir}/tests/engine"/>
   </target>
 
-  <target name="compilet1" >
+  <target name="compilet1" depends="compile_jdk14">
      <javac
         source="1.4"
         target="1.4"
@@ -84,9 +84,33 @@
            <pathelement path="${junit}"/>
         </classpath>
         <include name="${this.dir}/*.java"/>
+        <exclude name="${this.dir}/ShutdownWithoutDeregisterPermissionTest.java"/>
      </javac>
   </target>
 
+  <target name="compile_jdk14">
+     <javac
+        source="1.4"
+        target="1.4"
+        bootclasspath="${empty}"
+        nowarn="on"
+        debug="true"
+        depend="${depend}"
+        deprecation="${deprecation}"
+        optimize="${optimize}"
+        proceed="${proceed}"
+        verbose="${verbose}"
+        srcdir="${derby.testing.src.dir}"
+        destdir="${out.dir}">
+        <classpath>
+           <pathelement path="${java14compile.classpath}"/>
+           <pathelement path="${junit}"/>
+        </classpath>
+        <include name="${this.dir}/ShutdownWithoutDeregisterPermissionTest.java"/>
+     </javac>
+  </target>
+
+
   <target name="copyfiles">
     <copy todir="${out.dir}/${derby.testing.functest.dir}/tests/engine">
       <fileset dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/engine"



Mime
View raw message