Bug 548165: Fix initialization of severity of MultiStatus

Backport-of: 74207b3b38e6a400a63b692a9817f0ef49d10ea9
Change-Id: Ic9e69b54986692aa1f7554a2b1d34d29ba3577f0
diff --git a/jcommons/org.eclipse.statet.jcommons.util/src/org/eclipse/statet/jcommons/status/MultiStatus.java b/jcommons/org.eclipse.statet.jcommons.util/src/org/eclipse/statet/jcommons/status/MultiStatus.java
index 8f452e9..3706e88 100644
--- a/jcommons/org.eclipse.statet.jcommons.util/src/org/eclipse/statet/jcommons/status/MultiStatus.java
+++ b/jcommons/org.eclipse.statet.jcommons.util/src/org/eclipse/statet/jcommons/status/MultiStatus.java
@@ -26,6 +26,17 @@
 public class MultiStatus extends AbstractStatus {
 	
 	
+	private static byte computeSeverity(final ImList<Status> children) {
+		byte severity= OK;
+		for (final Status child : children) {
+			if (child.getSeverity() > severity) {
+				severity= child.getSeverity();
+			}
+		}
+		return severity;
+	}
+	
+	
 	private byte severity;
 	
 	private ImList<Status> children;
@@ -35,18 +46,21 @@
 			final String message, final @Nullable Throwable exception,
 			final ImList<Status> children) {
 		super(bundleId, code, message, exception);
+		this.severity= computeSeverity(children);
 		this.children= children;
 	}
 	
 	public MultiStatus(final String bundleId, final int code,
 			final String message, final @Nullable Throwable exception) {
 		super(bundleId, code, message, exception);
+		this.severity= OK;
 		this.children= ImCollections.newList();
 	}
 	
 	public MultiStatus(final String bundleId, final int code,
 			final String message) {
 		super(bundleId, code, message, null);
+		this.severity= OK;
 		this.children= ImCollections.newList();
 	}
 	
@@ -54,17 +68,20 @@
 			final String message, final @Nullable Throwable exception,
 			final ImList<Status> children) {
 		super(bundleId, 0, message, exception);
+		this.severity= computeSeverity(children);
 		this.children= children;
 	}
 	
 	public MultiStatus(final String bundleId,
 			final String message, final @Nullable Throwable exception) {
 		super(bundleId, 0, message, exception);
+		this.severity= OK;
 		this.children= ImCollections.newList();
 	}
 	
 	public MultiStatus(final String bundleId, final String message) {
 		super(bundleId, 0, message, null);
+		this.severity= OK;
 		this.children= ImCollections.newList();
 	}