Package org.sonar.api.utils

Examples of org.sonar.api.utils.SonarException


      Reader reader = null;
      try {
        reader = new InputStreamReader(new FileInputStream(inputFile.file()), fs.encoding());
        statements = statementChunker.chunk(tokenChunker.chunk(reader));
      } catch (FileNotFoundException e) {
        throw new SonarException("Cannot find file " + inputFile.file(), e);
      } finally {
        IOUtils.closeQuietly(reader);
      }

      List<Block> blocks = blockChunker.chunk(resourceEffectiveKey, statements);
View Full Code Here


          clones = executorService.submit(new Task(index, fileBlocks)).get(TIMEOUT, TimeUnit.SECONDS);
        } catch (TimeoutException e) {
          clones = 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);
        }

        save(context, inputFile, clones);
      }
    } finally {
View Full Code Here

    return null;
  }

  private void setMetric(Metric metric) {
    if (metric == null || !metric.isDataType()) {
      throw new SonarException("Metric is null or has unvalid type");
    }
    this.metric = metric;
  }
View Full Code Here

      project.getBuild().setDirectory(pomFile.getParentFile().getPath());
      project.addCompileSourceRoot(pomFile.getParentFile().getPath() + "/src/main/java");
      project.addTestCompileSourceRoot(pomFile.getParentFile().getPath() + "/src/test/java");
      return project;
    } catch (Exception e) {
      throw new SonarException("Failed to read Maven project file : " + pomUrlInClasspath, e);

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

    return NumberUtils.compare(n1.doubleValue(), n2.doubleValue()) >= 0;
  }

  private void setMetric(Metric metric) {
    if (metric == null || !metric.isDataType()) {
      throw new SonarException("Metric is null or has unvalid type");
    }
    this.metric = metric;
  }
View Full Code Here

      } catch (Exception e) {
        String message = String.format("Fail to download the plugin (%s, version %s) from %s (error is : %s)",
          release.getArtifact().getKey(), release.getVersion().getName(), release.getDownloadUrl(), e.getMessage());
        LOG.debug(message, e);
        throw new SonarException(message, e);
      }
    }
  }
View Full Code Here

      email.setStartTLSRequired(true);
      email.setSmtpPort(configuration.getSmtpPort());
    } else if (StringUtils.isBlank(configuration.getSecureConnection())) {
      email.setSmtpPort(configuration.getSmtpPort());
    } else {
      throw new SonarException("Unknown type of SMTP secure connection: " + configuration.getSecureConnection());
    }
  }
View Full Code Here

    String className = settings.getString(CoreProperties.CORE_AUTHENTICATOR_CLASS);
    SecurityRealm selectedRealm = null;
    if (!StringUtils.isEmpty(realmName)) {
      selectedRealm = selectRealm(realms, realmName);
      if (selectedRealm == null) {
        throw new SonarException(String.format(
          "Realm '%s' not found. Please check the property '%s' in conf/sonar.properties", realmName, CoreProperties.CORE_AUTHENTICATOR_REALM));
      }
    }
    if (selectedRealm == null && !StringUtils.isEmpty(className)) {
      LoginPasswordAuthenticator authenticator = selectAuthenticator(authenticators, className);
      if (authenticator == null) {
        throw new SonarException(String.format(
          "Authenticator '%s' not found. Please check the property '%s' in conf/sonar.properties", className, CoreProperties.CORE_AUTHENTICATOR_CLASS));
      }
      selectedRealm = new CompatibilityRealm(authenticator);
    }
    realm = selectedRealm;
View Full Code Here

        logger.info("Security realm started");
      } catch (RuntimeException e) {
        if (ignoreStartupFailure) {
          logger.error("IGNORED - Security realm fails to start: " + e.getMessage());
        } else {
          throw new SonarException("Security realm fails to start: " + e.getMessage(), e);
        }
      }
    }
  }
View Full Code Here

      LOG.info("Starting embedded database on port " + server.getPort() + " with url " + url);
      server.start();

      LOG.info("Embedded database started. Data stored in: " + dbHome.getAbsolutePath());
    } catch (Exception e) {
      throw new SonarException("Unable to start database", e);
    }
  }
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.