< prev index next >

src/java.rmi/share/classes/sun/rmi/transport/Transport.java

Print this page
@@ -188,11 +188,11 @@
                  ClassLoader ccl = target.getContextClassLoader();
  
                  ClassLoader savedCcl = Thread.currentThread().getContextClassLoader();
  
                  try {
-                     setContextClassLoader(ccl);
+                     if (ccl != savedCcl) setContextClassLoader(ccl);
                      currentTransport.set(this);
                      try {
                          java.security.AccessController.doPrivileged(
                              new java.security.PrivilegedExceptionAction<Void>() {
                              public Void run() throws IOException {

@@ -203,11 +203,11 @@
                          }, acc);
                      } catch (java.security.PrivilegedActionException pae) {
                          throw (IOException) pae.getException();
                      }
                  } finally {
-                     setContextClassLoader(savedCcl);
+                     if (ccl != savedCcl) setContextClassLoader(savedCcl);
                      currentTransport.set(null);
                  }
  
              } catch (IOException ex) {
                  transportLog.log(Log.BRIEF,
< prev index next >