Browse Source

Ensure NPE will not be thrown when cancelling a subscription

Issue: SPR-15393
pull/1369/merge
Violeta Georgieva 8 years ago committed by Arjen Poutsma
parent
commit
2556178422
  1. 4
      spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java
  2. 4
      spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java

4
spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java

@ -98,7 +98,9 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo @@ -98,7 +98,9 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo
* Listeners can call this method to cancel further writing.
*/
protected void cancel() {
this.subscription.cancel();
if (this.subscription != null) {
this.subscription.cancel();
}
}

4
spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java

@ -111,7 +111,9 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T, @@ -111,7 +111,9 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
* Listeners can call this method to cancel further writing.
*/
public void cancel() {
this.subscription.cancel();
if (this.subscription != null) {
this.subscription.cancel();
}
}

Loading…
Cancel
Save