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:MainClass.java
public static void main(String[] args) { //Compare Strings...No NullPointer Exception! System.out.println("12) Comapre null and null >>>" + StringUtils.equals(null, null)); }
From source file:StringUtilsTrial.java
public static void main(String[] args) { // Compare Strings...No NullPointer Exception! System.out.println("12) Comapre null and null >>>" + StringUtils.equals(null, null)); }
From source file:com.xx_dev.speed_test.SpeedTestClient.java
public static void main(String[] args) { EventLoopGroup group = new NioEventLoopGroup(); try {//from www . ja v a 2 s . c o m URL url = new URL(args[0]); boolean isSSL = false; String host = url.getHost(); int port = 80; if (StringUtils.equals(url.getProtocol(), "https")) { port = 443; isSSL = true; } if (url.getPort() > 0) { port = url.getPort(); } String path = url.getPath(); if (StringUtils.isNotBlank(url.getQuery())) { path += "?" + url.getQuery(); } PrintWriter resultPrintWriter = null; if (StringUtils.isNotBlank(args[1])) { String resultFile = args[1]; resultPrintWriter = new PrintWriter( new OutputStreamWriter(new FileOutputStream(resultFile, false), "UTF-8")); } Bootstrap b = new Bootstrap(); b.group(group).channel(NioSocketChannel.class) .handler(new SpeedTestHttpClientChannelInitializer(isSSL, resultPrintWriter)); // Make the connection attempt. Channel ch = b.connect(host, port).sync().channel(); // Prepare the HTTP request. HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); request.headers().set(HttpHeaders.Names.HOST, host); request.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE); //request.headers().set(HttpHeaders.Names.ACCEPT_ENCODING, HttpHeaders.Values.GZIP); // Send the HTTP request. ch.writeAndFlush(request); // Wait for the server to close the connection. ch.closeFuture().sync(); if (resultPrintWriter != null) { resultPrintWriter.close(); } } catch (InterruptedException e) { logger.error(e.getMessage(), e); } catch (FileNotFoundException e) { logger.error(e.getMessage(), e); } catch (UnsupportedEncodingException e) { logger.error(e.getMessage(), e); } catch (MalformedURLException e) { logger.error(e.getMessage(), e); } finally { group.shutdownGracefully(); } }
From source file:de.iteratec.iteraplan.xmi.XmiImport.java
/** * The entry point for data import./*from w ww .j a v a 2s . com*/ * * @param args not used * @throws IOException if the {@code iteraplanData.xmi} file will be not found */ public static void main(String[] args) throws IOException { if (args.length < 1) { LOGGER.error("Invalid method call! Use: XmiImport INITIAL_DATA|BANK_DATA"); } XmiImport xmiImport = new XmiImport(); if (StringUtils.equals(args[0], "BANK_DATA")) { xmiImport.importData(); } else if (StringUtils.equals(args[0], "INITIAL_DATA")) { xmiImport.importInitialData(); } else { LOGGER.error("Invalid method call! Use: XmiImport INITIAL_DATA|BANK_DATA"); } }
From source file:com.cws.esolutions.agent.AgentDaemon.java
public static void main(final String[] args) { AgentDaemon daemon = new AgentDaemon(); if (args.length != 1) { AgentDaemon.usage();//from w w w . ja v a2 s.c om return; } try { if (StringUtils.equals("start", args[0])) { daemon.init(null); daemon.start(); } else if (StringUtils.equals("stop", args[0])) { daemon.stop(); } else { AgentDaemon.usage(); } } catch (DaemonInitException dix) { ERROR_RECORDER.error(dix.getMessage(), dix); System.exit(-1); } }
From source file:com.liferay.portal.security.pwd.PwdEncryptor.java
/** * A few lines to test we've successfully got the Liferay code working in isolation. * @param args Not used./* w ww . ja v a 2 s . c o m*/ * @throws PwdEncryptorException Said no method call ever. */ public static void main(String[] args) throws PwdEncryptorException { String password = com.github.davidcarboni.cryptolite.Random.password(8); System.out.println("password = " + password); String hash = encrypt(password); System.out.println("hash = " + hash); String verify = encrypt(password, hash); System.out.println("verify = " + verify); boolean ok = StringUtils.equals(hash, verify); System.out.println("ok = " + ok); }
From source file:com.enonic.cms.core.search.query.QueryFieldFactory.java
private static void detectContentKeyField(final String field, final QueryField queryField) { if (StringUtils.equals(field, CONTENTKEY_FIELDNAME)) { queryField.setRenderAsIdQuery(true); }/* w ww . j ava 2 s . c om*/ }
From source file:com.intel.cosbench.driver.util.Division.java
public static Division getDivision(String division) { if (StringUtils.equals(division, "none")) return NONE; if (StringUtils.equals(division, "object")) return OBJECT; if (StringUtils.equals(division, "container")) return CONTAINER; String msg = "unrecogized division strategy: " + division; throw new ConfigException(msg); }
From source file:com.xx_dev.apn.proxy.config.ApnProxyListenType.java
public static ApnProxyListenType fromString(String _listenType) { if (StringUtils.equals(_listenType, "ssl")) { return ApnProxyListenType.SSL; } else if (StringUtils.equals(_listenType, "aes")) { return ApnProxyListenType.AES; } else if (StringUtils.equals(_listenType, "plain")) { return ApnProxyListenType.PLAIN; } else {//from w w w . java 2 s . c o m throw new ApnProxyConfigException("Unknown listen type"); } }
From source file:com.gantzgulch.sharing.domain.SharedFileAction.java
public static SharedFileAction fromHibernate(String action) { for (SharedFileAction sharedFileAction : values()) { if (StringUtils.equals(action, sharedFileAction.name())) { return sharedFileAction; }// w ww. j ava 2s. c om } return UNKNOWN; }