public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof SubversionRevision)) { return false; } SubversionRevision that = (SubversionRevision) o; return StringUtils.equalsIgnoreCase(revision, that.revision); }
@JsonCreator public static CexioPositionType forValue(String value) { if (StringUtils.equalsIgnoreCase("long", value)) return LONG; else if (StringUtils.equalsIgnoreCase("short", value)) return SHORT; else return null; }
static TriState toTriState(String agentConfigState) { if (StringUtils.isBlank(agentConfigState)) { return TriState.UNSET; } else if (StringUtils.equalsIgnoreCase(agentConfigState, "enabled")) { return TriState.TRUE; } else if (StringUtils.equalsIgnoreCase(agentConfigState, "disabled")) { return TriState.FALSE; } else { throw HaltApiResponses.haltBecauseOfReason("The value of `agent_config_state` can be one of `Enabled`, `Disabled` or null."); } } }
private boolean shouldDecodeFromJsonMessage(String topic){ if (StringUtils.isNotEmpty(messageFormatForAll) && StringUtils.equalsIgnoreCase(messageFormatForAll, JSON)) { return true; } else if (StringUtils.equalsIgnoreCase(messageFormatByTopic.getOrDefault(topic, ""), JSON)) { return true; } return false; } }
/** * Ugly parsing of Exec output into some Elements. Gets called from StreamPumper. * * @param line the line of output to parse */ public synchronized void consumeLine(final String line) { // check if the output contains the error string if (StringUtils.isNotEmpty(errorStr)) { // YES: set error flag if (StringUtils.equalsIgnoreCase(line.trim(), errorStr)) { foundError = true; } } } // consumeLine
@Override public boolean handlesMode(final String mode) { return StringUtils.equalsIgnoreCase(mode, getDeploymentMode()); }
/** * Implements equals for Evidence. * * @param that an object to check the equality of. * @return whether the two objects are equal. */ @SuppressWarnings("deprecation") @Override public boolean equals(Object that) { if (this == that) { return true; } if (!(that instanceof Evidence)) { return false; } final Evidence e = (Evidence) that; //TODO the call to ObjectUtils.equals needs to be replaced when we //stop supporting Jenkins 1.6 requirement. return StringUtils.equalsIgnoreCase(name, e.name) && StringUtils.equalsIgnoreCase(source, e.source) && StringUtils.equalsIgnoreCase(value, e.value) && ObjectUtils.equals(confidence, e.confidence); }
@Override public boolean apply(FieldSchema input) { return StringUtils.equalsIgnoreCase(input.getName(), DatePartitionHiveVersionFinder.this.partitionKeyName); } };
protected boolean processedTabKeyMatchesTabName(String tabName, String candidateTabKey) { try { String processedCandidateTabKey = BLCMessageUtils.getMessage(candidateTabKey); boolean candidateTabKeyWasProcessed = !StringUtils.equals(candidateTabKey, processedCandidateTabKey); return candidateTabKeyWasProcessed && StringUtils.equalsIgnoreCase(tabName, processedCandidateTabKey); } catch (NoSuchMessageException e) { LOG.debug("No such message exists for " + candidateTabKey, e); return false; } }
/** * <p>Compares given <code>string</code> to a CharSequences vararg of <code>searchStrings</code>, * returning {@code true} if the <code>string</code> is equal to any of the <code>searchStrings</code>, ignoring case.</p> * * <pre> * StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null) = false * StringUtils.equalsAnyIgnoreCase(null, null, null) = true * StringUtils.equalsAnyIgnoreCase(null, "abc", "def") = false * StringUtils.equalsAnyIgnoreCase("abc", null, "def") = false * StringUtils.equalsAnyIgnoreCase("abc", "abc", "def") = true * StringUtils.equalsAnyIgnoreCase("abc", "ABC", "DEF") = true * </pre> * * @param string to compare, may be {@code null}. * @param searchStrings a vararg of strings, may be {@code null}. * @return {@code true} if the string is equal (case-insensitive) to any other element of <code>searchStrings</code>; * {@code false} if <code>searchStrings</code> is null or contains no matches. * @since 3.5 */ public static boolean equalsAnyIgnoreCase(final CharSequence string, final CharSequence...searchStrings) { if (ArrayUtils.isNotEmpty(searchStrings)) { for (final CharSequence next : searchStrings) { if (equalsIgnoreCase(string, next)) { return true; } } } return false; }
@Override protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { if (StringUtils.equalsIgnoreCase("/login/mobile", httpServletRequest.getRequestURI()) && StringUtils.equalsIgnoreCase(httpServletRequest.getMethod(), "post")) { try { validateCode(new ServletWebRequest(httpServletRequest)); } catch (ValidateCodeException e) { authenticationFailureHandler.onAuthenticationFailure(httpServletRequest, httpServletResponse, e); return; } } filterChain.doFilter(httpServletRequest, httpServletResponse); }
@Override protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { if (StringUtils.equalsIgnoreCase("/login", httpServletRequest.getRequestURI()) && StringUtils.equalsIgnoreCase(httpServletRequest.getMethod(), "post")) { try { validateCode(new ServletWebRequest(httpServletRequest)); } catch (ValidateCodeException e) { authenticationFailureHandler.onAuthenticationFailure(httpServletRequest, httpServletResponse, e); return; } } filterChain.doFilter(httpServletRequest, httpServletResponse); }
private boolean typeMatchesAdminSection(TypedEntity typedEntity, String sectionKey) { String urlType = StringUtils.substring(sectionKey, sectionKey.indexOf(":") + 1); if(!StringUtils.equalsIgnoreCase(typedEntity.getType().getType(), urlType)) { return false; } return true; }
@Test public void testEqualsIgnoreCase() { assertTrue(StringUtils.equalsIgnoreCase(null, null)); assertTrue(StringUtils.equalsIgnoreCase(FOO, FOO)); assertTrue(StringUtils.equalsIgnoreCase(FOO, new String(new char[] { 'f', 'o', 'o' }))); assertTrue(StringUtils.equalsIgnoreCase(FOO, new String(new char[] { 'f', 'O', 'O' }))); assertFalse(StringUtils.equalsIgnoreCase(FOO, BAR)); assertFalse(StringUtils.equalsIgnoreCase(FOO, null)); assertFalse(StringUtils.equalsIgnoreCase(null, FOO)); assertTrue(StringUtils.equalsIgnoreCase("","")); assertFalse(StringUtils.equalsIgnoreCase("abcd","abcd ")); }
public void process(WatchedEvent event) throws Exception { if (EventType.NodeChildrenChanged.equals(event.getType())) { this.processNodeChildrenChanged(event); } else if (EventType.NodeDeleted.equals(event.getType())) { String application = CommonUtils.getApplication(this.endpoint); String parent = String.format("%s/%s/instances", CONSTANTS_ROOT_PATH, application); String current = event.getPath(); String path = String.format("%s/%s", parent, this.endpoint); if (StringUtils.equalsIgnoreCase(path, current)) { this.initializeCurrentClusterInstanceConfigIfNecessary(false); } // end-if (StringUtils.equalsIgnoreCase(path, current)) } }
private String getParticipantsIdentifier(Object proxy, Method method, Object[] args) throws Throwable { if (StringUtils.isBlank(this.identifier)) { return null; } RemoteNode remoteNode = CommonUtils.getRemoteNode(this.identifier); if (remoteNode == null) { return null; } String serverHost = remoteNode.getServerHost(); String serviceKey = remoteNode.getServiceKey(); int serverPort = remoteNode.getServerPort(); if (StringUtils.isNotBlank(serviceKey) && StringUtils.equalsIgnoreCase(serviceKey, "null") == false) { return this.identifier; } Object application = this.getParticipantsApplication(proxy, method, args); return String.format("%s:%s:%s", serverHost, application, serverPort); }
public ACLProvider create(ZooKeeperClientConfig config){ return StringUtils.equalsIgnoreCase(config.getAuthType(),SASL_AUTH_SCHEME) ? new SaslACLProvider(config) : new DefaultACLProvider(); }
private void checkRemoteResourceDescriptor(RemoteResourceDescriptor descriptor) throws IllegalStateException { RemoteCoordinator transactionCoordinator = (RemoteCoordinator) this.beanFactory.getCompensableNativeParticipant(); RemoteSvc nativeSvc = CommonUtils.getRemoteSvc(transactionCoordinator.getIdentifier()); RemoteSvc parentSvc = CommonUtils.getRemoteSvc(String.valueOf(this.transactionContext.getPropagatedBy())); RemoteSvc remoteSvc = descriptor.getRemoteSvc(); boolean nativeFlag = StringUtils.equalsIgnoreCase(remoteSvc.getServiceKey(), nativeSvc.getServiceKey()); boolean parentFlag = StringUtils.equalsIgnoreCase(remoteSvc.getServiceKey(), parentSvc.getServiceKey()); if (nativeFlag || parentFlag) { throw new IllegalStateException("Endpoint can not be its own remote branch!"); } // end-if (nativeFlag || parentFlag) }
private void validateCode(ServletWebRequest servletWebRequest) throws ServletRequestBindingException { ImageCode codeInSession = (ImageCode) sessionStrategy.getAttribute(servletWebRequest, ValidateController.SESSION_KEY_IMAGE_CODE); String codeInRequest = ServletRequestUtils.getStringParameter(servletWebRequest.getRequest(), "imageCode"); if (StringUtils.isBlank(codeInRequest)) { throw new ValidateCodeException("验证码不能为空!"); } if (codeInSession == null) { throw new ValidateCodeException("验证码不存在!"); } if (codeInSession.isExpire()) { sessionStrategy.removeAttribute(servletWebRequest, ValidateController.SESSION_KEY_IMAGE_CODE); throw new ValidateCodeException("验证码已过期!"); } if (!StringUtils.equalsIgnoreCase(codeInSession.getCode(), codeInRequest)) { throw new ValidateCodeException("验证码不正确!"); } sessionStrategy.removeAttribute(servletWebRequest, ValidateController.SESSION_KEY_IMAGE_CODE); }
private void validateCode(ServletWebRequest servletWebRequest) throws ServletRequestBindingException { String smsCodeInRequest = ServletRequestUtils.getStringParameter(servletWebRequest.getRequest(), "smsCode"); String mobileInRequest = ServletRequestUtils.getStringParameter(servletWebRequest.getRequest(), "smsCode"); SmsCode codeInSession = (SmsCode) sessionStrategy.getAttribute(servletWebRequest, ValidateController.SESSION_KEY_SMS_CODE + mobileInRequest); if (StringUtils.isBlank(smsCodeInRequest)) { throw new ValidateCodeException("验证码不能为空!"); } if (codeInSession == null) { throw new ValidateCodeException("验证码不存在!"); } if (codeInSession.isExpire()) { sessionStrategy.removeAttribute(servletWebRequest, ValidateController.SESSION_KEY_IMAGE_CODE); throw new ValidateCodeException("验证码已过期!"); } if (!StringUtils.equalsIgnoreCase(codeInSession.getCode(), smsCodeInRequest)) { throw new ValidateCodeException("验证码不正确!"); } sessionStrategy.removeAttribute(servletWebRequest, ValidateController.SESSION_KEY_IMAGE_CODE); } }