• fresher2011
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hello all:

 

I found, and worked around, an odd behavior. In a nutshell, I created a StandardSetController based on a QueryLocator. When the QueryLocator's underlying query returns zero records, attempting to set the controller's page set size causes an ugly exception. Worse, this happens in production, but not in my Enterprise sandbox.

 

Here's the original code:

 

con = new ApexPages.StandardSetController(Database.getQueryLocator(this.getQuery() ) );
con.setPageSize(15);

 

The query is specified by user input via a VisualForce page. When they specify a query that returns no results, then, again in Production, the following exception occurs:

 

(This is the styled VF error from my page).

 

I have verified that it's specifically the second line of code that causes the crash.

 

The above query looks like a query that underlies one of the reports elsewhere in the system.

 

I fixed this by commenting out the offending line and leaving the set size as the default, which works fine. But why would this happen, and why only in production? Should I be reporting this as a possible platform bug?

  • November 25, 2009
  • Like
  • 0