Tags: #<Tag:0x00007f79075ec388>

I try to create/save a LabTestAttribute it throws a ConversionException exception. I am writing a unit test for one of our module named as common lab test module. Before going on the issue I will let know the structure of module code.



Test Case

Hibernate File


@shujaat, there is probably missing a @PropertyGetter annotated method for the property valueReference that you added. You may need to provide this method depending on your use case to silence this error.

@ruhanga, in openmrs BaseAttribute class we have the setter and getter for valueReference property, Take a look at the BaseAttribute Abstract Class

Is this the full stack trace?

Yes @dkayiwa !

Can you commit your changes to a repository from where we can check out?

please checkout the master branch

Can you add these to the resource?

1 Like

Okay, let me add this @PropertyGetter /@PropertySetter for value.

Thanks a bunch @dkayiwa, these methods as is didn’t work, but I got the point. We needed to explicitly define PropertyGetter/Setter to handle value in this case.

@shujaat please check this commit…

I encountered the same error but with class org.openmrs.module.webservices.helper.TaskAction

at tasks on c -

but slightly different case

PR at RESTWS-764 by tendomart · Pull Request #475 · openmrs/ · GitHub

Anyone have an idea ?

@tendomart did you take a look at this in your log?

Caused by: java.lang.NumberFormatException: For input string: "TestTask" at java.lang.NumberFormatException.forInputString( at java.lang.Integer.parseInt( at java.lang.Integer.parseInt( at

@dkayiwa Yes I did , am not however certain why it throws a NumberFormatException yet i did provide the right params for this constructor TaskDefinition(java.lang.Integer id, java.lang.String name, java.lang.String description, java.lang.String taskClass)

@tendomart in your test, getUuid() returns getTestTaskName() which is TestTask, hence causing the error.

@dkayiwa was > @Override

    public String getUuid() {
        return RestTestConstants1_8.TASK_DEFINITION_UUID;

Necessarily designed to take in a string , if so then why do we have to parse in Non-Numeric **RestTestConstantsX_.UUID’**s then again type cast them to integers ?

I asked because trying to return a uuid as above a String , still requires an int , and failure to do so throws

java.lang.NumberFormatException: For input string: “266a2ff1-f0b1-45f4-ad04-2ce952a27920”

You need to override the TaskDefinitionResource1_8.getByUniqueId() method and deal with the uuid.

Thanks, Let me explore that .

I did it but am still getting a String to Int Casting Error specifically java.lang.NumberFormatException

something like this java.lang.NumberFormatException: For input string: “0464edb8-4a6e-11eb-b378-0242ac130002” so that we can not return the TaskDefinition using a the provided String uuid , as per the requirement.

@dkayiwa looks like we need to provide OverLoad TaskDefinition in core to accept an Int .

something like

TaskDefinition.getTaskById(String st)

with something like

TaskDefinition.getTaskById(Int in)

in core

Can you share the change you made to override getByUniqueId?

Wrapper getUUid Method

public class TaskServiceWrapper2_4 extends TaskServiceWrapper {

public TaskDefinition getTaskByUuid(String uuid) {
	return Context.getSchedulerService().getTaskByUuid(uuid);


Wrapper method injected at

public class TaskDefinitionResource2_4 extends TaskDefinitionResource1_8 {

 private TaskServiceWrapper2_4 taskServiceWrapper = new TaskServiceWrapper2_4();

    public void setTaskServiceWrapper(TaskServiceWrapper2_4 taskServiceWrapper) {
        this.taskServiceWrapper = taskServiceWrapper;


This is how the change looks like.

        public TaskDefinition getByUniqueId(String uniqueId) {
            TaskDefinition taskDefinition = taskServiceWrapper.getTaskByUuid(uniqueId);
            if (taskDefinition == null) {
                taskDefinition = taskServiceWrapper.getTaskById(Integer.parseInt(uniqueId));
            return taskDefinition;