db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1532175 - /db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/context/ContextService.java
Date Tue, 15 Oct 2013 03:56:07 GMT
Author: myrnavl
Date: Tue Oct 15 03:56:06 2013
New Revision: 1532175

URL: http://svn.apache.org/r1532175
Log:
DERBY-6352; Access denied ("java.lang.RuntimePermission" "modifyThread") in store.RecoveryAfterBackup
test
  Backport printing of additional info from trunk

Modified:
    db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/context/ContextService.java

Modified: db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/context/ContextService.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/context/ContextService.java?rev=1532175&r1=1532174&r2=1532175&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/context/ContextService.java
(original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/context/ContextService.java
Tue Oct 15 03:56:06 2013
@@ -27,6 +27,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 
 import org.apache.derby.iapi.error.ShutdownException;
+import org.apache.derby.iapi.services.info.JVMInfo;
 import org.apache.derby.iapi.services.monitor.Monitor;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
@@ -559,13 +560,39 @@ public final class ContextService //OLD 
                 final Thread fActive = active;
 				if (cm.setInterrupted(c))
                 {
-                    AccessController.doPrivileged(
-                            new PrivilegedAction() {
-                                public Object run()  {
-                                    fActive.interrupt();
-                                    return null;
-                                }
-                            });
+                    // DERBY-6352; in some cases a SecurityException is seen
+                    // demanding an explicit granting of modifyThread
+                    // permission, which should not be needed for Derby, as we
+                    // should not have any system threads.
+                    try {
+                        AccessController.doPrivileged(
+                                new PrivilegedAction() {
+                                    public Object run()  {
+                                        fActive.interrupt();
+                                        return null;
+                                    }
+                                });
+                    } catch (java.security.AccessControlException ace) {
+                        // if sane, ASSERT and stop. The Assert will
+                        // cause info on all current threads to be printed to
+                        // the console, and we're also adding details about
+                        // the thread causing the security exception.
+                        // if insane, rethrow, and if an IBM JVM, do a jvmdump
+                        if (SanityManager.DEBUG)
+                        {
+                            SanityManager.THROWASSERT("unexpectedly needing " +
+                                    "an extra permission, for thread: " +
+                                    fActive.getName() + " with state: "+
+                                    fActive.getState());
+                            ace.printStackTrace();
+                        }
+                        else {
+                            if (JVMInfo.isIBMJVM()) {
+                                JVMInfo.javaDump();
+                            }
+                            throw ace;
+                        }
+                    }
                 }
 			}
 		}



Mime
View raw message