(GroovyShell shell)
| 558 | |
| 559 | // GROOVY-6771 |
| 560 | private static void setupContextClassLoader(GroovyShell shell) { |
| 561 | final Thread current = Thread.currentThread(); |
| 562 | /** |
| 563 | * Privileged action that updates the thread context class loader. |
| 564 | */ |
| 565 | class DoSetContext implements PrivilegedAction<Object> { |
| 566 | /** |
| 567 | * Context class loader to install. |
| 568 | */ |
| 569 | ClassLoader classLoader; |
| 570 | |
| 571 | /** |
| 572 | * Creates the context-switch action. |
| 573 | * |
| 574 | * @param loader the class loader to install |
| 575 | */ |
| 576 | DoSetContext(ClassLoader loader) { |
| 577 | classLoader = loader; |
| 578 | } |
| 579 | |
| 580 | /** |
| 581 | * Sets the current thread context class loader. |
| 582 | * |
| 583 | * @return {@code null} |
| 584 | */ |
| 585 | @Override |
| 586 | public Object run() { |
| 587 | current.setContextClassLoader(classLoader); |
| 588 | return null; |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | new DoSetContext(shell.getClassLoader()).run(); |
| 593 | } |
| 594 | |
| 595 | /** |
| 596 | * Process the input files. |
no test coverage detected