ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ExecutorsTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ExecutorsTest.java (file contents):
Revision 1.14 by dl, Tue Jan 20 20:20:56 2004 UTC vs.
Revision 1.15 by dl, Thu Jan 22 14:07:50 2004 UTC

# Line 488 | Line 488 | public class ExecutorsTest extends JSR16
488          }
489      }
490  
491 +    class CallCCL implements Runnable {
492 +        final Callable task;
493 +        CallCCL(Callable t) { task = t; }
494 +        public void run() {
495 +            try {
496 +                task.call();
497 +                threadShouldThrow();
498 +            } catch(AccessControlException success) {
499 +            } catch(Exception ex) {
500 +                threadUnexpectedException();
501 +            }
502 +        }
503 +    }
504 +
505      /**
506       * Without permissions, calling privilegedCallable throws ACE
507       */
508      public void testprivilegedCallableWithNoPrivs() {
509 <        Policy savedPolicy = null;
509 >        Thread t1;
510          try {
511 <            savedPolicy = Policy.getPolicy();
511 >            Policy savedPolicy = Policy.getPolicy();
512              AdjustablePolicy policy = new AdjustablePolicy();
513              Policy.setPolicy(policy);
514 +            Callable task = Executors.privilegedCallable(new CheckCCL());
515 +            t1 = new Thread(new CallCCL(task));
516 +            Policy.setPolicy(savedPolicy);
517          } catch (AccessControlException ok) {
518              return;
519          }
520  
504        Callable task = Executors.privilegedCallable(new CheckCCL());
505        Policy.setPolicy(savedPolicy);
521          try {
522 <            task.call();
523 <            shouldThrow();
509 <        } catch(AccessControlException success) {
522 >            t1.start();
523 >            t1.join();
524          } catch(Exception ex) {
525              unexpectedException();
526 <        } finally {
513 <        }
526 >        }
527      }
528  
529      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines