You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by my...@apache.org on 2013/10/13 19:34:50 UTC
svn commit: r1531721 -
/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java
Author: myrnavl
Date: Sun Oct 13 17:34:50 2013
New Revision: 1531721
URL: http://svn.apache.org/r1531721
Log:
DERBY-6352; Access denied ("java.lang.RuntimePermission" "modifyThread") in store.RecoveryAfterBackup test
adding try/catch code to provide more information when this happens
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java?rev=1531721&r1=1531720&r2=1531721&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java Sun Oct 13 17:34:50 2013
@@ -27,6 +27,7 @@ import java.util.HashSet;
import java.util.Stack;
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.shared.common.sanity.SanityManager;
import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
@@ -555,13 +556,39 @@ public final class ContextService //OLD
final Thread fActive = active;
if (cm.setInterrupted(c))
{
- AccessController.doPrivileged(
- new PrivilegedAction<Void>() {
- public Void 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<Void>() {
+ public Void 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;
+ }
+ }
}
}
}