Browse Source

Merge branch '5.3.x'

pull/29045/head
Arjen Poutsma 2 years ago
parent
commit
b5b51e73fc
  1. 22
      spring-web/src/main/java/org/springframework/http/codec/multipart/PartGenerator.java

22
spring-web/src/main/java/org/springframework/http/codec/multipart/PartGenerator.java

@ -688,6 +688,16 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> { @@ -688,6 +688,16 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> {
@Override
public void onComplete() {
this.completed = true;
public void partComplete(boolean finalPart) {
State state = PartGenerator.this.state.get();
// writeComplete might have changed our state to IdleFileState
if (state != this) {
state.partComplete(finalPart);
}
else {
this.completed = true;
this.finalPart = finalPart;
}
}
public void writeBuffer(DataBuffer dataBuffer) {
@ -711,14 +721,16 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> { @@ -711,14 +721,16 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> {
private void writeComplete() {
IdleFileState newState = new IdleFileState(this);
if (this.completed) {
newState.onComplete();
}
else if (this.disposed) {
if (this.disposed) {
newState.dispose();
}
else if (changeState(this, newState)) {
requestToken();
if (this.completed) {
newState.partComplete(this.finalPart);
}
else {
requestToken();
}
}
else {
MultipartUtils.closeChannel(this.channel);

Loading…
Cancel
Save