Skip to content

Commit 30fad1a

Browse files
committed
SwapStream - use final field for file
1 parent 1753896 commit 30fad1a

File tree

1 file changed

+1
-3
lines changed
  • avaje-jex-file-upload/src/main/java/io/avaje/jex/file/upload

1 file changed

+1
-3
lines changed

avaje-jex-file-upload/src/main/java/io/avaje/jex/file/upload/SwapStream.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class SwapStream extends FilterOutputStream {
1616
private final long maxFileSize;
1717
private boolean swapped = false;
1818
private long size = 0;
19-
private File file;
19+
private final File file;
2020

2121
public SwapStream(ByteArrayOutputStream baos, File file, MultipartConfig multipartConfig) {
2222
super(baos);
@@ -28,7 +28,6 @@ public SwapStream(ByteArrayOutputStream baos, File file, MultipartConfig multipa
2828

2929
@Override
3030
public void write(int b) throws IOException {
31-
3231
size += 1;
3332
if (!swapped && maxMemory > -1 && size > maxMemory) {
3433
swapToFileStream();
@@ -40,7 +39,6 @@ public void write(int b) throws IOException {
4039

4140
@Override
4241
public void write(byte[] b, int off, int len) throws IOException {
43-
4442
size += len;
4543
if (!swapped && maxMemory > -1 && size > maxMemory) {
4644
swapToFileStream();

0 commit comments

Comments
 (0)