Source:
<code>public void handleGetConfigurationResponse( final com.alliander.osgp.dto.valueobjects.ConfigurationDto configurationDto, final String deviceIdentification, final String organisationIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType deviceResult, final OsgpException exception) { ResponseMessageResultType result = ResponseMessageResultType.OK; OsgpException osgpException = exception; Configuration configuration = null; try { if (deviceResult == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } final Ssld ssld = this.ssldRepository.findByDeviceIdentification(deviceIdentification); final List<DeviceOutputSetting> outputSettings = ssld.getOutputSettings(); this.replaceEmptyOutputSettings(configurationDto, outputSettings); configuration = this.domainCoreMapper.map(configurationDto, Configuration.class); for (final DeviceOutputSetting dos : outputSettings) { if (dos.getOutputType().equals(RelayType.TARIFF_REVERSED)) { for (final RelayMap rm : configuration.getRelayConfiguration().getRelayMap()) { if (rm.getIndex() == dos.getExternalId() && rm.getRelayType().equals(RelayType.TARIFF)) { rm.changeRelayType(RelayType.TARIFF_REVERSED); } } } } } catch (final Exception e) { LOGGER.error("Unexpected Exception for messageType: {}", messageType, e); result = ResponseMessageResultType.NOT_OK; osgpException = new TechnicalException(ComponentType.UNKNOWN, e.getMessage(), e); } <START> this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() <END> .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(osgpException) .withDataObject(configuration).build()); }</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 handleGetConfigurationResponse( final com.alliander.osgp.dto.valueobjects.ConfigurationDto configurationDto, final String deviceIdentification, final String organisationIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType deviceResult, final OsgpException exception) { ResponseMessageResultType result = ResponseMessageResultType.OK; OsgpException osgpException = exception; Configuration configuration = null; try { if (deviceResult == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } final Ssld ssld = this.ssldRepository.findByDeviceIdentification(deviceIdentification); final List<DeviceOutputSetting> outputSettings = ssld.getOutputSettings(); this.replaceEmptyOutputSettings(configurationDto, outputSettings); configuration = this.domainCoreMapper.map(configurationDto, Configuration.class); for (final DeviceOutputSetting dos : outputSettings) { if (dos.getOutputType().equals(RelayType.TARIFF_REVERSED)) { for (final RelayMap rm : configuration.getRelayConfiguration().getRelayMap()) { if (rm.getIndex() == dos.getExternalId() && rm.getRelayType().equals(RelayType.TARIFF)) { rm.changeRelayType(RelayType.TARIFF_REVERSED); } } } } } catch (final Exception e) { LOGGER.error("Unexpected Exception for messageType: {}", messageType, e); result = ResponseMessageResultType.NOT_OK; osgpException = new TechnicalException(ComponentType.UNKNOWN, e.getMessage(), e); } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(osgpException) .withDataObject(configuration).build(); this.webServiceResponseMessageSender.send(responseMessage); }