List of usage examples for org.apache.commons.lang3 StringUtils isBlank
public static boolean isBlank(final CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false
From source file:ch.cyberduck.core.googledrive.DriveUrlProvider.java
@Override public DescriptiveUrlBag toUrl(Path file) { final DescriptiveUrlBag list = new DescriptiveUrlBag(); if (file.isFile()) { try {/*from w w w. ja v a 2 s.c o m*/ if (StringUtils.isBlank(file.attributes().getVersionId())) { return DescriptiveUrlBag.empty(); } final File f = session.getClient().files().get(file.attributes().getVersionId()).execute(); if (StringUtils.isNotBlank(f.getWebContentLink())) { list.add(new DescriptiveUrl(URI.create(f.getWebContentLink()), DescriptiveUrl.Type.http, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), "HTTP"))); } if (StringUtils.isNotBlank(f.getWebViewLink())) { list.add(new DescriptiveUrl(URI.create(f.getWebViewLink()), DescriptiveUrl.Type.http, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), "Download"))); } } catch (IOException e) { new DriveExceptionMappingService().map(e); } } return list; }
From source file:com.cisco.oss.foundation.logging.converters.FoundationLoggingCompNamePatternConverter.java
public static String getComponentName() { String compName = System.getenv("_RPM_SOFTWARE_NAME"); if (StringUtils.isBlank(compName)) { compName = System.getProperty("app.name"); }//from w w w . ja v a 2 s . c o m if (StringUtils.isBlank(compName)) { compName = "UNKNOWN"; } return compName; }
From source file:com.qcadoo.model.api.IntegerUtils.java
/** * Parse integer value from string.//from ww w. j av a 2 s .co m * * @param stringValue * value to be parsed * @return parsed integer number or null if given string is empty or blank * @throws NumberFormatException * if given string does not represent correct number. */ public static Integer parse(final String stringValue) { if (StringUtils.isBlank(stringValue)) { return null; } return Integer.parseInt(StringUtils.trim(stringValue)); }
From source file:com.axibase.tsd.util.AtsdUtil.java
public static void check(String value, String errorMessage) { if (StringUtils.isBlank(value)) { throw new IllegalArgumentException(errorMessage); }/*ww w. ja v a 2s . c o m*/ }
From source file:com.esofthead.mycollab.vaadin.web.ui.field.UrlLinkViewField.java
@Override protected Component initContent() { if (StringUtils.isBlank(url)) { Label lbl = new Label(" "); lbl.setContentMode(ContentMode.HTML); return lbl; } else {//from w w w . j av a 2s. c o m final Link link = new Link(url, new ExternalResource(url)); link.setTargetName("_blank"); return link; } }
From source file:com.netsteadfast.greenstep.sys.SysQueryParamInspectUtils.java
public static List<String> getFields(String systemId, String progId, String actionMethodName) throws Exception { if (StringUtils.isBlank(systemId) || StringUtils.isBlank(progId) || StringUtils.isBlank(actionMethodName)) { throw new IllegalArgumentException("Query parameter inspact config id error."); }// www . j av a2 s. com List<String> fields = null; String key = systemId + KEY_SP_STR + progId + KEY_SP_STR + actionMethodName; String configValue = null; if (StringUtils.isBlank((configValue = getConfigParamMap().get(key)))) { return fields; } String tmp[] = configValue.split(VALUE_SP_STR); if (tmp == null || tmp.length < 1) { return fields; } fields = new ArrayList<String>(); for (String fieldName : tmp) { if (fieldName.trim().length() < 1) { continue; } fields.add(fieldName.trim()); } return fields; }
From source file:ch.citux.td.util.Log.java
public static void e(String tag, Exception exception) { if (exception != null && !StringUtils.isBlank(exception.getMessage())) { if (BuildConfig.DEBUG) { exception.printStackTrace(); } else {/*ww w .ja v a 2 s .com*/ android.util.Log.e(tag, exception.getMessage()); } } }
From source file:com.netsteadfast.greenstep.action.utils.SysProgUrlFieldCheckUtils.java
@Override public boolean check(String value) throws ControllerException { if (StringUtils.isBlank(value)) { return true; }/*from w w w . j av a 2s . c om*/ if (value.indexOf(Constants._COMMON_LOAD_FORM_ACTION) > -1 && value.indexOf("form_id") > -1 && value.indexOf("form_method") > -1) { // common form return true; } boolean f = false; for (String str : _STRs) { if (value.endsWith(str)) { f = true; } } return f; /* return ( value.endsWith(Constants._S2_ACTION_EXTENSION) || value.toLowerCase().endsWith(".htm") || value.toLowerCase().endsWith(".html") || value.endsWith(".jsp") ); */ }
From source file:ch.cyberduck.ui.comparator.ExtensionComparator.java
@Override protected int compareFirst(final Path p1, final Path p2) { if (p1.isDirectory() && p2.isDirectory()) { return 0; }/*from w w w . ja va2 s .co m*/ if (p1.isFile() && p2.isFile()) { if (StringUtils.isBlank(p1.getExtension()) && StringUtils.isBlank(p2.getExtension())) { return 0; } if (StringUtils.isBlank(p1.getExtension())) { return -1; } if (StringUtils.isBlank(p2.getExtension())) { return 1; } if (ascending) { return impl.compare(p1.getExtension(), p2.getExtension()); } return -impl.compare(p1.getExtension(), p2.getExtension()); } if (p1.isFile()) { return ascending ? 1 : -1; } return ascending ? -1 : 1; }