changeset 7856:19dcfcd6e435

8062807: Exporting RMI objects fails when run under restrictive SecurityManager Reviewed-by: smarks
author igerasim
date Mon, 17 Nov 2014 20:20:20 +0300
parents 50280300c7be
children c43642c55cd4
files src/share/classes/sun/rmi/transport/tcp/TCPTransport.java
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java	Mon Nov 17 12:09:50 2014 -0800
+++ b/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java	Mon Nov 17 20:20:20 2014 +0300
@@ -672,22 +672,22 @@
         }
 
         public void run() {
-            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            Thread t = Thread.currentThread();
+            String name = t.getName();
+            try {
+                t.setName("RMI TCP Connection(" +
+                          connectionCount.incrementAndGet() +
+                          ")-" + remoteHost);
+                AccessController.doPrivileged(new PrivilegedAction<Void>() {
                     @Override
                     public Void run() {
-                        Thread t = Thread.currentThread();
-                        String name = t.getName();
-                        try {
-                            t.setName("RMI TCP Connection(" +
-                                      connectionCount.incrementAndGet() +
-                                      ")-" + remoteHost);
-                            run0();
-                        } finally {
-                            t.setName(name);
-                        }
+                        run0();
                         return null;
                     }
                 }, NOPERMS_ACC);
+            } finally {
+                t.setName(name);
+            }
         }
 
         private void run0() {