diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2020-01-27 09:47:05 +0900 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-01-27 14:40:08 +0100 |
commit | 4cc13297ccf1fa3e982bbb5638162b3bad63f93c (patch) | |
tree | 3f0b0c0aead716773d569e0b2eb1efb3b6f02081 /org.eclipse.jgit.test/tst/org | |
parent | 0e4a717870f64e667e657650f12e93d477d369c3 (diff) | |
download | jgit-4cc13297ccf1fa3e982bbb5638162b3bad63f93c.tar.gz jgit-4cc13297ccf1fa3e982bbb5638162b3bad63f93c.zip |
ErrorProne: Enable and fix UnusedException check
Enable UnusedException at ERROR level which causes the build to fail
in many places with:
[UnusedException] This catch block catches an symbol and re-throws
another, but swallows the caught symbol rather than setting it as a
cause. This can make debugging harder.
Fix it by setting the caught exception as cause on the subsequently
thrown exception.
Note: The grammatically incorrect error message is copy-pasted as-is
from the version of ErrorProne currently used in Bazel; it has been
fixed by [1] in the latest version.
[1] https://github.com/google/error-prone/commit/d57a39c
Change-Id: I11ed38243091fc12f64f1b2db404ba3f1d2e98b5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java index 024f0f3b00..567880f478 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java @@ -149,7 +149,9 @@ public class TimeoutOutputStreamTest { try { Thread.sleep(1000); } catch (InterruptedException e) { - throw new InterruptedIOException(); + InterruptedIOException e1 = new InterruptedIOException(); + e1.initCause(e); + throw e1; } } } @@ -202,7 +204,9 @@ public class TimeoutOutputStreamTest { try { Thread.sleep(1000); } catch (InterruptedException e) { - throw new InterruptedIOException(); + InterruptedIOException e1 = new InterruptedIOException(); + e1.initCause(e); + throw e1; } } } |