Projectable.uniqueResult() Javadoc does not discuss what happens if no match is found

Bug #705527 reported by cowwoc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Querydsl
Fix Released
Undecided
Unassigned

Bug Description

Projectable.uniqueResult(Expression<?>[])
Projectable.uniqueResult(Expression<?>[], Expression<?>[], Expression<?>[]...)

have Javadoc but do not discuss what happens if no match is found. Does the method return an empty array? Does it return null? Does it throw an exception?

I suggest returning an empty array or list instead of null whenever possible (as suggested by the Effective Java book).

Revision history for this message
Timo Westkämper (timo-westkamper) wrote :

I updated the javadocs

Projectable.uniqueResult(Expression<?>[])

* returns an array with the size of the Expression array or null for no result

Projectable.uniqueResult(Expression<?>[], Expression<?>[], Expression<?>[]...)

* returns an array with the combined size of the Expression arrays or null for no result

Return empty arrays for null results would be confusing in this case, but in cases returning multiple results as Collection types, no null results are returned.

Changed in querydsl:
status: New → Fix Committed
Revision history for this message
Timo Westkämper (timo-westkamper) wrote :

Released in 2.1.0-beta3

Changed in querydsl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.