Terminate StreamCopy threads in case of errors
- fix NPE: don't invoke close() if no exception happened. Bug: 513554 Change-Id: I29f9b2ac1607ee26521e8aba334facd20e4ad79c Signed-off-by: Till Brychcy <register.eclipse@brychcy.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
65f9046547
commit
401c6c98b5
|
@ -283,12 +283,12 @@ class SshFetchConnection extends BasePackFetchConnection {
|
||||||
init(process.getInputStream(), process.getOutputStream());
|
init(process.getInputStream(), process.getOutputStream());
|
||||||
|
|
||||||
} catch (TransportException err) {
|
} catch (TransportException err) {
|
||||||
|
close();
|
||||||
throw err;
|
throw err;
|
||||||
} catch (Throwable err) {
|
} catch (Throwable err) {
|
||||||
|
close();
|
||||||
throw new TransportException(uri,
|
throw new TransportException(uri,
|
||||||
JGitText.get().remoteHungUpUnexpectedly, err);
|
JGitText.get().remoteHungUpUnexpectedly, err);
|
||||||
} finally {
|
|
||||||
close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -341,12 +341,20 @@ class SshPushConnection extends BasePackPushConnection {
|
||||||
init(process.getInputStream(), process.getOutputStream());
|
init(process.getInputStream(), process.getOutputStream());
|
||||||
|
|
||||||
} catch (TransportException err) {
|
} catch (TransportException err) {
|
||||||
|
try {
|
||||||
|
close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
throw err;
|
throw err;
|
||||||
} catch (Throwable err) {
|
} catch (Throwable err) {
|
||||||
|
try {
|
||||||
|
close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
throw new TransportException(uri,
|
throw new TransportException(uri,
|
||||||
JGitText.get().remoteHungUpUnexpectedly, err);
|
JGitText.get().remoteHungUpUnexpectedly, err);
|
||||||
} finally {
|
|
||||||
close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue