FilterPane Plugin

NullPointerException when params is empty

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: Grails-FilterPane 0.6.2
  • Fix Version/s: Grails-FilterPane-0.6.3
  • Component/s: None
  • Labels:
    None
  • Environment:
    Bug introduced in version 0.6. Does not affect 0.5
  • Patch Submitted:
    Yes

Description

the "if (filterProperties != null) {" test has been removed from version 0.6

So in FilterService, when 'params' is empty (line 19), then filterOpParams (line 20) is null, and then filterOpParams.keySet() (line 33) throws a NullPointerException.

When you install the plugin, and then call /book/ist, then params is empty and it crashes.

Re-enabling the missing code solves the problem.

Activity

Hide
Benjamin Gandon added a comment -

The NullPointerException stacktrace

Show
Benjamin Gandon added a comment - The NullPointerException stacktrace
Hide
Steve Krenek added a comment -

Thanks for reporting the issue, and particularly for taking the time to put together a patch. The filterProperties member was abandoned in favor of a more conventional method of determining the properties to be filtered. However, removing the if statement altogether was, as you found, the wrong thing to do. I'll put the statement back in, but instead of checking for filterProperties != null, it will check to see if any filter operators are present. If not, it will return the default list.

Show
Steve Krenek added a comment - Thanks for reporting the issue, and particularly for taking the time to put together a patch. The filterProperties member was abandoned in favor of a more conventional method of determining the properties to be filtered. However, removing the if statement altogether was, as you found, the wrong thing to do. I'll put the statement back in, but instead of checking for filterProperties != null, it will check to see if any filter operators are present. If not, it will return the default list.
Hide
Steve Krenek added a comment -

Fixed mostly by the patch submitted. Substituted "filterOpParams != null && filterOpParams.size() > 0" for "filterProperties != null".

Show
Steve Krenek added a comment - Fixed mostly by the patch submitted. Substituted "filterOpParams != null && filterOpParams.size() > 0" for "filterProperties != null".

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: