diff options
author | Alexander Kurtakov | 2017-09-09 08:58:20 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-09-09 08:58:20 +0000 |
commit | ce8888e5faa2bd53fc1219b76e178bd436bd1b65 (patch) | |
tree | f3605cd035960c0a63f550d14860164100cdc8a2 /org.eclipse.ui.intro.universal | |
parent | e68d8740242fc3d667d6108ff939fa371e427692 (diff) | |
download | eclipse.platform.ua-ce8888e5faa2bd53fc1219b76e178bd436bd1b65.tar.gz eclipse.platform.ua-ce8888e5faa2bd53fc1219b76e178bd436bd1b65.tar.xz eclipse.platform.ua-ce8888e5faa2bd53fc1219b76e178bd436bd1b65.zip |
Bug 522083 - Simplify StringUtils classesI20170909-1500I20170909-0920I20170909-0800I20170909-0510
Make concat return String directly as it opens the door for moving to
StringBuilder for concatenation and it was not used as buffer anywhere.
Change-Id: Ie81c3995694437ee84806fc9f4d372b2c2f78d80
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.ui.intro.universal')
2 files changed, 15 insertions, 16 deletions
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java index 53b1eee36..591dd084e 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. + * Copyright (c) 2004, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,12 +41,11 @@ public class BundleUtil { if (bundle == null) Log.error("Universal Welcome tried accessing a NULL bundle.", null); //$NON-NLS-1$ else { - String msg = StringUtil - .concat("Universal Welcome tried accessing Bundle: ", getBundleHeader( //$NON-NLS-1$ - bundle, Constants.BUNDLE_NAME), " vendor: ", //$NON-NLS-1$ - getBundleHeader(bundle, Constants.BUNDLE_VENDOR), - " bundle state: ", String.valueOf(bundle.getState())).toString(); //$NON-NLS-1$ - Log.error(msg, null); + String msg = StringUtil.concat("Universal Welcome tried accessing Bundle: ", getBundleHeader( //$NON-NLS-1$ + bundle, Constants.BUNDLE_NAME), " vendor: ", //$NON-NLS-1$ + getBundleHeader(bundle, Constants.BUNDLE_VENDOR), " bundle state: ", //$NON-NLS-1$ + String.valueOf(bundle.getState())); + Log.error(msg, null); } return false; } @@ -155,9 +154,9 @@ public class BundleUtil { // localLocation can be null if the passed resource could not // be found relative to the plugin. log fact, return resource, // as is. - String msg = StringUtil.concat("Could not find resource: ", //$NON-NLS-1$ - resource, " in ", getBundleHeader( //$NON-NLS-1$ - bundle, Constants.BUNDLE_NAME)).toString(); + String msg = StringUtil.concat("Could not find resource: ", //$NON-NLS-1$ + resource, " in ", getBundleHeader( //$NON-NLS-1$ + bundle, Constants.BUNDLE_NAME)); Log.warning(msg); return resource; } @@ -167,9 +166,9 @@ public class BundleUtil { */ return toExternalForm(localLocation); } catch (Exception e) { - String msg = StringUtil.concat("Failed to load resource: ", //$NON-NLS-1$ - resource, " from ", getBundleHeader(bundle, //$NON-NLS-1$ - Constants.BUNDLE_NAME)).toString(); + String msg = StringUtil.concat("Failed to load resource: ", //$NON-NLS-1$ + resource, " from ", getBundleHeader(bundle, //$NON-NLS-1$ + Constants.BUNDLE_NAME)); Log.error(msg, e); return resource; } diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java index 77eccf017..1d2148b82 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java @@ -12,11 +12,11 @@ package org.eclipse.ui.internal.intro.universal.util; public class StringUtil { - public static StringBuffer concat(String... strings) { - StringBuffer buffer = new StringBuffer(); + public static String concat(String... strings) { + StringBuilder buffer = new StringBuilder(); for (String string : strings) { buffer.append(string); } - return buffer; + return buffer.toString(); } } |