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.citux.td.util.Log.java
public static void e(Class caller, String message) { String tag = caller.getSimpleName(); if (!StringUtils.isBlank(message)) { android.util.Log.e(tag, message); }//from w ww. j av a2 s .c om }
From source file:com.axibase.tsd.query.AbstractQueryPart.java
public QueryPart<T> path(String path) { if (StringUtils.isBlank(path)) { throw new IllegalArgumentException("Path element is empty: " + path); }/*from w w w .java 2 s . c om*/ return new Query<T>(path, this); }
From source file:com.hybris.mobile.lib.commerce.helper.UrlHelper.java
/** * Return the webservice Http Address for token calls * * @param context Application-specific resources * @return Formatted String Url for WebService */// ww w .j ava 2s .c o m public static String getWebserviceTokenUrl(Context context, Configuration configuration) { if (configuration == null || StringUtils.isBlank(configuration.getBackendUrl())) { throw new IllegalArgumentException(); } return configuration.getBackendUrl() + context.getString(R.string.path_token); }
From source file:com.nike.vault.client.StaticVaultUrlResolver.java
/** * Explicit constructor for holding a static Vault URL. * * @param vaultUrl Vault URL/*from w ww.j a v a2 s. c o m*/ */ public StaticVaultUrlResolver(final String vaultUrl) { if (StringUtils.isBlank(vaultUrl)) { throw new IllegalArgumentException("Vault URL can not be blank."); } this.vaultUrl = vaultUrl; }
From source file:ca.paullalonde.gocd.sns_plugin.utils.NonBlankField.java
@Override public String doValidate(String input) { if (StringUtils.isBlank(input)) { return this.displayName + " must not be blank."; }// w w w. ja va 2s .c om return null; }
From source file:com.cognifide.qa.bb.config.ConfigStrategyProviderTest.java
@Test public void getReturnsYamlConfigByDefault() { assumeTrue(StringUtils.isBlank(System.getProperty(ConfigKeys.CONFIG_STRATEGY))); ConfigStrategy configStrategy = ConfigStrategyProvider.get(); assertThat(configStrategy).isInstanceOf(YamlConfig.class); }
From source file:edu.uci.ics.crawler4j.url.URLCanonicalizer.java
public static String getCanonicalURL(String href, String context) { try {/* w w w . ja v a 2s.c om*/ URL canonicalURL = new URL(UrlResolver.resolveUrl(context == null ? "" : context, href)); String host = canonicalURL.getHost().toLowerCase(); if (StringUtils.isBlank(host)) { // This is an invalid Url. return null; } String path = canonicalURL.getPath(); /* * Normalize: no empty segments (i.e., "//"), no segments equal to * ".", and no segments equal to ".." that are preceded by a segment * not equal to "..". */ path = new URI(path).normalize().toString(); /* * Convert '//' -> '/' */ int idx = path.indexOf("//"); while (idx >= 0) { path = path.replace("//", "/"); idx = path.indexOf("//"); } /* * Drop starting '/../' */ while (path.startsWith("/../")) { path = path.substring(3); } /* * Trim */ path = path.trim(); final SortedMap<String, String> params = createParameterMap(canonicalURL.getQuery()); final String queryString; if (params != null && params.size() > 0) { String canonicalParams = canonicalize(params); queryString = (canonicalParams.isEmpty() ? "" : "?" + canonicalParams); } else { queryString = ""; } /* * Add starting slash if needed */ if (path.length() == 0) { path = "/" + path; } /* * Drop default port: example.com:80 -> example.com */ int port = canonicalURL.getPort(); if (port == canonicalURL.getDefaultPort()) { port = -1; } String protocol = canonicalURL.getProtocol().toLowerCase(); String pathAndQueryString = normalizePath(path) + queryString; URL result = new URL(protocol, host, port, pathAndQueryString); return result.toExternalForm(); } catch (MalformedURLException ex) { return null; } catch (URISyntaxException ex) { return null; } }
From source file:com.shz.foundation.service.dynamic.SearchFilter.java
/** * searchParamskey?OPERATOR_FIELDNAME//from w ww . j av a2s . c o m */ public static Map<String, SearchFilter> parse(Map<String, Object> searchParams) { Map<String, SearchFilter> filters = Maps.newHashMap(); for (Entry<String, Object> entry : searchParams.entrySet()) { // String key = entry.getKey(); Object value = entry.getValue(); if (StringUtils.isBlank((String) value)) { continue; } // operatorfiledAttribute String[] names = StringUtils.split(key, "_"); if (names.length != 2) { throw new IllegalArgumentException(key + " is not a valid search filter name"); } String filedName = names[1]; Operator operator = Operator.fromString(names[0]); // searchFilter SearchFilter filter = new SearchFilter(filedName, operator, value); filters.put(key, filter); } return filters; }
From source file:musiccrawler.model.UrlConnection.java
public Connection settings() { Connection connection = Jsoup.connect(url); connection.userAgent(StringUtils.isBlank(userAgent) ? Constant.USER_AGENT_BROWSER : userAgent); connection.timeout(timeOut == 0 ? Constant.CONNECT_TIME_OUT : timeOut); return connection; }
From source file:com.stratio.cassandra.lucene.util.GeospatialUtilsJTS.java
/** * Returns the {@link JtsGeometry} represented by the specified WKT text. * * @param string the WKT text/*from w w w.j a v a 2 s.c o m*/ * @return the parsed geometry */ public static JtsGeometry geometry(String string) { if (StringUtils.isBlank(string)) { throw new IndexException("Shape shouldn't be blank"); } try { GeometryFactory geometryFactory = CONTEXT.getGeometryFactory(); WKTReader reader = new WKTReader(geometryFactory); Geometry geometry = reader.read(string); if (!geometry.isValid()) { geometry = geometry.buffer(0); } return CONTEXT.makeShape(geometry); } catch (ParseException | IllegalArgumentException e) { throw new IndexException(e, "Shape '{}' is not parseable", string); } }