The SmartTarget 2014 API for .NET has a handy IsEmpty()
method on the Tridion.SmartTarget.Query.ResultSet
class. You can use this to figure out if the query to SDL Fredhopper did return anything at all. The result set could be empty if there no items, promotions or other things returned by Fredhopper, or if the query timed out.
In the Java verison of API there is no com.tridion.smarttarget.query.ResultSet.isEmpty() or similar. I tried to test if the getItemsTotalCount() is null or 0 (although that is not the same kind of comparison) but that one throws an null pointer exception if the query times out.
So how should I test in the Java API whether I got any results from my query?