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:com.infullmobile.jenkins.plugin.restrictedregister.security.hudson.mail.AdminNotificationEmail.java
private static String getRecipients() { final IPluginConfig pluginConfig = PluginModule.getDefault().getPluginDescriptor().getGlobalConfig(); String adminEmail = pluginConfig.getAdminEmail(); if (StringUtils.isEmpty(adminEmail)) { adminEmail = PluginModule.getDefault().getJenkinsDescriptor().getAdminEmail(); }/* w w w.j a v a2 s . c om*/ return adminEmail; }
From source file:com.cloudera.nav.sdk.model.HiveIdGenerator.java
public static String generateColumnId(String sourceId, String databaseName, String tableName, String columnName) {//from w ww .j a va 2 s . c o m Preconditions.checkArgument( !StringUtils.isEmpty(sourceId) && !StringUtils.isEmpty(databaseName) && !StringUtils.isEmpty(tableName) && !StringUtils.isEmpty(columnName), "SourceId, database name, table name, and column name must be " + "supplied to generate Hive column identity"); return MD5IdGenerator.generateIdentity(sourceId, databaseName.toUpperCase(), tableName.toUpperCase(), columnName.toUpperCase()); }
From source file:com.bstek.dorado.util.PathUtils.java
public static String concatPath(String... paths) { StringBuffer result = new StringBuffer(); for (String path : paths) { if (StringUtils.isEmpty(path)) { continue; }// w w w . j a v a2 s .c om if (result.length() > 0) { boolean endsWithDelim = (result.charAt(result.length() - 1) == PATH_DELIM); boolean startsWithDelim = (path.charAt(0) == PATH_DELIM); if (endsWithDelim) { if (startsWithDelim) { result.setLength(result.length() - 1); } } else if (!startsWithDelim) result.append(PATH_DELIM); } result.append(path); } return result.toString(); }
From source file:com.mmj.app.lucene.search.cons.SortSearchEnum.java
/** * ?name?/* w w w .j a v a2 s . co m*/ */ public static SortSearchEnum getEnum(String name) { if (StringUtils.isEmpty(name)) { return DEFAULT; } for (SortSearchEnum current : values()) { if (StringUtils.equalsIgnoreCase(current.getName(), name)) { return current; } } return DEFAULT; }
From source file:cn.vlabs.duckling.vwb.service.config.provider.PropertiesFileReader.java
private static Properties load(String configFile) { Properties props = new Properties(); FileInputStream fis = null;/* w w w.j a va 2 s .c om*/ try { if (StringUtils.isEmpty(configFile)) { log.error("?"); } else { fis = new FileInputStream(configFile); props.load(fis); } } catch (FileNotFoundException e) { log.error("?" + configFile + ""); } catch (IOException e) { log.error(e); } finally { try { if (fis != null) { fis.close(); fis = null; } } catch (IOException ioe) { log.error(ioe); } } return props; }
From source file:ezbake.data.common.classification.VisibilityUtils.java
/** * Given an accumulo-style boolean expression string, return a list of string arrays which * represent the permutations of the visibilities * * @param classification/* w w w . j a v a 2s.co m*/ * @return * @throws VisibilityParseException */ public static List<Object> generateVisibilityList(String classification) throws VisibilityParseException { List<Object> classificationList = new ArrayList<>(); if (!StringUtils.isEmpty(classification)) { final ColumnVisibility visibility = new ColumnVisibility(classification); evaluateAccumuloExpression(visibility.getExpression(), visibility.getParseTree(), classificationList); // We need to check such that they are all wrapped in sublists if (classificationList.size() == 1 && classificationList.get(0) instanceof String) { final ArrayList check = new ArrayList(); check.add(classificationList); classificationList = check; } } return classificationList; }
From source file:com.onehippo.gogreen.utils.UserAgentUtils.java
public static boolean isMobile(HttpServletRequest request) { String userAgent = request.getHeader("User-Agent"); if (StringUtils.isEmpty(userAgent)) { return false; }/*from w ww . j av a 2s .co m*/ for (final Pattern pattern : mobileUserAgentPatterns) { final Matcher matcher = pattern.matcher(userAgent); if (matcher.find()) { return true; } } return false; }
From source file:com.sap.hana.cloud.samples.jenkins.storage.FileStorage.java
private static File getLocalStorageDirectory() { final String explicitValue = System.getProperty("com.sap.hana.cloud.samples.jenkins.storage.FileStorage"); if (!StringUtils.isEmpty(explicitValue)) { return new File(explicitValue); } else {//from w w w . j a v a 2 s. c o m // use the processes working directory return new File("."); } }
From source file:net.sourceforge.fenixedu.domain.phd.migration.common.ConversionUtilities.java
static public LocalDate parseDate(String value) { if (StringUtils.isEmpty(value)) { return null; }// ww w . j a v a 2 s. c om if (value.length() < 2) { return null; } LocalDate result = null; String normalizedValue = value; if (value.length() == "dMMyyyy".length()) { normalizedValue = "0".concat(value); } for (String pattern : CORRECT_DATE_PATTERNS) { try { result = DateTimeFormat.forPattern(pattern).parseDateTime(normalizedValue).toLocalDate(); } catch (IllegalArgumentException e) { continue; } if (result.isAfter(DateTimeFormat.forPattern("yyyy").parseDateTime("1920").toLocalDate()) && result.isBefore(DateTimeFormat.forPattern("yyy").parseDateTime("2020").toLocalDate())) { return result; } } throw new IncorrectDateFormatException(value); }
From source file:com.cloudera.nav.plugin.model.MD5IdGenerator.java
public static boolean isValidId(String id) { return !StringUtils.isEmpty(id) && MD5_PATTERN.matcher(id).matches(); }