← Back to team overview

dhis2-devs team mailing list archive

[Bug 1389912] Re: (Web-API) Using filter=name:like:* fails for certain objects

 

This have now been fixed in trunk rev 17411

** Changed in: dhis2
     Assignee: (unassigned) => Morten Olav Hansen (mortenoh)

** Changed in: dhis2
   Importance: Undecided => Medium

** Changed in: dhis2
       Status: New => Fix Committed

** Changed in: dhis2
    Milestone: None => 2.17

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1389912

Title:
  (Web-API) Using filter=name:like:* fails for certain objects

Status in DHIS 2:
  Fix Committed

Bug description:
  When using a filter query parameter with value 'name:like:<anything>',
  HTTP 500 internal server error is thrown for certain (types of)
  objects. Only happens for name:like, other property:operator combos
  behave as expected.

  More specifically, if the object which is being filtered does not have
  a 'name' parameter in its DB model (Hibernate mapping, table), a HTTP
  500 is returned. This is true for several DHIS2 objects, including
  messageconversations and interpretations.

  Test case:
  ----------------------------------------
  Run:
  curl -u admin:district -v "https://apps.dhis2.org/dev/api/interpretations?filter=name:like:test";

  Returns:
  ....
  org.hibernate.QueryException: could not resolve property: name of: org.hisp.dhis.interpretation.Interpretation
  ...

  Should return:
  Empty json object (no matches)

  ----------------------------------------

  Caused by special case implementation for filter=name:like:* in
  AbstractCrudController.getObjectList()

  Suggestions:
  Could be fixed by somehow checking in the aforementioned special case for the existence of a 'name' property. Unfortunately this is not trivial as property must be defined in the actual Hibernate model (filtering executed in query, I assume?).
  Could also be fixed by defining the name property in the mapping (might not be a great idea, depending on the case).

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1389912/+subscriptions


References