Skip to content

Commit

Permalink
Issue checkstyle#5506: disallowed StringBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
rnveach authored and Vantuz committed Apr 3, 2019
1 parent fb2a5ad commit f2c6cb1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions config/checkstyle_checks.xml
Expand Up @@ -283,7 +283,8 @@
org.apache.commons.beanutils.ConversionException,
org.antlr.v4.runtime.misc.ParseCancellationException,
antlr.RecognitionException, antlr.TokenStreamException,
antlr.TokenStreamRecognitionException, antlr.ANTLRException"/>
antlr.TokenStreamRecognitionException, antlr.ANTLRException,
java.lang.StringBuffer"/>
</module>
<module name="IllegalThrows"/>
<module name="IllegalToken">
Expand All @@ -297,7 +298,13 @@
<property name="format" value="^(US-ASCII|ISO-8859-1|UTF-8|UTF-16BE|UTF-16LE|UTF-16)$"/>
<property name="ignoreCase" value="true"/>
</module>
<module name="IllegalType"/>
<module name="IllegalType">
<property name="illegalClassNames"
value="java.util.HashSet, HashSet, java.util.LinkedHashMap, LinkedHashMap,
java.util.TreeMap, TreeMap, java.util.HashMap, HashMap,
java.util.LinkedHashSet, LinkedHashSet, java.util.TreeSet, TreeSet,
java.lang.StringBuffer, StringBuffer"/>
</module>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MissingCtor">
Expand Down
Expand Up @@ -272,7 +272,7 @@ private static String createPropertiesText() {
}

private static String getNodeText(Node node, boolean fixLinks) {
final StringBuffer result = new StringBuffer(20);
final StringBuilder result = new StringBuilder(20);

for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
if (child.getNodeType() == Node.TEXT_NODE) {
Expand All @@ -297,7 +297,7 @@ private static String getNodeText(Node node, boolean fixLinks) {
}

// -@cs[CyclomaticComplexity] No simple way to split this apart.
private static void appendNodeText(StringBuffer result, Node node, boolean fixLinks) {
private static void appendNodeText(StringBuilder result, Node node, boolean fixLinks) {
final String name = transformXmlToJavaDocName(node.getNodeName());
final boolean list = "ol".equals(name) || "ul".equals(name);
final boolean newLineOpenBefore = list || "p".equals(name) || "pre".equals(name)
Expand Down Expand Up @@ -351,7 +351,7 @@ else if (shouldAppendSpace(result, '<')) {
}
}

private static boolean shouldAppendSpace(StringBuffer text, char firstCharToAppend) {
private static boolean shouldAppendSpace(StringBuilder text, char firstCharToAppend) {
final boolean result;

if (text.length() == 0) {
Expand Down

0 comments on commit f2c6cb1

Please sign in to comment.