Code commits
openmrs-core
-
Ivo Ulrich <teleivo@users.noreply.github.com> 58bac16a8152307887741c1b2298c3d6581f15a1
Merge pull request #2179 from teleivo/TRUNK-5154
TRUNK-5154 ProgramWorkflowStateEditor tries to get state by uuid twice -
teleivo <mrteleivo@gmail.com> eba7a0a14e2ac86c5e55ab85b5f139ab972066b0
TRUNK-5154 ProgramWorkflowStateEditor tries to get state by uuid twice
the catch block will never be reached since getByUuid() just returns
null if nothing is found. The exception in the try block is normally
thrown by Integer.valueOf() if the text is a uuid and not a number
* use getState(Integer) first to try to get the ProgramWorkflowState by
its id
* is text is not an Integer, the exception in Integer.valueOf will lead
to the catch block being executed which then tries to fetch by the uuid
* added tests- api/src/main/java/org/openmrs/propertyeditor/ProgramWorkflowStateEditor.java (version eba7a0a14e2ac86c5e55ab85b5f139ab972066b0)
- api/src/test/java/org/openmrs/propertyeditor/ProgramWorkflowStateEditorTest.java (version eba7a0a14e2ac86c5e55ab85b5f139ab972066b0)