]> source.dussan.org Git - jgit.git/commit
SshSupport#runSshCommand: don't throw exception in finally block 10/155210/2
authorMatthias Sohn <matthias.sohn@sap.com>
Sat, 4 Jan 2020 14:44:19 +0000 (15:44 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 6 Jan 2020 10:40:04 +0000 (11:40 +0100)
commitd9e957dc2485d4a0737e537298e575365ec5eb2c
tree475904b94831ea8159093ce00d95d6c88943ce48
parentebea36aa07520f7f4b873930ca9b4dbca8db52ef
SshSupport#runSshCommand: don't throw exception in finally block

The CommandFailedException which was thrown in finally block is silently
discarded [1]. Refactor this method to throw the exception after the
finally block.

This fixes the warning "Null comparison always yields false: The
variable failure can only be null at this location".

[1] https://wiki.sei.cmu.edu/confluence/display/java/ERR04-J.+Do+not+complete+abruptly+from+a+finally+block
https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.20.2

Change-Id: Idbfc303d9c9046ab9a43e0d4c6d65d325bdaf0ed
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java