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

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

Introduction

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

Prototype

public static String trim(String str) 

Source Link

Document

Removes control characters (char <= 32) from both ends of this String, handling null by returning null.

Usage

From source file:eu.uqasar.message.error.ErrorReportMessage.java

@Override
protected Object getDataModel() {
    Map<String, Object> defaultModel = super.getDefaultModel();
    defaultModel.put("report", StringUtils.trim(getReport()));
    defaultModel.put("reporter", StringUtils.trim(getReporter()));
    defaultModel.put("errormessage", StringUtils.trim(getErrorMessage()));
    defaultModel.put("stacktrace", StringUtils.trim(getStacktrace()));
    defaultModel.put("markup", StringUtils.trim(getMarkup()));
    return defaultModel;
}

From source file:com.echosource.ada.core.AdaDirectory.java

/**
 * Instantiates a new php package.
 * 
 * @param key
 *          the key
 */
public AdaDirectory(String key) {
    setKey(StringUtils.defaultIfEmpty(StringUtils.trim(key), DEFAULT_PACKAGE_NAME));
}

From source file:com.hp.application.automation.tools.model.SvServerSettingsModel.java

@DataBoundConstructor
public SvServerSettingsModel(String name, String url, String username, Secret password) {
    this.name = StringUtils.trim(name);
    this.url = StringUtils.trim(url);
    this.username = username;
    this.password = password;
}

From source file:com.incapture.slate.model.node.WrapperNode.java

@Override
public String getContent() {
    StringBuilder sb = new StringBuilder();
    for (Node node : nodes) {
        sb.append(node.getContent()).append("\n");
    }/*from www .j  a  v  a 2  s .  c om*/
    return StringUtils.trim(sb.toString());
}

From source file:com.hp.application.automation.tools.model.SvExportModel.java

@DataBoundConstructor
public SvExportModel(String serverName, boolean force, String targetDirectory, boolean cleanTargetDirectory,
        SvServiceSelectionModel serviceSelection, boolean switchToStandByFirst) {
    super(serverName, force, serviceSelection);
    this.targetDirectory = StringUtils.trim(targetDirectory);
    this.cleanTargetDirectory = cleanTargetDirectory;
    this.switchToStandByFirst = switchToStandByFirst;
}

From source file:gemlite.core.internal.domain.utilClass.DBDataSource.java

public final String getString(String name) {
    String str = "";
    try {//from   w w w .j  a  va2  s  .  c o  m
        str = StringUtils.trim(rs.getString(name));
    } catch (SQLException e) {
        LogUtil.getCoreLog().error(name, e);
    }
    return str;
}

From source file:com.hangum.tadpole.rdb.core.editors.main.utils.plan.CubridExecutePlanUtils.java

/**
 * cubrid execute plan//from  www. ja  v a  2s .  c  o  m
 * 
 * @param userDB
 * @param reqQuery
 * @return
 * @throws Exception
 */
public static String plan(UserDBDAO userDB, final RequestQuery reqQuery) throws Exception {
    String sql = reqQuery.getSql();
    if (!sql.toLowerCase().startsWith("select")) {
        logger.error("[cubrid execute plan ]" + sql);
        throw new Exception("This statment not select. please check.");
    }
    Connection conn = null;
    ResultSet rs = null;
    PreparedStatement pstmt = null;

    try {
        conn = TadpoleSQLManager.getInstance(userDB).getDataSource().getConnection();
        conn.setAutoCommit(false); //     auto commit? false  .

        sql = StringUtils.trim(sql).substring(6);
        if (logger.isDebugEnabled())
            logger.debug("[qubrid modifying query]" + sql);
        sql = "select " + RECOMPILE + sql;

        pstmt = conn.prepareStatement(sql);
        if (reqQuery.getSqlStatementType() == SQL_STATEMENT_TYPE.PREPARED_STATEMENT) {
            final Object[] statementParameter = reqQuery.getStatementParameter();
            for (int i = 1; i <= statementParameter.length; i++) {
                pstmt.setObject(i, statementParameter[i - 1]);
            }
        }
        ((CUBRIDStatement) pstmt).setQueryInfo(true);
        rs = pstmt.executeQuery();

        String plan = ((CUBRIDStatement) pstmt).getQueryplan(); //  ?    .
        if (logger.isDebugEnabled())
            logger.debug("cubrid plan text : " + plan);

        return plan;
    } finally {
        if (rs != null)
            rs.close();
        if (pstmt != null)
            pstmt.close();
        if (conn != null)
            conn.close();
    }
}

From source file:com.github.restdriver.serverdriver.http.Header.java

/**
 * Creates a new header instance.//from  w  w  w  .j a v a  2 s .  com
 * 
 * @param nameAndValue The name and value as "name: value".
 */
public Header(String nameAndValue) {

    String[] parts = nameAndValue.split(":", 2);

    if (parts.length != 2) {
        throw new IllegalArgumentException("Single-argument Header must be 'name: value'");
    }

    name = StringUtils.trim(parts[0]);
    value = StringUtils.trim(parts[1]);
}

From source file:com.thistech.spotlink.model.BasicTrackingEvents.java

@Override
public TrackingEvents addEventUrl(String event, String url) {
    if (StringUtils.isNotBlank(event) && StringUtils.isNotBlank(url)) {
        getEventUrls().put(StringUtils.lowerCase(event), StringUtils.trim(url));
    }//from   w  w  w. j a  va  2  s. c om
    return this;
}

From source file:com.adobe.acs.tools.csv_asset_importer.impl.Column.java

public Column(final String raw, final int index) {
    this.index = index;
    this.raw = StringUtils.trim(raw);

    String paramsStr = StringUtils.substringBetween(raw, "{{", "}}");
    String[] params = StringUtils.split(paramsStr, ":");

    if (StringUtils.isBlank(paramsStr)) {
        this.relPropertyPath = this.getRaw();
    } else {// w  w  w . jav  a  2 s.  c  om
        this.relPropertyPath = StringUtils.trim(StringUtils.substringBefore(this.getRaw(), "{{"));

        if (params.length == 2) {
            this.dataType = nameToClass(StringUtils.stripToEmpty(params[0]));
            this.multi = StringUtils.equalsIgnoreCase(StringUtils.stripToEmpty(params[1]), MULTI);
        }

        if (params.length == 1) {
            if (StringUtils.equalsIgnoreCase(MULTI, StringUtils.stripToEmpty(params[0]))) {
                this.multi = true;
            } else {
                this.dataType = nameToClass(StringUtils.stripToEmpty(params[0]));
            }
        }
    }

    if (StringUtils.contains(this.relPropertyPath, "/")) {
        this.propertyName = StringUtils.trim(StringUtils.substringAfterLast(this.relPropertyPath, "/"));
    } else {
        this.propertyName = StringUtils.trim(this.relPropertyPath);
    }

}