Skip to content

Commit

Permalink
Merge branch 'master' into feature/#220-do-not-use-Arrays.copyOf
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder authored Nov 27, 2024
2 parents deb2507 + e8d8f36 commit 556455e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/ctc/wstx/dtd/DTDId.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public int hashCode() {

@Override
public String toString() {
StringBuffer sb = new StringBuffer(60);
StringBuilder sb = new StringBuilder(60);
sb.append("Public-id: ");
sb.append(mPublicId);
sb.append(", system-id: ");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/ctc/wstx/evt/WstxEventReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public String getElementText() throws XMLStreamException
// ??? do we need to update mPrePeekEvent now

String str = null;
StringBuffer sb = null;
StringBuilder sb = null;

// Ok, fine, then just need to loop through and get all the text...
for (; true; evt = nextEvent()) {
Expand All @@ -240,7 +240,7 @@ public String getElementText() throws XMLStreamException
str = curr;
} else {
if (sb == null) {
sb = new StringBuffer(str.length() + curr.length());
sb = new StringBuilder(str.length() + curr.length());
sb.append(str);
}
sb.append(curr);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/ctc/wstx/sr/StreamScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -1120,9 +1120,9 @@ protected void throwNullParent(WstxInputSource curr)
* <ol>
* <li>Entity in question is a simple character entity (either one of
* 5 pre-defined ones, or using decimal/hex notation), AND
* <li>
* </li>
* <li>Entity fits completely inside current input buffer.
* <li>
* </li>
* </ol>
* If so, character value of entity is returned. Character 0 is returned
* otherwise; if so, caller needs to do full resolution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void doTest(boolean ns, boolean coalescing, boolean autoEntity)
// Sanity check #2: and string buf should have it too
assertEquals
("Expected segment #"+segOffset+" (one-based; read with "+readCount+" reads) to get "
+expLen+" chars; StringBuffer only has "+sb.length(),
+expLen+" chars; StringBuilder only has "+sb.length(),
expLen, sb.length());

totalBuf.append(sb);
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/stax2/BaseStax2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import org.codehaus.stax2.evt.*;

import org.codehaus.stax2.ri.Stax2ReaderAdapter;
import org.codehaus.stax2.validation.ValidationProblemHandler;
import org.codehaus.stax2.validation.XMLValidationException;
import org.codehaus.stax2.validation.XMLValidationProblem;
import org.codehaus.stax2.validation.XMLValidationSchema;

Expand Down
5 changes: 2 additions & 3 deletions src/test/java/wstxtest/io/TestUTF8Reader.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package wstxtest.io;

import java.io.*;
import java.util.Arrays;

import junit.framework.TestCase;

Expand All @@ -26,9 +27,7 @@ public void testDelAtBufferBoundary() throws IOException

// Create input that will cause the array index out of bounds exception
byte[] inputBytes = new byte[INPUT_SIZE];
for (int i=0; i < inputBytes.length; i++) {
inputBytes[i] = CHAR_FILLER;
}
Arrays.fill(inputBytes, CHAR_FILLER);
inputBytes[BYTE_BUFFER_SIZE - 1] = CHAR_DEL;
InputStream in = new ByteArrayInputStream(inputBytes);

Expand Down

0 comments on commit 556455e

Please sign in to comment.