Source:
<code>public FindDevicesResponse findDevices(@OrganisationIdentification final String organisationIdentification, @RequestPayload final FindDevicesRequest request) throws OsgpException { LOGGER.info("Find devices for organisation: {}.", organisationIdentification); final FindDevicesResponse response = new FindDevicesResponse(); try { Page<com.alliander.osgp.domain.core.entities.Device> result = this.deviceManagementService .findDevices(organisationIdentification, request.getPageSize(), request.getPage(), this.deviceManagementMapper.map(request.getDeviceFilter(), com.alliander.osgp.domain.core.valueobjects.DeviceFilter.class)); if (result != null && response.getDevices() != null) { response.getDevices().addAll(this.deviceManagementMapper.mapAsList(result.getContent(), Device.class)); response.setPage(new com.alliander.osgp.adapter.ws.schema.core.common.Page()); response.getPage().setPageSize(result.getSize()); response.getPage().setTotalPages(result.getTotalPages()); response.getPage().setCurrentPage(result.getNumber()); } if (!request.isUsePages()) { int calls = 1; while ((calls += 1) <= result.getTotalPages()) { request.setPage(calls); result = this.deviceManagementService.findDevices(organisationIdentification, request.getPageSize(), request.getPage(), this.deviceManagementMapper.map(request.getDeviceFilter(), com.alliander.osgp.domain.core.valueobjects.DeviceFilter.class)); response.getDevices().addAll(this.deviceManagementMapper.mapAsList(result.getContent(), Device.class)); } } <START> } catch (final ArgumentNullOrEmptyException ane) { <END> response.setArgument(ane.getArgument()); response.setMessage(ane.getMessage()); } catch (final MethodConstraintViolationException e) { LOGGER.error(EXCEPTION, e.getMessage(), e.getStackTrace(), e); throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations())); } catch (final Exception e) { LOGGER.error(EXCEPTION, e.getMessage(), e.getStackTrace(), e); this.handleException(e); } return response; }</code><technical_language>![CRITICAL](<LINK_1> log rethrow this exception. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public FindDevicesResponse findDevices(@OrganisationIdentification final String organisationIdentification, @RequestPayload final FindDevicesRequest request) throws OsgpException { LOGGER.info("Find devices for organisation: {}.", organisationIdentification); final FindDevicesResponse response = new FindDevicesResponse(); try { Page<com.alliander.osgp.domain.core.entities.Device> result = this.deviceManagementService .findDevices(organisationIdentification, request.getPageSize(), request.getPage(), this.deviceManagementMapper.map(request.getDeviceFilter(), com.alliander.osgp.domain.core.valueobjects.DeviceFilter.class)); if (result != null && response.getDevices() != null) { response.getDevices().addAll(this.deviceManagementMapper.mapAsList(result.getContent(), Device.class)); response.setPage(new com.alliander.osgp.adapter.ws.schema.core.common.Page()); response.getPage().setPageSize(result.getSize()); response.getPage().setTotalPages(result.getTotalPages()); response.getPage().setCurrentPage(result.getNumber()); } if (!request.isUsePages()) { int calls = 1; while ((calls += 1) <= result.getTotalPages()) { request.setPage(calls); result = this.deviceManagementService.findDevices(organisationIdentification, request.getPageSize(), request.getPage(), this.deviceManagementMapper.map(request.getDeviceFilter(), com.alliander.osgp.domain.core.valueobjects.DeviceFilter.class)); response.getDevices().addAll(this.deviceManagementMapper.mapAsList(result.getContent(), Device.class)); } } } catch (final ArgumentNullOrEmptyException ane) { LOGGER.error("No results found when finding devices"); response.setArgument(ane.getArgument()); response.setMessage(ane.getMessage()); } catch (final MethodConstraintViolationException e) { LOGGER.error(EXCEPTION, e.getMessage(), e.getStackTrace(), e); throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations())); } catch (final Exception e) { LOGGER.error(EXCEPTION, e.getMessage(), e.getStackTrace(), e); this.handleException(e); } return response; }