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

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

Introduction

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

Prototype

public static boolean endsWithIgnoreCase(String str, String suffix) 

Source Link

Document

Case insensitive check if a String ends with a specified suffix.

Usage

From source file:com.tesora.dve.sql.util.PortalDBHelperConnectionResource.java

@Override
public ExceptionClassification classifyException(Throwable t) {
    String msg = t.getMessage().trim();
    if (msg == null)
        return null;
    if (StringUtils.endsWithIgnoreCase(msg, "expected exception"))
        return ExceptionClassification.DNE;
    if (StringUtils.containsIgnoreCase(msg, "No such Table:")
            || StringUtils.containsIgnoreCase(msg, "No such Table(s)")
            || StringUtils.containsIgnoreCase(msg, "No such Column:"))
        return ExceptionClassification.DNE;
    if (StringUtils.containsIgnoreCase(msg, "Unsupported statement kind for planning:")
            && StringUtils.endsWithIgnoreCase(msg, "RollbackTransactionStatement"))
        return ExceptionClassification.DNE;
    if (StringUtils.containsIgnoreCase(msg, "Data Truncation:"))
        return ExceptionClassification.OUT_OF_RANGE;
    if (StringUtils.containsIgnoreCase(msg, "ParserException")
            || StringUtils.containsIgnoreCase(msg, "Exception: Unable to build plan")
            || StringUtils.containsIgnoreCase(msg, "Parsing Failed:"))
        return ExceptionClassification.SYNTAX;
    if (StringUtils.containsIgnoreCase(msg, "Duplicate entry"))
        return ExceptionClassification.DUPLICATE;
    // this one should be removed ASAP we know we have a parser error when we get this
    if (StringUtils.containsIgnoreCase(msg, "java.lang.NullPointerException"))
        return ExceptionClassification.SYNTAX;
    return super.classifyException(t);
}

From source file:com.jd.bdp.hydra.hbase.service.impl.HbaseUtils.java

boolean isTopAnntation(Span span) {
    List<Annotation> alist = span.getAnnotations();
    boolean isfirst = false;
    for (Annotation a : alist) {
        if (StringUtils.endsWithIgnoreCase("cs", a.getValue())) {
            isfirst = true;//  w  ww.j  a  v  a 2  s. co m
        }
    }
    return isfirst;
}

From source file:eu.europa.esig.dss.tsl.CurrentTrustService.java

private boolean isCertificateURI(String value) {
    return StringUtils.endsWithIgnoreCase(value, ".crt");
}

From source file:com.jd.bdp.hydra.hbase.service.impl.HbaseUtils.java

Annotation getCsAnnotation(List<Annotation> alist) {
    for (Annotation a : alist) {
        if (StringUtils.endsWithIgnoreCase("cs", a.getValue())) {
            return a;
        }/*from   w w  w  .  java 2s.  co  m*/
    }
    return null;
}

From source file:com.apexxs.neonblack.detection.LocationInspector.java

public List<DetectedLocation> inspectLocations(List<DetectedLocation> locations, String text) {
    for (DetectedLocation loc : locations) {
        String countryCode;/*from  w w w . java  2  s .co m*/
        String stateCode;
        countryCode = isItACountry(loc.name);
        stateCode = isItAState(loc.name);

        if (StringUtils.equals("RGX", loc.detectedBy))
            continue;

        if (!StringUtils.isEmpty(countryCode) && !StringUtils.isEmpty(stateCode)) {
            loc.hints = new ArrayList<>();
            loc.hints.add("(countryCode:" + countryCode + " OR " + "admin1:" + stateCode + ")");
            //continue;
        } else {
            if (!StringUtils.isEmpty(countryCode)) {
                loc.hints = new ArrayList<>();
                loc.hints.add("countryCode:" + countryCode);
                loc.hints.add("featureCode:PCLI");
                loc.countryCode = countryCode;
                for (Integer pos : loc.startPos) {
                    countryPositions.put(pos, countryCode);
                }
            } else if (!StringUtils.isEmpty(stateCode)) {
                loc.hints = new ArrayList<>();
                loc.hints.add(("admin1:" + stateCode));
                loc.countryCode = "US";
                loc.stateCode = stateCode;
                for (Integer pos : loc.startPos) {
                    statePositions.put(pos, stateCode);
                }
            }
        }

        if (loc.hints == null) {
            String hint = anyHints(loc.name);
            if (!StringUtils.isEmpty(hint)) {
                loc.hints = new ArrayList<>();
                loc.hints.add(hint);
                if (StringUtils.endsWithIgnoreCase(loc.name, "province")) {
                    loc.synonym = loc.name.replaceAll("(?i)province", "").trim();
                }
                if (StringUtils.endsWithIgnoreCase(loc.name, "district")) {
                    loc.synonym = loc.name.replaceAll("(?i)district", "").trim();
                }
                if (StringUtils.endsWithIgnoreCase(loc.name, "village")) {
                    loc.synonym = loc.name.replaceAll("(?i)village", "").trim();
                }
            }
        }
    }
    for (DetectedLocation loc : locations) {
        loc = checkProximity(loc);
        loc = checkForBigramType1(loc);
        loc = checkForBigramType2(loc, text);
    }

    return locations;
}

From source file:com.jd.bdp.hydra.hbase.service.impl.HbaseUtils.java

Annotation getCrAnnotation(List<Annotation> alist) {
    for (Annotation a : alist) {
        if (StringUtils.endsWithIgnoreCase("cr", a.getValue())) {
            return a;
        }//from   ww  w.  ja v  a  2 s.c o  m
    }
    return null;
}

From source file:com.streamsets.pipeline.stage.destination.mapreduce.MapreduceUtils.java

@VisibleForTesting
static void addJarsToJob(Configuration conf, boolean allowMultiple, URL[] jarUrls, String... jarPatterns) {

    final List<String> allMatches = new LinkedList<>();
    final List<URL> patternMatches = new LinkedList<>();

    for (String pattern : jarPatterns) {
        if (LOG.isTraceEnabled()) {
            LOG.trace("Looking for pattern {}", pattern);
        }/* w w w. j  a  va 2 s . com*/
        for (URL url : jarUrls) {
            if (LOG.isTraceEnabled()) {
                LOG.trace("Looking in jar {}", url);
            }
            final String file = url.getFile();
            if (StringUtils.endsWithIgnoreCase(file, ".jar") && StringUtils.containsIgnoreCase(file, pattern)) {
                allMatches.add(url.toString());
                patternMatches.add(url);

                if (LOG.isDebugEnabled()) {
                    LOG.debug("Found jar {} for pattern {}", url, pattern);
                }
            }
        }

        if (patternMatches.isEmpty()) {
            throw new IllegalArgumentException(String.format("Did not find any jars for pattern %s", pattern));
        } else if (!allowMultiple && patternMatches.size() > 1) {
            throw new IllegalArgumentException(String.format("Found multiple jars for pattern %s: %s", pattern,
                    StringUtils.join(patternMatches, JAR_SEPARATOR)));
        }
        patternMatches.clear();
    }

    appendJars(conf, allMatches);
}

From source file:net.navasoft.madcoin.backend.services.security.UserDataAccess.java

private String defineKey(String username) {
    if (!username.contains("@") && (!StringUtils.containsIgnoreCase(username, ".org")
            || !StringUtils.containsIgnoreCase(username, ".net")
            || !StringUtils.containsIgnoreCase(username, ".gov")
            || !StringUtils.endsWithIgnoreCase(username, ".com"))) {
        return AccessProperties.USERNAME_QUERY.getConfigKey();
    } else {//  www . ja v a  2 s  .  c om
        return AccessProperties.USERMAIL_QUERY.getConfigKey();
    }
}

From source file:jp.co.tis.gsp.tools.db.beans.Column.java

public void setDataType(String dataType) {
    if (StringUtils.equalsIgnoreCase(dataType, "ARRAY") || StringUtils.endsWithIgnoreCase(dataType, "_ARRAY")) {
        dataType = StringUtils.replace(dataType, "_ARRAY", "");
        if (StringUtils.isEmpty(dataType)) {
            dataType = "VARCHAR";
        }//from  w  w  w .  j a v  a 2 s . c  om
        isArray = true;
    }
    this.dataType = dataType;
}

From source file:hydrograph.ui.perspective.dialog.PreStartActivity.java

private String getSystemJavaHomeValue() {
    String javaHome = System.getenv(JAVA_HOME);
    if (!StringUtils.endsWithIgnoreCase(javaHome, SLASH_BIN))
        javaHome = javaHome + SLASH_BIN;
    return javaHome;
}