SPR-6785 - Improve message error when the MarshallingView modelKey attribute is not valid

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2893 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Arjen Poutsma
2010-02-01 15:25:29 +00:00
parent ac1d678554
commit bf3c057208
2 changed files with 26 additions and 0 deletions
@@ -122,6 +122,9 @@ public class MarshallingView extends AbstractView {
protected Object locateToBeMarshalled(Map model) throws ServletException {
if (this.modelKey != null) {
Object o = model.get(this.modelKey);
if (o == null) {
throw new ServletException("Model contains no object with key [" + modelKey + "]");
}
if (!this.marshaller.supports(o.getClass())) {
throw new ServletException("Model object [" + o + "] retrieved via key [" + modelKey +
"] is not supported by the Marshaller");