Example usage for java.lang String concat

List of usage examples for java.lang String concat

Introduction

In this page you can find the example usage for java.lang String concat.

Prototype

public String concat(String str) 

Source Link

Document

Concatenates the specified string to the end of this string.

Usage

From source file:co.cask.common.security.server.ExternalAuthenticationServerSSLTest.java

@BeforeClass
public static void beforeClass() throws Exception {
    URL certUrl = ExternalAuthenticationServerSSLTest.class.getClassLoader().getResource("cert.jks");
    Assert.assertNotNull(certUrl);//  w  w  w .java2s  .  c  o  m

    String authHandlerConfigBase = Constants.AUTH_HANDLER_CONFIG_BASE;

    SecurityConfiguration cConf = SecurityConfiguration.create();
    cConf.set(Constants.SSL_ENABLED, "true");
    cConf.set(authHandlerConfigBase.concat("useLdaps"), "true");
    cConf.set(authHandlerConfigBase.concat("ldapsVerifyCertificate"), "false");
    cConf.set(Constants.AuthenticationServer.SSL_KEYSTORE_PATH, certUrl.getPath());
    configuration = cConf;

    String keystorePassword = cConf.get(Constants.AuthenticationServer.SSL_KEYSTORE_PASSWORD);
    KeyStoreKeyManager keyManager = new KeyStoreKeyManager(certUrl.getFile(), keystorePassword.toCharArray());
    SSLUtil sslUtil = new SSLUtil(keyManager, new TrustAllTrustManager());
    ldapListenerConfig = InMemoryListenerConfig.createLDAPSConfig("LDAP", InetAddress.getByName("127.0.0.1"),
            ldapPort, sslUtil.createSSLServerSocketFactory(), sslUtil.createSSLSocketFactory());

    setup();
}

From source file:com.splicemachine.derby.utils.SpliceStringFunctions.java

/**
 * Implements logic for the SQL function CONCAT.
 * /* w w  w  .j av a  2 s  .  co m*/
 * @param arg1 first string
 * @param arg2 second string
 * 
 * @return concatenation of arg1 and arg2
 */
public static String CONCAT(String arg1, String arg2) {
    // Per MySql documentation, if any argument is NULL,
    // function returns NULL.
    if (arg1 == null || arg2 == null) {
        return null;
    }
    return arg1.concat(arg2);
}

From source file:cn.org.awcp.core.utils.DateUtils.java

/**
 * ?<br>/*ww  w.j ava  2  s.  co m*/
 * generate by: vakin jiang at 2011-12-23
 * 
 * @param date
 * @return
 */
public static Date getDayBegin(Date date) {
    String format = DateFormatUtils.format(date, YYYY_MM_DD);
    return parseDate(format.concat(" 00:00:00"));
}

From source file:cn.org.awcp.core.utils.DateUtils.java

/**
 * ??<br>/*from   w  ww . ja  v  a2s  . c o m*/
 * generate by: vakin jiang at 2011-12-23
 * 
 * @param date
 * @return
 */
public static Date getDayEnd(Date date) {
    String format = DateFormatUtils.format(date, YYYY_MM_DD);
    return parseDate(format.concat(" 23:59:59"));
}

From source file:org.gvnix.service.roo.addon.addon.security.GvNix509TrustManager.java

/**
 * Export the given certificate to a file in SRC_MAIN_RESOURCES. The cert
 * file will have given <code>{alias}.cer</code> as file name.
 * <p>//from   w  w  w . ja va2 s .c  o  m
 * <b>We don't use Roo FileManager API</b> here in order to create cert
 * files because in this way if we have any problem importing them to the
 * JVM <code>cacerts</cacerts> Roo won't undo the cert files creation.
 * </p>
 * 
 * @param alias
 * @param cert
 * @param fileManager
 * @param pathResolver
 * @throws Exception
 */
public static void saveCertFile(String alias, X509Certificate cert, FileManager fileManager,
        PathResolver pathResolver) throws Exception {

    String aliasCerFileName = alias.concat(".cer");
    String cerFilePath = pathResolver.getIdentifier(LogicalPath.getInstance(Path.SRC_MAIN_RESOURCES, ""),
            aliasCerFileName);

    if (!fileManager.exists(cerFilePath)) {

        File cerFile = new File(cerFilePath);
        OutputStream os = null;
        try {
            os = new FileOutputStream(cerFile);
            os.write(cert.getEncoded());
        } finally {
            IOUtils.closeQuietly(os);
        }
        logger.info("Created ".concat(Path.SRC_MAIN_RESOURCES.name()).concat("/").concat(aliasCerFileName));
    }
}

From source file:com.erudika.para.validation.ValidationUtils.java

/**
 * Validates objects using Hibernate Validator.
 * @param content an object to be validated
 * @return a list of error messages or empty if object is valid
 *///from w  w  w . jav  a 2 s. c o  m
public static String[] validateObject(ParaObject content) {
    if (content == null) {
        return new String[] { "Object cannot be null." };
    }
    LinkedList<String> list = new LinkedList<String>();
    try {
        for (ConstraintViolation<ParaObject> constraintViolation : getValidator().validate(content)) {
            String prop = "'".concat(constraintViolation.getPropertyPath().toString()).concat("'");
            list.add(prop.concat(" ").concat(constraintViolation.getMessage()));
        }
    } catch (Exception e) {
        logger.error(null, e);
    }
    return list.toArray(new String[] {});
}

From source file:ca.sqlpower.wabit.enterprise.client.ServerInfoProvider.java

private static String generateServerKey(String host, String port, String path, String username, String password)
        throws MalformedURLException {
    return String.valueOf(host.concat(port).concat(path).concat(username).concat(password).hashCode());
}

From source file:com.vanvalt.util.comm.StringUtils.java

/**
 * ?"20151107162719"  "2015-11-07 16:27:19"
 * @param str/*  w  w w .ja va 2s.  co m*/
 * @return
 */
public static String formateStr2Date(String str) {

    String dateStr = "";

    if (str != null && str.length() >= 14) {

        if (!str.contains(Constant.STRING_LINE)) {
            dateStr = dateStr.concat(str.substring(0, 4)).concat(Constant.STRING_LINE)
                    .concat(str.substring(4, 6)).concat(Constant.STRING_LINE).concat(str.substring(6, 8))
                    .concat(Constant.STRING_SPACE).concat(str.substring(8, 10)).concat(Constant.STRING_COLON)
                    .concat(str.substring(10, 12)).concat(Constant.STRING_COLON).concat(str.substring(12, 14));
        } else {
            dateStr = str;
        }
    }

    return dateStr;
}

From source file:org.helianto.core.test.AbstractIntegrationTest.java

/**
 * Generate a not repeatable key of a given size.
 *///from  w  ww .j a  v a2s. co  m
public static String generateKey(int size) {
    String localKey = generateKey();
    while (localKey.length() != size) {
        if (localKey.length() > size) {
            localKey = localKey.substring(localKey.length() - size, localKey.length());
        } else if (localKey.length() < size) {
            localKey = localKey.concat(localKey);
        }
    }
    return localKey;
}

From source file:com.jaspersoft.jasperserver.jrsh.common.ZipUtil.java

public static File pack(String directory) {
    File dir = new File(directory);
    if (!dir.isDirectory()) {
        throw new DirectoryDoesNotExistException(directory);
    }//from  w w  w.  j a v  a 2  s . c o m
    directory = StringUtils.chomp(directory, separator);
    String outputFileName = directory.concat(".zip");
    try {
        File arch = new File(outputFileName);
        FileOutputStream fos = null;
        fos = new FileOutputStream(arch);
        ZipOutputStream zos = new ZipOutputStream(fos);
        addFiles(zos, directory, directory);
        zos.close();
        return arch;
    } catch (Exception unimportant) {
        throw new CannotPackDirectoryException();
    }
}