Source:
<code>public void handleRevokeKeyResponse(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleRevokeKeyResponse called for device: for organisation: {}", deviceIdentification, organisationIdentification); ResponseMessageResultType result = ResponseMessageResultType.OK; OsgpException osgpException = exception; try { if (deviceResult == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification); if (device == null) { throw new PlatformException(String.format("Device not found: %s", deviceIdentification)); } final Ssld ssld = this.ssldRepository.findByDeviceIdentification(deviceIdentification); ssld.setPublicKeyPresent(false); this.ssldRepository.save(ssld); LOGGER.info("publicKey has been revoked for device: for organisation: {}", deviceIdentification, organisationIdentification); } catch (final Exception e) { LOGGER.error("Unexpected Exception", e); result = ResponseMessageResultType.NOT_OK; osgpException = new TechnicalException(ComponentType.UNKNOWN, "Exception occurred while revoking key", e); } final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) <START> .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(exception).build(); <END> this.webServiceResponseMessageSender.send(responseMessage); }</code><technical_language>this withOsgpException(osgpException) instead of withOsgpException(exception)? get rid of Sonar complaint useless assignment osgpException line 164, exception e catch block is passed if occurs instead of ignored</technical_language>

Target:
public void handleRevokeKeyResponse(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleRevokeKeyResponse called for device: for organisation: {}", deviceIdentification, organisationIdentification); ResponseMessageResultType result = ResponseMessageResultType.OK; OsgpException osgpException = exception; try { if (deviceResult == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification); if (device == null) { throw new PlatformException(String.format("Device not found: %s", deviceIdentification)); } final Ssld ssld = this.ssldRepository.findByDeviceIdentification(deviceIdentification); ssld.setPublicKeyPresent(false); this.ssldRepository.save(ssld); LOGGER.info("publicKey has been revoked for device: for organisation: {}", deviceIdentification, organisationIdentification); } catch (final Exception e) { LOGGER.error("Unexpected Exception", e); result = ResponseMessageResultType.NOT_OK; osgpException = new TechnicalException(ComponentType.UNKNOWN, "Exception occurred while revoking key", e); } final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(osgpException) .build(); this.webServiceResponseMessageSender.send(responseMessage); }