Skip to content

Commit b375d42

Browse files
committed
Review nullability of getEnhancedStackTrace's result
1 parent 7c27113 commit b375d42

2 files changed

Lines changed: 3 additions & 15 deletions

File tree

rxjava2debug/src/main/java/com/akaita/java/rxjava2debug/ExceptionUtils.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
class ExceptionUtils {
2626

2727
static Throwable setRootCause(@NonNull Throwable throwable, @NonNull Throwable rootCause) {
28-
if (throwable == null){
29-
return null;
30-
}
31-
if (rootCause == null) {
32-
return throwable;
33-
}
34-
3528
List<Throwable> causes = listCauses(throwable);
3629
causes.add(rootCause);
3730
return collapseCauses(causes);

rxjava2debug/src/main/java/com/akaita/java/rxjava2debug/RxJava2Debug.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public static void disableRxJava2AssemblyTracking() {
6161
/**
6262
* Obtain a copy of the original Throwable with an extended StackTrace
6363
* @param original Original Throwable
64-
* @return new Throwable with enhanced StackTrace if information was found. <i>null</i> otherwise
64+
* @return new Throwable with enhanced StackTrace if information was found. <i>Original Throwable</i> otherwise
6565
*/
66-
public static @Nullable Throwable getEnhancedStackTrace(Throwable original) {
66+
public static @NonNull Throwable getEnhancedStackTrace(@NonNull Throwable original) {
6767
Throwable enhanced = original;
6868

6969
RxJavaAssemblyException assembledException = RxJavaAssemblyException.find(original);
@@ -86,12 +86,7 @@ private static void setRxJavaAssemblyHandler() {
8686
@Override
8787
public void uncaughtException(Thread t, Throwable e) {
8888
Throwable enhancedStackTrace = getEnhancedStackTrace(e);
89-
90-
if (enhancedStackTrace != null) {
91-
previousDefaultHandler.uncaughtException(t, enhancedStackTrace);
92-
} else {
93-
previousDefaultHandler.uncaughtException(t, e);
94-
}
89+
previousDefaultHandler.uncaughtException(t, enhancedStackTrace);
9590
}
9691
});
9792
}

0 commit comments

Comments
 (0)