Source:
public void run() { SubscriptionStatusLookup statusLookup; HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); HttpEntity<String> entity = new HttpEntity<>("parameters", headers); String uuid = UUID.randomUUID().toString(); String intentVerificationUrl = callbackUrl + INTENT_VERIFICATION_PARAMS; try { intentVerificationUrl = replaceParameters(intentVerificationUrl, mode, topic, uuid); ResponseEntity<String> response = (ResponseEntity<String>) httpAgentImpl .executeWithReturnTypeSync(intentVerificationUrl, entity, Method.GET, retryCount, retryInterval); if (!responseValid(response, uuid)) { statusLookup = SubscriptionStatusLookup.INTENT_FAILED; } else { statusLookup = SubscriptionStatusLookup.INTENT_VERIFIED; } } catch (RuntimeException e) { LOGGER.error("An error occurred during intent verification", e); statusLookup = SubscriptionStatusLookup.INTENT_FAILED; } catch (HttpException e ) { LOGGER.error("An error occurred during intent verification", e); statusLookup = SubscriptionStatusLookup.INTENT_FAILED; } List<HubSubscription> subscriptions = hubSubscriptionMDSService .findSubByCallbackUrlAndTopicId(callbackUrl, topicId); if (subscriptions == null || subscriptions.size() == 0 || subscriptions.size() > 1) { LOGGER.info("not handled earlier, need to check"); return; } HubSubscription subscription = subscriptions.get(0); Integer hubSubscriptionStatusId = subscription .getHubSubscriptionStatusId(); Integer currentStatus = -1; if (hubSubscriptionStatusId != 0) { currentStatus = subscription.getHubSubscriptionStatusId(); } if (!SubscriptionStatusLookup.INTENT_VERIFIED.getId().equals( currentStatus)) { subscription.setHubSubscriptionStatusId(statusLookup.getId()); hubSubscriptionMDSService.create(subscription); } }

Target:
public void run() { SubscriptionStatusLookup statusLookup; HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); HttpEntity<String> entity = new HttpEntity<>("parameters", headers); String uuid = UUID.randomUUID().toString(); String intentVerificationUrl = callbackUrl + INTENT_VERIFICATION_PARAMS; try { intentVerificationUrl = replaceParameters(intentVerificationUrl, mode, topic, uuid); ResponseEntity<String> response = (ResponseEntity<String>) httpAgentImpl .executeWithReturnTypeSync(intentVerificationUrl, entity, Method.GET, retryCount, retryInterval); if (!responseValid(response, uuid)) { statusLookup = SubscriptionStatusLookup.INTENT_FAILED; } else { statusLookup = SubscriptionStatusLookup.INTENT_VERIFIED; } } catch (RuntimeException | HttpException e) { LOGGER.error("An error occurred during intent verification", e); statusLookup = SubscriptionStatusLookup.INTENT_FAILED; } List<HubSubscription> subscriptions = hubSubscriptionMDSService .findSubByCallbackUrlAndTopicId(callbackUrl, topicId); if (subscriptions == null || subscriptions.size() == 0 || subscriptions.size() > 1) { LOGGER.info("not handled earlier, need to check"); return; } HubSubscription subscription = subscriptions.get(0); Integer hubSubscriptionStatusId = subscription .getHubSubscriptionStatusId(); Integer currentStatus = -1; if (hubSubscriptionStatusId != 0) { currentStatus = subscription.getHubSubscriptionStatusId(); } if (!SubscriptionStatusLookup.INTENT_VERIFIED.getId().equals( currentStatus)) { subscription.setHubSubscriptionStatusId(statusLookup.getId()); hubSubscriptionMDSService.create(subscription); } }