Skip to content

Commit 37d229b

Browse files
committed
Merge pull request #10805 from izeye:unused-20171029
* pr/10805: Remove unnecessary assignments
2 parents 0317427 + 4979af9 commit 37d229b

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private JSONObject readJson(InputStream in, Charset charset) throws Exception {
209209
StringBuilder out = new StringBuilder();
210210
InputStreamReader reader = new InputStreamReader(in, charset);
211211
char[] buffer = new char[BUFFER_SIZE];
212-
int bytesRead = -1;
212+
int bytesRead;
213213
while ((bytesRead = reader.read(buffer)) != -1) {
214214
out.append(buffer, 0, bytesRead);
215215
}

spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private String loadContent(InputStream inputStream) throws IOException {
7878
private void copy(InputStream inputStream, OutputStream outputStream)
7979
throws IOException {
8080
byte[] buffer = new byte[BUFFER_SIZE];
81-
int bytesRead = -1;
81+
int bytesRead;
8282
while ((bytesRead = inputStream.read(buffer)) != -1) {
8383
outputStream.write(buffer, 0, bytesRead);
8484
}

spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ private static class InputStreamEntryWriter implements EntryWriter {
300300
@Override
301301
public void write(OutputStream outputStream) throws IOException {
302302
byte[] buffer = new byte[BUFFER_SIZE];
303-
int bytesRead = -1;
303+
int bytesRead;
304304
while ((bytesRead = this.inputStream.read(buffer)) != -1) {
305305
outputStream.write(buffer, 0, bytesRead);
306306
}
@@ -387,7 +387,7 @@ private static class CrcAndSize {
387387

388388
private void load(InputStream inputStream) throws IOException {
389389
byte[] buffer = new byte[BUFFER_SIZE];
390-
int bytesRead = -1;
390+
int bytesRead;
391391
while ((bytesRead = inputStream.read(buffer)) != -1) {
392392
this.crc.update(buffer, 0, bytesRead);
393393
this.size += bytesRead;

spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private void copyToFile(InputStream inputStream, File file)
107107
}
108108

109109
private void copy(InputStream in, OutputStream out) throws IOException {
110-
int bytesRead = -1;
110+
int bytesRead;
111111
while ((bytesRead = in.read(this.buffer)) != -1) {
112112
out.write(this.buffer, 0, bytesRead);
113113
}

spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private void unpack(JarEntry entry, File file) throws IOException {
150150
OutputStream outputStream = new FileOutputStream(file);
151151
try {
152152
byte[] buffer = new byte[BUFFER_SIZE];
153-
int bytesRead = -1;
153+
int bytesRead;
154154
while ((bytesRead = inputStream.read(buffer)) != -1) {
155155
outputStream.write(buffer, 0, bytesRead);
156156
}

0 commit comments

Comments
 (0)