Skip to content

Commit

Permalink
Fixing squid: S1854 Dead stores should be removed part 8
Browse files Browse the repository at this point in the history
devFozgul committed Jun 14, 2016

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
1 parent 34bcd1c commit 66451b1
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -431,7 +431,7 @@ public static String decodeString(byte[] bytes) {
*/
private static CharBuffer decodeString(byte[] bytes, Charset charset, int referenceLength) {
try {
Charset autodetectedCharset = charset;
Charset autodetectedCharset;
final CharsetDecoder decoder = charset.newDecoder();
final CharBuffer buffer = decoder.decode(ByteBuffer.wrap(bytes));
if ((decoder.isAutoDetecting())
@@ -496,11 +496,10 @@ public static String decodeString(InputStream stream) throws IOException {
final byte[] buffer = new byte[BUFFER_SIZE];
int read;
while ((read = stream.read(buffer)) > 0) {
byte[] tmp = new byte[completeBuffer.length + read];
final byte[] tmp = new byte[completeBuffer.length + read];
System.arraycopy(completeBuffer, 0, tmp, 0, completeBuffer.length);
System.arraycopy(buffer, 0, tmp, completeBuffer.length, read);
completeBuffer = tmp;
tmp = null;
}
return decodeString(completeBuffer);
}
@@ -534,11 +533,10 @@ public static boolean decodeString(InputStream stream, List<String> lineArray) t
int read;

while ((read = stream.read(buffer)) > 0) {
byte[] tmp = new byte[completeBuffer.length + read];
final byte[] tmp = new byte[completeBuffer.length + read];
System.arraycopy(completeBuffer, 0, tmp, 0, completeBuffer.length);
System.arraycopy(buffer, 0, tmp, completeBuffer.length, read);
completeBuffer = tmp;
tmp = null;
}

// Get the two default charsets
@@ -563,13 +561,11 @@ public static boolean decodeString(InputStream stream, List<String> lineArray) t
if (!ok) {
for (final Entry<String, Charset> charset : Charset.availableCharsets().entrySet()) {
if (decodeString(new ByteArrayInputStream(completeBuffer), lineArray, charset.getValue())) {
completeBuffer = null;
return true;
}
}
}

completeBuffer = null;
return ok;
}

0 comments on commit 66451b1

Please sign in to comment.