List of usage examples for org.apache.commons.lang StringUtils equals
public static boolean equals(String str1, String str2)
Compares two Strings, returning true
if they are equal.
From source file:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.RegistrationValidator.java
protected void comparePasswords(final Errors errors, final String pwd, final String checkPwd) { if (StringUtils.isNotEmpty(pwd) && StringUtils.isNotEmpty(checkPwd) && !StringUtils.equals(pwd, checkPwd)) { errors.rejectValue("checkPwd", "validation.checkPwd.equals"); } else {// w w w . ja v a 2 s. com if (StringUtils.isEmpty(checkPwd)) { errors.rejectValue("checkPwd", "register.checkPwd.invalid"); } } }
From source file:com.cognifide.cq.cqsm.foundation.actions.CompositeActionResult.java
private String checkCommonAuthorizable(ActionResult[] args) { String pattern = args[0].getAuthorizable(); for (ActionResult actionResult : args) { String current = actionResult.getAuthorizable(); if (current != null && !StringUtils.equals(current, pattern)) { String msg = String.format(MISMATCH_MSG, actionResult.getAuthorizable(), pattern); throw new IllegalArgumentException(msg); }/*from w w w. j av a2 s. com*/ } return pattern; }
From source file:com.bluexml.xforms.servlets.UpdateServlet.java
/** * Update./*w w w.ja v a 2 s . c o m*/ * * @param req * the req * @throws ServletException * the servlet exception */ protected void update(HttpServletRequest req) throws ServletException { AlfrescoController controller = AlfrescoController.getInstance(); try { Node node = getDocumentReq(req); String skipIdStr = StringUtils.trimToNull(req.getParameter(ID_AS_SERVLET)); boolean idAsServlet = !StringUtils.equals(skipIdStr, "false"); String userName = req.getParameter(MsgId.PARAM_USER_NAME.getText()); AlfrescoTransaction transaction = createTransaction(controller, userName); controller.persistClass(transaction, node, idAsServlet, null); transaction.executeBatch(); } catch (Exception e) { throw new ServletException(e); } }
From source file:com.evolveum.midpoint.prism.LiteralEqualsStrategy.java
@Override protected boolean equalsInternal(ObjectLocator leftLocator, ObjectLocator rightLocator, Object lhs, Object rhs) {/*from ww w. ja v a 2 s. c o m*/ // System.out.println("DomAwareEqualsStrategy: "+PrettyPrinter.prettyPrint(lhs)+"<=>"+PrettyPrinter.prettyPrint(rhs)); if (lhs instanceof String && rhs instanceof String) { // this is questionable (but seems ok) return DOMUtil.compareTextNodeValues((String) lhs, (String) rhs); } else if (lhs instanceof Element && rhs instanceof Element) { // this is perhaps obsolete final Element left = (Element) lhs; final Element right = (Element) rhs; boolean result = DOMUtil.compareElement(left, right, true); // System.out.println("cmp: "+PrettyPrinter.prettyPrint(left)+"<=>"+PrettyPrinter.prettyPrint(right)+": "+result); return result; } else if (lhs instanceof QName && rhs instanceof QName) { QName l = (QName) lhs; QName r = (QName) rhs; if (!l.equals(r)) { return false; } return StringUtils.equals(l.getPrefix(), r.getPrefix()); } else if (lhs instanceof ItemPathType && rhs instanceof ItemPathType) { // ItemPathType's equals is already working literally return ((ItemPathType) lhs).equals((ItemPathType) rhs); } else { return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); } }
From source file:hydrograph.ui.propertywindow.widgets.customwidgets.joinproperty.ELTJoinPortCount.java
private void setPropertyNames() { String propertyNameArray[] = StringUtils.split(this.propertyName, "|"); if (StringUtils.isNotEmpty(propertyNameArray[0])) firstPortPropertyName = propertyNameArray[0]; if (propertyNameArray.length == 2 && StringUtils.equals(Constants.UNUSED_PORT_COUNT_PROPERTY, propertyNameArray[1])) this.unusedPortPropertyName = propertyNameArray[1]; }
From source file:com.googlecode.markuputils.MarkupBuilderUnitTest.java
@Test(dataProvider = "elements", dependsOnMethods = { "markupBuilder" }) public void startOpenElement(String element) { String expected = "<" + element; MarkupBuilder builder = new MarkupBuilder(); builder.startOpenElement(element);// w w w .ja va 2 s .co m String testValue = builder.toMarkup(); String msg = new StringBuilder().append("Expected: ").append(expected).append(", Found: ").append(testValue) .toString(); logger.info(msg); assert StringUtils.equals(expected, testValue) : msg; }
From source file:com.ning.maven.plugins.duplicatefinder.DependencyWrapper.java
public boolean matches(Artifact artifact) { ArtifactVersion version = null;/*from w w w. ja v a 2 s.co m*/ try { if (artifact.getVersionRange() != null) { version = artifact.getSelectedVersion(); } else { version = new DefaultArtifactVersion(artifact.getVersion()); } } catch (OverConstrainedVersionException ex) { return false; } return StringUtils.equals(dependency.getGroupId(), artifact.getGroupId()) && StringUtils.equals(dependency.getArtifactId(), artifact.getArtifactId()) && StringUtils.equals(StringUtils.defaultIfEmpty(dependency.getType(), "jar"), StringUtils.defaultIfEmpty(artifact.getType(), "jar")) && StringUtils.equals(dependency.getClassifier(), artifact.getClassifier()) && (versionRange == null || versionRange.containsVersion(version) || StringUtils.equals(artifact.getVersion(), dependency.getVersion())); }
From source file:cn.hxh.springside.orm.PageRequest.java
/** * ???./*from ww w . j a va 2 s . c o m*/ * * @param orderDir ?descasc,?','. */ public void setOrderDir(final String orderDir) { String lowcaseOrderDir = StringUtils.lowerCase(orderDir); //order? String[] orderDirs = StringUtils.split(lowcaseOrderDir, ','); for (String orderDirStr : orderDirs) { if (!StringUtils.equals(Sort.DESC, orderDirStr) && !StringUtils.equals(Sort.ASC, orderDirStr)) { throw new IllegalArgumentException("??" + orderDirStr + "??"); } } this.orderDir = lowcaseOrderDir; }
From source file:controllers.Common.java
@Before(priority = 0) public static void csrfCheck() { boolean isPost = StringUtils.equals(request.method, "POST"); boolean isFormEncoded = StringUtils.equals(request.contentType, "application/x-www-form-urlencoded"); boolean isApiRequest = StringUtils.startsWith(request.path, "/api/"); if (isPost && isFormEncoded && !isApiRequest) { String authenticityToken = SecurityUtils.stripXSS(params.get("authenticityToken")); if (authenticityToken == null) { Logger.warn("No authenticity token from %s for request: %s", request.remoteAddress, request.url); }/* ww w . j a v a 2 s.c o m*/ checkAuthenticity(); } }
From source file:com.eviware.soapui.plugins.Version.java
@Override public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; }// w w w.jav a2 s. c om Version that = (Version) o; return this.majorVersion == that.majorVersion && this.minorVersion == that.minorVersion && StringUtils.equals(this.patchVersion, that.patchVersion); }