--- jsr166/src/test/tck/AbstractExecutorServiceTest.java 2009/11/02 20:28:31 1.16 +++ jsr166/src/test/tck/AbstractExecutorServiceTest.java 2009/11/16 04:57:09 1.17 @@ -122,7 +122,7 @@ public class AbstractExecutorServiceTest policy.addPermission(new RuntimePermission("getContextClassLoader")); policy.addPermission(new RuntimePermission("setContextClassLoader")); Policy.setPolicy(policy); - } catch(AccessControlException ok) { + } catch (AccessControlException ok) { return; } try { @@ -144,7 +144,7 @@ public class AbstractExecutorServiceTest finally { try { Policy.setPolicy(savedPolicy); - } catch(AccessControlException ok) { + } catch (AccessControlException ok) { return; } } @@ -161,7 +161,7 @@ public class AbstractExecutorServiceTest policy.addPermission(new RuntimePermission("getContextClassLoader")); policy.addPermission(new RuntimePermission("setContextClassLoader")); Policy.setPolicy(policy); - } catch(AccessControlException ok) { + } catch (AccessControlException ok) { return; } @@ -197,7 +197,7 @@ public class AbstractExecutorServiceTest policy.addPermission(new RuntimePermission("getContextClassLoader")); policy.addPermission(new RuntimePermission("setContextClassLoader")); Policy.setPolicy(policy); - } catch(AccessControlException ok) { + } catch (AccessControlException ok) { return; } @@ -265,11 +265,11 @@ public class AbstractExecutorServiceTest ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(1)); try { - for(int i = 0; i < 5; ++i){ + for (int i = 0; i < 5; ++i){ p.submit(new MediumRunnable()); } shouldThrow(); - } catch(RejectedExecutionException success){} + } catch (RejectedExecutionException success){} joinPool(p); } @@ -280,11 +280,11 @@ public class AbstractExecutorServiceTest public void testExecute2() { ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(1)); try { - for(int i = 0; i < 5; ++i) { + for (int i = 0; i < 5; ++i) { p.submit(new SmallCallable()); } shouldThrow(); - } catch(RejectedExecutionException e){} + } catch (RejectedExecutionException e){} joinPool(p); } @@ -303,13 +303,13 @@ public class AbstractExecutorServiceTest try { Thread.sleep(MEDIUM_DELAY_MS); shouldThrow(); - } catch(InterruptedException e){ + } catch (InterruptedException e){ } return null; } }).get(); - } catch(InterruptedException success){ - } catch(Exception e) { + } catch (InterruptedException success){ + } catch (Exception e) { unexpectedException(); } @@ -319,7 +319,7 @@ public class AbstractExecutorServiceTest t.start(); Thread.sleep(SHORT_DELAY_MS); t.interrupt(); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } joinPool(p); @@ -337,9 +337,9 @@ public class AbstractExecutorServiceTest try { p.submit(new SmallCallable()).get(); shouldThrow(); - } catch(InterruptedException e){} - catch(RejectedExecutionException e2){} - catch(ExecutionException e3){} + } catch (InterruptedException e){} + catch (RejectedExecutionException e2){} + catch (ExecutionException e3){} return Boolean.TRUE; } }; @@ -350,7 +350,7 @@ public class AbstractExecutorServiceTest public void run() { try { c.call(); - } catch(Exception e){} + } catch (Exception e){} } }); try { @@ -358,7 +358,7 @@ public class AbstractExecutorServiceTest Thread.sleep(SHORT_DELAY_MS); t.interrupt(); t.join(); - } catch(InterruptedException e){ + } catch (InterruptedException e){ unexpectedException(); } @@ -380,14 +380,14 @@ public class AbstractExecutorServiceTest } }; - for(int i =0; i < 5; i++){ + for (int i =0; i < 5; i++){ p.submit(c).get(); } shouldThrow(); } - catch(ExecutionException success){ - } catch(Exception e) { + catch (ExecutionException success){ + } catch (Exception e) { unexpectedException(); } joinPool(p); @@ -401,7 +401,7 @@ public class AbstractExecutorServiceTest try { e.invokeAny(null); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -416,7 +416,7 @@ public class AbstractExecutorServiceTest try { e.invokeAny(new ArrayList>()); } catch (IllegalArgumentException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -434,7 +434,7 @@ public class AbstractExecutorServiceTest l.add(null); e.invokeAny(l); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); unexpectedException(); } finally { @@ -451,8 +451,8 @@ public class AbstractExecutorServiceTest ArrayList> l = new ArrayList>(); l.add(new NPETask()); e.invokeAny(l); - } catch(ExecutionException success) { - } catch(Exception ex) { + } catch (ExecutionException success) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -471,7 +471,7 @@ public class AbstractExecutorServiceTest String result = e.invokeAny(l); assertSame(TEST_STRING, result); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -486,7 +486,7 @@ public class AbstractExecutorServiceTest try { e.invokeAll(null); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -501,7 +501,7 @@ public class AbstractExecutorServiceTest try { List> r = e.invokeAll(new ArrayList>()); assertTrue(r.isEmpty()); - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -519,7 +519,7 @@ public class AbstractExecutorServiceTest l.add(null); e.invokeAll(l); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -538,8 +538,8 @@ public class AbstractExecutorServiceTest assertEquals(1, result.size()); for (Iterator> it = result.iterator(); it.hasNext();) it.next().get(); - } catch(ExecutionException success) { - } catch(Exception ex) { + } catch (ExecutionException success) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -560,7 +560,7 @@ public class AbstractExecutorServiceTest for (Iterator> it = result.iterator(); it.hasNext();) assertSame(TEST_STRING, it.next().get()); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -576,7 +576,7 @@ public class AbstractExecutorServiceTest try { e.invokeAny(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -593,7 +593,7 @@ public class AbstractExecutorServiceTest l.add(new StringTask()); e.invokeAny(l, MEDIUM_DELAY_MS, null); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -608,7 +608,7 @@ public class AbstractExecutorServiceTest try { e.invokeAny(new ArrayList>(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (IllegalArgumentException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -626,7 +626,7 @@ public class AbstractExecutorServiceTest l.add(null); e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); unexpectedException(); } finally { @@ -643,8 +643,8 @@ public class AbstractExecutorServiceTest ArrayList> l = new ArrayList>(); l.add(new NPETask()); e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); - } catch(ExecutionException success) { - } catch(Exception ex) { + } catch (ExecutionException success) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -663,7 +663,7 @@ public class AbstractExecutorServiceTest String result = e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); assertSame(TEST_STRING, result); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -678,7 +678,7 @@ public class AbstractExecutorServiceTest try { e.invokeAll(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -695,7 +695,7 @@ public class AbstractExecutorServiceTest l.add(new StringTask()); e.invokeAll(l, MEDIUM_DELAY_MS, null); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -710,7 +710,7 @@ public class AbstractExecutorServiceTest try { List> r = e.invokeAll(new ArrayList>(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); assertTrue(r.isEmpty()); - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -728,7 +728,7 @@ public class AbstractExecutorServiceTest l.add(null); e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -747,8 +747,8 @@ public class AbstractExecutorServiceTest assertEquals(1, result.size()); for (Iterator> it = result.iterator(); it.hasNext();) it.next().get(); - } catch(ExecutionException success) { - } catch(Exception ex) { + } catch (ExecutionException success) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -769,7 +769,7 @@ public class AbstractExecutorServiceTest for (Iterator> it = result.iterator(); it.hasNext();) assertSame(TEST_STRING, it.next().get()); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -797,7 +797,7 @@ public class AbstractExecutorServiceTest assertTrue(f2.isDone()); assertTrue(f3.isDone()); assertTrue(f3.isCancelled()); - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e);