Package org.sonar.api.utils

Examples of org.sonar.api.utils.SonarException


    subscribeTo(CHECKED_TYPES);
    if (!Strings.isNullOrEmpty(regularExpression)) {
      try {
        pattern = Pattern.compile(regularExpression, Pattern.DOTALL);
      } catch (RuntimeException e) {
        throw new SonarException("Unable to compile regular expression: " + regularExpression, e);
      }
    }
  }
View Full Code Here


  public void visitFile(AstNode astNode) {
    List<String> lines;
    try {
      lines = Files.readLines(getContext().getFile(), charset);
    } catch (IOException e) {
      throw new SonarException(e);
    }
    int nr= 0;
    for (String line : lines) {
      nr++;
      String[] sub = line.split("^\\s*#define\\s+", 2);
View Full Code Here

  public void visitFile(AstNode astNode) {
    List<String> lines;
    try {
      lines = Files.readLines(getContext().getFile(), charset);
    } catch (IOException e) {
      throw new SonarException(e);
    }

    if (!matches(expectedLines, lines)) {
      getContext().createFileViolation(this, "Add or update the header of this file.");
    }
View Full Code Here

  public void visitFile(AstNode astNode) {
    List<String> lines;
    try {
      lines = Files.readLines(getContext().getFile(), charset);
    } catch (IOException e) {
      throw new SonarException(e);
    }
    for (String line : lines) {
      if (line.contains("\t")) {
        getContext().createFileViolation(this, "Replace all tab characters in this file by sequences of white-spaces.");
        break;
View Full Code Here

      String msg = new StringBuilder()
          .append("Cannot feed the data into sonar, details: '")
          .append(e)
          .append("'")
          .toString();
      throw new SonarException(msg, e);
    }
  }
View Full Code Here

    if (!Strings.isNullOrEmpty(regEx)) {
      try {
        reg = Pattern.compile(regEx).matcher("");
      } catch (RuntimeException e) {
        throw new SonarException("Unable to compile regular expression: " + regEx, e);
      }
    }
    subscribeTo(CxxGrammarImpl.LITERAL);
  }
View Full Code Here

    if (!Strings.isNullOrEmpty(regEx)) {
      try {
        IP = Pattern.compile(regEx).matcher("");
      } catch (RuntimeException e) {
        throw new SonarException("Unable to compile regular expression: " + regEx, e);
      }
    }
    subscribeTo(CxxGrammarImpl.LITERAL);
  }
View Full Code Here

    if (!Strings.isNullOrEmpty(regEx)) {
      try {
        pattern = Pattern.compile(regEx, Pattern.DOTALL);
      } catch (RuntimeException e) {
        throw new SonarException("Unable to compile regular expression: " + regEx, e);
      }
    }
  }
View Full Code Here

  public void init() {
    if (!Strings.isNullOrEmpty(regularExpression)) {
      try {
        pattern = Pattern.compile(regularExpression, Pattern.DOTALL);
      } catch (RuntimeException e) {
        throw new SonarException("Unable to compile regular expression: " + regularExpression, e);
      }
    }
  }
View Full Code Here

  public void visitFile(AstNode astNode) {
    List<String> lines;
    try {
      lines = Files.readLines(getContext().getFile(), charset);
    } catch (IOException e) {
      throw new SonarException(e);
    }
    for (int i = 0; i < lines.size(); i++) {
      String line = lines.get(i);
      if (pattern.matcher(line).find()) {
        getContext().createLineViolation(this, "Do not use relative path for #include directive.", i + 1);
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.