Package org.sonar.server.exceptions

Examples of org.sonar.server.exceptions.NotFoundException


  }

  private ResourceDto findProject(String projectKey) {
    ResourceDto resourceDto = resourceDao.getResource(ResourceQuery.create().setKey(projectKey));
    if (resourceDto == null) {
      throw new NotFoundException("Project " + projectKey + " does not exists.");
    }
    return resourceDto;
  }
View Full Code Here


    DbSession session = dbClient.openSession(false);
    try {
      dbClient.componentDao().getByKey(session, fileKey);
      List<String> lines = sourceService.getLinesAsTxt(session, fileKey);
      if (lines == null) {
        throw new NotFoundException("File '" + fileKey + "' does not exist");
      }
      IOUtils.writeLines(lines, "\n", response.stream().output(), Charsets.UTF_8);
    } catch (IOException e) {
      throw new IllegalStateException("Fail to write raw source of file " + fileKey, e);
    } finally {
View Full Code Here

  }

  private IssueFilterDto findIssueFilterDto(Long id, String login) {
    IssueFilterDto issueFilterDto = filterDao.selectById(id);
    if (issueFilterDto == null) {
      throw new NotFoundException("Filter not found: " + id);
    }
    verifyCurrentUserCanReadFilter(issueFilterDto.toIssueFilter(), login);
    return issueFilterDto;
  }
View Full Code Here

  }

  @Test
  public void show_unknown_filter() throws Exception {
    MockUserSession session = MockUserSession.set().setLogin("eric").setUserId(123).setGlobalPermissions("none");
    when(service.find(42L, session)).thenThrow(new NotFoundException("Filter 42 does not exist"));

    try {
      tester.newGetRequest("api/issue_filters", "show").setParam("id", "42").execute();
      fail();
    } catch (NotFoundException e) {
View Full Code Here

TOP

Related Classes of org.sonar.server.exceptions.NotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.