Package org.sonar.api.utils

Examples of org.sonar.api.utils.SonarException


  }

  public void reportResourceModification(String resourceKey) {
    ResourceDto rootProject = resourceDao.getRootProjectByComponentKey(resourceKey);
    if (rootProject == null) {
      throw new SonarException("Unable to find root project for component with [key=" + resourceKey + "]");
    }
    propertiesDao.setProperty(new PropertyDto().setKey(SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY).setResourceId(rootProject.getId())
      .setValue(String.valueOf(System.currentTimeMillis())));
  }
View Full Code Here


      watch.stop(message);

      return dbFile;

    } catch (SQLException e) {
      throw new SonarException("Unable to create database for DryRun", e);
    }

  }
View Full Code Here

      File dir = new File(basedir, path);
      FileUtils.forceMkdir(dir);
      return dir;

    } catch (IOException e) {
      throw new SonarException(e);
    }
  }
View Full Code Here

  private void handleException(int readTimeout, String projectKey, SonarException e) {
    Throwable rootCause = Throwables.getRootCause(e);
    if (rootCause instanceof SocketTimeoutException) {
      // Pico will unwrap the first runtime exception
      throw new SonarException(new SonarException(String.format("Preview database read timed out after %s ms. You can try to increase read timeout with property -D"
        + CoreProperties.PREVIEW_READ_TIMEOUT_SEC + " (in seconds)",
        readTimeout), e));
    }
    if (projectKey != null && (rootCause instanceof HttpException) && (((HttpException) rootCause).getResponseCode() == 401)) {
      // Pico will unwrap the first runtime exception
      throw new SonarException(new SonarException(String.format("You don't have access rights to project [%s]", projectKey), e));
    }
  }
View Full Code Here

        urls.add(file.toURI().toURL());
      }
      return new URLClassLoader(urls.toArray(new URL[urls.size()]), null);

    } catch (MalformedURLException e) {
      throw new SonarException("Fail to create the project classloader. Classpath element is unvalid.", e);
    }
  }
View Full Code Here

          files.add(outputDirectoryFile);
        }
      }
      return files;
    } catch (DependencyResolutionRequiredException e) {
      throw new SonarException("Fail to create the project classloader", e);
    }
  }
View Full Code Here

      appendHeader(profile, writer);
      appendRules(profile, writer);
      appendFooter(writer);

    } catch (IOException e) {
      throw new SonarException("Fail to export the profile " + profile, e);
    }
  }
View Full Code Here

      } else if (field.getType().equals(Boolean.class)) {
        field.set(check, Boolean.parseBoolean(value));

      } else {
        throw new SonarException("The type of the field " + field + " is not supported: " + field.getType());
      }
    } catch (IllegalAccessException e) {
      throw new SonarException("Can not set the value of the field " + field + " in the class: " + check.getClass().getName(), e);
    }
  }
View Full Code Here

        result = loadTemplateFromAbsolutePath();
      }
      return result;

    } catch (IOException e) {
      throw new SonarException("Can not read the file " + getTemplatePath(), e);
    }
  }
View Full Code Here

          classLoader = initClassloader(jdbcDriver);
        }
      } catch (SonarException e) {
        throw e;
      } catch (Exception e) {
        throw new SonarException("Fail to install JDBC driver", 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.