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.auth10.federation.FederatedConfiguration.java
private static IFederatedConfiguration load(HttpServletRequest request) { java.util.Properties props = new java.util.Properties(); IFederatedConfiguration configurator = null; try {/*from ww w . j a v a 2 s . c o m*/ InputStream is = FederatedConfiguration.class.getResourceAsStream("/federation.properties"); props.load(is); String className = props.getProperty(LOADER_CLASS, "com.auth10.federation.BasicFileConfiguration"); if (!StringUtils.isEmpty(className)) { Constructor<?> declaredConstructor = Class.forName(className) .getDeclaredConstructor(HttpServletRequest.class); configurator = (IFederatedConfiguration) declaredConstructor.newInstance(request); } } catch (IOException e) { throw new RuntimeException("Configuration could not be loaded", e); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } /* if (configurator == null){ //Utilizamos los valores por defecto configurator = new BasicFileConfiguration(request); } */ return configurator; }
From source file:com.sangupta.pep.macros.NotesMacro.java
@Override public ContentAndClasses process(String content, File parentDir) { final ContentAndClasses cc = new ContentAndClasses(content); if (StringUtils.isEmpty(content)) { return cc; }/*from ww w .j ava2s . c o m*/ Matcher matcher = PATTERN.matcher(content); if (matcher.matches()) { StringBuilder builder = new StringBuilder(); builder.append(matcher.group(1)); builder.append("<p class=\"notes\">"); builder.append(matcher.group(2)); builder.append("</p>"); builder.append(matcher.group(3)); String newContent = builder.toString(); if (!content.equals(newContent)) { cc.setContent(newContent); cc.addClass("has_notes"); } else { cc.setContent(content); } } return cc; }
From source file:com.codenjoy.dojo.client.AbstractTextBoard.java
public boolean isGameOver() { return StringUtils.isEmpty(data); }
From source file:com.bstek.dorado.config.xml.StringArrayPropertyParser.java
@Override protected Object doParse(Node node, ParseContext context) throws Exception { Object value = super.doParse(node, context); if (value == null) return null; if (value instanceof String) { String text = (String) value; if (!StringUtils.isEmpty(text)) { return StringUtils.split(text, seperator); } else {//from w ww . j a v a 2 s . com return null; } } else if (value instanceof String[]) { return value; } else { throw new XmlParseException("String array expected.", node, context); } }
From source file:com.intel.cosbench.controller.handler.WorkloadHandler.java
@Override protected String process(HttpServletRequest req, HttpServletResponse res) throws Exception { String id = req.getParameter("id"); if (StringUtils.isEmpty(id)) throw new BadRequestException(); return process(id); }
From source file:com.mmj.app.web.vo.SuggestVO.java
public SuggestVO(TopicDO topic) { setId(topic.getId());/*from w w w . ja v a2s . c o m*/ setImgUrl(StringUtils.isEmpty(topic.getImgUrl()) ? "/images/image30.png" : topic.getImgUrl()); setTitle(topic.getTitle()); setUrl(topic.getOriginalUrl()); }
From source file:com.laxser.blitz.web.instruction.HttpErrorInstruction.java
@Override public void doRender(Invocation inv) throws Exception { String message = resolvePlaceHolder(this.message, inv); message = StringEscapeUtils.escapeHtml(message); //??HTMLXSS if (StringUtils.isEmpty(message)) { inv.getResponse().sendError(code); } else {//w w w .jav a 2 s .c o m inv.getResponse().sendError(code, message); } }
From source file:com.pedra.storefront.forms.validation.GuestValidator.java
@Override public void validate(final Object object, final Errors errors) { final GuestForm guestForm = (GuestForm) object; final String email = guestForm.getEmail(); if (StringUtils.isEmpty(email)) { errors.rejectValue("email", "profile.email.invalid"); } else if (StringUtils.length(email) > 255 || !Pattern.matches(EMAIL_REGEX, email)) { errors.rejectValue("email", "profile.email.invalid"); }/*from w w w . java2 s . c o m*/ }
From source file:net.duckling.ddl.web.tag.AuthorTag.java
@Override public int doVWBStart() throws Exception { Resource meta = vwbcontext.getResource(); String author = meta.getCreator(); if (StringUtils.isEmpty(author)) { author = "unknown"; }// w w w .ja v a 2 s.c o m if (!StringUtils.isEmpty(author)) { pageContext.getOut().print(getBean(AoneUserService.class).getUserNameByID(author)); } else { pageContext.getOut().print("unknown"); } return SKIP_BODY; }
From source file:com.npower.dl.DownloadFactory.java
/** * Extract Download ID From URL//from w w w.j av a 2 s . co m * @param uri * @return */ public static String parserDownloadID(String uri) { if (StringUtils.isEmpty(uri)) { return null; } String result = uri.trim(); if (result.lastIndexOf('.') > 0 && result.lastIndexOf('.') > result.lastIndexOf('/')) { result = result.substring(0, result.lastIndexOf('.')); } while (result.endsWith("/")) { result = result.substring(0, result.length() - 1); } result = result.substring(result.lastIndexOf('/') + 1, result.length()); return result; }