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

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.85 by jsr166, Sun May 29 14:18:52 2011 UTC vs.
Revision 1.87 by jsr166, Mon May 30 22:53:21 2011 UTC

# Line 1126 | Line 1126 | public class JSR166TestCase extends Test
1126      }
1127  
1128      /**
1129 <     * A CyclicBarrier that fails with AssertionFailedErrors instead
1130 <     * of throwing checked exceptions.
1129 >     * A CyclicBarrier that uses timed await and fails with
1130 >     * AssertionFailedErrors instead of throwing checked exceptions.
1131       */
1132      public class CheckedBarrier extends CyclicBarrier {
1133          public CheckedBarrier(int parties) { super(parties); }
1134  
1135          public int await() {
1136              try {
1137 <                return super.await();
1137 >                return super.await(2 * LONG_DELAY_MS, MILLISECONDS);
1138 >            } catch (TimeoutException e) {
1139 >                throw new AssertionFailedError("timed out");
1140              } catch (Exception e) {
1141                  AssertionFailedError afe =
1142                      new AssertionFailedError("Unexpected exception: " + e);
# Line 1179 | Line 1181 | public class JSR166TestCase extends Test
1181              oos.writeObject(o);
1182              oos.flush();
1183              oos.close();
1184 <            ByteArrayInputStream bin =
1185 <                new ByteArrayInputStream(bos.toByteArray());
1186 <            ObjectInputStream ois = new ObjectInputStream(bin);
1187 <            return (T) ois.readObject();
1184 >            ObjectInputStream ois = new ObjectInputStream
1185 >                (new ByteArrayInputStream(bos.toByteArray()));
1186 >            T clone = (T) ois.readObject();
1187 >            assertSame(o.getClass(), clone.getClass());
1188 >            return clone;
1189          } catch (Throwable t) {
1190              threadUnexpectedException(t);
1191              return null;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines