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:jp.ikedam.jenkins.plugins.updatesitesmanager.DescribedUpdateSiteWrapper.java

/**
 * Constructor for new UpdateSite/* w ww .  ja v a  2s .  c om*/
 * 
 * @param id
 * @param url
 */
@DataBoundConstructor
public DescribedUpdateSiteWrapper(String id, String url) {
    super(null, null);
    this.updateSite = new UpdateSite(StringUtils.trim(id), StringUtils.trim(url));
}

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

@DataBoundConstructor
public SvServiceSelectionModel(SelectionType selectionType, String service, String projectPath,
        String projectPassword) {
    Validate.notNull(selectionType, "SelectionType must be specified");
    this.selectionType = selectionType;
    this.service = StringUtils.trim(service);
    this.projectPath = StringUtils.trim(projectPath);
    this.projectPassword = Secret.fromString(projectPassword);
}

From source file:de.snertlab.xdccBee.irc.DccMessageParser.java

private static String delete_control_codes(String packetName) {
    String s = packetName;//from   w w w. ja v  a2  s. com
    s = s.replaceAll("\\002|\\003(\\d{1,2})?(,\\d{1,2})?|\\x0F|\\x16|\\x1F", "");
    s = StringUtils.trim(s);
    return s;
}

From source file:ch.entwine.weblounge.taglib.content.ElementValueIteratorTag.java

/**
 * Sets the element to iterate over.
 * 
 * @param value
 *          the element name
 */
public void setElement(String value) {
    elementName = StringUtils.trim(value);
}

From source file:com.openteach.diamond.rpc.protocol.AbstractRPCProtocolFactory.java

/**
 * //from   w w w.j av  a2s  . co m
 * @param properties
 * @return
 */
protected RPCProtocolConfiguration properties2Configuration(Properties properties) {
    RPCProtocolConfiguration configuration = new RPCProtocolConfiguration();
    String value = properties.getProperty("network.max.sessionPreHost");
    if (StringUtils.isNotBlank(value)) {
        configuration.setMaxSessionPreHost(Integer.valueOf(StringUtils.trim(value)));
    }
    return configuration;
}

From source file:ch.entwine.weblounge.taglib.content.PropertyValueIteratorTag.java

/**
 * Sets the property to iterate over.
 * 
 * @param value
 *          the property name
 */
public void setProperty(String value) {
    propertyName = StringUtils.trim(value);
}

From source file:com.npower.dm.setup.task.TacItemParser.java

private String trim(String s) {
    return StringUtils.trim(StringUtils.strip(s, "\"';"));
}

From source file:com.bstek.dorado.view.loader.PackagesConfigPackageParser.java

@Override
@SuppressWarnings("unchecked")
protected Object doParse(Node node, ParseContext context) throws Exception {
    Element element = (Element) node;
    String name = element.getAttribute("name");
    Assert.notEmpty(name);//from  w  w w .j ava 2s .  co  m

    Package pkg;
    PackagesConfig packagesConfig = ((PackagesConfigParseContext) context).getPackagesConfig();
    Map<String, Package> packages = packagesConfig.getPackages();
    pkg = packages.get(name);
    if (pkg == null) {
        pkg = new Package(name);
        packages.put(name, pkg);
    }

    Map<String, Object> properties = parseProperties(element, context);
    if (!properties.containsKey("fileNames")) {
        Object value = parseProperty("fileNames", element, context);
        if (value != null && value != ConfigUtils.IGNORE_VALUE) {
            properties.put("fileNames", value);
        }
    }

    String fileNamesText = StringUtils.trim((String) properties.remove("fileNames"));
    fileNamesText = StringUtils.defaultIfEmpty(fileNamesText, NONE_FILE);
    String[] oldFileNames = pkg.getFileNames();
    String[] newFileNames = fileNamesText.split(",");
    if (oldFileNames != null && oldFileNames.length > 0) {
        newFileNames = (String[]) ArrayUtils.addAll(oldFileNames, newFileNames);
    }
    pkg.setFileNames(newFileNames);

    String dependsText = (String) properties.remove("depends");
    if (StringUtils.isNotEmpty(dependsText)) {
        String[] dependsArray = dependsText.split(",");
        for (String depends : dependsArray) {
            pkg.getDepends().add(depends);
        }
    }

    String dependedByText = (String) properties.remove("dependedBy");
    if (StringUtils.isNotEmpty(dependedByText)) {
        String[] dependedByArray = dependedByText.split(",");
        for (String dependedBy : dependedByArray) {
            pkg.getDependedBy().add(dependedBy);
        }
    }

    String clientTypeText = (String) properties.remove("clientType");
    if (StringUtils.isNotEmpty(clientTypeText)) {
        pkg.setClientType(ClientType.parseClientTypes(clientTypeText));
    }

    ((Map<String, Object>) new BeanMap(pkg)).putAll(properties);
    return pkg;
}

From source file:fr.paris.lutece.plugins.genericattributes.util.GenericAttributesUtils.java

/**
 * Return the field which title is specified in parameter
 * @param strTitle the title//  w w  w  .  j a v  a 2s .  co m
 * @param listFields the list of fields
 * @return the field which title is specified in parameter
 */
public static Field findFieldByTitleInTheList(String strTitle, List<Field> listFields) {
    if ((listFields == null) || listFields.isEmpty()) {
        return null;
    }

    for (Field field : listFields) {
        if (StringUtils.isNotBlank(strTitle)) {
            if (StringUtils.equals(StringUtils.trim(strTitle), StringUtils.trim(field.getTitle()))) {
                return field;
            }
        } else if (StringUtils.isBlank(field.getTitle())) {
            return field;
        }
    }

    return null;
}

From source file:gov.nih.nci.cabig.caaers.esb.client.impl.CaaersCaXchangeMessageBroadcastServiceImpl.java

/**
 * Will route the request to the C3PR CaXchangeMessageBroadCaster
 *///from w w  w .j  a va 2 s.c  o m
public void broadcast(String message) throws gov.nih.nci.cabig.caaers.esb.client.BroadcastException {

    try {
        CaXchangeMessageBroadcasterImpl broadCaster = new CaXchangeMessageBroadcasterImpl();
        String iHubURL = Configuration.LAST_LOADED_CONFIGURATION.get(Configuration.CAEXCHANGE_URL);
        log.info("ca exchage URL + " + iHubURL);
        iHubURL = StringUtils.trim(iHubURL);
        broadCaster.setCaXchangeURL(iHubURL);
        broadCaster.setMessageTypesMapping(messageTypesMapping);
        broadCaster.setDelegatedCredentialProvider(delegatedCredentialProvider);
        broadCaster.setMessageResponseHandlers(new CaXchangeMessageResponseHandlerSet());
        broadCaster.broadcast(message);
        log.info("Broadcasted the message to PSC( url :" + broadCaster.getCaXchangeURL() + ")");
    } catch (Throwable e) {
        log.error("Error while broadcasting the message to PSC", e);
        throw new gov.nih.nci.cabig.caaers.esb.client.BroadcastException(e);
    }
}