List of usage examples for org.apache.commons.lang3 StringUtils isEmpty
public static boolean isEmpty(final CharSequence cs)
Checks if a CharSequence is empty ("") or null.
StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = false
NOTE: This method changed in Lang version 2.0.
From source file:com.opensymphony.xwork2.config.ConfigurationUtil.java
/** * Splits the string into a list using a comma as the token separator. * @param parent The comma separated string. * @return A list of tokens from the specified string. *//*from w w w .j ava 2s. com*/ public static List<String> buildParentListFromString(String parent) { if (StringUtils.isEmpty(parent)) { return Collections.emptyList(); } StringTokenizer tokenizer = new StringTokenizer(parent, ","); List<String> parents = new ArrayList<>(); while (tokenizer.hasMoreTokens()) { String parentName = tokenizer.nextToken().trim(); if (StringUtils.isNotEmpty(parentName)) { parents.add(parentName); } } return parents; }
From source file:com.zeroro.paypal.classic.ipn.IPNMessageParser.java
public IPNMessageParser(String ipnMessage) { nvp = new HashMap<>(); if (!StringUtils.isEmpty(ipnMessage)) { String[] pairs = ipnMessage.split("&"); for (String pair : pairs) { String[] keyValue = pair.split("=", 2); // match only the first = try { nvp.put(URLDecoder.decode(keyValue[0], "UTF-8"), URLDecoder.decode(keyValue[1], "UTF-8")); } catch (UnsupportedEncodingException e) { // will never happen as UTF-8 is supported logger.error("encoding ipn message error", e); }// w w w . j a v a2 s . com } } }
From source file:com.ankang.report.main.ReportCabinet.java
public static Class matchModule(String serviceAlias) { if (StringUtils.isEmpty(serviceAlias)) { throw new ReportException("????"); }/*from w w w . jav a2 s . c o m*/ ExecuteMethod em = matchExecuteMethod(serviceAlias); if (null == em) { throw new ReportException("???"); } return em.getClazz(); }
From source file:info.archinnov.achilles.internals.codecs.ProtocolVersionCodec.java
@Override public ProtocolVersion decode(String fromCassandra) throws AchillesTranscodingException { if (StringUtils.isEmpty(fromCassandra)) { return null; } else {//from www .j av a 2s .c o m return ProtocolVersion.valueOf(fromCassandra); } }
From source file:ke.alphacba.cms.core.util.NoSessionIdUtils.java
public static BaseResp writeCookie(HttpSession session, HttpServletRequest request, HttpServletResponse response, String loginCookieName, String domain, int cookieTime) { BaseResp baseResp = new BaseResp(); String jsessionId = (String) session.getAttribute("jsessionId"); try {/*www .j ava 2 s .c o m*/ Cookie[] cookies = request.getCookies(); if (cookies == null) { baseResp.setErrorNo(ErrorNoConstants.ERR_COM_ERRORINFO, "??"); return baseResp; } boolean flag = false; boolean httpOnly = true; for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(loginCookieName)) { if (StringUtils.isEmpty(cookies[i].getValue())) { writeCookie(response, loginCookieName, domain, cookieTime, jsessionId, httpOnly); } flag = true; } } if (!flag) { writeCookie(response, loginCookieName, domain, cookieTime, jsessionId, httpOnly); } } catch (Exception e) { log.error("write cookie store error !", e); } return baseResp; }
From source file:com.arcanix.php.phar.FilePharEntryProvider.java
public FilePharEntryProvider(final File file, final String localPath, final PharCompression pharCompression) throws FileNotFoundException { if (file == null) { throw new IllegalArgumentException("File cannot be null"); }//from www . j av a 2 s .c o m if (!file.isFile()) { throw new IllegalArgumentException("File must be a valid file and cannot be a directory"); } if (StringUtils.isEmpty(localPath)) { throw new IllegalArgumentException("Local path cannot be empty"); } if (pharCompression == null) { throw new IllegalArgumentException("Phar compression cannot be null"); } this.file = file; this.localPath = localPath; this.pharCompression = pharCompression; }
From source file:com.thinkbiganalytics.policy.standardization.DefaultValueStandardizer.java
@Override public String convertValue(String value) { return (StringUtils.isEmpty(value) ? defaultStr : value); }
From source file:com.github.rvesse.airline.parser.resources.HomeDirectoryLocator.java
@Override protected String resolve(String searchLocation) { // Apply parent resolve() first as this strips off any file:// prefix searchLocation = super.resolve(searchLocation); // Find the home directory since we will potentially use this to resolve // the special ~/ alias File homeDir;/*ww w . ja v a2s. c om*/ if (!StringUtils.isEmpty(System.getProperty("user.home"))) { homeDir = new File(System.getProperty("user.home")); } else { // Can't resolve as no home directory available return searchLocation; } // Expand ~/ or ~\ alias (platform dependent) if (searchLocation.startsWith("~" + File.separator)) { // Remember we need to ensure there is a separator between the home // directory and the rest of the path searchLocation = homeDir.getAbsolutePath() + searchLocation.substring(homeDir.getAbsolutePath().endsWith(File.separator) ? 2 : 1); } return searchLocation; }
From source file:com.uimirror.core.framework.rest.auth.Token.java
public Token(String token, String paraphrase) { if (StringUtils.isEmpty(token)) { throw new IllegalArgumentException("AccessToken Can't be empty"); }//from w w w. ja v a 2s. c om this.token = token; this.paraphrase = paraphrase; }
From source file:com.webbfontaine.valuewebb.action.tt.TtLogger.java
/** * Adds new entry to log list of TT based on user entered message saved in 'log' variable * * @return empty string//from w w w. ja v a 2 s . co m */ public String addUserLog() { TtGen ttGen = TtGenHome.getComponentInstance(false).getInstance(); if (!StringUtils.isEmpty(ttGen.getLog())) { TtLog ttLog = new TtLog(new Date(), Actor.instance().getId(), null, ttGen.getLog(), CHAT_MESSAGE, ttGen); persistLog(ttLog); reloadLogs(ttLog); ttGen.setLog(null); } return ""; }