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:de.iteratec.iteraplan.model.InformationSystemInterface.java
public void setName(String stringToSet) { if (stringToSet == null) { name = ""; } else {/*from w w w . j a v a 2 s . c om*/ this.name = StringUtils.trim(StringUtil.removeIllegalXMLChars(stringToSet)); } }
From source file:jp.ikedam.jenkins.plugins.viewcopy_builder.ViewcopyBuilder.java
/** * Constructor to instantiate from parameters in the job configuration page. * /*from w ww . j ava 2 s .c o m*/ * When instantiating from the saved configuration, * the object is directly serialized with XStream, * and no constructor is used. * * @param fromViewName a name of a view to be copied from. may contains variable expressions. * @param toViewName a name of a view to be copied to. may contains variable expressions. * @param overwrite whether to overwrite if the view to be copied to is already existing. * @param viewcopyOperationList * the list of operations to be performed when copying. */ @DataBoundConstructor public ViewcopyBuilder(String fromViewName, String toViewName, boolean overwrite, List<ViewcopyOperation> viewcopyOperationList) { this.fromViewName = StringUtils.trim(fromViewName); this.toViewName = StringUtils.trim(toViewName); this.overwrite = overwrite; this.viewcopyOperationList = viewcopyOperationList; }
From source file:com.intuit.tank.project.Request.java
public String getSimplePath() { return StringUtils.trim(simplePath); }
From source file:io.cloudslang.orchestrator.services.ExecutionStateServiceImpl.java
private void validateBranchId(String branchId) { Validate.notEmpty(StringUtils.trim(branchId), "branchId cannot be null or empty"); }
From source file:jp.ikedam.jenkins.plugins.jobcopy_builder.JobcopyBuilder.java
/** * Constructor to instantiate from parameters in the job configuration page. * //from w w w . j av a 2s . c o m * When instantiating from the saved configuration, * the object is directly serialized with XStream, * and no constructor is used. * * @param fromJobName a name of a job to be copied from. may contains variable expressions. * @param toJobName a name of a job to be copied to. may contains variable expressions. * @param overwrite whether to overwrite if the job to be copied to is already existing. * @param jobcopyOperationList * the list of operations to be performed when copying. * @param additionalFilesetList * the list of sets of files to copy additional to JOBNAME/config.xml. */ @DataBoundConstructor public JobcopyBuilder(String fromJobName, String toJobName, boolean overwrite, List<JobcopyOperation> jobcopyOperationList, List<AdditionalFileset> additionalFilesetList) { this.fromJobName = StringUtils.trim(fromJobName); this.toJobName = StringUtils.trim(toJobName); this.overwrite = overwrite; this.jobcopyOperationList = jobcopyOperationList; this.additionalFilesetList = additionalFilesetList; }
From source file:com.intuit.tank.project.Request.java
public String getHostname() { return StringUtils.trim(hostname); }
From source file:gov.va.med.pharmacy.peps.presentation.common.displaytag.DefaultHssfExportView.java
/** * escapeColumnValue// w w w . ja va2s .c o m * @param rawValue unmodified text * @return String with html/xml removed */ protected String escapeColumnValue(Object rawValue) { if (rawValue == null) { return null; } String returnString = ObjectUtils.toString(rawValue); // Extract text try { returnString = extractText(returnString); } catch (IOException e) { LOG.warn(e.getLocalizedMessage()); } // escape the String to get the tabs, returns, newline explicit as \t \r \n returnString = StringEscapeUtils.escapeJava(StringUtils.trimToEmpty(returnString)); // remove tabs, insert four whitespaces instead returnString = StringUtils.replace(StringUtils.trim(returnString), "\\t", " "); // remove the return, only newline valid in excel returnString = StringUtils.replace(StringUtils.trim(returnString), "\\r", " "); // unescape so that \n gets back to newline returnString = StringEscapeUtils.unescapeJava(returnString); return returnString; }
From source file:com.edgenius.core.Global.java
public static void syncTo(GlobalSetting setting) { setting.setDefaultDirection(Global.DefaultDirection); setting.setDefaultLanguage(Global.DefaultLanguage); setting.setDefaultCountry(Global.DefaultCountry); setting.setDefaultTimeZone(Global.DefaultTimeZone); setting.setDefaultLoginKey(Global.DefaultLoginKey); setting.setHostProtocol(Global.SysHostProtocol); if (StringUtils.indexOf(Global.SysHostAddress, ':') != -1) { String[] addr = StringUtils.split(Global.SysHostAddress, ':'); setting.setHostName(addr[0]);//from w w w. j a v a 2 s .c o m setting.setHostPort(Integer.parseInt(addr[1])); } else { setting.setHostName(Global.SysHostAddress); if (Global.SysHostProtocol != null && Global.SysHostProtocol.startsWith("https:")) setting.setHostPort(443); else setting.setHostPort(80); } setting.setPublicSearchEngineAllow(Global.PublicSearchEngineAllow); setting.setContextPath(StringUtils.trim(Global.SysContextPath)); setting.setEncryptAlgorithm(Global.PasswordEncodingAlgorithm); setting.setEncryptPassword(Global.EncryptPassword); setting.setSpaceQuota(Global.SpaceQuota); setting.setDelayRemoveSpaceHours(Global.DelayRemoveSpaceHours); setting.setEnableAdminPermControl(Global.EnableAdminPermControl); setting.setDelayOfflineSyncMinutes(Global.DelayOfflineSyncMinutes); setting.setRegisterMethod(Global.registerMethod); setting.setMaintainJobCron(Global.MaintainJobCron); setting.setCommentsNotifierCron(Global.CommentsNotifierCron); setting.setMaxCommentsNotifyPerDay(Global.MaxCommentsNotifyPerDay); setting.setAutoFixLinks(Global.AutoFixLinks); setting.setDefaultNotifyMail(Global.DefaultNotifyMail); setting.setCcToSystemAdmin(Global.ccToSystemAdmin); setting.setDefaultReceiverMailAddress(Global.DefaultReceiverMail); setting.setSystemTitle(Global.SystemTitle); setting.setAdsense(enable(Global.ADSENSE)); setting.setTextnut(enable(Global.TEXTNUT)); setting.setSkin(Global.Skin); setting.setWebservice(enable(Global.webServiceEnabled)); setting.setWebserviceAuthenticaton( StringUtils.isBlank(Global.webServiceAuth) ? "basic" : Global.webServiceAuth); setting.setRestservice(enable(Global.restServiceEnabled)); setting.setRestserviceAuthenticaton( StringUtils.isBlank(Global.restServiceAuth) ? "basic" : Global.restServiceAuth); setting.setDetectLocaleFromRequest(Global.DetectLocaleFromRequest); setting.setVersionCheck(Global.VersionCheck); setting.setVersionCheckCron(Global.VersionCheckCron); setting.setPurgeDaysOldActivityLog(Global.PurgeDaysOldActivityLog); //convert suppress value to names StringBuffer supStr = new StringBuffer(); if (Global.suppress > 0) { for (SUPPRESS sup : SUPPRESS.values()) { if ((sup.getValue() & Global.suppress) > 0) { supStr.append(sup.name()).append(","); } } if (supStr.length() > 0) { supStr.deleteCharAt(supStr.length() - 1); } } setting.setSuppress(supStr.toString()); setting.setTwitterOauthConsumerKey(Global.TwitterOauthConsumerKey); setting.setTwitterOauthConsumerSecret(Global.TwitterOauthConsumerSecret); }
From source file:com.hangum.tadpole.rdb.core.dialog.export.SQLToStringDialog.java
private void sqlToStr() { String variable = textVariable.getText(); if (StringUtils.trim(variable).equals("")) { variable = SQLToJavaConvert.DEFAULT_VARIABLE; textVariable.setText(variable);//from w w w . j av a2 s . com } StringBuffer sbStr = new StringBuffer(); String[] sqls = parseSQL(); SQLToLanguageConvert slt = new SQLToLanguageConvert( (EditorDefine.SQL_TO_APPLICATION) comboLanguageType.getData(comboLanguageType.getText())); for (int i = 0; i < sqls.length; i++) { if ("".equals(StringUtils.trimToEmpty(sqls[i]))) continue; if (i == 0) sbStr.append(slt.sqlToString(variable, sqls[i])); else sbStr.append(slt.sqlToString(variable + i, sqls[i])); // ? . sbStr.append("\r\n"); } textConvert.setText(sbStr.toString()); }
From source file:com.smartitengineering.events.async.api.impl.akka.decorator.ActorFactory.java
protected final Module getGuiceModule(final String moduleClassStr, final Properties properties) throws IllegalArgumentException, IllegalStateException { Module module = null;/*from w ww . j av a2 s.co m*/ final Class clazz; try { clazz = Class.forName(StringUtils.trim(moduleClassStr), true, Thread.currentThread().getContextClassLoader()); } catch (ClassNotFoundException ex) { throw new IllegalStateException(ex); } if (!Module.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException("Specified class not instance of Module"); } Class<? extends Module> moduleClass = clazz; boolean foundConstructor = false; Constructor<? extends Module> defaultContructor; try { defaultContructor = moduleClass.getConstructor(); module = defaultContructor.newInstance(); foundConstructor = true; } catch (InstantiationException ex) { throw new IllegalStateException(ex); } catch (IllegalAccessException ex) { throw new IllegalStateException(ex); } catch (InvocationTargetException ex) { throw new IllegalStateException(ex); } catch (NoSuchMethodException ex) { } catch (SecurityException ex) { } if (!foundConstructor) { try { defaultContructor = moduleClass.getConstructor(Properties.class); module = defaultContructor.newInstance(properties); foundConstructor = true; } catch (InstantiationException ex) { throw new IllegalStateException(ex); } catch (IllegalAccessException ex) { throw new IllegalStateException(ex); } catch (InvocationTargetException ex) { throw new IllegalStateException(ex); } catch (NoSuchMethodException ex) { } catch (SecurityException ex) { } } if (!foundConstructor) { throw new IllegalStateException("No supported contructors found - no args and with a properties obj!"); } return module; }