Remove unnecessary assignments

Closes gh-10805
pull/8516/merge
Johnny Lim 7 years ago committed by Stephane Nicoll
parent 03174277b4
commit 4979af9fa5

@ -209,7 +209,7 @@ class JsonReader {
StringBuilder out = new StringBuilder(); StringBuilder out = new StringBuilder();
InputStreamReader reader = new InputStreamReader(in, charset); InputStreamReader reader = new InputStreamReader(in, charset);
char[] buffer = new char[BUFFER_SIZE]; char[] buffer = new char[BUFFER_SIZE];
int bytesRead = -1; int bytesRead;
while ((bytesRead = reader.read(buffer)) != -1) { while ((bytesRead = reader.read(buffer)) != -1) {
out.append(buffer, 0, bytesRead); out.append(buffer, 0, bytesRead);
} }

@ -78,7 +78,7 @@ public class DefaultLaunchScript implements LaunchScript {
private void copy(InputStream inputStream, OutputStream outputStream) private void copy(InputStream inputStream, OutputStream outputStream)
throws IOException { throws IOException {
byte[] buffer = new byte[BUFFER_SIZE]; byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead = -1; int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) { while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead); outputStream.write(buffer, 0, bytesRead);
} }

@ -300,7 +300,7 @@ public class JarWriter implements LoaderClassesWriter {
@Override @Override
public void write(OutputStream outputStream) throws IOException { public void write(OutputStream outputStream) throws IOException {
byte[] buffer = new byte[BUFFER_SIZE]; byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead = -1; int bytesRead;
while ((bytesRead = this.inputStream.read(buffer)) != -1) { while ((bytesRead = this.inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead); outputStream.write(buffer, 0, bytesRead);
} }
@ -387,7 +387,7 @@ public class JarWriter implements LoaderClassesWriter {
private void load(InputStream inputStream) throws IOException { private void load(InputStream inputStream) throws IOException {
byte[] buffer = new byte[BUFFER_SIZE]; byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead = -1; int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) { while ((bytesRead = inputStream.read(buffer)) != -1) {
this.crc.update(buffer, 0, bytesRead); this.crc.update(buffer, 0, bytesRead);
this.size += bytesRead; this.size += bytesRead;

@ -107,7 +107,7 @@ public class TestJarFile {
} }
private void copy(InputStream in, OutputStream out) throws IOException { private void copy(InputStream in, OutputStream out) throws IOException {
int bytesRead = -1; int bytesRead;
while ((bytesRead = in.read(this.buffer)) != -1) { while ((bytesRead = in.read(this.buffer)) != -1) {
out.write(this.buffer, 0, bytesRead); out.write(this.buffer, 0, bytesRead);
} }

@ -150,7 +150,7 @@ public class JarFileArchive implements Archive {
OutputStream outputStream = new FileOutputStream(file); OutputStream outputStream = new FileOutputStream(file);
try { try {
byte[] buffer = new byte[BUFFER_SIZE]; byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead = -1; int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) { while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead); outputStream.write(buffer, 0, bytesRead);
} }

Loading…
Cancel
Save