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.bstek.dorado.data.config.xml.PreloadDataResolverParser.java
@Override protected Object doParse(Node node, ParseContext context) throws Exception { DataParseContext dataContext = (DataParseContext) context; Element element = ((Element) node); String name = element.getAttribute(XmlConstants.ATTRIBUTE_NAME); if (StringUtils.isEmpty(name)) { throw new XmlParseException("[" + XmlConstants.ATTRIBUTE_NAME + "] attribute of [" + DataXmlConstants.DATA_RESOLVER + "] can not be empty - [" + dataContext.getResource() + "]", element, context);//from w w w . j ava 2 s . co m } Map<String, NodeWrapper> configuredDataResolvers = dataContext.getConfiguredDataResolvers(); if (configuredDataResolvers.containsKey(name)) { boolean overwrite = BooleanUtils.toBoolean(element.getAttribute(DataXmlConstants.ATTRIBUTE_OVERWRITE)); if (!overwrite) { throw new XmlParseException(DataXmlConstants.DATA_RESOLVER + " [" + name + "] is not unique!", element, context); } } configuredDataResolvers.put(name, new NodeWrapper(node, context.getResource())); return null; }
From source file:com.enonic.cms.core.boot.HomeResolver.java
private String resolvePath() { String path = this.systemProperties.getProperty(CMS_HOME); if (!StringUtils.isEmpty(path)) { return path; }//w w w .j a va 2 s. c o m path = this.environment.get(CMS_HOME_ENV); if (!StringUtils.isEmpty(path)) { return path; } return this.defaultHome.getAbsolutePath(); }
From source file:com.envision.envservice.common.util.SAPUtil.java
/** * To Field Code// w w w.j av a 2s .c om */ public static String toFieldCode(String sapInfo) { if (StringUtils.isEmpty(sapInfo)) { return StringUtils.EMPTY; } int codeStart = sapInfo.lastIndexOf(FIELD_PREFIX_CODE) + FIELD_PREFIX_CODE.length(); int codeEnd = sapInfo.lastIndexOf(FIELD_SUFFIX_CODE); // int codeEnd = sapInfo.indexOf(FIELD_SUFFIX_CODE); if (codeStart == -1 || codeEnd == -1) { return sapInfo; } return sapInfo.substring(codeStart, codeEnd); }
From source file:com.intel.cosbench.controller.web.WorkloadPageController.java
@Override protected ModelAndView process(HttpServletRequest req, HttpServletResponse res) { String id = req.getParameter("id"); if (StringUtils.isEmpty(id)) throw new BadRequestException(); return process(id); }
From source file:com.athena.peacock.common.core.util.XMLGregorialCalendarUtil.java
/** * <pre>/*from w ww. j av a 2 s .c o m*/ * ?? ? . * , pattern? ?? 'yyyyMMddHHmmss' . * </pre> * * @param date Date ? * @return ? */ public static String getFormattedDate(String pattern, Date date) { if (date == null) { return null; } if (StringUtils.isEmpty(pattern)) { pattern = DEFAULT_DATE_PATTERN; } return new SimpleDateFormat(pattern).format(date); }
From source file:com.intel.cosbench.controller.web.StagePageController.java
@Override protected ModelAndView process(HttpServletRequest req, HttpServletResponse res) { String wid = req.getParameter("wid"); if (StringUtils.isEmpty(wid)) throw new BadRequestException(); String sid = req.getParameter("sid"); if (StringUtils.isEmpty(sid)) throw new BadRequestException(); return process(wid, sid); }
From source file:io.seldon.semvec.SemanticVectorsStore.java
public static void initialise(Properties props) { SemanticVectorsStore.baseDirectory = props.getProperty("io.seldon.labs.semvec.basedir"); if (SemanticVectorsStore.baseDirectory == null) { logger.warn("No base directory for semantic vectors specified"); } else {/* w w w . j av a 2s . c om*/ String clientsToPreload = props.getProperty("io.seldon.labs.semvec.preload"); if (!StringUtils.isEmpty(clientsToPreload)) { String client[] = clientsToPreload.split(","); for (int i = 0; i < client.length; i++) { String prefixStr = props.getProperty("io.seldon.labs.semvec.preload.prefix." + client[i]); if (prefixStr == null) prefixStr = "text"; if (prefixStr != null) { String prefix[] = prefixStr.split(","); for (int j = 0; j < prefix.length; j++) { logger.info("Preloading semantic vectors store for client " + client[i] + " with prefix " + prefix[j] + "..."); SemVectorsPeer svPeer = get(client[i], prefix[j]); if (svPeer == null) { // logger.error("Failed to preload store for client "+client[i]+" with prefix "+prefix[j]); final String message = "Failed to preload store for client " + client[i] + " with prefix " + prefix[j]; logger.error(message, new Exception(message)); } else logger.info("Preloaded semantic vectors store for client " + client[i] + " with prefix " + prefix[j]); } } } } } }
From source file:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.ProfileValidator.java
@Override public void validate(final Object object, final Errors errors) { final UpdateProfileForm profileForm = (UpdateProfileForm) object; final String title = profileForm.getTitleCode(); final String firstName = profileForm.getFirstName(); final String lastName = profileForm.getLastName(); if (StringUtils.isEmpty(title)) { errors.rejectValue("titleCode", "profile.title.invalid"); } else if (StringUtils.length(title) > 255) { errors.rejectValue("titleCode", "profile.title.invalid"); }//from w w w . j av a2 s . c o m if (StringUtils.isBlank(firstName)) { errors.rejectValue("firstName", "profile.firstName.invalid"); } else if (StringUtils.length(firstName) > 255) { errors.rejectValue("firstName", "profile.firstName.invalid"); } if (StringUtils.isBlank(lastName)) { errors.rejectValue("lastName", "profile.lastName.invalid"); } else if (StringUtils.length(lastName) > 255) { errors.rejectValue("lastName", "profile.lastName.invalid"); } }
From source file:me.yyam.beanutils.DateConverter.java
protected Object convertToDate(Class type, Object value, String pattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); if (value instanceof String) { try {/*from ww w . j a v a2s . co m*/ if (StringUtils.isEmpty(value.toString())) { return null; } Date date = sdf.parse((String) value); if (type.equals(Timestamp.class)) { return new Timestamp(date.getTime()); } return date; } catch (Exception pe) { return null; } } else if (value instanceof Date) { return value; } throw new ConversionException("?? " + value.getClass().getName() + " " + type.getName()); }