Package org.sonar.api.utils

Examples of org.sonar.api.utils.SonarException


    assertThat(client.getLastRefreshDate()).isNull();
  }

  @Test
  public void ignore_connection_errors() {
    when(reader.readString(any(URI.class), eq(Charsets.UTF_8))).thenThrow(new SonarException());
    assertThat(client.getUpdateCenter()).isNull();
  }
View Full Code Here


  private String decode(String val) {
    if (val != null) {
      try {
        val = URLDecoder.decode(val, CharEncoding.UTF_8);
      } catch (UnsupportedEncodingException e) {
        throw new SonarException("Decoding chart parameter : " + val, e);
      }
    }
    return val;
  }
View Full Code Here

      param.setDefaultValue(propertyAnnotation.defaultValue());
      if (!StringUtils.isBlank(propertyAnnotation.type())) {
        try {
          param.setType(PropertyType.valueOf(propertyAnnotation.type().trim()).name());
        } catch (IllegalArgumentException e) {
          throw new SonarException("Invalid property type [" + propertyAnnotation.type() + "]", e);
        }
      } else {
        param.setType(guessType(field.getType()).name());
      }
    }
View Full Code Here

    try {
      reader = new InputStreamReader(FileUtils.openInputStream(file), CharEncoding.UTF_8);
      return parse(reader);

    } catch (IOException e) {
      throw new SonarException("Fail to load the file: " + file, e);

    } finally {
      Closeables.closeQuietly(reader);
    }
  }
View Full Code Here

    try {
      reader = new InputStreamReader(input, CharEncoding.UTF_8);
      return parse(reader);

    } catch (IOException e) {
      throw new SonarException("Fail to load the xml stream", e);

    } finally {
      Closeables.closeQuietly(reader);
    }
  }
View Full Code Here

        processRule(rule, rulesC);
      }
      return rules;

    } catch (XMLStreamException e) {
      throw new SonarException("XML is not valid", e);
    }
  }
View Full Code Here

      } else if (StringUtils.equalsIgnoreCase("tag", nodeName)) {
        tags.add(StringUtils.trim(cursor.collectDescendantText(false)));
      }
    }
    if (Strings.isNullOrEmpty(rule.getKey())) {
      throw new SonarException("Node <key> is missing in <rule>");
    }
    rule.setTags(tags.toArray(new String[tags.size()]));
  }
View Full Code Here

      } else if (StringUtils.equalsIgnoreCase("defaultValue", propNodeName)) {
        param.setDefaultValue(propText);
      }
    }
    if (Strings.isNullOrEmpty(param.getKey())) {
      throw new SonarException("Node <key> is missing in <param>");
    }
  }
View Full Code Here

    }

    if (type.matches(".\\[.+\\]")) {
      return type;
    }
    throw new SonarException("Invalid property type [" + type + "]");
  }
View Full Code Here

  protected void install(DefaultPluginMetadata metadata, @Nullable File pluginBasedir, File deployedPlugin) {
    try {
      metadata.addDeployedFile(deployedPlugin);
      copyDependencies(metadata, deployedPlugin, pluginBasedir);
    } catch (IOException e) {
      throw new SonarException(FAIL_TO_INSTALL_PLUGIN + metadata, 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.