Example usage for org.apache.commons.lang StringUtils replaceChars

List of usage examples for org.apache.commons.lang StringUtils replaceChars

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils replaceChars.

Prototype

public static String replaceChars(String str, String searchChars, String replaceChars) 

Source Link

Document

Replaces multiple characters in a String in one go.

Usage

From source file:org.sonar.core.hash.SourceLinesHashesComputer.java

private String computeHash(String line) {
    String reducedLine = StringUtils.replaceChars(line, "\t ", "");
    if (reducedLine.isEmpty()) {
        return "";
    }//ww  w .ja va2  s . c om
    return Hex.encodeHexString(md5Digest.digest(reducedLine.getBytes(UTF_8)));
}

From source file:org.sonar.core.issue.tracking.LineHashSequence.java

private static String hash(String line) {
    String reducedLine = StringUtils.replaceChars(line, "\t ", "");
    if (reducedLine.isEmpty()) {
        return "";
    }//from  w  ww .j a v  a2s .c  o  m
    return DigestUtils.md5Hex(reducedLine);
}

From source file:org.sonar.core.measure.MeasureFilterSql.java

private void appendResourceKeyCondition(StringBuilder sb) {
    if (StringUtils.isNotBlank(filter.getResourceKeyRegexp())) {
        sb.append(" AND UPPER(p.kee) LIKE '");
        // limitation : special characters _ and % are not escaped
        String regexp = StringEscapeUtils.escapeSql(filter.getResourceKeyRegexp());
        regexp = StringUtils.replaceChars(regexp, '*', '%');
        regexp = StringUtils.replaceChars(regexp, '?', '_');
        sb.append(StringUtils.upperCase(regexp)).append("'");
    }/*from w w w.  j  a  v a 2  s . c o  m*/
}

From source file:org.sonar.core.persistence.DbTester.java

public DbTester schema(Class baseClass, String filename) {
    String path = StringUtils.replaceChars(baseClass.getCanonicalName(), '.', '/');
    schemaPath = path + "/" + filename;
    return this;
}

From source file:org.sonar.core.persistence.TestDatabase.java

public TestDatabase schema(Class baseClass, String filename) {
    String path = StringUtils.replaceChars(baseClass.getCanonicalName(), '.', '/');
    schemaPath = path + "/" + filename;
    return this;
}

From source file:org.sonar.db.CoreDbTester.java

public static CoreDbTester createForSchema(Class testClass, String filename) {
    String path = StringUtils.replaceChars(testClass.getCanonicalName(), '.', '/');
    String schemaPath = path + "/" + filename;
    return new CoreDbTester(schemaPath);
}

From source file:org.sonar.db.CoreDbTester.java

public static CoreDbTester createEmpty() {
    String path = StringUtils.replaceChars(CoreDbTester.class.getCanonicalName(), '.', '/');
    String schemaPath = path + "/empty.sql";
    return new CoreDbTester(schemaPath);
}

From source file:org.sonar.db.DbTester.java

public static DbTester createForSchema(System2 system2, Class testClass, String filename) {
    String path = StringUtils.replaceChars(testClass.getCanonicalName(), '.', '/');
    String schemaPath = path + "/" + filename;
    return new DbTester(system2, schemaPath).setDisableDefaultOrganization(true);
}

From source file:org.sonar.db.profiling.SqlLogFormatter.java

public static String formatSql(String sql) {
    return StringUtils.replaceChars(sql, '\n', ' ');
}

From source file:org.sonar.db.version.v50.FileSourceDto.java

public static String lineChecksum(String line) {
    String reducedLine = StringUtils.replaceChars(line, SPACE_CHARS, "");
    if (reducedLine.isEmpty()) {
        return "";
    }// w  w w .ja va 2  s  .  c o  m
    return DigestUtils.md5Hex(reducedLine);
}