Skip to content

Commit a1d35c2

Browse files
committed
ConcurrentModel.addAttribute javadoc: null value not supported
Issue: SPR-16831
1 parent 99534a3 commit a1d35c2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

spring-context/src/main/java/org/springframework/ui/ConcurrentModel.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -68,7 +68,8 @@ public ConcurrentModel(Object attributeValue) {
6868
/**
6969
* Add the supplied attribute under the supplied name.
7070
* @param attributeName the name of the model attribute (never {@code null})
71-
* @param attributeValue the model attribute value (can be {@code null})
71+
* @param attributeValue the model attribute value (never {@code null} for {@code ConcurrentModel},
72+
* with the {@code Nullable} declaration inherited from {@link Model#addAttribute(String, Object)})
7273
*/
7374
public ConcurrentModel addAttribute(String attributeName, @Nullable Object attributeValue) {
7475
Assert.notNull(attributeName, "Model attribute name must not be null");
@@ -80,14 +81,14 @@ public ConcurrentModel addAttribute(String attributeName, @Nullable Object attri
8081
/**
8182
* Add the supplied attribute to this {@code Map} using a
8283
* {@link org.springframework.core.Conventions#getVariableName generated name}.
83-
* <p><emphasis>Note: Empty {@link Collection Collections} are not added to
84+
* <p><i>Note: Empty {@link Collection Collections} are not added to
8485
* the model when using this method because we cannot correctly determine
8586
* the true convention name. View code should check for {@code null} rather
86-
* than for empty collections as is already done by JSTL tags.</emphasis>
87+
* than for empty collections as is already done by JSTL tags.</i>
8788
* @param attributeValue the model attribute value (never {@code null})
8889
*/
89-
public ConcurrentModel addAttribute(@Nullable Object attributeValue) {
90-
Assert.notNull(attributeValue, "Model object must not be null");
90+
public ConcurrentModel addAttribute(Object attributeValue) {
91+
Assert.notNull(attributeValue, "Model attribute value must not be null");
9192
if (attributeValue instanceof Collection && ((Collection<?>) attributeValue).isEmpty()) {
9293
return this;
9394
}

0 commit comments

Comments
 (0)