List of usage examples for org.apache.commons.lang3 StringUtils isBlank
public static boolean isBlank(final CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false
From source file:com.thoughtworks.go.http.mocks.HttpRequestBuilder.java
public static HttpRequestBuilder GET(String path) { return new HttpRequestBuilder().withMethod("GET").withPath(StringUtils.isBlank(path) ? "/" : path); }
From source file:io.ucoin.ucoinj.core.client.model.bma.gson.IdentityTypeAdapter.java
@Override public BlockchainBlock.Identity deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String identityStr = json.getAsString(); if (StringUtils.isBlank(identityStr)) { return null; }//from w w w .j a v a 2 s.c o m String[] identityParts = identityStr.split(":"); if (identityParts.length != 4) { throw new JsonParseException( String.format("Bad format for BlockchainBlock.Identity. Should have 4 parts, but found %s.", identityParts.length)); } BlockchainBlock.Identity result = new BlockchainBlock.Identity(); int i = 0; result.setPubkey(identityParts[i++]); result.setSignature(identityParts[i++]); result.setTimestamp(Integer.parseInt(identityParts[i++])); result.setUid(identityParts[i++]); return result; }
From source file:com.weibo.api.motan.protocol.grpc.GrpcUtil.java
private static String getGrpcClassName(Class<?> clazz) { GrpcConfig config = clazz.getAnnotation(GrpcConfig.class); if (config == null || StringUtils.isBlank(config.grpc())) { throw new MotanFrameworkException("can not find grpc config in class " + clazz.getName()); }//from w w w . j a v a 2s .c o m return config.grpc(); }
From source file:com.erudika.para.queue.MockQueue.java
@Override public void push(String task) { if (!StringUtils.isBlank(task)) { q.add(task); } }
From source file:cd.go.authentication.passwordfile.model.User.java
public User(String username, String displayName, String emailId) { this.username = username; this.displayName = displayName; this.emailId = emailId == null ? null : emailId.toLowerCase().trim(); if (StringUtils.isBlank(this.username)) { throw new InvalidUsernameException("Username can not be blank."); }/*from w w w. j a v a2 s . com*/ }
From source file:com.trenako.web.editors.WeakDbRefPropertyEditor.java
@Override public void setAsText(String text) throws IllegalArgumentException { if (allowEmpty && StringUtils.isBlank(text)) { setValue(null);/*w w w . j a v a 2 s .co m*/ return; } setValue(WeakDbRef.buildFromSlug(text, DbReferenceable.class)); }
From source file:com.lhh.neo4j.service.Neo4jBaseGenericServiceImpl.java
public Iterable<T> findList(String idStr) { if (StringUtils.isBlank(idStr)) return null; return repository.findList(idStr); }
From source file:com.dh.controller.user.UserController.java
@RequestMapping("/authenticate.do") @ResponseBody/*from w w w .j a v a2 s .c om*/ public Object authenticate(HttpServletRequest request, String account, String password) { LOG.info("authenticate,account?{},password?{}", account, password); if (StringUtils.isBlank(account) || StringUtils.isBlank(password)) { return JSON.toJSONString(new RespVO(-1, "????")); } User user = userService.authenticate(account, password); if (user == null) { return JSON.toJSONString(new RespVO(-2, "????")); } HttpSession session = request.getSession(true); session.setAttribute(SessionKey.DH_USER, user); return JSON.toJSONString(new RespVO(0, "?", user.getUserId())); }
From source file:gov.nih.nci.caintegrator.common.AnnotationUtil.java
/** * @param abstractAnnotationValues abstractAnnotationValues * @param dataValues the values from the current upload file * @param filterList the list of display string to filter * @return set of distinct available values *//*from w w w .ja v a 2 s. c o m*/ public static Set<String> getAdditionalValue(Collection<AbstractAnnotationValue> abstractAnnotationValues, List<String> dataValues, Set<String> filterList) { Set<String> results = new HashSet<String>(); for (String dataValue : dataValues) { if (!StringUtils.isBlank(dataValue) && !filterList.contains(dataValue)) { if (NumberUtils.isNumber(dataValue)) { dataValue = NumericUtil.formatDisplay(dataValue); } results.add(dataValue); } } for (AbstractAnnotationValue abstractAnnotationValue : abstractAnnotationValues) { String displayString = abstractAnnotationValue.toString(); if (StringUtils.isNotBlank(displayString) && !filterList.contains(displayString)) { results.add(displayString); } } return results; }
From source file:com.jim.im.exception.ImJsonMappingExceptionMapper.java
@Override public Response toResponse(JsonMappingException e) { ApiErrorCode errorCode = ApiErrorCode.PARAM_ERROR; String errorMsg = e.getMessage(); if (StringUtils.isBlank(errorMsg)) { errorMsg = IMConstant.MSG_PARAM_ERROR; }/*from ww w . j a v a 2 s.c o m*/ String requestId = RequestContext.get(IMConstant.REQUEST_ID); ApiErrorCodeException errorCodeException = new ApiErrorCodeException(requestId, errorCode, errorMsg, e); logger.error(requestId, errorCodeException); return RestResult.failure(requestId, errorCode.errorCode, errorMsg); }