It is mentioned that the annotation SearchSpec can be used in my RestController. I tried the same and while testing a negative scenario I came across a case where I just passed multiple spaces in search criteria like following /resource?search=(resourceId= )
This gave me a NullPointerException as below
java.lang.NullPointerException: null
at com.sipios.springsearch.QueryVisitorImpl.visitCriteria(QueryVisitorImpl.kt:50)
at com.sipios.springsearch.QueryVisitorImpl.visitCriteria(QueryVisitorImpl.kt:8)
Looking at the code it appears that the check implemented has following
val criteria = SearchCriteria(
key,
op,
matchResult!!.groups[1]!!.value, //here is where it breaks
matchResult.groups[2]!!.value,
matchResult.groups[3]!!.value
)
was the use of !! operator intentional? If yes, how are consumers who are directly annotating SearchSpec in their controller methods are advised to handle this? If no, can this be considered a defect and prioritized?
EDIT:
After further testing, following scenario fails with similar error. When calling search without any search criteria like /resource?search=() below exception is thrown.
java.lang.NullPointerException: visit(ctx.query()) must not be null
at com.sipios.springsearch.QueryVisitorImpl.visitPriorityQuery(QueryVisitorImpl.kt:22)
at com.sipios.springsearch.QueryVisitorImpl.visitPriorityQuery(QueryVisitorImpl.kt:8)
It is mentioned that the annotation
SearchSpec
can be used in my RestController. I tried the same and while testing a negative scenario I came across a case where I just passed multiple spaces in search criteria like following/resource?search=(resourceId= )
This gave me a
NullPointerException
as belowLooking at the code it appears that the check implemented has following
was the use of
!!
operator intentional? If yes, how are consumers who are directly annotatingSearchSpec
in their controller methods are advised to handle this? If no, can this be considered a defect and prioritized?EDIT:
After further testing, following scenario fails with similar error. When calling search without any search criteria like
/resource?search=()
below exception is thrown.