Are preconditions necessary inside handler APIs that are supported by Frameworks? -


basically when spring io or other framework matter routes url handler method, injects path parameters user supplied values.

public responseentity<list<datamodel>> doget(@pathvariable string param1, @pathvariable string param2) { preconditions.checknotnull(param1); preconditions.checknotnull(param2); } 

is practice or redundant make precondition checks on supplied params inside function shown above?

the spring framework not allow injection of null values above parameters. still, handler method can invoked other parts of code (a bad practice, legit nevertheless). method can passed null values when under junit test.

so having said this, there compelling case not have preconditions assertions @ top of handler api?


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -