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

Bug #705527 reported by cowwoc on 2011-01-20
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).

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

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  Edit
Everyone can see this information.

Other bug subscribers