@@ -80,7 +80,7 @@ public long read(ByteBuffer buffer) throws IOException {
80
80
int maxLength = buffer .capacity ();
81
81
82
82
if (startPart == parts .size () && endWritten ) {
83
- return overallLength ;
83
+ return - 1 ;
84
84
}
85
85
86
86
boolean full = false ;
@@ -437,9 +437,9 @@ private ByteArrayOutputStream generateFileStart(FilePart filePart)
437
437
private long handleFilePart (WritableByteChannel target , FilePart filePart ) throws IOException {
438
438
FilePartStallHandler handler = new FilePartStallHandler (
439
439
filePart .getStalledTime (), filePart );
440
-
440
+
441
441
handler .start ();
442
-
442
+
443
443
if (FilePartSource .class .isAssignableFrom (filePart .getSource ().getClass ())) {
444
444
int length = 0 ;
445
445
@@ -464,7 +464,7 @@ private long handleFilePart(WritableByteChannel target, FilePart filePart) throw
464
464
}
465
465
try {
466
466
nWrite = fc .transferTo (fileLength , l , target );
467
-
467
+
468
468
if (nWrite == 0 ) {
469
469
logger .info ("Waiting for writing..." );
470
470
try {
@@ -496,7 +496,7 @@ private long handleFilePart(WritableByteChannel target, FilePart filePart) throw
496
496
}
497
497
}
498
498
handler .completed ();
499
-
499
+
500
500
fc .close ();
501
501
502
502
length += handleFileEnd (target , filePart );
@@ -556,7 +556,7 @@ private long handleMultiPart(WritableByteChannel target, Part currentPart) throw
556
556
return handleStringPart (target , (StringPart ) currentPart );
557
557
} else if (currentPart .getClass ().equals (FilePart .class )) {
558
558
FilePart filePart = (FilePart ) currentPart ;
559
-
559
+
560
560
return handleFilePart (target , filePart );
561
561
}
562
562
return 0 ;
0 commit comments