NumberFormat Exception rendering chart search view w/UUID

The chart search module extension point includes;

"url": "${project.parent.artifactId}/{{patient.patientId}}",

where {{patient.patientId}} translates to the real patient id, like patientId=3838, however when am customizing the patient search widget to provide a chartsearch url as reported at: Defining unique URL for afterSelectedUrl property of patientsearch widget the patientId translates to uuid, which @darius said is meant to be so, so i wanted to support both of these at the same time, however the second results into a NumberFormatException which i have not yet been able to trace where it happens within the module’s code.

When i searched around, i met with where a similar issue was handled for StringToEncounterConverter, So i upgraded to UIFR 3.3.1 as suggested at but this doesn’t fix the issue, any extra thing i need to know to solve this issue?

Put a breakpoint in the exact place where the exception is thrown and follow the way back. However in the stacktrace you should see all the methods and classes involved, isn’t that right?

1 Like

However, in this case there’s no reference in the log to where the error is thrown as being part of the chartsearch module.

Then maybe someone is swallowing the exception (or at least its cause). Sonar should detect these cases.


Looking at the stack trace I see:$StringToNumber.convert(
at org.openmrs.ui.framework.UiFrameworkUtil.determineArgumentValue( 

From this I guess that you have code in your controller like

controller(@RequestParam("patientId") Integer patientId, ...)

and naturally this fails with a NumberFormatException if a UUID is passed in.

Take a look at the first argument to this controller. This supports either patient_id or uuid, because it just lets the UI Framework (and Spring’s underlying conversion service) automatically take care of things.

(Particularly, StringToPatientConverter in the uiframework module already knows how to fetch a patient based on either a patient_id or a uuid.)

1 Like

Thanks @darius, that was the issue and your comment help me fix the issue :smile:

something i noticed however is that patient becomes null at the controller level when i use jq(’#chart-search-form-submit’).serialize() as URL which returns/transforms into something like:

url: "/openmrs-standalone/chartsearch/searchSavingSection/getResultsFromTheServer.action?"

from Ajax.


    SEVERE: Servlet.service() for servlet openmrs threw exception
	at org.openmrs.module.chartsearch.fragment.controller.TopAreaFragmentController.getResultsFromTheServer(

Investigation shows that patient fails to be passed from the view.