Commits

Matthew Watson [Atlassian] committed 1339e85

CRUC-3594: CR-FE-3572 rework

  • Participants
  • Parent commits e8ae626
  • Tags 2.4.0-build-20101018022715

Comments (0)

Files changed (1)

processutils/src/main/java/com/atlassian/utils/process/ProcessException.java

 
     public ProcessException(String message, Throwable cause) {
         super(message, cause);
-        setExitCode(cause);
+        exitCode = extractExitCode(cause);
     }
 
-    private void setExitCode(Throwable cause) {
+    private static int extractExitCode(Throwable cause) {
         // Trawl the whole chain looking for a process exception - copy it's exit code.
         while (cause != null) {
             if (cause instanceof ProcessException) {
-                exitCode = ((ProcessException) cause).getExitCode();
-                return;
+                return ((ProcessException) cause).getExitCode();
             }
             cause = cause.getCause();
         }
+        return 0;
     }
 
     public ProcessException(String message) {
 
     public ProcessException(Throwable e) {
         super(e);
-        setExitCode(e);
+        exitCode = extractExitCode(e);
     }
 
     public ProcessException(String message, int exitCode) {