Package org.sonar.api.utils

Examples of org.sonar.api.utils.SonarException


      connection = dataSource.getConnection();
      statement = connection.createStatement();
      statement.executeUpdate("TRUNCATE TABLE " + table);
    } catch (SQLException e) {
      LOG.error("Fail to truncate table " + table, e);
      throw new SonarException("Fail to truncate table " + table, e);
    } finally {
      DbUtils.closeQuietly(statement);
      DbUtils.closeQuietly(connection);
    }
View Full Code Here


    try {
      connection = dataSource.getConnection();
      DdlUtils.createSchema(connection, dialect);
    } catch (SQLException e) {
      LOG.error("Fail to createSchema local database schema", e);
      throw new SonarException("Fail to createSchema local database schema", e);
    } finally {
      DbUtils.closeQuietly(connection);
    }

    return this;
View Full Code Here

      for (URL url : others) {
        realm.addURL(url);
      }
      return realm;
    } catch (UnsupportedClassVersionError e) {
      throw new SonarException(String.format("The plugin %s is not supported with Java %s", plugin.getKey(),
        SystemUtils.JAVA_VERSION_TRIMMED), e);

    } catch (Exception e) {
      throw new SonarException(String.format("Fail to build the classloader of %s", plugin.getKey()), e);
    }
  }
View Full Code Here

      for (File file : plugin.getDeployedFiles()) {
        base.addURL(file.toURI().toURL());
      }
      return true;
    } catch (UnsupportedClassVersionError e) {
      throw new SonarException(String.format("The plugin %s is not supported with Java %s",
        plugin.getKey(), SystemUtils.JAVA_VERSION_TRIMMED), e);

    } catch (Exception e) {
      throw new SonarException(String.format("Fail to extend the plugin %s for %s",
        plugin.getBasePlugin(), plugin.getKey()), e);
    }
  }
View Full Code Here

          for (String packageName : packages) {
            dep.importFrom(realm.getId(), packageName);
          }
        } catch (NoSuchRealmException e) {
          // should never happen
          throw new SonarException(e);
        }
      }
    }
  }
View Full Code Here

    try {
      Class clazz = get(plugin.getKey()).loadClass(plugin.getMainClass());
      return (Plugin) clazz.newInstance();

    } catch (UnsupportedClassVersionError e) {
      throw new SonarException(String.format("The plugin %s is not supported with Java %s",
        plugin.getKey(), SystemUtils.JAVA_VERSION_TRIMMED), e);

    } catch (Exception e) {
      throw new SonarException(String.format("Fail to load plugin %s", plugin.getKey()), e);
    }
  }
View Full Code Here

  private void createDatasource() {
    try {
      CustomHibernateConnectionProvider.setDatasourceForConfig(database.getDataSource());
    } catch (Exception e) {
      throw new SonarException("Fail to connect to database", e);
    }
  }
View Full Code Here

  String readInputStream(String filePath, InputStream input) {
    String result = null;
    try {
      result = IOUtils.toString(input, "UTF-8");
    } catch (IOException e) {
      throw new SonarException("Fail to load file: " + filePath, e);
    } finally {
      IOUtils.closeQuietly(input);
    }
    return result;
  }
View Full Code Here

  private byte[] fileToByte(File dbFile) {
    try {
      return Files.toByteArray(dbFile);
    } catch (IOException e) {
      throw new SonarException("Unable to create h2 database file", e);
    }
  }
View Full Code Here

      return Long.valueOf(dto.getValue());
    }
    // For modules look for root project last modification timestamp
    ResourceDto rootProject = resourceDao.getRootProjectByComponentId(projectId);
    if (rootProject == null) {
      throw new SonarException("Unable to find root project for project with [id=" + projectId + "]");
    }
    PropertyDto dto = propertiesDao.selectProjectProperty(rootProject.getId(), SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY);
    if (dto == null) {
      return 0;
    }
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.