diff options
author | Alexander Kurtakov | 2017-09-09 06:14:37 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-09-09 06:14:37 +0000 |
commit | 5637df6a1da1030460329520dff8193ec2d0c46d (patch) | |
tree | 09202276fb683fc5622f3fd2c1be12e3a0510cd0 | |
parent | ae78d6feeb2c8a7159edcbd9249278aae99355a0 (diff) | |
download | eclipse.platform.ua-5637df6a1da1030460329520dff8193ec2d0c46d.tar.gz eclipse.platform.ua-5637df6a1da1030460329520dff8193ec2d0c46d.tar.xz eclipse.platform.ua-5637df6a1da1030460329520dff8193ec2d0c46d.zip |
Bug 520255 - Replace StringBuffer with StringBuilder in
eclipse.platform.ua
Handle help.ui and help.webapp except for cases which involved public
methods signatures although in internal classes.
Change-Id: I5256794e73b5c24f249278005d3529c17f0576f1
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
43 files changed, 117 insertions, 164 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpActivitySupport.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpActivitySupport.java index aefe7d6b7..f286fb74b 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpActivitySupport.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpActivitySupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -96,7 +96,7 @@ public class HelpActivitySupport implements IHelpActivitySupport { int loc = value.indexOf("ACTIVITY_EDITOR"); //$NON-NLS-1$ if (loc!= -1 && className!=null) { needsLiveHelp=true; - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(value.substring(0, loc)); buffer.append(getActivityEditorValue(pluginId, className, embedded)); buffer.append(value.substring(loc+15)); diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java index 447b1d165..6ac173a75 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -63,17 +63,11 @@ public class StyledLineWrapper implements StyledTextContent { setText(text); } - /** - * @see StyledTextContent#addTextChangeListener(TextChangeListener) - */ @Override public void addTextChangeListener(TextChangeListener l) { // do nothing } - /** - * @see StyledTextContent#getCharCount() - */ @Override public int getCharCount() { if (charCount != -1) @@ -84,9 +78,6 @@ public class StyledLineWrapper implements StyledTextContent { return charCount; } - /** - * @see StyledTextContent#getLine(int) - */ @Override public String getLine(int i) { if ((i >= lines.size()) || (i < 0)) @@ -94,9 +85,6 @@ public class StyledLineWrapper implements StyledTextContent { return lines.get(i); } - /** - * @see StyledTextContent#getLineAtOffset(int) - */ @Override public int getLineAtOffset(int offset) { if (offset >= getCharCount()) @@ -109,9 +97,6 @@ public class StyledLineWrapper implements StyledTextContent { return line; } - /** - * @see StyledTextContent#getLineCount() - */ @Override public int getLineCount() { if (lines.size() == 0) @@ -119,17 +104,11 @@ public class StyledLineWrapper implements StyledTextContent { return lines.size(); } - /** - * @see StyledTextContent#getLineDelimiter() - */ @Override public String getLineDelimiter() { return null; } - /** - * @see StyledTextContent#getOffsetAtLine(int) - */ @Override public int getOffsetAtLine(int line) { if (lines.size() == 0) @@ -140,9 +119,6 @@ public class StyledLineWrapper implements StyledTextContent { return offset; } - /** - * @see StyledTextContent#getTextRange(int, int) - */ @Override public String getTextRange(int start, int end) { int l1 = getLineAtOffset(start); @@ -150,7 +126,7 @@ public class StyledLineWrapper implements StyledTextContent { if (l1 == l2) return getLine(l1).substring(start - getOffsetAtLine(l1), end - start); - StringBuffer range = new StringBuffer(getLine(l1).substring( + StringBuilder range = new StringBuilder(getLine(l1).substring( start - getOffsetAtLine(l1))); for (int i = l1 + 1; i < l2; i++) range.append(getLine(i)); @@ -158,25 +134,16 @@ public class StyledLineWrapper implements StyledTextContent { return range.toString(); } - /** - * @see StyledTextContent#removeTextChangeListener(TextChangeListener) - */ @Override public void removeTextChangeListener(TextChangeListener arg0) { // do nothing } - /** - * @see StyledTextContent#replaceTextRange(int, int, String) - */ @Override public void replaceTextRange(int arg0, int arg1, String arg2) { // do nothing } - /** - * @see StyledTextContent#setText(String) - */ @Override public void setText(String text) { if (text == null) diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterPage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterPage.java index cef402645..86eacb9fa 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterPage.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -96,7 +96,7 @@ public class InfoCenterPage extends RootScopePage { } public void store(IPreferenceStore store) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); AdaptableHelpResource[] elements = getElements(); for (int i = 0; i < elements.length; i++) { diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/EscapeUtils.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/EscapeUtils.java index 66e18a753..d5fcbbea7 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/EscapeUtils.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/EscapeUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -54,7 +54,7 @@ public class EscapeUtils { } int next = 0; - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); int index = message.indexOf('&'); while (index >= 0) { result.append(message.substring(next, index + 1)); @@ -70,7 +70,7 @@ public class EscapeUtils { if (value == null) { return null; } - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java index df697e977..8f7ff699e 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -409,7 +409,7 @@ public class ContextHelpPart extends SectionPart implements IHelpPart { } private String buildSearchExpression(String[] searchTerms) { - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); for (int i = 0; i < searchTerms.length; i++) { if (buff.length() > 0) buff.append(" OR "); //$NON-NLS-1$ @@ -558,7 +558,7 @@ public class ContextHelpPart extends SectionPart implements IHelpPart { private String formatHelpContext(IContext context) { String locale = Platform.getNL(); - StringBuffer sbuf = new StringBuffer(); + StringBuilder sbuf = new StringBuilder(); sbuf.append("<form>"); //$NON-NLS-1$ sbuf.append("<p>"); //$NON-NLS-1$ sbuf.append(decodeContextBoldTags(context)); @@ -653,7 +653,7 @@ public class ContextHelpPart extends SectionPart implements IHelpPart { return sbuf.toString(); } - private void addCategory(StringBuffer sbuf, String category) { + private void addCategory(StringBuilder sbuf, String category) { if (category == null) category = Messages.ContextHelpPart_seeAlso; sbuf.append("<p><span color=\""); //$NON-NLS-1$ diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/DynamicHelpPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/DynamicHelpPart.java index eec77dd4e..5de6d501d 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/DynamicHelpPart.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/DynamicHelpPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -263,14 +263,14 @@ public class DynamicHelpPart extends SectionPart implements IHelpPart { BaseHelpSystem.getSearchManager().search(searchQuery, localResults, monitor); SearchHit[] hits = localResults.getSearchHits(); - updateResults(phrase, excludeContext, new StringBuffer(), hits); + updateResults(phrase, excludeContext, new StringBuilder(), hits); } void scheduleSearch(Job job) { if (runningJob != null) { runningJob.cancel(); } - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); buff.append("<form>"); //$NON-NLS-1$ buff.append("<p><span color=\""); //$NON-NLS-1$ buff.append(IFormColors.TITLE); @@ -290,14 +290,15 @@ public class DynamicHelpPart extends SectionPart implements IHelpPart { } private void updateResults(final String phrase, - final IContext excludeContext, final StringBuffer buffer, + final IContext excludeContext, final StringBuilder buffer, final SearchHit[] hits) { if (getSection().isDisposed()) return; getSection().getDisplay().asyncExec(() -> doUpdateResults(phrase, excludeContext, buffer, hits)); } - private void doUpdateResults(String phrase, IContext excludeContext, StringBuffer buff, SearchHit[] hits) { + private void doUpdateResults(String phrase, IContext excludeContext, StringBuilder buff, + SearchHit[] hits) { if (runningJob != null) { runningJob.cancel(); } diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java index 8ef81fa4e..baecadbb7 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -187,7 +187,7 @@ public class EngineResultSection { private void initializeText() { Bundle bundle = Platform.getBundle("org.eclipse.ui.views"); //$NON-NLS-1$ if (bundle != null) { - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); buff.append("<form>"); //$NON-NLS-1$ buff.append("<p><a href=\""); //$NON-NLS-1$ buff.append(HREF_PROGRESS); @@ -248,7 +248,7 @@ public class EngineResultSection { public synchronized void canceling() { if (hits.size() == 0 && !searchResults.isDisposed()) { - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); buff.append("<form>"); //$NON-NLS-1$ buff.append("<p><span color=\"summary\">");//$NON-NLS-1$ buff.append(Messages.EngineResultSection_canceling); @@ -334,7 +334,7 @@ public class EngineResultSection { void updateResults(boolean reflow) { ISearchEngineResult[] results = getResults(); updateSectionTitle(results.length); - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); buff.append("<form>"); //$NON-NLS-1$ IHelpResource oldCat = null; @@ -479,7 +479,7 @@ public class EngineResultSection { return null; } - private void updateErrorStatus(StringBuffer buff) { + private void updateErrorStatus(StringBuilder buff) { int indent = 21; buff.append("<li indent=\"" + indent + "\" style=\"image\" value=\""); //$NON-NLS-1$ //$NON-NLS-2$ buff.append(ISharedImages.IMG_OBJS_ERROR_TSK); diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HistoryScopeSet.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HistoryScopeSet.java index a0f2828c4..176add750 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HistoryScopeSet.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HistoryScopeSet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2016 IBM Corporation and others. + * Copyright (c) 2005, 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 @@ -55,7 +55,7 @@ public class HistoryScopeSet extends ScopeSet { @Override protected String encodeFileName(String name) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java index 856328b3b..eeacde6d0 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -1711,7 +1711,7 @@ public class ReusableHelpPart implements IHelpUIConstants, .getShowAllMessage(); if (message == null) return Messages.AskShowAll_message; - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); int state = STATE_START; for (int i = 0; i < message.length(); i++) { diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java index 8f9021e49..624d25174 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2016 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -33,7 +33,6 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout; public class ScopeSelectPart extends AbstractFormPart implements IHelpPart { - public class ScopeObserver implements Observer { @Override @@ -98,8 +97,8 @@ public class ScopeSelectPart extends AbstractFormPart implements IHelpPart { } private void setScopeLink(String name) { - StringBuffer buff = new StringBuffer(); - StringBuffer nameBuff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); + StringBuilder nameBuff = new StringBuilder(); nameBuff.append("</b> <a href=\"rescope\" "); //$NON-NLS-1$ if (!Platform.getWS().equals(Platform.WS_GTK)) { nameBuff.append(" alt=\""); //$NON-NLS-1$ diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java index 997c3aada..1a4cd2be7 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -63,7 +63,6 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout; public class SearchPart extends AbstractFormPart implements IHelpPart, IHelpUIConstants { - public class SearchScopeObserver implements Observer { @Override @@ -366,7 +365,7 @@ public class SearchPart extends AbstractFormPart implements IHelpPart, IHelpUICo } private void updateSearchWordText() { - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); buff.append("<form>"); //$NON-NLS-1$ buff.append("<p>"); //$NON-NLS-1$ buff.append(Messages.expression_label); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java index fa343e02f..6e574e5a5 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -115,7 +115,7 @@ public class WebappResources { // load bundle if (bundle == null) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); String language = locale.getLanguage(); String contry = locale.getCountry(); String variant = locale.getVariant(); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java index e7c336a27..b6af10e5c 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -8,7 +8,6 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - package org.eclipse.help.internal.webapp.data; import java.util.List; @@ -21,7 +20,6 @@ import org.eclipse.help.internal.util.ProductPreferences; /** * Utility class for parsing the CSS preferences */ - public class CssUtil { private final static String cssLink1 = "<link rel=\"stylesheet\" href=\""; //$NON-NLS-1$ @@ -62,7 +60,7 @@ public class CssUtil { } public static String createCssIncludes(List<String> cssFiles, String backPath) { - StringBuffer script = new StringBuffer(); + StringBuilder script = new StringBuilder(); for (String cssPath : cssFiles) { script.append(cssLink1); script.append(fixCssPath(cssPath, backPath)); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java index b2ae71ff7..d0baf9b24 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java @@ -362,7 +362,7 @@ public class PrintData extends RequestData { * topics we're printing. */ private String normalizeHrefs(String content, String baseHref) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); Matcher matcher = PATTERN_LINK.matcher(content); int prev = 0; while (matcher.find()) { @@ -380,7 +380,7 @@ public class PrintData extends RequestData { */ private String getContent(String href, String locale) { InputStream in = HelpSystem.getHelpContent(href, locale); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); InputStream rawInput=null; if (in != null) { try { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java index 9b7d3c16a..54e038b33 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -637,7 +637,7 @@ public class SearchData extends ActivitiesData { if (altList==null || altList.isEmpty()) return ""; //$NON-NLS-1$ - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append(ServletResources.getString("AlternateSearchQueries", request)); //$NON-NLS-1$ result.append("<ul>"); //$NON-NLS-1$ diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java index b38985b3b..c4b48547f 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -57,7 +57,7 @@ public class UrlUtil { if (str == null) return null; char[] wordChars = new char[str.length()]; str.getChars(0, str.length(), wordChars, 0); - StringBuffer jsEncoded = new StringBuffer(); + StringBuilder jsEncoded = new StringBuilder(); for (char unicode : wordChars) { // to enhance readability, do not encode A-Z,a-z if (('A' <= unicode && unicode <= 'Z') @@ -93,14 +93,14 @@ public class UrlUtil { return null; } - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (int i = 0 ; i < str.length(); i++) { appendEncodedChar(result, str.charAt(i)); } return result.toString(); } - private static void appendEncodedChar(StringBuffer result, char ch) { + private static void appendEncodedChar(StringBuilder result, char ch) { if (needsEncoding(ch)) { int chInt = ch; result.append("&#" + chInt + ';'); //$NON-NLS-1$ @@ -541,7 +541,7 @@ public class UrlUtil { if (parameter == null) { return null; } - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (int i = 0; i < parameter.length(); i++) { char nextChar = parameter.charAt(i); if (Character.isLetterOrDigit(nextChar) || nextChar == '-') { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java index d24570b07..d945ba1de 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -97,7 +97,7 @@ public class AboutParser extends ResultParser { @Override public String toJSON() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(JSonHelper.BEGIN_BRACE); buf.append(JSonHelper.NEWLINE + JSonHelper.SPACE); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java index c1446fa65..7b461468f 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -55,7 +55,7 @@ public class NavParser extends ResultParser { @Override public String toJSON() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(JSonHelper.BEGIN_BRACE); buf.append(JSonHelper.NEWLINE + JSonHelper.SPACE); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java index 909d3839a..3c3b0ffb1 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2016 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -64,7 +64,7 @@ public class ParseElement { public String toJSON(int level) { - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); String space = JSonHelper.SPACE; for (int s = 0; s < level; s++) { @@ -131,7 +131,7 @@ public class ParseElement { public String toJSON() { - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); if (props != null) { Enumeration<?> enumObj = props.keys(); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java index cd3829553..1d77325c8 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2016 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -72,7 +72,7 @@ public class ResultParser extends DefaultHandler { public String toJSON() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(JSonHelper.BEGIN_BRACE); buf.append(JSonHelper.NEWLINE + JSonHelper.SPACE); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java index 1ed3acc9c..e577e6b88 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2016 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -150,7 +150,7 @@ public class NavService extends NavServlet { private String writeContent(ITopic topic, String path, Locale locale, AbstractHelpScope scope) { - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); buff.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$ buff.append("<nav\n title=\""); //$NON-NLS-1$ diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java index 5178463ad..a4565b72a 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 IBM Corporation and others. + * Copyright (c) 2008, 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 @@ -86,7 +86,7 @@ public class AboutServlet extends HttpServlet { req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$ resp.setContentType("text/html; charset=UTF-8"); //$NON-NLS-1$ locale = UrlUtil.getLocaleObj(req, resp); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(XHTML_1); String showParam = req.getParameter("show"); //$NON-NLS-1$ if ("agent".equalsIgnoreCase(showParam)) { //$NON-NLS-1$ @@ -163,7 +163,7 @@ public class AboutServlet extends HttpServlet { } private void getAgent(HttpServletRequest req, HttpServletResponse resp) throws IOException { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(XHTML_1); String title = WebappResources.getString("userAgent", locale); //$NON-NLS-1$ buf.append(UrlUtil.htmlEncode(title)); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java index 09b73530d..cd8ba5ad8 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -37,9 +37,6 @@ public class BreadcrumbsFilter implements IFilter { + "\n<script type=\"text/javascript\" src=\""; //$NON-NLS-1$ private static final String HEAD_CONTENT3 = "/content/" + HelpPlugin.PLUGIN_ID + "/livehelp.js\"> </script>"; //$NON-NLS-1$ //$NON-NLS-2$ - /* (non-Javadoc) - * @see org.eclipse.help.internal.webapp.servlet.IFilter#filter(javax.servlet.http.HttpServletRequest, java.io.OutputStream) - */ @Override public OutputStream filter(HttpServletRequest req, OutputStream out) { String uri = req.getRequestURI(); @@ -96,7 +93,7 @@ public class BreadcrumbsFilter implements IFilter { private String getBackpath(String path) { int num = new Path(path).segmentCount(); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i=0;i<num;++i) { if (i > 0) { buf.append('/'); @@ -107,8 +104,8 @@ public class BreadcrumbsFilter implements IFilter { } private String getBodyContent(int[] path, String backPath, boolean isNarrow, String locale) { - StringBuffer buf = new StringBuffer(); - StringBuffer pathBuf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); + StringBuilder pathBuf = new StringBuilder(); ITopic topic = HelpPlugin.getTocManager().getTocs(locale)[path[0]].getTopic(null); pathBuf.append(path[0]); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java index aa50e958e..995cbca1c 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -48,7 +48,7 @@ public class ChildLinkInserter { if (subtopics.length == 0) { return; } - StringBuffer links = new StringBuffer("\n<ul class=\"childlinks\">\n"); //$NON-NLS-1$ + StringBuilder links = new StringBuilder("\n<ul class=\"childlinks\">\n"); //$NON-NLS-1$ for (int i=0;i<subtopics.length;++i) { if (ScopeUtils.showInTree(subtopics[i], scope)) { links.append("\n<li><a href=\""); //$NON-NLS-1$ @@ -104,7 +104,7 @@ public class ChildLinkInserter { private String getBackpath(String path) { int num = new Path(path).segmentCount() - 1; - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i=0; i < num; ++i) { if (i > 0) { buf.append('/'); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java index 12533ed24..c0aec25ee 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -74,7 +74,7 @@ public class ContextServlet extends HttpServlet { } private String serialize(IContext context) throws IOException { - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); buff.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$ buff.append('<' + Context.NAME ); if (context instanceof IContext2) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java index 53da50e11..6e8268a1d 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -222,7 +222,7 @@ public class CookieUtil { if (len <= 0) { return null; } - StringBuffer data = new StringBuffer(len); + StringBuilder data = new StringBuilder(len); data.append(lengthAndSubstring1[1]); int n = len / MAX_COOKIE_PAYLOAD; for (int i = 2; i <= n; i++) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java index cf59bb0b5..c2624e5f5 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -88,7 +88,7 @@ public class EclipseConnector { // Redirect if the request includes PLUGINS_ROOT and is not a content request int index = url.lastIndexOf(HelpURLConnection.PLUGINS_ROOT); if (index!= -1 && url.indexOf("content/" + HelpURLConnection.PLUGINS_ROOT) == -1) { //$NON-NLS-1$ - StringBuffer redirectURL = new StringBuffer(); + StringBuilder redirectURL = new StringBuilder(); redirectURL.append(req.getContextPath()); redirectURL.append(req.getServletPath()); @@ -167,7 +167,7 @@ public class EclipseConnector { t = t.getCause(); } - StringBuffer message = new StringBuffer(); + StringBuilder message = new StringBuilder(); message.append(errorPageBegin); message.append("<p>"); //$NON-NLS-1$ message.append(ServletResources.getString( diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java index a2134cc6a..c27fa6441 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -68,7 +68,7 @@ public class ExtensionServlet extends HttpServlet { } private String serialize(ContentExtension[] extensions) throws TransformerException { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$ buf.append("<contentExtensions>\n"); //$NON-NLS-1$ for (ContentExtension extension : extensions) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterUtils.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterUtils.java index 1f360e173..b0a4c770e 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterUtils.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -17,7 +17,7 @@ public class FilterUtils { public static String getRelativePathPrefix(HttpServletRequest req) { // append "../" to get to the webapp - StringBuffer result = new StringBuffer(""); //$NON-NLS-1$ + StringBuilder result = new StringBuilder(""); //$NON-NLS-1$ String path = req.getPathInfo(); if (path != null) { for (int i; 0 <= (i = path.indexOf('/')); path = path diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java index 7495b659b..85032770e 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -63,7 +63,7 @@ public class FramesetFilter implements IFilter { if (path == null) { return out; } - StringBuffer script = new StringBuffer(scriptPart1); + StringBuilder script = new StringBuilder(scriptPart1); for (int i; 0 <= (i = path.indexOf('/')); path = path.substring(i + 1)) { script.append("../"); //$NON-NLS-1$ } diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java index 46b54d684..a36fb6309 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -8,7 +8,6 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - package org.eclipse.help.internal.webapp.servlet; import java.io.*; @@ -33,9 +32,6 @@ public class HighlightFilter implements IFilter { private static final String sheetRefPart1 = "<link id=\"highlightStyle\" rel=\"STYLESHEET\" href=\""; //$NON-NLS-1$ private static final String sheetRefPart3 = "advanced/highlight.css\" charset=\"ISO-8859-1\" type=\"text/css\"></link>\n"; //$NON-NLS-1$ - /* - * @see IFilter#filter(HttpServletRequest, OutputStream) - */ @Override public OutputStream filter(HttpServletRequest req, OutputStream out) { String uri = req.getRequestURI(); @@ -67,8 +63,8 @@ public class HighlightFilter implements IFilter { * @return byte[] */ private byte[] createJScript(HttpServletRequest req, Collection<String> keywords) { - StringBuffer buf = new StringBuffer(scriptPart1); - StringBuffer buf2 = new StringBuffer(sheetRefPart1); + StringBuilder buf = new StringBuilder(scriptPart1); + StringBuilder buf2 = new StringBuilder(sheetRefPart1); // append comma separated list of keywords Iterator<String> it = keywords.iterator(); if (!it.hasNext()) diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java index 1aac6c890..ec2741da2 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -129,7 +129,7 @@ public class IndexFragmentServlet extends HttpServlet { private class Serializer { private IIndex index; - private StringBuffer buf; + private StringBuilder buf; private int count = 0; private String locale; private List<Integer> entryList; @@ -142,7 +142,7 @@ public class IndexFragmentServlet extends HttpServlet { this.locale = locale; this.scope = scope; index = HelpPlugin.getIndexManager().getIndex(locale); - buf = new StringBuffer(); + buf = new StringBuilder(); } /* diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java index 154d040b5..1cde29a40 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -75,7 +75,7 @@ public class IndexServlet extends HttpServlet { } public String serialize(IIndexContribution[] contributions, String locale) throws TransformerException { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$ buf.append("<indexContributions>\n"); //$NON-NLS-1$ if (writer == null) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java index 577ba5071..9fdc777ca 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -252,7 +252,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager { private void saveContents() throws IOException { - StringBuffer data = new StringBuffer(); + StringBuilder data = new StringBuilder(); data.append(URLCoder.compactEncode(currentWorkingSet /* , "UTF8" */ )); @@ -301,7 +301,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager { private void saveCriteria() throws IOException { - StringBuffer data = new StringBuffer(); + StringBuilder data = new StringBuilder(); data.append(URLCoder.compactEncode(currentWorkingSet)); //|scope1$platform#AIX,WINDOWS,$version#1.0,2.0, for (WorkingSet ws : workingSets) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java index 0ee8fe3ac..fc912f8d6 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -99,8 +99,8 @@ public class InjectionFilter implements IFilter { IPath path = new Path(pathInfo); int upLevels = path.segmentCount() - 1; String relativePath = FilterUtils.getRelativePathPrefix(req); - StringBuffer script = new StringBuffer(); - StringBuffer disabledContent = new StringBuffer(); + StringBuilder script = new StringBuilder(); + StringBuilder disabledContent = new StringBuilder(); script.append(CssUtil.createCssIncludes(cssIncludes, FilterUtils.getRelativePathPrefix(req))); if (addDisabled) { if (needsLiveHelp) { @@ -116,7 +116,7 @@ public class InjectionFilter implements IFilter { } - private void appendDisabled(StringBuffer buff, int nsteps, boolean narrow, String relativePath) { + private void appendDisabled(StringBuilder buff, int nsteps, boolean narrow, String relativePath) { String message = HelpBasePlugin.getActivitySupport().getDocumentMessage(narrow); if (message==null) return; diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java index 7a3fb3cc5..7e3e01d8f 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -8,7 +8,6 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - package org.eclipse.help.internal.webapp.servlet; import java.io.ByteArrayInputStream; @@ -44,7 +43,7 @@ public class PluginsRootResolvingStream extends OutputStream { private final String[] keywords = { INSERT_CHILD_LINKS, INSERT_CHILD_LINK_STYLE }; private boolean[] possibleKeywordMatches; private String pathPrefix; - private StringBuffer tag; + private StringBuilder tag; private ByteArrayOutputStream metaTagBuffer; private boolean tagRead; private HttpServletRequest req; @@ -63,7 +62,7 @@ public class PluginsRootResolvingStream extends OutputStream { if (b == '<') { state = IN_TAG; charsMatched = 0; - tag = new StringBuffer(); + tag = new StringBuilder(); tagRead = false; } else { out.write(b); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java index b8ef6324b..66d91a775 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -15,11 +15,11 @@ import java.io.PrintWriter; public class ServletPrintWriter extends PrintWriter{ - private StringBuffer buffer; + private StringBuilder buffer; public ServletPrintWriter() { super(new ByteArrayOutputStream()); - buffer = new StringBuffer(); + buffer = new StringBuilder(); } /** diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java index 0a12b54c8..2cff6db8b 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -26,9 +26,6 @@ public class ShowInTocFilter implements IFilter { private static final String scriptPart1 = "\n<script type=\"text/javascript\" src=\""; //$NON-NLS-1$ private static final String scriptPart3 = "advanced/synchWithToc.js\"></script>"; //$NON-NLS-1$ - /* - * @see IFilter#filter(HttpServletRequest, OutputStream) - */ @Override public OutputStream filter(HttpServletRequest req, OutputStream out) { String uri = req.getRequestURI(); @@ -53,7 +50,7 @@ public class ShowInTocFilter implements IFilter { if (path == null) { return out; } - StringBuffer script = new StringBuffer(scriptPart1); + StringBuilder script = new StringBuilder(scriptPart1); String relativePath = FilterUtils.getRelativePathPrefix(req); script.append(relativePath); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java index 66f918abf..511cbe611 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2016 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -82,7 +82,7 @@ public class TocFragmentServlet extends HttpServlet { private class Serializer { private TocData tocData; - private StringBuffer buf; + private StringBuilder buf; private int requestKind; private Locale locale; private AbstractHelpScope scope; @@ -93,7 +93,7 @@ public class TocFragmentServlet extends HttpServlet { public Serializer(TocData data, Locale locale, AbstractHelpScope scope) { tocData = data; - buf = new StringBuffer(); + buf = new StringBuilder(); this.locale = locale; this.scope = scope; if (tocData.isExpandPath()) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java index f85722f67..5741bdbc0 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -81,7 +81,7 @@ public class TocServlet extends HttpServlet { } protected String serialize(TocContribution[] contributions, String locale) throws TransformerException { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$ buf.append("<tocContributions>\n"); //$NON-NLS-1$ if (writer == null) { diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java index 451195e52..68551af33 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2016 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -171,7 +171,7 @@ public class ValidatorServlet extends HttpServlet { public String replaceAll(String str, char remove, String add) { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); for (int s=0; s < str.length(); s++) { char ch = str.charAt(s); diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java index 89680aa57..5fbca1026 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -27,7 +27,7 @@ public class SearchXMLGenerator { } public static String serialize(SearchHit[] hits, boolean boolIsCategory) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$ buf.append("<searchHits>\n"); //$NON-NLS-1$ @@ -42,7 +42,7 @@ public class SearchXMLGenerator { return buf.toString(); } - private static void serialize(SearchHit hit, StringBuffer buf, + private static void serialize(SearchHit hit, StringBuilder buf, String indent, boolean boolIsCategory) { buf.append(indent + "<hit"); //$NON-NLS-1$ if (hit.getHref() != null) { @@ -73,14 +73,14 @@ public class SearchXMLGenerator { buf.append(indent + "</hit>\n"); //$NON-NLS-1$ } - private static void serialize(String summary, StringBuffer buf, String indent) { + private static void serialize(String summary, StringBuilder buf, String indent) { buf.append(indent + "<summary>"); //$NON-NLS-1$ buf.append(XMLGenerator.xmlEscape(summary)); buf.append("</summary>\n"); //$NON-NLS-1$ } private static void serializeCategory(IHelpResource categoryResource, - StringBuffer buf, String indent) { + StringBuilder buf, String indent) { String category = categoryResource.getLabel(); if (category == null) return; diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/Utils.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/Utils.java index 2a1eee0ef..267f2a04a 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/Utils.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/Utils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2016 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -87,7 +87,7 @@ public class Utils { } private static String removeString(String response, String remove) { - StringBuffer buff = new StringBuffer(response); + StringBuilder buff = new StringBuilder(response); int index = buff.indexOf(remove); if (index > -1) { int start = buff.lastIndexOf("<script", index); //$NON-NLS-1$ |