From a8194b48e2b988ab140f7ab06ab6a735eacf0830 Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Wed, 15 Aug 2007 17:47:27 +0000 Subject: [PATCH] FORWARD MERGE: SWF-347 --- spring-webflow/changelog.txt | 5 ++- .../impl/RequestControlContextImpl.java | 31 ++++++++++--------- .../webflow/test/MockRequestContext.java | 4 +-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/spring-webflow/changelog.txt b/spring-webflow/changelog.txt index eaba990c..bf9806ae 100644 --- a/spring-webflow/changelog.txt +++ b/spring-webflow/changelog.txt @@ -1,6 +1,6 @@ SPRING WEB FLOW (SWF) CHANGELOG =============================== -http://www.springframework.org +http://www.springframework.org/webflow Changes in version 1.1.0 () ------------------------------------- @@ -9,6 +9,7 @@ Package org.springframework.binding * Fixed serializability problems in ConversionException, EvaluationException and MethodInvocationException. * Added targetCollection(String) method to MappingBuilder. * ConversionExecutor now checks for assignment compatible types (SWF-337). +* Fixed bug in MapAccessor where accessing a map entry with a null value would result in an exception (SWF-343). Package org.springframework.webflow.action * Improved FormAction.setupForm() JavaDoc (SWF-325). @@ -44,9 +45,11 @@ Package org.springframework.webflow.engine methods to XmlFlowBuilder to allow for control over the registration of beans needed locally by a flow definition. Useful for testing (SWF-307). * Ensures that all exceptions (including RuntimeExceptions) are handled properly by the FlowExecution (SWF-333). +* Ensured the RequestContext attribute map can never be null (SWF-347). Package org.springframework.webflow.execution * Added a holder for the FlowExecutionContext of a request (SWF-163). +* Made the Event class non-final to allow for extension (SWF-330). Package org.springframework.webflow.executor * JSF integration code now manages flow execution locks properly in exceptional situations and when the diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java index d3b39003..3abd79dd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java @@ -55,35 +55,36 @@ class RequestControlContextImpl implements RequestControlContext { private static final Log logger = LogFactory.getLog(RequestControlContextImpl.class); /** - * The owning flow execution. + * The owning flow execution carrying out this request. */ private FlowExecutionImpl flowExecution; - /** - * The request scope data map. - */ - private LocalAttributeMap requestScope = new LocalAttributeMap(); - /** * A source context for the caller who initiated this request. */ private ExternalContext externalContext; /** - * The last event that occured in this request context. + * The request scope data map. Never null, initially empty. + */ + private LocalAttributeMap requestScope = new LocalAttributeMap(); + + /** + * Holder for contextual properties describing the currently executing request; never null, initially empty and + * immutable. + */ + private AttributeMap attributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP; + + /** + * The last event that occurred in this request context; initially null. */ private Event lastEvent; /** - * The last transition that executed in this request context. + * The last transition that executed in this request context; initially null. */ private Transition lastTransition; - /** - * Holder for contextual execution properties. - */ - private AttributeMap attributes; - /** * Create a new request context. * @param flowExecution the owning flow execution @@ -91,8 +92,8 @@ class RequestControlContextImpl implements RequestControlContext { */ public RequestControlContextImpl(FlowExecutionImpl flowExecution, ExternalContext externalContext) { Assert.notNull(flowExecution, "The owning flow execution is required"); - this.externalContext = externalContext; this.flowExecution = flowExecution; + this.externalContext = externalContext; } // implementing RequestContext @@ -224,7 +225,7 @@ class RequestControlContextImpl implements RequestControlContext { // internal helpers /** - * Returns the execution listerns for the flow execution of this request context. + * Returns the execution listeners for the flow execution of this request context. */ protected FlowExecutionListeners getExecutionListeners() { return flowExecution.getListeners(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java index 28d9f6ba..a6cf2b9a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java @@ -48,12 +48,12 @@ public class MockRequestContext implements RequestContext { private MutableAttributeMap requestScope = new LocalAttributeMap(); + private MutableAttributeMap attributes = new LocalAttributeMap(); + private Event lastEvent; private Transition lastTransition; - private MutableAttributeMap attributes = new LocalAttributeMap(); - /** * Creates a new mock request context with the following defaults: *