Package org.sonar.api.utils

Examples of org.sonar.api.utils.SonarException


      visitor = new FilteringDependencyNodeVisitor(visitor, secondPassFilter);

      root.accept(visitor);

    } catch (DependencyTreeBuilderException e) {
      throw new SonarException("Can not load the graph of dependencies of the project " + project.getKey(), e);
    }
  }
View Full Code Here


        reactor = builder.execute();
      } else {
        reactor = bootstrapper.bootstrap();
      }
      if (reactor == null) {
        throw new SonarException(bootstrapper + " has returned null as ProjectReactor");
      }
      add(reactor);
    }
  }
View Full Code Here

  /**
   * Execute this method to fail the build.
   */
  protected void fail(String message) {
    throw new SonarException(message);
  }
View Full Code Here

    } catch (MessageException e) {
      throw e;

    } catch (Exception e) {
      // SONAR-2278 the resource should not be lost in exception stacktrace.
      throw new SonarException("Fail to decorate '" + resource + "'", e);
    }
  }
View Full Code Here

    }

    validateBranch(validationMessages, branch);

    if (!validationMessages.isEmpty()) {
      throw new SonarException("Validation of project reactor failed:\n  o " + Joiner.on("\n  o ").join(validationMessages));
    }
  }
View Full Code Here

  private void preventAutomaticProjectCreationIfNeeded(ProjectReactor reactor) {
    if (settings.getBoolean(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION)) {
      String projectKey = reactor.getRoot().getKeyWithBranch();
      if (resourceDao.findByKey(projectKey) == null) {
        throw new SonarException(String.format("Unable to scan non-existing project \"%s\"", projectKey));
      }
    }
  }
View Full Code Here

        // This is a new module or previously a library so OK
        return;
      }
      if (rootInDB.getKey().equals(moduleKey)) {
        // SONAR-4245 current subproject is actually a root project in SQ DB
        throw new SonarException(
          String.format("The project '%s' is already defined in SonarQube but not as a module of project '%s'. "
            + "If you really want to stop directly analysing project '%s', please first delete it from SonarQube and then relaunch the analysis of project '%s'.",
            moduleKey, rootProjectKey, moduleKey, rootProjectKey));
      }
      if (!rootProjectKey.equals(rootInDB.getKey())) {
        // SONAR-4692 current subproject is already a subproject in another project
        throw new SonarException(String.format("Module \"%s\" is already part of project \"%s\"", moduleDef.getKey(), rootInDB.getKey()));
      }
    }
  }
View Full Code Here

        logDeserializationIssue();
        alreadyLoggedDeserializationIssue = true;
      }
      return null;
    } catch (IOException e) {
      throw new SonarException(UNABLE_TO_READ_NOTIFICATION, e);

    } catch (ClassNotFoundException e) {
      throw new SonarException(UNABLE_TO_READ_NOTIFICATION, e);
    }
  }
View Full Code Here

      objectOutputStream.writeObject(notification);
      objectOutputStream.close();
      return new NotificationQueueDto().setData(byteArrayOutputStream.toByteArray());

    } catch (IOException e) {
      throw new SonarException("Unable to write notification", e);

    } finally {
      IOUtils.closeQuietly(byteArrayOutputStream);
    }
  }
View Full Code Here

          filtered = Iterables.filter(duplications, minimumTokensPredicate);
        } catch (TimeoutException e) {
          filtered = null;
          LOG.warn("Timeout during detection of duplications for " + inputFile, e);
        } catch (InterruptedException e) {
          throw new SonarException("Fail during detection of duplication for " + inputFile, e);
        } catch (ExecutionException e) {
          throw new SonarException("Fail during detection of duplication for " + inputFile, e);
        }

        JavaCpdEngine.save(context, inputFile, filtered);
      }
    } finally {
View Full Code Here

TOP

Related Classes of org.sonar.api.utils.SonarException

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.