Hey All,

So as I am testing out the rest api's I'm noticing a recurring issue
in the service layers - they do not necessarily check or throw errors
for bad data.

One example is in DefaultPageService#updatePage. If I pass this method
a bogus pageLayoutCode, it will retrieve a null layout at 315, and
then set the page's layout to null at line 335. This results in
corrupted data.

Another example is DefaultPageService#addWidgetToPageRegion. This will
not actually save corrupt data, but it doesn't check if the widgetId
is valid, and will eventually throw a nullpointerexception.

What is the correct way to deal with this? Should service layer
methods be checking data validity and throwing errors that the
controller can listen for and pass on as a 400? Am I missing
something, or are there other suggestions?

Reply via email to