List of usage examples for org.apache.commons.lang StringUtils trim
public static String trim(String str)
Removes control characters (char <= 32) from both ends of this String, handling null
by returning null
.
From source file:cppsensor.sonar.CppProjectAnalysisHandler.java
private String[] getStringArrayBySeparator(String value, String separator) { if (value != null) { String[] strings = StringUtils.splitByWholeSeparator(value, separator); String[] result = new String[strings.length]; for (int index = 0; index < strings.length; index++) { result[index] = StringUtils.trim(strings[index]); }/*from w w w. ja v a 2 s . com*/ return result; } return ArrayUtils.EMPTY_STRING_ARRAY; }
From source file:com.echosource.ada.core.AdaFile.java
/** * The default constructor. aPackageName * /*from w ww . j a va2s . co m*/ * @param className * String representing the class name * @param isUnitTest * String representing the unit test * @param aPackageName * the a package name */ public AdaFile(String packageKey, String className, String extension, boolean isUnitTest) { LOG.debug( "aPackageName=[" + packageKey + "], className=[" + className + "], unitTest=[" + isUnitTest + "]"); if (className == null) { throw new IllegalArgumentException("Php filename can not be null"); } if (className.indexOf('$') > 0) { throw new IllegalArgumentException("Php inner classes are not supported yet : " + className); } this.filename = StringUtils.trim(className); String key; if (StringUtils.isBlank(packageKey)) { this.packageKey = AdaDirectory.DEFAULT_PACKAGE_NAME; this.longName = this.filename; key = new StringBuilder().append(this.filename).append(extension).toString(); } else { this.packageKey = packageKey.trim(); this.longName = new StringBuilder().append(this.packageKey).append(PACKAGE_SEPARATOR) .append(this.filename).toString(); key = new StringBuilder().append(this.packageKey).append(PACKAGE_SEPARATOR).append(this.filename) .append(extension).toString(); } setKey(key); this.unitTest = isUnitTest; }
From source file:com.carlos.projects.billing.ExcelToMySQLImporter.java
private Component createComponent(Row row, Family family) { Component component = new Component(); component.setCode(StringUtils.trim(row.getCell(COMPONENT_CODE).getStringCellValue())); component.setDescription(StringUtils.trim(row.getCell(COMPONENT_DESCRIPTION).getStringCellValue())); component.setDiscount1(row.getCell(COMPONENT_DISCOUNT_1).getNumericCellValue()); component.setDiscount2(row.getCell(COMPONENT_DISCOUNT_2).getNumericCellValue()); component.setPrice(row.getCell(COMPONENT_PRICE).getNumericCellValue()); component.setFamily(family);//from ww w . j ava 2 s . c om return component; }
From source file:com.bstek.dorado.data.config.ConfigurableDataConfigManager.java
/** * ??// w w w.j av a 2 s.c om * * @param configLocations * ???String?? */ public void addConfigLocations(List<String> configLocations) { if (this.configLocations == null) { this.configLocations = new ArrayList<String>(); } for (String location : configLocations) { this.configLocations.add(StringUtils.trim(location)); } configLocationArray = null; }
From source file:com.dianping.lion.service.impl.ConfigServiceImpl.java
@Override public List<ConfigVo> findConfigVos(ConfigCriteria criteria) { int projectId = criteria.getProjectId(); int envId = criteria.getEnvId(); HasValueEnum hasValue = EnumUtils.fromEnumProperty(HasValueEnum.class, "value", criteria.getHasValue()); List<Config> configs = configDao.findConfigByProject(projectId); List<ConfigVo> configVos = new ArrayList<ConfigVo>(configs.size()); if (!configs.isEmpty()) { List<Integer> hasInstanceConfigs = configDao.findHasInstanceConfigs(projectId, envId); List<Integer> hasContextInstConfigs = configDao.findHasContextInstConfigs(projectId, envId); Map<Integer, ConfigInstance> defaultInsts = configDao.findDefaultInstances(projectId, envId); List<Integer> hasReferencedConfigs = isSharedProject(projectId) ? configDao.getProjectHasReferencedConfigs(projectId) : Collections.<Integer>emptyList(); for (Config config : configs) { //????? String key = StringUtils.trim(criteria.getKey()); String value = StringUtils.trim(criteria.getValue()); ConfigInstance defaultInst = defaultInsts.get(config.getId()); if ((StringUtils.isEmpty(key) || config.getKey().contains(key)) && (hasValue == HasValueEnum.All || (hasValue == HasValueEnum.Yes && defaultInst != null) || (hasValue == HasValueEnum.No && defaultInst == null)) && (StringUtils.isEmpty(value) || (defaultInst != null && defaultInst.getValue().contains(value)))) { configVos.add(new ConfigVo(config, hasInstanceConfigs.contains(config.getId()), hasContextInstConfigs.contains(config.getId()), hasReferencedConfigs.contains(config.getId()), defaultInst)); }/*from w w w . j a va2 s . co m*/ } } return configVos; }
From source file:com.naver.jr.study.bo.sesame.SesameBOImpl.java
@Override public SesameContents replaceVideoId(SesameContents sesameContents) throws SQLException, IOException, SAXException { if (sesameContents == null) { return sesameContents; }/*from w w w .ja v a 2 s . co m*/ if (StringUtils.equals(sesameContents.getContentType(), "vod")) { if (StringUtils.equals(JrCommonUtil.getMobileDevice(), "iphone")) { String vid = sesameContents.getContent(); sesameContents.setContent(videoRemoteBO.getVideoId(vid, "270P_480_500_64_1")); } sesameContents.setInKey(JrCommonUtil.createInKey(StringUtils.trim(sesameContents.getContent()))); } return sesameContents; }
From source file:com.haulmont.cuba.core.app.FoldersServiceBean.java
protected <T> T runScript(String script, Binding binding) { script = StringUtils.trim(script); if (script.endsWith(".groovy")) { script = resources.getResourceAsString(script); }/*w w w . j av a 2 s .c om*/ Object result = scripting.evaluateGroovy(script, binding); //noinspection unchecked return (T) result; }
From source file:hydrograph.ui.expression.editor.datastructure.MethodDetails.java
public String createDefaultPlaceHolder(IMethod iMethod, String className) throws JavaModelException { StringBuffer buffer = new StringBuffer(); buffer.append(className + Constants.DOT); buffer.append(iMethod.getElementName() + Constants.OPENING_BRACKET); if (iMethod.getParameterNames() != null && iMethod.getParameterNames() != null) for (int index = 0; index < iMethod.getParameterNames().length; index++) { buffer.append(iMethod.getParameterNames()[index]); if (index != iMethod.getParameterTypes().length - 1) { buffer.append(Constants.COMMA + SWT.SPACE); }/* w ww. j ava2 s . co m*/ } buffer.append(Constants.CLOSING_BRACKET); return StringUtils.trim(buffer.toString()); }
From source file:jp.ikedam.jenkins.plugins.ldap_sasl.SearchUserDnResolver.java
/** * Constructor instantiating with parameters in the configuration page. * // w w w . j av a 2s. com * When instantiating from the saved configuration, * the object is directly serialized with XStream, * and no constructor is used. * * @param searchBase the base DN to search for the user. * @param searchQueryTemplate the query to execute in which the place to put the username is {0}. */ @DataBoundConstructor public SearchUserDnResolver(String searchBase, String searchQueryTemplate) { this.searchBase = StringUtils.trim(searchBase); this.searchQueryTemplate = StringUtils.trim(searchQueryTemplate); }
From source file:ch.systemsx.cisd.openbis.generic.client.web.server.UploadServiceServlet.java
private static List<String> extractSessionKeys(final HttpServletRequest request, final String sessionKeysNumberParameter) throws ServletException { List<String> sessionKeys = new ArrayList<String>(); for (int i = 0; i < Integer.parseInt(sessionKeysNumberParameter); i++) { String sessionKey = StringUtils.trim(request.getParameter("sessionKey_" + i)); if (StringUtils.isBlank(sessionKey)) { throw new ServletException( "No field 'sessionKey_" + i + "' could be found in the transmitted form."); }/*from www . ja v a 2s . com*/ sessionKeys.add(sessionKey); } return sessionKeys; }