Author: peter_firmstone
Date: Tue May 15 12:45:04 2012
New Revision: 1338673

URL: http://svn.apache.org/viewvc?rev=1338673&view=rev
Log:
Session class delayed instantiation in jdk1.6 caused SecurityException because 
proxy ProtectionDomain was on the stack.  This caused some jtreg tests to fail, 
small fix, the bug doesn't exist in any releases.

Modified:
    river/jtsk/trunk/qa/build.xml
    river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Session.java

Modified: river/jtsk/trunk/qa/build.xml
URL: 
http://svn.apache.org/viewvc/river/jtsk/trunk/qa/build.xml?rev=1338673&r1=1338672&r2=1338673&view=diff
==============================================================================
--- river/jtsk/trunk/qa/build.xml (original)
+++ river/jtsk/trunk/qa/build.xml Tue May 15 12:45:04 2012
@@ -57,8 +57,8 @@
     <!-- or override in <river root>/qa/build.properties -->
     <property name="jtreg.home" location="${env.JT_HOME}" />
     <!-- probably should rename the environment variable, to enable using the 
correct -->
-    <!-- jdk version for the jtreg tests which depend on jdk1.5 -->
-    <property name="jdk1.5.home" location="/usr/jdk/jdk1.6.0_25"/>
+    <!-- jdk version for the jtreg tests -->
+    <property name="jdk.home" location="/usr/jdk/jdk1.6.0_25"/>
     <property name="jtlib.tmp" location="${jtreg.dir}/JTlib-tmp"/>
 
     <!-- classpath for use by ClassDep in this build -->
@@ -215,7 +215,7 @@
         <jtreg  dir="${jtreg.dir}" verbose="all,nopass" failonerror="false"
                 errorproperty="jtreg.fail" failureproperty="jtreg.fail"
                 reportdir="${jtreg.dir}/JTreport" workdir="${jtreg.dir}/JTwork"
-                jdk="${jdk1.5.home}">
+                jdk="${jdk.home}">
             <arg 
value="-cpa:${jtlib.tmp}/jsk-policy.jar${path.separator}${jtlib.tmp}/jsk-lib.jar${path.separator}${jtlib.tmp}/jsk-platform.jar${path.separator}${jtlib.tmp}/jsk-resources.jar${path.separator}${jtlib.tmp}/phoenix-init.jar${path.separator}${jtlib.tmp}/tools.jar${path.separator}${jtlib.tmp}/classserver.jar${path.separator}${jtlib.tmp}/reference-collections-1.0.0.jar${path.separator}${jtlib.tmp}/high-scale-lib.jar"/>
             <arg value="-timeout:8"/>
             <!--<arg value="-Djsk.home=${river.home}"/>-->

Modified: river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Session.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Session.java?rev=1338673&r1=1338672&r2=1338673&view=diff
==============================================================================
--- river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Session.java (original)
+++ river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Session.java Tue May 15 
12:45:04 2012
@@ -25,6 +25,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -56,8 +57,29 @@ final class Session {
     private static final String[] stateNames = {
        "idle", "open", "finished", "terminated"
     };
-
-    private static final boolean traceSupression = 
Boolean.getBoolean("com.sun.jini.jeri.server.suppressStackTraces");
+   
+    /** 
+     * This method prevents a SecurityException from being thrown for
+     * a client proxy that doesn't have permission to read the property.
+     * When this is the case, the secure trace supression option
+     * is chosen.
+     * This is not optimised, because exception conditions
+     * are exceptional.
+     */
+    private static boolean traceSupression(){
+        try {
+            return AccessController.doPrivileged(
+                new PrivilegedAction<Boolean>() 
+                {
+                    public Boolean run() {
+                        return 
Boolean.getBoolean("com.sun.jini.jeri.server.suppressStackTraces");
+                    }
+                }
+            );
+        } catch (SecurityException e) {
+            return true;
+        }
+    }
 
     /**
      * pool of threads for executing tasks in system thread group: used for
@@ -882,7 +904,7 @@ final class Session {
         
         private IOException wrap(String message, Exception e){
             Throwable t = null;
-            if (traceSupression){
+            if (traceSupression()){
                 t = e;
             } else {
                 t = e.fillInStackTrace();


Reply via email to