List of usage examples for org.apache.commons.lang StringUtils isNotBlank
public static boolean isNotBlank(String str)
Checks if a String is not empty (""), not null and not whitespace only.
From source file:bazaar4idea.command.BzrErrorUtil.java
static boolean isAuthorizationRequiredAbort(BzrAbstractResult result) { String line = getLastErrorLine(result); return StringUtils.isNotBlank(line) && (StringUtils.contains(line, "authorization required") || StringUtils.contains(line, "authorization failed")); }
From source file:com.swtxml.util.parser.KeyValueParser.java
public static Map<String, String> parse(String value, Strictness strictness) { Map<String, String> values = new HashMap<String, String>(); for (String valuePair : VALUE_SPLITTER.split(value)) { if (StringUtils.isNotBlank(valuePair)) { String[] keyValue = KEY_VALUE_SPLITTER.split(valuePair); if (keyValue.length != 2) { if (strictness == Strictness.STRICT) { throw new ParseException("Invalid format: \"" + valuePair + "\" "); } else { if (keyValue.length == 1) { keyValue = new String[] { keyValue[0], "" }; }/*from ww w .j a v a 2s. c om*/ } } values.put(keyValue[0].trim(), keyValue[1].trim()); } } return values; }
From source file:com.junly.common.enums.HttpChannelType.java
/** * // w w w .j a va 2 s . c o m * * @param code * @return */ public static HttpChannelType getEnumByCode(String code) { if (StringUtils.isNotBlank(code)) { for (HttpChannelType activitie : HttpChannelType.values()) { if (StringUtils.equals(code, activitie.getCode())) { return activitie; } } } return null; }
From source file:com.smartitengineering.util.bean.ResourceFactory.java
public static Resource getResource(final String resource) { if (StringUtils.isNotBlank(resource) && resource.startsWith(PropertiesLocator.CLASSPATH_RESOURCE_PREFIX)) { return new ClasspathResource(resource); } else if (StringUtils.isNotBlank(resource)) { return new FileSystemResource(resource); }/*from w w w. ja v a 2 s . c o m*/ return null; }
From source file:com.googlecode.jtiger.modules.ecside.filter.ExportFilterUtils.java
public static boolean isExported(WebContext context) { return StringUtils.isNotBlank(getTableId(context)); }
From source file:com.opengamma.web.bundle.BundleType.java
/** * Lookup the type using the file suffix. * // w w w .j a va 2s. c o m * @param fileName the file name including the suffix, null returns null * @return the bundle type, null if unable to determine */ public static BundleType getType(final String fileName) { if (StringUtils.isNotBlank(fileName)) { if (fileName.toLowerCase().endsWith("." + JS.getSuffix())) { return JS; } else if (fileName.toLowerCase().endsWith("." + CSS.getSuffix())) { return CSS; } } return null; }
From source file:com.digitalpebble.storm.crawler.protocol.AbstractHttpProtocol.java
protected static String getAgentString(String agentName, String agentVersion, String agentDesc, String agentURL, String agentEmail) {// w ww . j a v a 2 s . c o m StringBuffer buf = new StringBuffer(); buf.append(agentName); if (StringUtils.isNotBlank(agentVersion)) { buf.append("/"); buf.append(agentVersion); } boolean hasAgentDesc = StringUtils.isNotBlank(agentDesc); boolean hasAgentURL = StringUtils.isNotBlank(agentURL); boolean hasAgentEmail = StringUtils.isNotBlank(agentEmail); if (hasAgentDesc || hasAgentEmail || hasAgentURL) { buf.append(" ("); if (hasAgentDesc) { buf.append(agentDesc); if (hasAgentURL || hasAgentEmail) buf.append("; "); } if (hasAgentURL) { buf.append(agentURL); if (hasAgentEmail) buf.append("; "); } if (hasAgentEmail) { buf.append(agentEmail); } buf.append(")"); } return buf.toString(); }
From source file:com.mobileman.projecth.web.util.NumUtils.java
public static Double convert2double(String str) { try {/* w w w . jav a 2 s. c om*/ if (StringUtils.isNotBlank(str)) { return Double.parseDouble(str.replace(',', '.')); } } catch (Exception ex) { } return null; }
From source file:com.haulmont.cuba.web.toolkit.FileUploadTypesHelper.java
public static String convertToMIME(String types, String originSeparator, String separator) { return StringUtils.isNotBlank(types) ? convertToMIME(types.split(originSeparator), separator) : null; }
From source file:com.codestudio.dorm.web.util.PartyAuthUtil.java
/** * ???null//from w w w. j av a2 s . c o m * * @param request * @param response * @return */ public static Party getPartyInfo(HttpServletRequest request, HttpServletResponse response) { Party party = null; UserCookieManager userCookieManager = new UserCookieManager(request, response, null, "/"); String partyId = userCookieManager.getTempCookie(UserCookieManager.PARTY_ID, null); if (StringUtils.isNotBlank(partyId)) { party = new Party(); party.setId(Long.valueOf(partyId)); party.setPartyNum(userCookieManager.getTempCookie(UserCookieManager.PARTY_NUM, null)); } return party; }