List of usage examples for org.apache.commons.lang StringUtils isBlank
public static boolean isBlank(String str)
Checks if a String is whitespace, empty ("") or null.
From source file:filters.SupportedFormats.java
public static String supportFormat(String path) throws EmptyExtensionException { String extension = getFormatExtension(path); if (StringUtils.isBlank(extension)) { throw new EmptyExtensionException(); }// w w w .j av a2 s . c o m if (formats.contains(extension)) { return extension; } else { return null; } }
From source file:ch.entwine.weblounge.bridge.oaipmh.util.OsgiUtil.java
/** * Get a mandatory, non-blank value from a dictionary. * /*from www. j ava 2s . c om*/ * @throws ConfigurationException * key does not exist or its value is blank */ public static String getCfg(Dictionary d, String key) throws ConfigurationException { Object p = d.get(key); if (p == null) throw new ConfigurationException(key, "does not exist"); String ps = p.toString(); if (StringUtils.isBlank(ps)) throw new ConfigurationException(key, "is blank"); return ps; }
From source file:com.taobao.adfs.database.tdhsocket.client.util.ConvertUtil.java
public static byte getByteFromString(String stringVal) throws SQLException { if (StringUtils.isBlank(stringVal)) { return (byte) 0; }// w ww . j a v a 2 s.c o m stringVal = stringVal.trim(); try { int decimalIndex = stringVal.indexOf("."); if (decimalIndex != -1) { double valueAsDouble = Double.parseDouble(stringVal); return (byte) valueAsDouble; } long valueAsLong = Long.parseLong(stringVal); return (byte) valueAsLong; } catch (NumberFormatException NFE) { throw new SQLException("Parse byte value error:" + stringVal); } }
From source file:com.aqnote.shared.cryptology.util.ProviderUtil.java
@SuppressWarnings("unchecked") public static void removeProvider(String className) throws Exception { if (StringUtils.isBlank(className)) return;/*from w w w .jav a2 s . c o m*/ Class<?> clazz = Class.forName(className); if (clazz == null || !clazz.isAssignableFrom(Provider.class)) return; removeProvider((Class<Provider>) clazz); }
From source file:com.surfs.storage.web.filter.LoginFilter.java
@Override public void init(FilterConfig filterConfig) throws ServletException { String excludes = filterConfig.getInitParameter("excludes"); if (StringUtils.isBlank(excludes)) return;/*from w ww .j av a 2 s . co m*/ String[] excludeArray = excludes.split(","); excludes_Pattern = new Pattern[excludeArray.length]; for (int i = 0; i < excludeArray.length; i++) { excludes_Pattern[i] = Pattern.compile(excludeArray[i].trim()); } }
From source file:io.logspace.hq.rest.AbstractLogspaceResourcesBase.java
protected static String getRequiredQueryParam(Request req, String name) { String value = req.queryParams(name); if (StringUtils.isBlank(value)) { throw ParameterValueException.missingQueryParameter(name); }/*w w w. j a v a2 s .c o m*/ return value; }
From source file:ips1ap101.lib.core.jsf.component.BotonBuscar.java
private boolean isRenderedToo() { String script = this.getOnClick(); if (StringUtils.isBlank(script)) { return false; }/*from www . j a va 2 s . co m*/ WebuiInput sibling = getSibling(); if (sibling instanceof TextField) { TextField textField = (TextField) sibling; return sibling.isRendered() && !textField.isReadOnly(); } return true; }
From source file:de.codesourcery.eve.skills.util.ClasspathInputStreamProvider.java
public ClasspathInputStreamProvider(String path) { if (StringUtils.isBlank(path)) { throw new IllegalArgumentException("path cannot be blank / NULL"); }// w w w. j a v a 2 s .c o m this.path = path; }
From source file:com.googlecode.jtiger.modules.ecside.resource.MimeUtils.java
/** * Return the mime type for a file name. The extension is parsed out and the * method to get mime type by extension is called. Extension mappings are * found in the mimeTypes.properties file in the org.extremecomponents.util * package.//from w ww .j av a 2 s. c o m */ public static String getFileMimeType(String fileName) { if (StringUtils.isBlank(fileName) || (fileName.indexOf(".") == -1)) { return null; } fileName = fileName.substring(fileName.lastIndexOf(".")); return getExtensionMimeType(fileName); }
From source file:com.digitalpebble.storm.crawler.persistence.Scheduler.java
/** Returns a Scheduler instance based on the configuration **/ @SuppressWarnings({ "rawtypes", "unchecked" }) public static Scheduler getInstance(Map stormConf) { Scheduler scheduler;//from w w w . j av a2 s .co m String className = ConfUtils.getString(stormConf, schedulerClassParamName); if (StringUtils.isBlank(className)) { throw new RuntimeException("Missing value for config " + schedulerClassParamName); } try { Class<?> schedulerc = Class.forName(className); boolean interfaceOK = Scheduler.class.isAssignableFrom(schedulerc); if (!interfaceOK) { throw new RuntimeException("Class " + className + " must extend Scheduler"); } scheduler = (Scheduler) schedulerc.newInstance(); } catch (Exception e) { throw new RuntimeException("Can't instanciate " + className); } scheduler.init(stormConf); return scheduler; }