List of usage examples for org.apache.commons.lang3 StringUtils equals
public static boolean equals(final CharSequence cs1, final CharSequence cs2)
Compares two CharSequences, returning true if they represent equal sequences of characters.
null s are handled without exceptions.
From source file:ch.cyberduck.core.b2.B2AttributesFinderFeature.java
@Override public PathAttributes find(final Path file) throws BackgroundException { if (file.isRoot()) { return PathAttributes.EMPTY; }//from w ww. java 2 s . c om try { final B2FileResponse info = session.getClient().getFileInfo(new B2FileidProvider(session) .withCache(cache).getFileid(file, new DisabledListProgressListener())); return this.toAttributes(info); } catch (B2ApiException e) { if (StringUtils.equals("file_state_none", e.getMessage())) { return PathAttributes.EMPTY; } throw new B2ExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch (IOException e) { throw new DefaultIOExceptionMappingService().map(e); } }
From source file:com.adeptj.runtime.osgi.BridgeServletContextAttributeListener.java
@Override public void attributeAdded(ServletContextAttributeEvent event) { if (StringUtils.equals(event.getName(), Constants.ATTRIBUTE_BUNDLE_CTX)) { ServiceTrackers.getInstance().openEventDispatcherTracker((BundleContext) event.getValue()); }//from w w w. ja va 2 s .c o m }
From source file:de.micromata.tpsb.doc.parser.ParserResult.java
public FileInfo getFileInfoForFullQualifiedClassName(final String fullQualifiedClassName) { return CollectionUtils.find(this, new Predicate<FileInfo>() { @Override/*from w ww. j a v a 2s.co m*/ public boolean evaluate(FileInfo fInfo) { return StringUtils.equals(fullQualifiedClassName, fInfo.getClassName()); } }); }
From source file:io.wcm.handler.link.ui.Redirect.java
@PostConstruct private void activate() throws IOException { // resolve link of redirect page String redirectUrl = linkHandler.get(resource).buildUrl(); // in publish mode redirect to target if (wcmMode == WCMMode.DISABLED) { renderPage = false;//from w w w.j av a 2s .c o m if (StringUtils.isNotEmpty(redirectUrl)) { if (StringUtils.equals(redirectStatus, Integer.toString(HttpServletResponse.SC_MOVED_TEMPORARILY))) { response.sendRedirect(redirectUrl); } else { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", redirectUrl); } } else { response.sendError(HttpServletResponse.SC_NOT_FOUND); } } }
From source file:io.adeptj.runtime.server.CredentialMatcher.java
private static boolean fromServerConfig(String id, String pwd) { return Configs.of().undertow().getObject(KEY_USER_CREDENTIAL_MAPPING).unwrapped().entrySet().stream() .anyMatch(entry -> StringUtils.equals(entry.getKey(), id) && Arrays.equals(toHash(pwd).toCharArray(), ((String) entry.getValue()).toCharArray())); }
From source file:io.adeptj.runtime.osgi.BridgeServletContextAttributeListener.java
@Override public void attributeAdded(ServletContextAttributeEvent event) { if (StringUtils.equals(event.getName(), ATTRIBUTE_BUNDLE_CTX)) { ServiceTrackers.getInstance().openEventDispatcherTracker((BundleContext) event.getValue()); }//from w w w. j ava2 s .co m }
From source file:com.alibaba.dubbo.qos.server.handler.TelnetProcessHandler.java
@Override protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception { if (StringUtils.isBlank(msg)) { ctx.writeAndFlush(QosProcessHandler.prompt); } else {/*from www . j a v a 2s . c om*/ CommandContext commandContext = TelnetCommandDecoder.decode(msg); commandContext.setRemote(ctx.channel()); try { String result = commandExecutor.execute(commandContext); if (StringUtils.equals(QosConstants.CLOSE, result)) { ctx.writeAndFlush(getByeLabel()).addListener(ChannelFutureListener.CLOSE); } else { ctx.writeAndFlush(result + QosConstants.BR_STR + QosProcessHandler.prompt); } } catch (NoSuchCommandException ex) { ctx.writeAndFlush(msg + " :no such command"); ctx.writeAndFlush(QosConstants.BR_STR + QosProcessHandler.prompt); log.error("can not found command " + commandContext, ex); } catch (Exception ex) { ctx.writeAndFlush(msg + " :fail to execute commandContext by " + ex.getMessage()); ctx.writeAndFlush(QosConstants.BR_STR + QosProcessHandler.prompt); log.error("execute commandContext got exception " + commandContext, ex); } } }
From source file:de.micromata.genome.gwiki.page.impl.wiki.filter.GWikiSpaceFilter.java
@Override public Void filter(GWikiFilterChain<Void, GWikiServeElementFilterEvent, GWikiServeElementFilter> chain, GWikiServeElementFilterEvent event) { GWikiContext wikiContext = event.getWikiContext(); String setspace = wikiContext.getRequestParameter(WIKI_SET_SPACE_PARAM); if (StringUtils.isNotBlank(setspace) == true) { String redid = wikiContext.getWikiWeb().getSpaces().switchUserSpace(wikiContext, setspace); if (redid != null) { try { wikiContext.getResponse().sendRedirect(wikiContext.localUrl(redid)); return null; // wikiContext.sendError(HttpServletResponse.SC_TEMPORARY_REDIRECT, redUrl); } catch (IOException ex) { ; // nothing }/*from w w w. j a va2s . c o m*/ } } else { String spaceId = wikiContext.getWikiWeb().getSpaces().findCurrentPageSpaceId(wikiContext); if (spaceId != null && StringUtils.equals(spaceId, setspace) == false) { String redid = wikiContext.getWikiWeb().getSpaces().switchUserSpace(wikiContext, spaceId); } } chain.nextFilter(event); return null; }
From source file:edu.umn.se.trap.form.GrantSet.java
/** * @param accountName// w w w . j a v a 2s . c om * @return * * Return whether or not a grant is contained in this GrantSet. * */ public boolean contains(String accountName) { for (FormGrant fg : this.grants) { if (StringUtils.equals(fg.getAccountName(), accountName)) { return true; } } return false; }
From source file:com.thoughtworks.go.config.merge.MergePipelineConfigs.java
public void addPart(BasicPipelineConfigs pipelineConfigs) { if (!StringUtils.equals(pipelineConfigs.getGroup(), this.getGroup())) throw new IllegalArgumentException("Group names must be the same in merge"); this.parts.add(pipelineConfigs); }