Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.common/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java51
3 files changed, 24 insertions, 31 deletions
diff --git a/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
index 8490b134..8591f04a 100644
--- a/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.common; singleton:=true
-Bundle-Version: 3.10.200.qualifier
+Bundle-Version: 3.10.300.qualifier
Bundle-Localization: plugin
Export-Package: org.eclipse.core.internal.boot;x-friends:="org.eclipse.core.resources,org.eclipse.core.runtime.compatibility,org.eclipse.pde.build",
org.eclipse.core.internal.runtime;common=split;mandatory:=common;
diff --git a/bundles/org.eclipse.equinox.common/pom.xml b/bundles/org.eclipse.equinox.common/pom.xml
index 0be09dd6..b91c9efb 100644
--- a/bundles/org.eclipse.equinox.common/pom.xml
+++ b/bundles/org.eclipse.equinox.common/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
- <version>3.10.200-SNAPSHOT</version>
+ <version>3.10.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java
index a1f875fd..a30c485f 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.core.runtime;
+import java.util.*;
+
/**
* A concrete multi-status implementation,
* suitable either for instantiating or subclassing.
@@ -24,7 +26,7 @@ public class MultiStatus extends Status {
/** List of child statuses.
*/
- private IStatus[] children;
+ private final List<IStatus> children = new ArrayList<>();
/**
* Creates and returns a new multi-status object with the given children.
@@ -40,16 +42,7 @@ public class MultiStatus extends Status {
public MultiStatus(String pluginId, int code, IStatus[] newChildren, String message, Throwable exception) {
this(pluginId, code, message, exception);
Assert.isLegal(newChildren != null);
- int maxSeverity = getSeverity();
- for (int i = 0; i < newChildren.length; i++) {
- Assert.isLegal(newChildren[i] != null);
- int severity = newChildren[i].getSeverity();
- if (severity > maxSeverity)
- maxSeverity = severity;
- }
- this.children = new IStatus[newChildren.length];
- setSeverity(maxSeverity);
- System.arraycopy(newChildren, 0, this.children, 0, newChildren.length);
+ addAllInternal(newChildren);
}
/**
@@ -64,7 +57,6 @@ public class MultiStatus extends Status {
*/
public MultiStatus(String pluginId, int code, String message, Throwable exception) {
super(OK, pluginId, code, message, exception);
- children = new IStatus[0];
}
/**
@@ -74,10 +66,7 @@ public class MultiStatus extends Status {
*/
public void add(IStatus status) {
Assert.isLegal(status != null);
- IStatus[] result = new IStatus[children.length + 1];
- System.arraycopy(children, 0, result, 0, children.length);
- result[result.length - 1] = status;
- children = result;
+ children.add(status);
int newSev = status.getSeverity();
if (newSev > getSeverity()) {
setSeverity(newSev);
@@ -93,15 +82,24 @@ public class MultiStatus extends Status {
*/
public void addAll(IStatus status) {
Assert.isLegal(status != null);
- IStatus[] statuses = status.getChildren();
- for (int i = 0; i < statuses.length; i++) {
- add(statuses[i]);
+ addAllInternal(status.getChildren());
+ }
+
+ private void addAllInternal(IStatus[] newChildren) {
+ int maxSeverity = getSeverity();
+ for (IStatus child : newChildren) {
+ Assert.isLegal(child != null);
+ int severity = child.getSeverity();
+ if (severity > maxSeverity)
+ maxSeverity = severity;
}
+ this.children.addAll(Arrays.asList(newChildren));
+ setSeverity(maxSeverity);
}
@Override
public IStatus[] getChildren() {
- return children;
+ return children.toArray(new IStatus[0]);
}
@Override
@@ -135,15 +133,10 @@ public class MultiStatus extends Status {
*/
@Override
public String toString() {
- StringBuffer buf = new StringBuffer(super.toString());
- buf.append(" children=["); //$NON-NLS-1$
- for (int i = 0; i < children.length; i++) {
- if (i != 0) {
- buf.append(" "); //$NON-NLS-1$
- }
- buf.append(children[i].toString());
+ StringJoiner joiner = new StringJoiner(" ", super.toString() + " children=[", "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ for (IStatus child : children) {
+ joiner.add(child.toString());
}
- buf.append("]"); //$NON-NLS-1$
- return buf.toString();
+ return joiner.toString();
}
}

Back to the top