Skip to content

Improve message error when the MarshallingView modelKey attribute is not valid [SPR-6785] #11451

@spring-projects-issues

Description

@spring-projects-issues

Florent Ramiere opened SPR-6785 and commented

When a user specifies an invalid key in the modelKey attribute a NPE exception occurs.
An appropriate error message would help the developer.

 
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">
	<property name="modelKey" value="invalidKey" />
	<property name="marshaller" ref="xstreamMarshaller" />
</bean>

gives

 
java.lang.NullPointerException
        at org.springframework.web.servlet.view.xml.MarshallingView.locateToBeMarshalled(MarshallingView.java:125)
        at org.springframework.web.servlet.view.xml.MarshallingView.renderMergedOutputModel(MarshallingView.java:98)
        at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060)

Affects: 3.0 GA

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions