]> source.dussan.org Git - jgit.git/commitdiff
CommitGraphWriter: fix UnusedException errorprone error 70/197670/1
authorMatthias Sohn <matthias.sohn@sap.com>
Tue, 13 Dec 2022 14:04:45 +0000 (15:04 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 13 Dec 2022 14:04:45 +0000 (15:04 +0100)
Errorprone run in the bazel build raised this exception:

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java:105:
error: [UnusedException] This catch block catches an exception and
re-throws another, but swallows the caught exception rather than setting
it as a cause. This can make debugging harder.
} catch (InterruptedIOException e) {
  ^
    (see https://errorprone.info/bugpattern/UnusedException)
  Did you mean 'throw new
IOException(JGitText.get().commitGraphWritingCancelled, e);'?

Change-Id: Iad832fe17955fc1e60e6a4902bc50fd9dca76b9d

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java

index 2f96c4d7739d9f9262eb00fb88fdbc85fad1aec9..a58a9eb6329b0080dee46440b4c54baef040fef5 100644 (file)
@@ -103,7 +103,8 @@ public class CommitGraphWriter {
                        writeChunks(monitor, out, chunks);
                        writeCheckSum(out);
                } catch (InterruptedIOException e) {
-                       throw new IOException(JGitText.get().commitGraphWritingCancelled);
+                       throw new IOException(JGitText.get().commitGraphWritingCancelled,
+                                       e);
                } finally {
                        monitor.endTask();
                }