List of usage examples for org.apache.commons.lang StringUtils isEmpty
public static boolean isEmpty(String str)
Checks if a String is empty ("") or null.
From source file:acromusashi.stream.component.kestrel.spout.RestrictWatcher.java
/** * ??????/*ww w . j a v a 2s. c o m*/ * * @param filePath ?? */ public RestrictWatcher(String filePath) { if (StringUtils.isEmpty(filePath) == false) { this.targetFile = new File(filePath); } }
From source file:com.flowlogix.ui.MinimizedHandler.java
@Override public Resource createResource(String resourceName) { if (StringUtils.isEmpty(resourceName)) { return null; }//from ww w . j a v a 2s. c o m return super.createResource(toMinimized(resourceName)); }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.AbstractDatasourceComponentLoader.java
protected void loadDatasource(DatasourceComponent component, Element element) { final String datasource = element.attributeValue("datasource"); if (!StringUtils.isEmpty(datasource)) { Datasource ds = context.getDsContext().get(datasource); if (ds == null) { throw new GuiDevelopmentException(String.format("Datasource '%s' is not defined", datasource), getContext().getFullFrameId(), "Component ID", component.getId()); }/* w w w . j av a 2 s . co m*/ String property = element.attributeValue("property"); if (StringUtils.isEmpty(property)) { throw new GuiDevelopmentException( String.format("Can't set datasource '%s' for component '%s' because 'property' " + "attribute is not defined", datasource, component.getId()), context.getFullFrameId()); } component.setDatasource(ds, property); } }
From source file:jp.co.opentone.bsol.framework.core.util.ArgumentValidator.java
/** * ???????. ???IllegalArgumentException??. * @param arg/*ww w .j a v a 2s. c o m*/ * ? * @param name * ???? */ public static void validateNotEmpty(String arg, String name) { if (StringUtils.isEmpty(arg)) { String n = getName(name); throw new IllegalArgumentException(n + " must not be empty"); } }
From source file:gaffer.user.User.java
public User(final String userId) { this.userId = StringUtils.isEmpty(userId) ? UNKNOWN_USER_ID : userId; }
From source file:bazaar4idea.ui.BzrGlobalStatusDialog.java
public void append(String text) { if (StringUtils.isEmpty(text)) { return; } outputTextArea.append(text); }
From source file:com.clican.pluto.cms.ui.ext.converter.NumberConverter.java
public Object getAsObject(FacesContext context, UIComponent component, String value) { if (StringUtils.isEmpty(value)) { return null; } else {/*from w w w .j a va2 s .c o m*/ try { return TypeUtils.stringToNumber(value, Class.forName(modelClass)); } catch (Exception e) { log.error("", e); } return null; } }
From source file:com.custardsource.maven.plugins.jmx.Invoke.java
@Override public void validate() throws MojoExecutionException { if (StringUtils.isEmpty(objectName)) { throw new MojoExecutionException("objectName can't be empty"); }//from ww w. ja v a2 s .c o m if (StringUtils.isEmpty(operation)) { throw new MojoExecutionException("operation can't be empty"); } }
From source file:com.rogoman.easyauth.HMAC.java
/** * Calculates the HMAC digest value based on the provided parameters. * * @param msg Message// w ww . jav a2 s. co m * @param keyString Key to be used in the hashing process * @param algorithm HMAC algorithm to be used * @return HMAC digest * @throws java.io.UnsupportedEncodingException if UTF-8 or ASCII encoding is not available * @throws java.security.NoSuchAlgorithmException thrown when the passed digest algorithm name cannot be recognized * @throws java.security.InvalidKeyException thrown when the passed secret key value is invalid according to the digest algorithm */ static String hmacDigest(final String msg, final String keyString, final String algorithm) throws UnsupportedEncodingException, InvalidKeyException, NoSuchAlgorithmException { if (msg == null) { throw new IllegalArgumentException("msg is empty"); } if (keyString == null) { throw new IllegalArgumentException("keyString is empty"); } if (StringUtils.isEmpty(algorithm)) { throw new IllegalArgumentException("algo is empty"); } String digest = null; byte[] keyAsBytes = (keyString).getBytes("UTF-8"); byte[] msgAsBytes = msg.getBytes("ASCII"); byte[] byteResult = hmacDigest(msgAsBytes, keyAsBytes, algorithm); digest = convertToHexString(byteResult); return digest; }
From source file:com.amazonaws.codepipeline.jenkinsplugin.AWSClientFactory.java
public AWSClients getAwsClient(final String awsAccessKey, final String awsSecretKey, final String proxyHost, final int proxyPort, final String region, final String pluginUserAgentPrefix) { final Region awsRegion = Region.getRegion(Regions.fromName(region)); final AWSClients aws; if (StringUtils.isEmpty(awsAccessKey) && StringUtils.isEmpty(awsSecretKey)) { aws = AWSClients.fromDefaultCredentialChain(awsRegion, proxyHost, proxyPort, pluginUserAgentPrefix); } else {// w ww. j a v a 2 s .c o m aws = AWSClients.fromBasicCredentials(awsRegion, awsAccessKey, awsSecretKey, proxyHost, proxyPort, pluginUserAgentPrefix); } return aws; }