Я получаю сообщение об ошибке при вызове функции в java.
Тип возврата недействителен, и я просто вызываю его и вывожу строку внутри.JavaNullPointerException при вызове функции
Вот вызов подслушивания функции:
@RequestMapping(method = RequestMethod.POST)
public String findDevicesByCriteria(@Valid @ModelAttribute Device device, BindingResult bindingResult, Model uiModel) {
if (isCriteriaEmpty(device)) {
uiModel.addAttribute("criteriaEmptyWarning", "error_search_criteria_empty");
return ViewConstants.DEVICE_SEARCH_VIEW;
}
identityService.searchDevices(device.getSerialNumber(), device.getOwner().getSiteName(), device.getIpAdress(), device.getInstallDate(), device.getEndDate()); // the error come from here
return ViewConstants.DEVICE_SEARCH_VIEW;
}
Прототип в интерфейсе функции подслушивания:
/**
* Search devices.
*
* @param sn the serial number of the device
* @param site the site of it
* @param ipAdress the ip adress of it
* @param installDt the install date of it
* @param endDt the end date of it
* @return the list of device
*/
void searchDevices(String sn, String site, String ipAdress, Date installDt, Date EndDt);
И, наконец, функция, которая вызывает проблемы:
public void searchDevices(String sn, String site, String ipAdress, Date installDt, Date EndDt) {
System.out.println("toto");
}
Просим связаться с нами
С уважением
device.getOwner() вызывает проблему. Спасибо –