Source:
public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final SubscriptionBase subscriptionBase, final Errors errors, final NativeWebRequest request, final Client client) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } if (featureToggleService.isFeatureEnabled(CHECK_OWNING_APPLICATION) && !applicationService.exists(subscriptionBase.getOwningApplication())) { return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, "owning_application doesn't exist"), request); } if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } try { if (featureToggleService.isFeatureEnabled(DISABLE_SUBSCRIPTION_CREATION)) { try { return ok(subscriptionService.getExistingSubscription(subscriptionBase)); } catch (final NoSuchSubscriptionException e) { return Responses.create(new ServiceUnavailableException( "Subscription creation is temporarily unavailable", e).asProblem(), request); } catch (final NakadiException e) { Responses.create(e.asProblem(), request); } } final Result<Subscription> result = subscriptionService.createSubscription(subscriptionBase, client); if (!result.isSuccessful()) { return Responses.create(result.getProblem(), request); } return prepareLocationResponse(result.getValue()); } catch (final DuplicatedSubscriptionException e) { final Result<Subscription> result = subscriptionService.processDuplicatedSubscription(subscriptionBase); if (!result.isSuccessful()) { return Responses.create(result.getProblem(), request); } return ok(result.getValue()); } }

Target:
public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final SubscriptionBase subscriptionBase, final Errors errors, final NativeWebRequest request, final Client client) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } if (featureToggleService.isFeatureEnabled(CHECK_OWNING_APPLICATION) && !applicationService.exists(subscriptionBase.getOwningApplication())) { return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, "owning_application doesn't exist"), request); } if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } try { if (featureToggleService.isFeatureEnabled(DISABLE_SUBSCRIPTION_CREATION)) { try { return ok(subscriptionService.getExistingSubscription(subscriptionBase)); } catch (final NoSuchSubscriptionException e) { return Responses.create(new ServiceUnavailableException( "Subscription creation is temporarily unavailable", e).asProblem(), request); } catch (final NakadiException e) { return Responses.create(e.asProblem(), request); } } final Result<Subscription> result = subscriptionService.createSubscription(subscriptionBase, client); if (!result.isSuccessful()) { return Responses.create(result.getProblem(), request); } return prepareLocationResponse(result.getValue()); } catch (final DuplicatedSubscriptionException e) { final Result<Subscription> result = subscriptionService.processDuplicatedSubscription(subscriptionBase); if (!result.isSuccessful()) { return Responses.create(result.getProblem(), request); } return ok(result.getValue()); } }