]> source.dussan.org Git - jgit.git/commitdiff
Fix logging null if called process fails 09/129009/4
authorCliffred van Velzen <cliffred@cliffred.nl>
Mon, 10 Sep 2018 06:45:01 +0000 (08:45 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 12 Sep 2018 21:42:35 +0000 (23:42 +0200)
If some process executed by FS#readPipe ends in an error,
the error stream is never set as errorMessage because
FS#GobblerThread#waitForProcessCompletion always returned true.
This caused LOG#warn to be called with null.

Return false whenever FS#GobblerThread#waitForProcessCompletion fails.

Bug: 538723
Change-Id: Ic9492bd688431d52c8665f7a2efec2989e95a4ce
Signed-off-by: Cliffred van Velzen <cliffred@cliffred.nl>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java

index 6d3be7c686a616427bbc34bb66ce02e133f48864..ea3cf5f518008c53de9fa53311c86d5af3d8ca56 100644 (file)
@@ -640,12 +640,15 @@ public abstract class FS {
                                                        JGitText.get().commandClosedStderrButDidntExit,
                                                        desc, PROCESS_EXIT_TIMEOUT), -1);
                                        fail.set(true);
+                                       return false;
                                }
                        } catch (InterruptedException e) {
-                               LOG.error(MessageFormat.format(
-                                               JGitText.get().threadInterruptedWhileRunning, desc), e);
+                               setError(originalError, MessageFormat.format(
+                                               JGitText.get().threadInterruptedWhileRunning, desc), -1);
+                               fail.set(true);
+                               return false;
                        }
-                       return false;
+                       return true;
                }
 
                private void setError(IOException e, String message, int exitCode) {