8000 Migrate from deprecated Throwables.propagateIfPossible(throwable) to … · keepfit/google-http-java-client@1c6049a · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c6049a

Browse files
kluevergarrettjonesgoogle
authored andcommitted
Migrate from deprecated Throwables.propagateIfPossible(throwable) to throwIfUnchecked(throwable).
ATTENTION: the previous method allowed a null Throwable, but the replacement does not. If this is a problem, please let me know. More information: go/throwables-lsc Tested: TAP train for global presubmit queue http://test/OCL:147290834:BASE:147288131:1486945534671:7ebcefdb Some tests failed; test failures are believed to be unrelated to this CL ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=147866181
1 parent 2e2e395 commit 1c6049a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

google-http-client/src/main/java/com/google/api/client/util/Throwables.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ public static RuntimeException propagate(Throwable throwable) {
7474
* @param throwable throwable (may be {@code null})
7575
*/
7676
public static void propagateIfPossible(Throwable throwable) {
77-
com.google.common.base.Throwables.propagateIfPossible(throwable);
77+
if (throwable != null) {
78+
if (throwable instanceof RuntimeException) {
79+
throw (RuntimeException) throwable;
80+
}
81+
if (throwable instanceof Error) {
82+
throw (Error) throwable;
83+
}
84+
}
7885
}
7986

8087
/**

0 commit comments

Comments
 (0)
0