diff options
author | Han-Wen Nienhuys <hanwen@google.com> | 2018-10-09 16:22:06 +0200 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@google.com> | 2018-10-15 16:45:19 +0200 |
commit | 8a5b044a99deb7c6b2166c3f763f90b4e3d8d223 (patch) | |
tree | 8e2e6e226ddc5f205cf960b9f42f63b74c7ef3e2 /org.eclipse.jgit | |
parent | 18dce03a4104b75980866fb21076ce1cc1706b3d (diff) | |
download | jgit-8a5b044a99deb7c6b2166c3f763f90b4e3d8d223.tar.gz jgit-8a5b044a99deb7c6b2166c3f763f90b4e3d8d223.zip |
InternalPushConnection: don't swallow RuntimeException
Uncaught exceptions are handled by java.lang.Thread's handler, which
prints it to stderr.
This is useful because InternalPushConnection is used in tests, and
during development, the server side may have programming errors that
manifest as RuntimeExceptions.
Before this change, all types of failures would lead to a uniform
failure message "test://test/conn0: push not permitted" on the client.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I0983cbeb86d36fa7a9313373f5fce54971f804ec
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalPushConnection.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalPushConnection.java index 732be63dc1..f05e0b8c7d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalPushConnection.java @@ -46,6 +46,7 @@ package org.eclipse.jgit.transport; import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; +import java.io.UncheckedIOException; import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.internal.JGitText; @@ -103,10 +104,13 @@ class InternalPushConnection<C> extends BasePackPushConnection { // Ignored. Client cannot use this repository. } catch (ServiceNotAuthorizedException e) { // Ignored. Client cannot use this repository. - } catch (IOException err) { - // Client side of the pipes should report the problem. - } catch (RuntimeException err) { - // Clients side will notice we went away, and report. + } catch (IOException e) { + // Since the InternalPushConnection + // is used in tests, we want to avoid hiding exceptions + // because they can point to programming errors on the server + // side. By rethrowing, the default handler will dump it + // to stderr. + throw new UncheckedIOException(e); } finally { try { out_r.close(); |