diff options
author | Lars Vogel | 2017-07-24 08:51:11 +0000 |
---|---|---|
committer | Lars Vogel | 2017-07-24 08:51:11 +0000 |
commit | cdf67ef72195e7895c7ecc4b94cece346dca885c (patch) | |
tree | d5a13a15836036f1d7d4ffd814a39264e56d1f59 | |
parent | 3585c54cedcee8c5c5b3505b826f89a4efa2b917 (diff) | |
download | eclipse.platform.runtime-cdf67ef72195e7895c7ecc4b94cece346dca885c.tar.gz eclipse.platform.runtime-cdf67ef72195e7895c7ecc4b94cece346dca885c.tar.xz eclipse.platform.runtime-cdf67ef72195e7895c7ecc4b94cece346dca885c.zip |
Bug 516531 - Use StringBuilder instead of StringBuffer inI20170727-2000I20170727-0610I20170726-2000I20170725-2000I20170724-2000
eclipse.platform.runtime
Change for org.eclipse.core.tools
Change-Id: I71207189baf91d18c239841267c7696d12d58778
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
12 files changed, 26 insertions, 26 deletions
diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java index af90aae30..cccf1d57f 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/ByteUtil.java @@ -24,7 +24,7 @@ public class ByteUtil { * @return a byte array string representation */ public static String byteArrayToString(byte[] byteArray, int max) { - StringBuffer result = new StringBuffer(byteArray.length * 2 + 2); + StringBuilder result = new StringBuilder(byteArray.length * 2 + 2); int bytesToBeShown = (max > 0) ? (Math.min(max, byteArray.length)) : byteArray.length; result.append('['); for (int i = 0; i < bytesToBeShown; i++) { diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java index 15448c4d9..f581a1a93 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/CopyStructuredSelectionAction.java @@ -43,7 +43,7 @@ public class CopyStructuredSelectionAction extends AbstractCopySelectionAction { public String getContents() { // retrieves the selected contents from the selection provider IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection(); - StringBuffer content = new StringBuffer(); + StringBuilder content = new StringBuilder(); for (Iterator selectionIter = selection.iterator(); selectionIter.hasNext();) { content.append(selectionIter.next()); content.append('\n'); diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableSelectionProviderDecorator.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableSelectionProviderDecorator.java index 9be9318f3..d3e333682 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableSelectionProviderDecorator.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/TableSelectionProviderDecorator.java @@ -65,7 +65,7 @@ public class TableSelectionProviderDecorator implements ISelectionProvider { // constructs a list with the selected elements IStructuredSelection structuredSelection = (IStructuredSelection) selection; - StringBuffer copyText = new StringBuffer(); + StringBuilder copyText = new StringBuilder(); copyText.append(headerPluginStats()); copyText.append('\n'); for (Iterator selectionIter = structuredSelection.iterator(); selectionIter.hasNext();) { diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java index f2f4eb93c..ee6b4a435 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/AbstractDumper.java @@ -46,7 +46,7 @@ public abstract class AbstractDumper implements IDumper { MeteredInputStream meteredInput = null; Dump dump = new Dump(); dump.setFile(file); - StringBuffer contents = new StringBuffer(40); + StringBuilder contents = new StringBuilder(40); try { //uses a metered input stream in order to count the number of bytes read meteredInput = new MeteredInputStream(openInputStream(file)); @@ -76,7 +76,7 @@ public abstract class AbstractDumper implements IDumper { * @throws Exception * @throws DumpException */ - protected abstract void dumpContents(PushbackInputStream input, StringBuffer contents) throws IOException, Exception, DumpException; + protected abstract void dumpContents(PushbackInputStream input, StringBuilder contents) throws IOException, Exception, DumpException; /** * Opens an input stream connected to the file object provided. Provides an diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java index 4fa4d5147..20534d6a3 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumpSummaryView.java @@ -82,7 +82,7 @@ public class DumpSummaryView extends SpyView { this.setTitleToolTip("Dump summary for file " + file.getAbsolutePath()); //$NON-NLS-1$ // generates text to be shown on this view - StringBuffer output = new StringBuffer(); + StringBuilder output = new StringBuilder(); if (dump.isFailed()) output.append(dump.getFailureReason().toString()); else diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java index 5b08bd72b..2a4e72033 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/DumperFactory.java @@ -108,7 +108,7 @@ public class DumperFactory { } private String getListOfDumperClass(Properties cfg) { - StringBuffer buf = new StringBuffer("\r\nList of files who have a dumper class"); + StringBuilder buf = new StringBuilder("\r\nList of files who have a dumper class"); for (Enumeration e = cfg.keys(); e.hasMoreElements();) { String element = (String) e.nextElement(); buf.append("\r\n"); diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java index e431f363f..ecb0b591a 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/MultiStrategyDumper.java @@ -37,7 +37,7 @@ public abstract class MultiStrategyDumper extends AbstractDumper { * @see #openInputStream(File) */ @Override - protected final void dumpContents(PushbackInputStream input, StringBuffer contents) throws IOException, Exception, DumpException { + protected final void dumpContents(PushbackInputStream input, StringBuilder contents) throws IOException, Exception, DumpException { DataInputStream dataInput = new DataInputStream(input); int c; while ((c = input.read()) != -1) { diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java index fd66d55a4..bc92717bc 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/metadata/StateDumper.java @@ -17,7 +17,7 @@ import org.eclipse.osgi.service.resolver.*; public class StateDumper extends AbstractDumper { @Override - protected void dumpContents(PushbackInputStream input, StringBuffer contents) throws IOException, Exception, DumpException { + protected void dumpContents(PushbackInputStream input, StringBuilder contents) throws IOException, Exception, DumpException { PlatformAdmin admin = Platform.getPlatformAdmin(); // use the deprecated API to support running against a 3.0 Eclipse State state = admin.getFactory().readState(new DataInputStream(input)); @@ -34,7 +34,7 @@ public class StateDumper extends AbstractDumper { dumpBundle(allBundle, contents); } - private void dumpBundle(BundleDescription bundle, StringBuffer contents) { + private void dumpBundle(BundleDescription bundle, StringBuilder contents) { contents.append("\n"); //$NON-NLS-1$ contents.append("Bundle: "); //$NON-NLS-1$ contents.append(bundle.getSymbolicName()); @@ -53,7 +53,7 @@ public class StateDumper extends AbstractDumper { dumpRequired(element, contents); } - private void dumpRequired(BundleSpecification required, StringBuffer contents) { + private void dumpRequired(BundleSpecification required, StringBuilder contents) { contents.append("\tRequired: "); //$NON-NLS-1$ contents.append(required.getName()); contents.append(" - Version: "); //$NON-NLS-1$ @@ -66,7 +66,7 @@ public class StateDumper extends AbstractDumper { contents.append('\n'); } - private void dumpHost(HostSpecification host, StringBuffer contents) { + private void dumpHost(HostSpecification host, StringBuilder contents) { contents.append("\tHost: "); //$NON-NLS-1$ contents.append(host.getName()); contents.append(" - Version: "); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/PropertyFileConverter.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/PropertyFileConverter.java index 4157b1fe0..5f8c9e867 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/PropertyFileConverter.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/PropertyFileConverter.java @@ -73,7 +73,7 @@ public class PropertyFileConverter { /** * Appends the text to put at the end of each Java messages file. */ - private void appendPostText(StringBuffer buffer, String bundlePath, String typeName) { + private void appendPostText(StringBuilder buffer, String bundlePath, String typeName) { buffer.append("\n\tstatic {\n"); //$NON-NLS-1$ buffer.append("\t\t// load message values from bundle file\n"); //$NON-NLS-1$ buffer.append("\t\tNLS.initializeMessages(BUNDLE_NAME, "); //$NON-NLS-1$ @@ -87,7 +87,7 @@ public class PropertyFileConverter { /** * Appends the text to put at the beginning of each Java messages file. */ - private void appendPreText(StringBuffer buffer, String pkgName, String bundleName, String typeName) { + private void appendPreText(StringBuilder buffer, String pkgName, String bundleName, String typeName) { //if this text had typos, would it be a false pretext? buffer.append("/**********************************************************************\n"); //$NON-NLS-1$ buffer.append(" * Copyright (c) 2005 IBM Corporation and others. All rights reserved. This\n"); //$NON-NLS-1$ @@ -116,7 +116,7 @@ public class PropertyFileConverter { if (toDelete == null || toDelete.isEmpty()) return null; BufferedReader reader = new BufferedReader(new InputStreamReader(propertiesFile.getContents())); - StringBuffer bundle = new StringBuffer(); + StringBuilder bundle = new StringBuilder(); try { String line; @@ -177,11 +177,11 @@ public class PropertyFileConverter { String typeName = accessorFile.getFullPath().removeFileExtension().lastSegment(); BufferedReader reader = new BufferedReader(new InputStreamReader(propertiesFile.getContents())); String bundleName = propertiesFile.getName(); - StringBuffer clazz = new StringBuffer(); + StringBuilder clazz = new StringBuilder(); // convert the bundle resource (messages.properties) to the simple name (messages) String simpleBundleName = new Path(bundleName).removeFileExtension().toString(); appendPreText(clazz, pkgName, simpleBundleName, typeName); - StringBuffer bundle = new StringBuffer(); + StringBuilder bundle = new StringBuilder(); int savings = 0; try { String line; @@ -229,7 +229,7 @@ public class PropertyFileConverter { * Blank lines are preserved. */ private String convertToComment(String line) { - StringBuffer comment = new StringBuffer(); + StringBuilder comment = new StringBuilder(); if (line.trim().length() > 0) { comment.append("\t//"); //$NON-NLS-1$ } @@ -255,7 +255,7 @@ public class PropertyFileConverter { int len = string.length(); if (len == 0) return string; - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); char c = string.charAt(0); if (Character.isJavaIdentifierStart(c)) result.append(c); @@ -296,7 +296,7 @@ public class PropertyFileConverter { */ private String extractKey(String line) { int len = line.length(); - StringBuffer key = new StringBuffer(); + StringBuilder key = new StringBuilder(); for (int i = 0; i < len; i++) { char c = line.charAt(i); //whitespace, colon, or equals characters represent key separators diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypePropertySource.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypePropertySource.java index 8f32dbaae..af0a6d103 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypePropertySource.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/ContentTypePropertySource.java @@ -75,7 +75,7 @@ public class ContentTypePropertySource implements IPropertySource, IAdaptable { private Object toString(String[] fileNames) { if (fileNames.length == 0) return ""; //$NON-NLS-1$ - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (String fileName : fileNames) { result.append(fileName); result.append(','); diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java index bcfedde85..6383183a2 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PluginDependencyGraphNode.java @@ -66,7 +66,7 @@ public class PluginDependencyGraphNode { * and include the list of children and ancestor nodes. */ public String toDeepString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); // write ID writeln(buffer, 0, NLS.bind(Messages.stats_pluginid, descriptor.getSymbolicName())); @@ -99,7 +99,7 @@ public class PluginDependencyGraphNode { * Ultility method to write a string and cr to the given buffer. Indent the * text the given number of tabs. */ - private void writeln(StringBuffer buffer, int indent, String text) { + private void writeln(StringBuilder buffer, int indent, String text) { for (int i = 0; i < indent; i++) buffer.append('\t'); buffer.append(text); @@ -126,7 +126,7 @@ public class PluginDependencyGraphNode { @Override public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("PluginDependencyGraphNode("); //$NON-NLS-1$ buffer.append(descriptor.getSymbolicName()); buffer.append(')'); diff --git a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java index b80e4338f..fab3890d8 100644 --- a/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java +++ b/bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/runtime/PreferenceStatsView.java @@ -292,7 +292,7 @@ public class PreferenceStatsView extends SpyView { } void updateTextView() { - final StringBuffer buffer = new StringBuffer(); + final StringBuilder buffer = new StringBuilder(); buffer.append("Size of Eclipse 2.1 preference objects: " + prettyPrint(calculateOldSize()) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("Total node count: " + prettyPrint(nodeCount) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("Nodes without keys: " + prettyPrint(emptyNodes) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -316,7 +316,7 @@ public class PreferenceStatsView extends SpyView { } private String prettyPrint(int i) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (;;) { if (i < 1000) { String val = Integer.toString(i); |