Skip to content

Commit

Permalink
fix(web): Handling two different cases of NPEs (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
robzienert committed Mar 27, 2017
1 parent f6ce3d6 commit f800783
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Expand Up @@ -19,23 +19,23 @@ package com.netflix.spinnaker.igor.build
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.igor.build.model.GenericBuild
import com.netflix.spinnaker.igor.jenkins.client.model.JobConfig
import com.netflix.spinnaker.igor.jenkins.client.model.QueuedJob
import com.netflix.spinnaker.igor.model.BuildServiceProvider
import com.netflix.spinnaker.igor.service.BuildMasters
import groovy.transform.InheritConstructors
import groovy.util.logging.Slf4j
import org.springframework.web.bind.annotation.ExceptionHandler
import retrofit.RetrofitError
import javax.servlet.http.HttpServletRequest
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.servlet.HandlerMapping
import org.yaml.snakeyaml.Yaml
import retrofit.RetrofitError

import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import java.util.concurrent.ExecutorService

Expand Down Expand Up @@ -208,6 +208,11 @@ class BuildController {
it.fileName == fileName
}?.relativePath

if (path == null) {
log.error("Unable to get properties: Could not find build artifact matching requested filename '${fileName}' on '${master}' build '${buildNumber}")
return map
}

def propertyStream = jenkinsService.getPropertyFile(job, buildNumber, path).body.in()

if (fileName.endsWith('.yml') || fileName.endsWith('.yaml')) {
Expand Down
Expand Up @@ -54,6 +54,8 @@ class CommitController extends AbstractCommitController {
} else if(e.response.status == 404) {
return getNotFoundCommitsResponse(projectKey, repositorySlug, requestParams.to, requestParams.from, master.baseUrl)
}
log.error("Unhandled error response, acting like commit response was not found", e)
return getNotFoundCommitsResponse(projectKey, repositorySlug, requestParams.to, requestParams.from, master.baseUrl)
}

commitsResponse.commits.each {
Expand Down

0 comments on commit f800783

Please sign in to comment.