Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2018-12-05 03:32:36 -0500
committerLars Vogel2019-01-08 03:51:27 -0500
commitd327fddebdf5df0d2651480085b6d5ac79a30beb (patch)
tree7b18ec9636bacd43cad154312421ee514c484f35
parent6e0828f3b328cfb6bbb6e250248d49b264836c38 (diff)
downloadrt.equinox.p2-d327fddebdf5df0d2651480085b6d5ac79a30beb.tar.gz
rt.equinox.p2-d327fddebdf5df0d2651480085b6d5ac79a30beb.tar.xz
rt.equinox.p2-d327fddebdf5df0d2651480085b6d5ac79a30beb.zip
Bug 542418 - Use StringBuilder in org.eclipse.equinox.p2.engine
StringBuffer should not be used according to its Javadoc as it is slower than StringBuilder. Change-Id: Ib7b4b2f413670f14ce20a9f12032c580973f0ebd Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingActionsException.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SlashEncode.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java2
9 files changed, 18 insertions, 18 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
index 34b8e547b..20bf19e4f 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
@@ -52,7 +52,7 @@ public class DebugHelper {
}
public static void debug(String name, String message) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("["); //$NON-NLS-1$
buffer.append(EngineActivator.ID + "-" + name); //$NON-NLS-1$
buffer.append("] "); //$NON-NLS-1$
@@ -68,7 +68,7 @@ public class DebugHelper {
if (array == null || array.size() == 0)
return "[]"; //$NON-NLS-1$
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append('[');
boolean first = true;
for (Object elem : array) {
@@ -91,7 +91,7 @@ public class DebugHelper {
}
public static String formatOperation(PhaseSet phaseSet, Operand[] operands, ProvisioningContext context) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("phaseSet=" + formatPhaseSet(phaseSet)); //$NON-NLS-1$
buffer.append(","); //$NON-NLS-1$
buffer.append(DebugHelper.LINE_SEPARATOR);
@@ -116,7 +116,7 @@ public class DebugHelper {
}
public static String formatInstallableUnitOperand(InstallableUnitOperand iuOperand) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(iuOperand.first());
if (iuOperand.first() != null && iuOperand.first().getFragments() != null)
buffer.append(DebugHelper.formatArray(iuOperand.first().getFragments(), true, false));
@@ -128,7 +128,7 @@ public class DebugHelper {
}
public static String formatPhaseSet(PhaseSet phaseSet) {
- StringBuffer buffer = new StringBuffer(phaseSet.getClass().getName());
+ StringBuilder buffer = new StringBuilder(phaseSet.getClass().getName());
buffer.append(DebugHelper.formatArray(Arrays.asList(phaseSet.getPhases()), false, false));
return buffer.toString();
}
@@ -138,7 +138,7 @@ public class DebugHelper {
}
public static String formatAction(ProvisioningAction action, Map<String, Object> parameters) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(action.getClass().getName());
if (action instanceof ParameterizedProvisioningAction) {
ParameterizedProvisioningAction parameterizedAction = (ParameterizedProvisioningAction) action;
@@ -155,7 +155,7 @@ public class DebugHelper {
if (!it.hasNext())
return "{}"; //$NON-NLS-1$
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append('{');
for (;;) {
Entry<String, ? extends Object> e = it.next();
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingActionsException.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingActionsException.java
index cf26aaeaf..c6bd10ff0 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingActionsException.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingActionsException.java
@@ -34,7 +34,7 @@ public class MissingActionsException extends ProvisionException {
if (missingActions.length == 0)
throw new IllegalArgumentException("Bad exception: No missing actions"); //$NON-NLS-1$
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int i = 0; i < missingActions.length; i++) {
MissingAction missingAction = missingActions[i];
buffer.append(missingAction.getActionId());
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
index a49315b83..4e1c2f728 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
@@ -42,7 +42,7 @@ public class ProfileEvent extends EventObject implements IProfileEvent {
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("ProfileEvent["); //$NON-NLS-1$
buffer.append(getProfileId());
buffer.append("-->"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
index ef726c314..70cc804d8 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
@@ -174,7 +174,7 @@ public class ProfilePreferences extends EclipsePreferences {
* Any reserved filter characters are escaped.
*/
private String encodeForFilter(String string) {
- StringBuffer result = new StringBuffer(string.length());
+ StringBuilder result = new StringBuilder(string.length());
char[] input = string.toCharArray();
for (int i = 0; i < input.length; i++) {
switch (input[i]) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
index a32e460a0..b14e6c758 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
@@ -660,7 +660,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
* Converts a profile id into a string that can be used as a file name in any file system.
*/
public static String escape(String toEscape) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
int length = toEscape.length();
for (int i = 0; i < length; ++i) {
char ch = toEscape.charAt(i);
@@ -688,7 +688,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
if (text.indexOf('%') == -1)
return text;
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
int length = text.length();
for (int i = 0; i < length; ++i) {
char ch = text.charAt(i);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SlashEncode.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SlashEncode.java
index 9c1a1854a..f68acabd1 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SlashEncode.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SlashEncode.java
@@ -27,7 +27,7 @@ final public class SlashEncode {
if (size == 0)
return str;
- StringBuffer processed = new StringBuffer(size);
+ StringBuilder processed = new StringBuilder(size);
int processedPos = 0;
for (int i = 0; i < size; i++) {
@@ -64,7 +64,7 @@ final public class SlashEncode {
if (size == 0)
return str;
- StringBuffer processed = new StringBuffer(size);
+ StringBuilder processed = new StringBuilder(size);
int processedPos = 0;
for (int i = 0; i < size; i++) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
index 62755de1f..64247a8d2 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
@@ -81,7 +81,7 @@ public class TouchpointManager implements IRegistryChangeListener {
@Override
public String toString() {
- StringBuffer result = new StringBuffer(element.toString());
+ StringBuilder result = new StringBuilder(element.toString());
if (createdExtension) {
String touchpointString = touchpoint != null ? touchpoint.toString() : "not created"; //$NON-NLS-1$
result.append(" => " + touchpointString); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
index 36bf3ebe3..61231725f 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
@@ -103,7 +103,7 @@ public class CertificateChecker {
// log the unsigned artifacts if requested
if (DebugHelper.DEBUG_CERTIFICATE_CHECKER_UNSIGNED && !unsigned.isEmpty()) {
- StringBuffer message = new StringBuffer("The following artifacts are unsigned:\n"); //$NON-NLS-1$
+ StringBuilder message = new StringBuilder("The following artifacts are unsigned:\n"); //$NON-NLS-1$
for (File file : unsigned) {
message.append(NLS.bind(" {0}\n", file.getPath())); //$NON-NLS-1$
}
@@ -112,7 +112,7 @@ public class CertificateChecker {
// log the untrusted certificates if requested
if (DebugHelper.DEBUG_CERTIFICATE_CHECKER_UNTRUSTED && !untrusted.isEmpty()) {
- StringBuffer message = new StringBuffer("The following certificates are untrusted:\n"); //$NON-NLS-1$
+ StringBuilder message = new StringBuilder("The following certificates are untrusted:\n"); //$NON-NLS-1$
for (Certificate cert : untrustedArtifacts.keySet()) {
message.append(cert.toString() + "\n"); //$NON-NLS-1$
message.append(" used by the following artifacts:\n"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
index ea86dfa4d..68c30b028 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
@@ -392,7 +392,7 @@ public class ProvisioningContext {
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("{artifactRepos=" + DebugHelper.formatArray(null != artifactRepositories ? Arrays.asList(artifactRepositories) : null, true, false)); //$NON-NLS-1$
buffer.append(", metadataRepos=" + DebugHelper.formatArray(null != metadataRepositories ? Arrays.asList(metadataRepositories) : null, true, false)); //$NON-NLS-1$
buffer.append(", properties=" + getProperties() + "}"); //$NON-NLS-1$ //$NON-NLS-2$

Back to the top