I have a project, in which there is a setter method as shown below:
public Long getvoiceId() {
return voiceId;
}
Now, I am using DOM parser
to generate the xml from the object itself, but for this particular field, I am getting compilation error as shown below.
It always give me the compilation error, indicating that the method's return type should be changed to string.
Element voiceId = doc.createElement("voiceId");
InvoiceId.appendChild(doc.createTextNode(Long.toString(irm.getInvoiceId())));
voiceReferenceNotificationMessage.appendChild(voiceId);
As you can see above, I am explicitly casting it using Long.toString
, but I am still getting NullPointerException
for this.
Please advise on how to proceed, thanks.