Source:
<code>public void handleUpdateFirmwareResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final UpdateFirmwareResponseDto updateFirmwareResponseDto) throws FunctionalException { LOGGER.info("handleUpdateFirmwareResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Update firmware response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } final List<FirmwareVersion> firmwareVersions = this.configurationMapper .mapAsList(updateFirmwareResponseDto.getFirmwareVersions(), FirmwareVersion.class); final SmartMeter smartMeter = this.domainHelperService .findSmartMeter(deviceMessageMetadata.getDeviceIdentification()); this.firmwareService.storeFirmware(smartMeter, updateFirmwareResponseDto.getFirmwareIdentification(), firmwareVersions, deviceMessageMetadata.getOrganisationIdentification()); final UpdateFirmwareResponse updateFirmwareResponse = new UpdateFirmwareResponse(firmwareVersions); <START> this.webServiceResponseMessageSender.send( <END> ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withDataObject(updateFirmwareResponse) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
public void handleUpdateFirmwareResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final UpdateFirmwareResponseDto updateFirmwareResponseDto) throws FunctionalException { LOGGER.info("handleUpdateFirmwareResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Update firmware response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } final List<FirmwareVersion> firmwareVersions = this.configurationMapper .mapAsList(updateFirmwareResponseDto.getFirmwareVersions(), FirmwareVersion.class); final SmartMeter smartMeter = this.domainHelperService .findSmartMeter(deviceMessageMetadata.getDeviceIdentification()); this.firmwareService.storeFirmware(smartMeter, updateFirmwareResponseDto.getFirmwareIdentification(), firmwareVersions, deviceMessageMetadata.getOrganisationIdentification()); final UpdateFirmwareResponse updateFirmwareResponse = new UpdateFirmwareResponse(firmwareVersions); ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withDataObject(updateFirmwareResponse) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send( responseMessage, deviceMessageMetadata.getMessageType()); }