From 68cc57549a56480b723b6112e1bee0de114eeda1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Karnok?= Date: Thu, 6 Apr 2017 19:15:12 +0200 Subject: [PATCH] Restore correct order of terminated flag check --- .../servlet/mvc/method/annotation/ReactiveTypeHandler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandler.java index 9b2f81b847f..cf36906a061 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandler.java @@ -274,7 +274,10 @@ class ReactiveTypeHandler { this.elementRef.lazySet(null); return; } - + + // Check terminal signal before processing element.. + boolean isTerminated = this.terminated; + Object element = this.elementRef.get(); if (element != null) { this.elementRef.lazySet(null); @@ -291,7 +294,7 @@ class ReactiveTypeHandler { } } - if (this.terminated) { + if (isTerminated) { this.done = true; Throwable ex = this.error; this.error = null;