536 |
|
return AccessController.doPrivileged( |
537 |
|
new PrivilegedExceptionAction<T>() { |
538 |
|
public T run() throws Exception { |
539 |
– |
ClassLoader savedcl = null; |
539 |
|
Thread t = Thread.currentThread(); |
540 |
< |
try { |
541 |
< |
ClassLoader cl = t.getContextClassLoader(); |
543 |
< |
if (ccl != cl) { |
544 |
< |
t.setContextClassLoader(ccl); |
545 |
< |
savedcl = cl; |
546 |
< |
} |
540 |
> |
ClassLoader cl = t.getContextClassLoader(); |
541 |
> |
if (ccl == cl) { |
542 |
|
return task.call(); |
543 |
< |
} finally { |
544 |
< |
if (savedcl != null) |
545 |
< |
t.setContextClassLoader(savedcl); |
546 |
< |
} |
543 |
> |
} else { |
544 |
> |
t.setContextClassLoader(ccl); |
545 |
> |
try { |
546 |
> |
return task.call(); |
547 |
> |
} finally { |
548 |
> |
t.setContextClassLoader(cl); |
549 |
> |
} |
550 |
> |
} |
551 |
|
} |
552 |
|
}, acc); |
553 |
|
} catch (PrivilegedActionException e) { |