List of usage examples for java.lang String isEmpty
public boolean isEmpty()
From source file:com.ibm.watson.app.qaclassifier.ScanLogs.java
private static String getRequiredProperty(String propertyName) { String value = System.getProperty(propertyName); if (value == null || value.isEmpty()) { throw new IllegalArgumentException(propertyName + " is a required property"); }/* ww w . ja va 2 s . c o m*/ return value; }
From source file:at.treedb.util.Execute.java
public static ExecResult execute(String command, String[] param, Map<String, File> map) { DefaultExecutor executor = new DefaultExecutor(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); CommandLine cmdLine = null;//from ww w . j a va 2s. co m int exitValue = 0; try { PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream); cmdLine = new CommandLine(command); if (param != null) { for (String s : param) { s = s.trim(); if (s.isEmpty()) { continue; } cmdLine.addArgument(s); } } cmdLine.setSubstitutionMap(map); executor.setStreamHandler(streamHandler); exitValue = executor.execute(cmdLine); return new ExecResult(exitValue, outputStream.toString(), null); } catch (Exception e) { return new ExecResult(-1, outputStream.toString(), e); } }
From source file:com.flipkart.poseidon.handlers.http.utils.StringUtils.java
/** * Returns false if given string in null or empty *///from w w w . jav a 2s . co m public static boolean isNullOrEmpty(String string) { if (string != null) { return string.isEmpty(); } return true; }
From source file:com.hazelcast.qasonar.listpullrequests.ListPullRequests.java
private static String getDefaultModule(String defaultModule) { if (defaultModule == null || defaultModule.isEmpty()) { return ""; }//from w w w .j av a 2s. c o m return " --defaultModule " + defaultModule; }
From source file:net.rptools.tokentool.util.FileSaveUtil.java
public static boolean makeDir(String dirName, File destDir) { if (dirName.isEmpty()) return false; File newDir;//from ww w . j a va2 s . c o m newDir = new File(destDir, dirName); if (newDir.mkdir()) { log.info("Created directory: " + newDir.getAbsolutePath()); return true; } else { log.error("Could not create directory: " + newDir.getAbsolutePath()); } return false; }
From source file:Main.java
public static String createDialNumber(String bridge, String host, String code) { String dialString = "tel:"; dialString = dialString + bridge + Uri.parse(",") + Uri.parse(","); if (host != null && !host.isEmpty()) { dialString = dialString + host + Uri.parse("#"); }/* w w w. j av a2s . c om*/ if (code != null && !code.isEmpty()) { dialString = dialString + Uri.parse(",") + code + Uri.parse("#"); } return dialString; }
From source file:Main.java
private static Map<String, String> getAttributes(String xml) { String s = xml.substring(xml.indexOf("<") + 1, xml.indexOf(">")); String[] ss = s.split(" "); if (ss.length == 1) { return null; }/*from w w w .j a va 2s . c om*/ Map<String, String> m = new HashMap<>(); for (int i = 1; i < ss.length; i++) { String s0 = ss[i].trim(); if (!s0.isEmpty()) { m.put(s0.split("=")[0], delQuot(s0.split("=")[1])); } } return m; }
From source file:com.tilab.ca.sse.core.util.SSEUtils.java
public static boolean hasContent(String string) { return string != null && !string.isEmpty(); }
From source file:de.tudarmstadt.ukp.experiments.dip.wp1.documents.helpers.boilerplateremoval.impl.Utils.java
/** * Returns `True` if string contains only white-space characters or is * empty. Otherwise `False` is returned. * * @param text// w w w .j ava 2 s . c om * @return */ // TODO remove public static boolean is_blank(String text) { return (text.isEmpty() || text.matches("\\s+")); }
From source file:org.alfresco.utils.HttpUtil.java
/** * Populate HTTP message call with given content. * /*from w w w .ja va 2s. c om*/ * @param content String content * @return {@link StringEntity} content. * @throws UnsupportedEncodingException if unsupported */ public static StringEntity setMessageBody(final String content) throws UnsupportedEncodingException { if (content == null || content.isEmpty()) { throw new IllegalArgumentException("Content is required."); } return new StringEntity(content, UTF_8_ENCODING); }