Skip to content

Commit

Permalink
Honor Systems generated updates
Browse files Browse the repository at this point in the history
x-stream#298
Automatic updates
https://jenkins.updater.j2eeguys.com/
xstream/src/java/com/thoughtworks/xstream/core/util/FastStack.java
    Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder". [java:S1149]
xstream/src/java/com/thoughtworks/xstream/io/path/PathTracker.java
    Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder". [java:S1149]
xstream/src/java/com/thoughtworks/xstream/io/xml/AbstractPullReader.java
    Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder". [java:S1149]
xstream/src/java/com/thoughtworks/xstream/io/xml/XomReader.java
    Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder". [java:S1149]
xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/reporters/HtmlReporter.java
    Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder". [java:S1149]
xstream/src/java/com/thoughtworks/xstream/io/xml/XmlFriendlyNameCoder.java
    Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder". [java:S1149]
xstream/src/java/com/thoughtworks/xstream/core/util/XmlHeaderAwareReader.java
    Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder". [java:S1149]
xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/reporters/TextReporter.java
    Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder". [java:S1149]
xstream/src/java/com/thoughtworks/xstream/io/xml/DomDriver.java
    Disable access to external entities in XML parsing. [java:S2755]

Also-by: Stephen Davidson <[email protected]>
Signed-off-by: Honor Systems Updater Jenkins <[email protected]>
  • Loading branch information
hsujenkins committed Jul 6, 2022
1 parent bbf4e3d commit cdf0510
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2006 Joe Walnes.
* Copyright (C) 2006, 2022 Joe Walnes.
* Copyright (C) 2006, 2007, 2015 XStream Committers.
* All rights reserved.
*
Expand Down Expand Up @@ -57,7 +57,7 @@ public void startBenchmark() {
}

private String css() {
StringBuffer css = new StringBuffer("\n");
StringBuilder css = new StringBuilder("\n");
css.append("body, h1, h2, h3, td { font-family: arial; }\n");
css.append("h1 { text-align: center; }\n");
css.append("table, h3 { margin-left: 40px; }\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2006 Joe Walnes.
* Copyright (C) 2006, 2022 Joe Walnes.
* Copyright (C) 2006, 2007, 2015 XStream Committers.
* All rights reserved.
*
Expand Down Expand Up @@ -83,7 +83,7 @@ public void endBenchmark() {
}

private String pad(String value) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append(value);
while (result.length() < 50) {
result.append('.');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004, 2005 Joe Walnes.
* Copyright (C) 2004, 2005, 2022 Joe Walnes.
* Copyright (C) 2006, 2007, 2009, 2014, 2018 XStream Committers.
* All rights reserved.
*
Expand Down Expand Up @@ -87,7 +87,7 @@ private void resizeStack(final int newCapacity) {

@Override
public String toString() {
final StringBuffer result = new StringBuffer("[");
final StringBuilder result = new StringBuilder("[");
for (int i = 0; i < pointer; i++) {
if (i > 0) {
result.append(", ");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2007, 2008, 2010, 2014, 2015, 2020 XStream Committers.
* Copyright (C) 2007, 2008, 2010, 2014, 2015, 2020, 2022 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
Expand Down Expand Up @@ -74,8 +74,8 @@ private Map<String, String> getHeader(final PushbackInputStream[] in) throws IOE
int i = 0;
char ch = 0;
char valueEnd = 0;
final StringBuffer name = new StringBuffer();
final StringBuffer value = new StringBuffer();
final StringBuilder name = new StringBuilder();
final StringBuilder value = new StringBuilder();
boolean escape = false;
while (i != -1 && (i = in[0].read()) != -1) {
out.write(i);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004, 2005, 2006 Joe Walnes.
* Copyright (C) 2004, 2005, 2006, 2022 Joe Walnes.
* Copyright (C) 2006, 2007, 2009, 2011, 2014, 2015, 2020 XStream Committers.
* All rights reserved.
*
Expand Down Expand Up @@ -130,7 +130,7 @@ public String peekElement(final int i) {
final Integer integer = indexMapStack[idx].get(pathStack[idx]);
final int index = integer.intValue();
if (index > 1) {
final StringBuffer chunk = new StringBuffer(pathStack[idx].length() + 6);
final StringBuilder chunk = new StringBuilder(pathStack[idx].length() + 6);
chunk.append(pathStack[idx]).append('[').append(index).append(']');
name = chunk.toString();
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005, 2006 Joe Walnes.
* Copyright (C) 2005, 2006, 2022 Joe Walnes.
* Copyright (C) 2006, 2007, 2009, 2010, 2011, 2014, 2015, 2016 XStream Committers.
* All rights reserved.
*
Expand Down Expand Up @@ -183,7 +183,7 @@ public String getValue() {
// lets only use a string buffer when we get 2 strings
// to avoid copying strings
String last = null;
StringBuffer buffer = null;
StringBuilder buffer = null;

mark();
Event event = readEvent();
Expand All @@ -195,7 +195,7 @@ public String getValue() {
last = text;
} else {
if (buffer == null) {
buffer = new StringBuffer(last);
buffer = new StringBuilder(last);
}
buffer.append(text);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004, 2005, 2006 Joe Walnes.
* Copyright (C) 2004, 2005, 2006, 2022 Joe Walnes.
* Copyright (C) 2006, 2007, 2008, 2009, 2011, 2014, 2015, 2020 XStream Committers.
* All rights reserved.
*
Expand All @@ -20,6 +20,7 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.net.URL;
import javax.xml.XMLConstants;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
Expand Down Expand Up @@ -102,6 +103,9 @@ private HierarchicalStreamReader createReader(final InputSource source) {
}
}
}
//https://rules.sonarsource.com/java/RSPEC-2755
documentBuilderFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
documentBuilderFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
if (encoding != null) {
source.setEncoding(encoding);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2006 Joe Walnes.
* Copyright (C) 2006, 2022 Joe Walnes.
* Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013, 2014, 2015, 2019, 2020, 2021 XStream Committers.
* All rights reserved.
*
Expand Down Expand Up @@ -497,7 +497,7 @@ private String encodeName(final String name) {
}

// Otherwise full processing
final StringBuffer result = new StringBuffer(length + 8);
final StringBuilder result = new StringBuilder(length + 8);

// We know first N chars are safe
if (i > 0) {
Expand Down Expand Up @@ -555,7 +555,7 @@ private String decodeName(final String name) {
}

// Otherwise full processing
final StringBuffer result = new StringBuffer(length + 8);
final StringBuilder result = new StringBuilder(length + 8);

// We know first N chars are safe
if (i > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004, 2005, 2006 Joe Walnes.
* Copyright (C) 2004, 2005, 2006, 2022 Joe Walnes.
* Copyright (C) 2006, 2007, 2009, 2011, 2014 XStream Committers.
* All rights reserved.
*
Expand Down Expand Up @@ -72,7 +72,7 @@ public String getNodeName() {
@Override
public String getValue() {
// currentElement.getValue() not used as this includes text of child elements, which we don't want.
final StringBuffer result = new StringBuffer();
final StringBuilder result = new StringBuilder();
final int childCount = currentElement.getChildCount();
for (int i = 0; i < childCount; i++) {
final Node child = currentElement.getChild(i);
Expand Down

0 comments on commit cdf0510

Please sign in to comment.