Source:
<code>public void handleBuildStateChange(Build build) throws IOException { LOG.info("Got event for a buildId: {}", build.getBuildNumber()); if (build.getState() == State.QUEUED) { return; } BuildDefinition definition = buildDefinitionService.getByModule(build.getModuleId()).get(); String whitelist = Objects.firstNonNull(System.getenv("BUILD_WHITELIST"), ""); List<String> whitelistedRepos= Splitter.on(',').omitEmptyStrings().splitToList(whitelist); if (!whitelistedRepos.contains(definition.getGitInfo().getRepository())) { return; } String uiHost = "<LINK_0>"; String appRoot = "blazar"; String gitHost = definition.getGitInfo().getHost(); String gitOrg = definition.getGitInfo().getOrganization(); String gitRepo = definition.getGitInfo().getRepository(); String gitBranch = definition.getGitInfo().getBranch(); String moduleName = definition.getModule().getName(); String buildNumber = Integer.toString(build.getBuildNumber()); String url = uiHost + "/" + appRoot + "/builds" + "/" + gitHost + "/" + gitOrg + "/" + gitRepo + "/" + gitBranch + "/" + moduleName + "/" + buildNumber; GHCommitState state = toGHCommitState(build.getState()); String sha = build.getSha().get(); String description = getStateDescription(build.getState()); String context = "CI-blazar"; <START> GitHub gitHubApi = gitHubByHost.get(gitHost); <END> GHRepository gitHubApiRepo = gitHubApi.getRepository(definition.getGitInfo().getFullRepositoryName()); LOG.info("Setting status of commit on module {}:{} (moduleId: {}) to {}", sha, definition.getGitInfo().getFullRepositoryName(), gitBranch, build.getModuleId(), description); gitHubApiRepo.createCommitStatus(sha, state, url, description, context); }</code><technical_language>I Preconditions.checkNotNull(gitHubByHost.get(gitHost)); fails fast</technical_language>

Target:
public void handleBuildStateChange(Build build) throws IOException { LOG.info("Got event for a buildId: {}", build.getBuildNumber()); if (build.getState() == State.QUEUED) { return; } BuildDefinition definition = buildDefinitionService.getByModule(build.getModuleId()).get(); String whitelist = Objects.firstNonNull(System.getenv("BUILD_WHITELIST"), ""); List<String> whitelistedRepos= Splitter.on(',').omitEmptyStrings().splitToList(whitelist); if (!whitelistedRepos.contains(definition.getGitInfo().getRepository())) { return; } String uiHost = "<LINK_0>"; String appRoot = "blazar"; String gitHost = definition.getGitInfo().getHost(); String gitOrg = definition.getGitInfo().getOrganization(); String gitRepo = definition.getGitInfo().getRepository(); String gitBranch = definition.getGitInfo().getBranch(); String moduleName = definition.getModule().getName(); String buildNumber = Integer.toString(build.getBuildNumber()); String url = uiHost + "/" + appRoot + "/builds" + "/" + gitHost + "/" + gitOrg + "/" + gitRepo + "/" + gitBranch + "/" + moduleName + "/" + buildNumber; GHCommitState state = toGHCommitState(build.getState()); String sha = build.getSha().get(); String description = getStateDescription(build.getState()); String context = "CI-blazar"; GitHub gitHubApi = Preconditions.checkNotNull(gitHubByHost.get(gitHost)); GHRepository gitHubApiRepo = gitHubApi.getRepository(definition.getGitInfo().getFullRepositoryName()); LOG.info("Setting status of commit on module {}:{} (moduleId: {}) to {}", sha, definition.getGitInfo().getFullRepositoryName(), gitBranch, build.getModuleId(), description); gitHubApiRepo.createCommitStatus(sha, state, url, description, context); }