Showing posts with label reports. Show all posts
Showing posts with label reports. Show all posts

Friday, January 22, 2010

Validate method on reports

Be careful with naming report method validate(). It does not appear in override list for the report methods but still will be called by the framework if you are running report from the output menu item. Just try to add the following lines to any report that has no such method:

private boolean validate(Object _calledFrom)
{
    throw error("Unexpected call.");
}

Moreover, if your method has different signature from above you will get another exception regarding incorrect method signature.
The root cause of this call is located deep inside ReportRun framework - some of the methods are being called via reflection from SysReportRun class (see SysReportRun._validate() method for exmaple).

The full list of such dangerous names can be found in SysReportRun::reportFindMethodsMap() method.