Skip to content

Commit a178357

Browse files
committed
Merge pull request #3000 from zsxwing/java6
Replace the Java 7 AssertionError(message, cause) with RuntimeException
2 parents 34dce48 + 596ecd2 commit a178357

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

src/main/java/rx/observers/TestSubscriber.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,14 @@ public void assertError(Class<? extends Throwable> clazz) {
356356
throw new AssertionError("No errors");
357357
} else
358358
if (err.size() > 1) {
359-
throw new AssertionError("Multiple errors: " + err.size(), new CompositeException(err));
359+
AssertionError ae = new AssertionError("Multiple errors: " + err.size());
360+
ae.initCause(new CompositeException(err));
361+
throw ae;
360362
} else
361363
if (!clazz.isInstance(err.get(0))) {
362-
throw new AssertionError("Exceptions differ; expected: " + clazz + ", actual: " + err.get(0), err.get(0));
364+
AssertionError ae = new AssertionError("Exceptions differ; expected: " + clazz + ", actual: " + err.get(0));
365+
ae.initCause(err.get(0));
366+
throw ae;
363367
}
364368
}
365369

@@ -378,10 +382,14 @@ public void assertError(Throwable throwable) {
378382
throw new AssertionError("No errors");
379383
} else
380384
if (err.size() > 1) {
381-
throw new AssertionError("Multiple errors: " + err.size(), new CompositeException(err));
385+
AssertionError ae = new AssertionError("Multiple errors: " + err.size());
386+
ae.initCause(new CompositeException(err));
387+
throw ae;
382388
} else
383389
if (!throwable.equals(err.get(0))) {
384-
throw new AssertionError("Exceptions differ; expected: " + throwable + ", actual: " + err.get(0), err.get(0));
390+
AssertionError ae = new AssertionError("Exceptions differ; expected: " + throwable + ", actual: " + err.get(0));
391+
ae.initCause(err.get(0));
392+
throw ae;
385393
}
386394
}
387395

@@ -400,9 +408,13 @@ public void assertNoTerminalEvent() {
400408
throw new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
401409
} else
402410
if (err.size() == 1) {
403-
throw new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none", err.get(0));
411+
AssertionError ae = new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
412+
ae.initCause(err.get(0));
413+
throw ae;
404414
} else {
405-
throw new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none", new CompositeException(err));
415+
AssertionError ae = new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
416+
ae.initCause(new CompositeException(err));
417+
throw ae;
406418
}
407419
}
408420
}

src/main/java/rx/subjects/ReplaySubject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void call(SubjectObserver<T> o) {
114114
boolean skipFinal = false;
115115
try {
116116
for (;;) {
117-
int idx = o.index();
117+
int idx = o.<Integer>index();
118118
int sidx = state.index;
119119
if (idx != sidx) {
120120
Integer j = state.replayObserverFromIndex(idx, o);

0 commit comments

Comments
 (0)