Buggy code:
public static final String TARGET_URL = "https:////quay.io//api//v1//" ; private final ObjectMapper objectMapper ; private static final int QUAY_PATH_LENGTH = 3 ; private static final int DOCKERHUB_PATH_LENGTH = 2 ; private static final Logger LOG = LoggerFactory . getLogger ( DockerRepoResource . class ) ; private final List < String > namespaces = new ArrayList < > ( ) ; private static class RepoList { private List < Container > repositories ; public void setRepositories ( List < Container > repositories ) { } public List < Container > getRepositories ( ) { } } private static class Collab { private String content ; public void setContent ( String content ) { } public String getContent ( ) { } } public DockerRepoResource ( ObjectMapper mapper , HttpClient client , UserDAO userDAO , TokenDAO tokenDAO , ContainerDAO containerDAO , TagDAO tagDAO ) { } @ GET @ Path ( "//user//{userId}" ) @ Timed @ UnitOfWork @ ApiOperation ( value = "List<seq2seq4repair_space>repos<seq2seq4repair_space>owned<seq2seq4repair_space>by<seq2seq4repair_space>the<seq2seq4repair_space>logged-in<seq2seq4repair_space>user" , notes = "Lists<seq2seq4repair_space>all<seq2seq4repair_space>registered<seq2seq4repair_space>and<seq2seq4repair_space>unregistered<seq2seq4repair_space>containers<seq2seq4repair_space>owned<seq2seq4repair_space>by<seq2seq4repair_space>the<seq2seq4repair_space>user" , response = Container . class , responseContainer = "List" ) public List < Container > userContainers ( @ ApiParam ( value = "User<seq2seq4repair_space>ID" , required = true ) @ PathParam ( "userId" ) Long userId ) { } @ PUT @ Path ( "//refresh" ) @ Timed @ UnitOfWork @ ApiOperation ( value = "Refresh<seq2seq4repair_space>repos<seq2seq4repair_space>owned<seq2seq4repair_space>by<seq2seq4repair_space>the<seq2seq4repair_space>logged-in<seq2seq4repair_space>user" , notes = "Updates<seq2seq4repair_space>some<seq2seq4repair_space>metadata" , response = Container . class , responseContainer = "List" ) public List < Container > refresh ( @ ApiParam ( value = "UserRequest<seq2seq4repair_space>to<seq2seq4repair_space>refresh<seq2seq4repair_space>the<seq2seq4repair_space>list<seq2seq4repair_space>of<seq2seq4repair_space>repos<seq2seq4repair_space>for<seq2seq4repair_space>a<seq2seq4repair_space>user" , required = true ) UserRequest request ) { } @ GET @ Timed @ UnitOfWork @ ApiOperation ( value = "List<seq2seq4repair_space>all<seq2seq4repair_space>docker<seq2seq4repair_space>containers<seq2seq4repair_space>cached<seq2seq4repair_space>in<seq2seq4repair_space>database" , notes = "List<seq2seq4repair_space>docker<seq2seq4repair_space>container<seq2seq4repair_space>repos<seq2seq4repair_space>currently<seq2seq4repair_space>known.<seq2seq4repair_space>" + ( ( "Right<seq2seq4repair_space>now,<seq2seq4repair_space>tokens<seq2seq4repair_space>are<seq2seq4repair_space>used<seq2seq4repair_space>to<seq2seq4repair_space>synchronously<seq2seq4repair_space>talk<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>quay.io<seq2seq4repair_space>API<seq2seq4repair_space>to<seq2seq4repair_space>list<seq2seq4repair_space>repos.<seq2seq4repair_space>" + "Ultimately,<seq2seq4repair_space>we<seq2seq4repair_space>should<seq2seq4repair_space>cache<seq2seq4repair_space>this<seq2seq4repair_space>information<seq2seq4repair_space>and<seq2seq4repair_space>refresh<seq2seq4repair_space>either<seq2seq4repair_space>by<seq2seq4repair_space>user<seq2seq4repair_space>request<seq2seq4repair_space>or<seq2seq4repair_space>by<seq2seq4repair_space>time<seq2seq4repair_space>" ) + "TODO:<seq2seq4repair_space>This<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>properly<seq2seq4repair_space>defined<seq2seq4repair_space>list<seq2seq4repair_space>of<seq2seq4repair_space>objects,<seq2seq4repair_space>it<seq2seq4repair_space>also<seq2seq4repair_space>needs<seq2seq4repair_space>admin<seq2seq4repair_space>authentication" ) , response = Container . class , responseContainer = "List" ) public List < Container > allContainers ( ) { } @ GET @ Timed @ UnitOfWork @ Path ( "//{containerId}" ) @ ApiOperation ( value = "Get<seq2seq4repair_space>a<seq2seq4repair_space>cached<seq2seq4repair_space>repo" , response = Container . class ) public Container getContainer ( @ ApiParam ( value = "Container<seq2seq4repair_space>ID" , required = true ) @ PathParam ( "containerId" ) Long containerId ) { } @ POST @ Timed @ UnitOfWork @ Path ( "//register" ) @ ApiOperation ( value = "Register<seq2seq4repair_space>a<seq2seq4repair_space>container" , notes = "Register<seq2seq4repair_space>a<seq2seq4repair_space>container<seq2seq4repair_space>(public<seq2seq4repair_space>or<seq2seq4repair_space>private).<seq2seq4repair_space>Assumes<seq2seq4repair_space>that<seq2seq4repair_space>user<seq2seq4repair_space>is<seq2seq4repair_space>using<seq2seq4repair_space>quay.io<seq2seq4repair_space>and<seq2seq4repair_space>github.<seq2seq4repair_space>Include<seq2seq4repair_space>quay.io<seq2seq4repair_space>in<seq2seq4repair_space>path<seq2seq4repair_space>if<seq2seq4repair_space>using<seq2seq4repair_space>quay.io" , response = Container . class ) public Container register ( @ QueryParam ( "repository" ) String path , @ QueryParam ( "enduser_id" ) Long userId ) { } @ DELETE @ UnitOfWork @ Path ( "//unregister//{containerId}" ) @ ApiOperation ( value = "Deletes<seq2seq4repair_space>a<seq2seq4repair_space>container" , hidden = true ) public Container unregister ( @ ApiParam ( value = "Container<seq2seq4repair_space>id<seq2seq4repair_space>to<seq2seq4repair_space>delete" , required = true ) @ PathParam ( "containerId" ) Long containerId ) { } @ GET @ Timed @ UnitOfWork @ Path ( "//allRegistered//{userId}" ) @ ApiOperation ( value = "List<seq2seq4repair_space>all<seq2seq4repair_space>registered<seq2seq4repair_space>containers<seq2seq4repair_space>from<seq2seq4repair_space>a<seq2seq4repair_space>user" , notes = "Get<seq2seq4repair_space>user's<seq2seq4repair_space>registered<seq2seq4repair_space>containers<seq2seq4repair_space>only" , response = Container . class , responseContainer = "List" ) public List < Container > userRegisteredContainers ( @ ApiParam ( value = "User<seq2seq4repair_space>ID" , required = true ) @ PathParam ( "userId" ) Long userId ) { } @ GET @ Timed @ UnitOfWork @ Path ( "allRegistered" ) @ ApiOperation ( value = "List<seq2seq4repair_space>all<seq2seq4repair_space>registered<seq2seq4repair_space>containers.<seq2seq4repair_space>This<seq2seq4repair_space>would<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>minimal<seq2seq4repair_space>resource<seq2seq4repair_space>that<seq2seq4repair_space>would<seq2seq4repair_space>need<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>implemented<seq2seq4repair_space>" + "by<seq2seq4repair_space>a<seq2seq4repair_space>GA4GH<seq2seq4repair_space>reference<seq2seq4repair_space>server" , tags = { "GA4GH" , "container" } , notes = "" , response = Container . class , responseContainer = "List" ) public List < Container > allRegisteredContainers ( ) { } @ GET @ Timed @ UnitOfWork @ Path ( "registered" ) @ ApiOperation ( value = "Get<seq2seq4repair_space>a<seq2seq4repair_space>registered<seq2seq4repair_space>container" , notes = "Lists<seq2seq4repair_space>info<seq2seq4repair_space>of<seq2seq4repair_space>container.<seq2seq4repair_space>Enter<seq2seq4repair_space>full<seq2seq4repair_space>path<seq2seq4repair_space>(include<seq2seq4repair_space>quay.io<seq2seq4repair_space>in<seq2seq4repair_space>path)" , response = Container . class ) public Container getRegisteredContainer ( @ QueryParam ( "repository" ) String repo ) { <START_BUG> Container repository = containerDAO . findByPath ( repo ) ; <END_BUG> return repository ; } @ PUT @ Timed @ UnitOfWork @ Path ( "//shareWithUser" ) @ ApiOperation ( value = "User<seq2seq4repair_space>shares<seq2seq4repair_space>a<seq2seq4repair_space>container<seq2seq4repair_space>with<seq2seq4repair_space>a<seq2seq4repair_space>chosen<seq2seq4repair_space>user" , notes = "Needs<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>fleshed<seq2seq4repair_space>out." , hidden = true ) public void shareWithUser ( @ QueryParam ( "container_id" ) Long containerId , @ QueryParam ( "user_id" ) Long userId ) { } @ PUT @ Timed @ UnitOfWork @ Path ( "//shareWithGroup" ) @ ApiOperation ( value = "User<seq2seq4repair_space>shares<seq2seq4repair_space>a<seq2seq4repair_space>container<seq2seq4repair_space>with<seq2seq4repair_space>a<seq2seq4repair_space>chosen<seq2seq4repair_space>group" , notes = "Needs<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>fleshed<seq2seq4repair_space>out." , hidden = true ) public void shareWithGroup ( @ QueryParam ( "container_id" ) Long containerId , @ QueryParam ( "group_id" ) Long groupId ) { } @ GET @ Timed @ UnitOfWork @ Path ( "//getRepo//{userId}//{repository}" ) @ ApiOperation ( value = "Fetch<seq2seq4repair_space>repo<seq2seq4repair_space>from<seq2seq4repair_space>quay.io" , response = String . class , hidden = true ) public String getRepo ( @ ApiParam ( "The<seq2seq4repair_space>full<seq2seq4repair_space>path<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>repository.<seq2seq4repair_space>e.g.<seq2seq4repair_space>namespace//name" ) @ PathParam ( "repository" ) String repo , @ ApiParam ( "user<seq2seq4repair_space>id" ) @ PathParam ( "userId" ) long userId ) { } @ GET @ Timed @ UnitOfWork @ Path ( "//builds" ) @ ApiOperation ( value = "Get<seq2seq4repair_space>the<seq2seq4repair_space>list<seq2seq4repair_space>of<seq2seq4repair_space>repository<seq2seq4repair_space>builds." , notes = "For<seq2seq4repair_space>TESTING<seq2seq4repair_space>purposes.<seq2seq4repair_space>Also<seq2seq4repair_space>useful<seq2seq4repair_space>for<seq2seq4repair_space>getting<seq2seq4repair_space>more<seq2seq4repair_space>information<seq2seq4repair_space>about<seq2seq4repair_space>the<seq2seq4repair_space>repository.\n<seq2seq4repair_space>Enter<seq2seq4repair_space>full<seq2seq4repair_space>path<seq2seq4repair_space>without<seq2seq4repair_space>quay.io" , response = String . class , hidden = true ) public String builds ( @ QueryParam ( "repository" ) String repo , @ QueryParam ( "userId" ) long userId ) { } @ GET @ Timed @ UnitOfWork @ Path ( "//search" ) @ ApiOperation ( value = "Search<seq2seq4repair_space>for<seq2seq4repair_space>matching<seq2seq4repair_space>registered<seq2seq4repair_space>containers." + "<seq2seq4repair_space>This<seq2seq4repair_space>would<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>minimal<seq2seq4repair_space>resource<seq2seq4repair_space>that<seq2seq4repair_space>would<seq2seq4repair_space>need<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>implemented<seq2seq4repair_space>by<seq2seq4repair_space>a<seq2seq4repair_space>GA4GH<seq2seq4repair_space>reference<seq2seq4repair_space>server" , notes = "Search<seq2seq4repair_space>on<seq2seq4repair_space>the<seq2seq4repair_space>name<seq2seq4repair_space>(full<seq2seq4repair_space>path<seq2seq4repair_space>name)<seq2seq4repair_space>and<seq2seq4repair_space>description." , response = Container . class , responseContainer = "List" , tags = { "GA4GH" , "container" } ) public List < Container > search ( @ QueryParam ( "pattern" ) String word ) { } @ GET @ Timed @ UnitOfWork @ Path ( "//tags" ) @ ApiOperation ( value = "List<seq2seq4repair_space>the<seq2seq4repair_space>tags<seq2seq4repair_space>for<seq2seq4repair_space>a<seq2seq4repair_space>registered<seq2seq4repair_space>container" , response = Tag . class , responseContainer = "List" , hidden = true ) public List < Tag > tags ( @ QueryParam ( "containerId" ) long containerId ) { } @ GET @ Timed @ UnitOfWork @ Path ( "//collab" ) @ ApiOperation ( value = "Get<seq2seq4repair_space>the<seq2seq4repair_space>corresponding<seq2seq4repair_space>collab.cwl<seq2seq4repair_space>file<seq2seq4repair_space>on<seq2seq4repair_space>Github" , notes = "Enter<seq2seq4repair_space>full<seq2seq4repair_space>path<seq2seq4repair_space>of<seq2seq4repair_space>container<seq2seq4repair_space>(add<seq2seq4repair_space>quay.io<seq2seq4repair_space>if<seq2seq4repair_space>using<seq2seq4repair_space>quay.io)" , response = DockerRepoResource . Collab . class ) public DockerRepoResource . Collab collab ( @ QueryParam ( "repository" ) String repository ) { } private static class QuayUser { private String username ; public void setUsername ( String username ) { }

Fix:
Container repository = containerDAO . findRegisteredByPath ( repo ) ;