Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 92B89E2FA for ; Mon, 7 Jan 2013 16:08:35 +0000 (UTC) Received: (qmail 35232 invoked by uid 500); 7 Jan 2013 16:08:35 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 35004 invoked by uid 500); 7 Jan 2013 16:08:34 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 34992 invoked by uid 99); 7 Jan 2013 16:08:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2013 16:08:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2013 16:08:31 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 887E923888FE; Mon, 7 Jan 2013 16:08:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1429868 [2/6] - in /commons/proper/codec/trunk/src: main/java/org/apache/commons/codec/ main/java/org/apache/commons/codec/binary/ main/java/org/apache/commons/codec/digest/ main/java/org/apache/commons/codec/language/ main/java/org/apache... Date: Mon, 07 Jan 2013 16:08:07 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130107160811.887E923888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java Mon Jan 7 16:08:05 2013 @@ -45,8 +45,8 @@ public class DigestUtils { * @throws IOException * On error reading from the stream */ - private static byte[] digest(MessageDigest digest, InputStream data) throws IOException { - byte[] buffer = new byte[STREAM_BUFFER_LENGTH]; + private static byte[] digest(final MessageDigest digest, final InputStream data) throws IOException { + final byte[] buffer = new byte[STREAM_BUFFER_LENGTH]; int read = data.read(buffer, 0, STREAM_BUFFER_LENGTH); while (read > -1) { @@ -70,10 +70,10 @@ public class DigestUtils { * @throws IllegalArgumentException * when a {@link NoSuchAlgorithmException} is caught. */ - public static MessageDigest getDigest(String algorithm) { + public static MessageDigest getDigest(final String algorithm) { try { return MessageDigest.getInstance(algorithm); - } catch (NoSuchAlgorithmException e) { + } catch (final NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } } @@ -188,7 +188,7 @@ public class DigestUtils { * @return MD2 digest * @since 1.7 */ - public static byte[] md2(byte[] data) { + public static byte[] md2(final byte[] data) { return getMd2Digest().digest(data); } @@ -202,7 +202,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.7 */ - public static byte[] md2(InputStream data) throws IOException { + public static byte[] md2(final InputStream data) throws IOException { return digest(getMd2Digest(), data); } @@ -214,7 +214,7 @@ public class DigestUtils { * @return MD2 digest * @since 1.7 */ - public static byte[] md2(String data) { + public static byte[] md2(final String data) { return md2(StringUtils.getBytesUtf8(data)); } @@ -226,7 +226,7 @@ public class DigestUtils { * @return MD2 digest as a hex string * @since 1.7 */ - public static String md2Hex(byte[] data) { + public static String md2Hex(final byte[] data) { return Hex.encodeHexString(md2(data)); } @@ -240,7 +240,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.7 */ - public static String md2Hex(InputStream data) throws IOException { + public static String md2Hex(final InputStream data) throws IOException { return Hex.encodeHexString(md2(data)); } @@ -252,7 +252,7 @@ public class DigestUtils { * @return MD2 digest as a hex string * @since 1.7 */ - public static String md2Hex(String data) { + public static String md2Hex(final String data) { return Hex.encodeHexString(md2(data)); } @@ -263,7 +263,7 @@ public class DigestUtils { * Data to digest * @return MD5 digest */ - public static byte[] md5(byte[] data) { + public static byte[] md5(final byte[] data) { return getMd5Digest().digest(data); } @@ -277,7 +277,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.4 */ - public static byte[] md5(InputStream data) throws IOException { + public static byte[] md5(final InputStream data) throws IOException { return digest(getMd5Digest(), data); } @@ -288,7 +288,7 @@ public class DigestUtils { * Data to digest * @return MD5 digest */ - public static byte[] md5(String data) { + public static byte[] md5(final String data) { return md5(StringUtils.getBytesUtf8(data)); } @@ -299,7 +299,7 @@ public class DigestUtils { * Data to digest * @return MD5 digest as a hex string */ - public static String md5Hex(byte[] data) { + public static String md5Hex(final byte[] data) { return Hex.encodeHexString(md5(data)); } @@ -313,7 +313,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.4 */ - public static String md5Hex(InputStream data) throws IOException { + public static String md5Hex(final InputStream data) throws IOException { return Hex.encodeHexString(md5(data)); } @@ -324,7 +324,7 @@ public class DigestUtils { * Data to digest * @return MD5 digest as a hex string */ - public static String md5Hex(String data) { + public static String md5Hex(final String data) { return Hex.encodeHexString(md5(data)); } @@ -337,7 +337,7 @@ public class DigestUtils { * @deprecated Use {@link #sha1(byte[])} */ @Deprecated - public static byte[] sha(byte[] data) { + public static byte[] sha(final byte[] data) { return sha1(data); } @@ -353,7 +353,7 @@ public class DigestUtils { * @deprecated Use {@link #sha1(InputStream)} */ @Deprecated - public static byte[] sha(InputStream data) throws IOException { + public static byte[] sha(final InputStream data) throws IOException { return sha1(data); } @@ -366,7 +366,7 @@ public class DigestUtils { * @deprecated Use {@link #sha1(String)} */ @Deprecated - public static byte[] sha(String data) { + public static byte[] sha(final String data) { return sha1(data); } @@ -378,7 +378,7 @@ public class DigestUtils { * @return SHA-1 digest * @since 1.7 */ - public static byte[] sha1(byte[] data) { + public static byte[] sha1(final byte[] data) { return getSha1Digest().digest(data); } @@ -392,7 +392,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.7 */ - public static byte[] sha1(InputStream data) throws IOException { + public static byte[] sha1(final InputStream data) throws IOException { return digest(getSha1Digest(), data); } @@ -403,7 +403,7 @@ public class DigestUtils { * Data to digest * @return SHA-1 digest */ - public static byte[] sha1(String data) { + public static byte[] sha1(final String data) { return sha1(StringUtils.getBytesUtf8(data)); } @@ -415,7 +415,7 @@ public class DigestUtils { * @return SHA-1 digest as a hex string * @since 1.7 */ - public static String sha1Hex(byte[] data) { + public static String sha1Hex(final byte[] data) { return Hex.encodeHexString(sha1(data)); } @@ -429,7 +429,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.7 */ - public static String sha1Hex(InputStream data) throws IOException { + public static String sha1Hex(final InputStream data) throws IOException { return Hex.encodeHexString(sha1(data)); } @@ -441,7 +441,7 @@ public class DigestUtils { * @return SHA-1 digest as a hex string * @since 1.7 */ - public static String sha1Hex(String data) { + public static String sha1Hex(final String data) { return Hex.encodeHexString(sha1(data)); } @@ -456,7 +456,7 @@ public class DigestUtils { * @return SHA-256 digest * @since 1.4 */ - public static byte[] sha256(byte[] data) { + public static byte[] sha256(final byte[] data) { return getSha256Digest().digest(data); } @@ -473,7 +473,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.4 */ - public static byte[] sha256(InputStream data) throws IOException { + public static byte[] sha256(final InputStream data) throws IOException { return digest(getSha256Digest(), data); } @@ -488,7 +488,7 @@ public class DigestUtils { * @return SHA-256 digest * @since 1.4 */ - public static byte[] sha256(String data) { + public static byte[] sha256(final String data) { return sha256(StringUtils.getBytesUtf8(data)); } @@ -503,7 +503,7 @@ public class DigestUtils { * @return SHA-256 digest as a hex string * @since 1.4 */ - public static String sha256Hex(byte[] data) { + public static String sha256Hex(final byte[] data) { return Hex.encodeHexString(sha256(data)); } @@ -520,7 +520,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.4 */ - public static String sha256Hex(InputStream data) throws IOException { + public static String sha256Hex(final InputStream data) throws IOException { return Hex.encodeHexString(sha256(data)); } @@ -535,7 +535,7 @@ public class DigestUtils { * @return SHA-256 digest as a hex string * @since 1.4 */ - public static String sha256Hex(String data) { + public static String sha256Hex(final String data) { return Hex.encodeHexString(sha256(data)); } @@ -550,7 +550,7 @@ public class DigestUtils { * @return SHA-384 digest * @since 1.4 */ - public static byte[] sha384(byte[] data) { + public static byte[] sha384(final byte[] data) { return getSha384Digest().digest(data); } @@ -567,7 +567,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.4 */ - public static byte[] sha384(InputStream data) throws IOException { + public static byte[] sha384(final InputStream data) throws IOException { return digest(getSha384Digest(), data); } @@ -582,7 +582,7 @@ public class DigestUtils { * @return SHA-384 digest * @since 1.4 */ - public static byte[] sha384(String data) { + public static byte[] sha384(final String data) { return sha384(StringUtils.getBytesUtf8(data)); } @@ -597,7 +597,7 @@ public class DigestUtils { * @return SHA-384 digest as a hex string * @since 1.4 */ - public static String sha384Hex(byte[] data) { + public static String sha384Hex(final byte[] data) { return Hex.encodeHexString(sha384(data)); } @@ -614,7 +614,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.4 */ - public static String sha384Hex(InputStream data) throws IOException { + public static String sha384Hex(final InputStream data) throws IOException { return Hex.encodeHexString(sha384(data)); } @@ -629,7 +629,7 @@ public class DigestUtils { * @return SHA-384 digest as a hex string * @since 1.4 */ - public static String sha384Hex(String data) { + public static String sha384Hex(final String data) { return Hex.encodeHexString(sha384(data)); } @@ -644,7 +644,7 @@ public class DigestUtils { * @return SHA-512 digest * @since 1.4 */ - public static byte[] sha512(byte[] data) { + public static byte[] sha512(final byte[] data) { return getSha512Digest().digest(data); } @@ -661,7 +661,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.4 */ - public static byte[] sha512(InputStream data) throws IOException { + public static byte[] sha512(final InputStream data) throws IOException { return digest(getSha512Digest(), data); } @@ -676,7 +676,7 @@ public class DigestUtils { * @return SHA-512 digest * @since 1.4 */ - public static byte[] sha512(String data) { + public static byte[] sha512(final String data) { return sha512(StringUtils.getBytesUtf8(data)); } @@ -691,7 +691,7 @@ public class DigestUtils { * @return SHA-512 digest as a hex string * @since 1.4 */ - public static String sha512Hex(byte[] data) { + public static String sha512Hex(final byte[] data) { return Hex.encodeHexString(sha512(data)); } @@ -708,7 +708,7 @@ public class DigestUtils { * On error reading from the stream * @since 1.4 */ - public static String sha512Hex(InputStream data) throws IOException { + public static String sha512Hex(final InputStream data) throws IOException { return Hex.encodeHexString(sha512(data)); } @@ -723,7 +723,7 @@ public class DigestUtils { * @return SHA-512 digest as a hex string * @since 1.4 */ - public static String sha512Hex(String data) { + public static String sha512Hex(final String data) { return Hex.encodeHexString(sha512(data)); } @@ -736,7 +736,7 @@ public class DigestUtils { * @deprecated Use {@link #sha1Hex(byte[])} */ @Deprecated - public static String shaHex(byte[] data) { + public static String shaHex(final byte[] data) { return sha1Hex(data); } @@ -752,7 +752,7 @@ public class DigestUtils { * @deprecated Use {@link #sha1Hex(InputStream)} */ @Deprecated - public static String shaHex(InputStream data) throws IOException { + public static String shaHex(final InputStream data) throws IOException { return sha1Hex(data); } @@ -765,7 +765,7 @@ public class DigestUtils { * @deprecated Use {@link #sha1Hex(String)} */ @Deprecated - public static String shaHex(String data) { + public static String shaHex(final String data) { return sha1Hex(data); } @@ -779,7 +779,7 @@ public class DigestUtils { * @return the updated {@link MessageDigest} * @since 1.7 */ - public static MessageDigest updateDigest(final MessageDigest messageDigest, byte[] valueToDigest) { + public static MessageDigest updateDigest(final MessageDigest messageDigest, final byte[] valueToDigest) { messageDigest.update(valueToDigest); return messageDigest; } Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java Mon Jan 7 16:08:05 2013 @@ -65,7 +65,7 @@ public class Md5Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. * */ - public static String apr1Crypt(byte[] keyBytes) { + public static String apr1Crypt(final byte[] keyBytes) { return apr1Crypt(keyBytes, APR1_PREFIX + B64.getRandomSalt(8)); } @@ -77,7 +77,7 @@ public class Md5Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. */ - public static String apr1Crypt(byte[] keyBytes, String salt) { + public static String apr1Crypt(final byte[] keyBytes, String salt) { // to make the md5Crypt regex happy if (salt != null && !salt.startsWith(APR1_PREFIX)) { salt = APR1_PREFIX + salt; @@ -91,7 +91,7 @@ public class Md5Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. */ - public static String apr1Crypt(String keyBytes) { + public static String apr1Crypt(final String keyBytes) { return apr1Crypt(keyBytes.getBytes(Charsets.UTF_8)); } @@ -112,7 +112,7 @@ public class Md5Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. */ - public static String apr1Crypt(String keyBytes, String salt) { + public static String apr1Crypt(final String keyBytes, final String salt) { return apr1Crypt(keyBytes.getBytes(Charsets.UTF_8), salt); } @@ -144,7 +144,7 @@ public class Md5Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. */ - public static String md5Crypt(byte[] keyBytes, String salt) { + public static String md5Crypt(final byte[] keyBytes, final String salt) { return md5Crypt(keyBytes, salt, MD5_PREFIX); } @@ -159,7 +159,7 @@ public class Md5Crypt { * when a {@link java.security.NoSuchAlgorithmException} is caught. */ public static String md5Crypt(final byte[] keyBytes, final String salt, final String prefix) { - int keyLen = keyBytes.length; + final int keyLen = keyBytes.length; // Extract the real salt from the given string which can be a complete hash string. String saltString; @@ -173,9 +173,9 @@ public class Md5Crypt { } saltString = m.group(1); } - byte[] saltBytes = saltString.getBytes(Charsets.UTF_8); + final byte[] saltBytes = saltString.getBytes(Charsets.UTF_8); - MessageDigest ctx = DigestUtils.getMd5Digest(); + final MessageDigest ctx = DigestUtils.getMd5Digest(); /* * The password first, since that is what is most unknown @@ -215,7 +215,7 @@ public class Md5Crypt { * Then something really weird... */ ii = keyLen; - int j = 0; + final int j = 0; while (ii > 0) { if ((ii & 1) == 1) { ctx.update(finalb[j]); @@ -228,7 +228,7 @@ public class Md5Crypt { /* * Now make the output string */ - StringBuilder passwd = new StringBuilder(prefix + saltString + "$"); + final StringBuilder passwd = new StringBuilder(prefix + saltString + "$"); finalb = ctx.digest(); /* Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java Mon Jan 7 16:08:05 2013 @@ -76,7 +76,7 @@ public class Sha2Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. */ - public static String sha256Crypt(byte[] keyBytes) { + public static String sha256Crypt(final byte[] keyBytes) { return sha256Crypt(keyBytes, null); } @@ -90,7 +90,7 @@ public class Sha2Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. */ - public static String sha256Crypt(byte[] keyBytes, String salt) { + public static String sha256Crypt(final byte[] keyBytes, String salt) { if (salt == null) { salt = SHA256_PREFIX + B64.getRandomSalt(8); } @@ -122,9 +122,9 @@ public class Sha2Crypt { * when a {@link NoSuchAlgorithmException} is caught * @see MessageDigestAlgorithms */ - private static String sha2Crypt(byte[] keyBytes, String salt, String saltPrefix, int blocksize, String algorithm) { + private static String sha2Crypt(final byte[] keyBytes, final String salt, final String saltPrefix, final int blocksize, final String algorithm) { - int keyLen = keyBytes.length; + final int keyLen = keyBytes.length; // Extracts effective salt and the number of rounds from the given salt. int rounds = ROUNDS_DEFAULT; @@ -133,7 +133,7 @@ public class Sha2Crypt { throw new IllegalArgumentException("Salt must not be null"); } - Matcher m = SALT_PATTERN.matcher(salt); + final Matcher m = SALT_PATTERN.matcher(salt); if (m == null || !m.find()) { throw new IllegalArgumentException("Invalid salt value: " + salt); } @@ -142,9 +142,9 @@ public class Sha2Crypt { rounds = Math.max(ROUNDS_MIN, Math.min(ROUNDS_MAX, rounds)); roundsCustom = true; } - String saltString = m.group(4); - byte[] saltBytes = saltString.getBytes(Charsets.UTF_8); - int saltLen = saltBytes.length; + final String saltString = m.group(4); + final byte[] saltBytes = saltString.getBytes(Charsets.UTF_8); + final int saltLen = saltBytes.length; // 1. start digest A // Prepare for the real work. @@ -283,7 +283,7 @@ public class Sha2Crypt { /* * Create byte sequence P. */ - byte[] pBytes = new byte[keyLen]; + final byte[] pBytes = new byte[keyLen]; int cp = 0; while (cp < keyLen - blocksize) { System.arraycopy(tempResult, 0, pBytes, cp, blocksize); @@ -325,7 +325,7 @@ public class Sha2Crypt { * Create byte sequence S. */ // Remark: The salt is limited to 16 chars, how does this make sense? - byte[] sBytes = new byte[saltLen]; + final byte[] sBytes = new byte[saltLen]; cp = 0; while (cp < saltLen - blocksize) { System.arraycopy(tempResult, 0, sBytes, cp, blocksize); @@ -411,7 +411,7 @@ public class Sha2Crypt { /* * Now we can construct the result string. It consists of three parts. */ - StringBuilder buffer = new StringBuilder(saltPrefix); + final StringBuilder buffer = new StringBuilder(saltPrefix); if (roundsCustom) { buffer.append(ROUNDS_PREFIX); buffer.append(rounds); @@ -505,7 +505,7 @@ public class Sha2Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. */ - public static String sha512Crypt(byte[] keyBytes) { + public static String sha512Crypt(final byte[] keyBytes) { return sha512Crypt(keyBytes, null); } @@ -519,7 +519,7 @@ public class Sha2Crypt { * @throws RuntimeException * when a {@link java.security.NoSuchAlgorithmException} is caught. */ - public static String sha512Crypt(byte[] keyBytes, String salt) { + public static String sha512Crypt(final byte[] keyBytes, String salt) { if (salt == null) { salt = SHA512_PREFIX + B64.getRandomSalt(8); } Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java Mon Jan 7 16:08:05 2013 @@ -178,7 +178,7 @@ public class UnixCrypt { * plaintext password * @return a 13 character string starting with the salt string */ - public static String crypt(byte[] original) { + public static String crypt(final byte[] original) { return crypt(original, null); } @@ -195,36 +195,36 @@ public class UnixCrypt { * @throws IllegalArgumentException * if the salt does not match the allowed pattern */ - public static String crypt(byte[] original, String salt) { + public static String crypt(final byte[] original, String salt) { if (salt == null) { - Random randomGenerator = new Random(); - int numSaltChars = SALT_CHARS.length; + final Random randomGenerator = new Random(); + final int numSaltChars = SALT_CHARS.length; salt = "" + SALT_CHARS[randomGenerator.nextInt(numSaltChars)] + SALT_CHARS[randomGenerator.nextInt(numSaltChars)]; } else if (!salt.matches("^[" + B64.B64T + "]{2,}$")) { throw new IllegalArgumentException("Invalid salt value: " + salt); } - StringBuilder buffer = new StringBuilder(" "); - char charZero = salt.charAt(0); - char charOne = salt.charAt(1); + final StringBuilder buffer = new StringBuilder(" "); + final char charZero = salt.charAt(0); + final char charOne = salt.charAt(1); buffer.setCharAt(0, charZero); buffer.setCharAt(1, charOne); - int eSwap0 = CON_SALT[charZero]; - int eSwap1 = CON_SALT[charOne] << 4; - byte key[] = new byte[8]; + final int eSwap0 = CON_SALT[charZero]; + final int eSwap1 = CON_SALT[charOne] << 4; + final byte key[] = new byte[8]; for (int i = 0; i < key.length; i++) { key[i] = 0; } for (int i = 0; i < key.length && i < original.length; i++) { - int iChar = original[i]; + final int iChar = original[i]; key[i] = (byte) (iChar << 1); } - int schedule[] = desSetKey(key); - int out[] = body(schedule, eSwap0, eSwap1); - byte b[] = new byte[9]; + final int schedule[] = desSetKey(key); + final int out[] = body(schedule, eSwap0, eSwap1); + final byte b[] = new byte[9]; intToFourBytes(out[0], b, 0); intToFourBytes(out[1], b, 4); b[8] = 0; @@ -259,7 +259,7 @@ public class UnixCrypt { * plaintext password * @return a 13 character string starting with the salt string */ - public static String crypt(String original) { + public static String crypt(final String original) { return crypt(original.getBytes(Charsets.UTF_8)); } @@ -274,11 +274,11 @@ public class UnixCrypt { * @throws IllegalArgumentException * if the salt does not match the allowed pattern */ - public static String crypt(String original, String salt) { + public static String crypt(final String original, final String salt) { return crypt(original.getBytes(Charsets.UTF_8), salt); } - private static int[] body(int schedule[], int eSwap0, int eSwap1) { + private static int[] body(final int schedule[], final int eSwap0, final int eSwap1) { int left = 0; int right = 0; int t = 0; @@ -295,7 +295,7 @@ public class UnixCrypt { t = right; right = left >>> 1 | left << 31; left = t >>> 1 | t << 31; - int results[] = new int[2]; + final int results[] = new int[2]; permOp(right, left, 1, 0x55555555, results); right = results[0]; left = results[1]; @@ -311,18 +311,18 @@ public class UnixCrypt { permOp(right, left, 4, 0xf0f0f0f, results); right = results[0]; left = results[1]; - int out[] = new int[2]; + final int out[] = new int[2]; out[0] = left; out[1] = right; return out; } - private static int byteToUnsigned(byte b) { - int value = b; + private static int byteToUnsigned(final byte b) { + final int value = b; return value < 0 ? value + 256 : value; } - private static int dEncrypt(int el, int r, int s, int e0, int e1, int sArr[]) { + private static int dEncrypt(int el, final int r, final int s, final int e0, final int e1, final int sArr[]) { int v = r ^ r >>> 16; int u = v & e0; v &= e1; @@ -335,11 +335,11 @@ public class UnixCrypt { return el; } - private static int[] desSetKey(byte key[]) { - int schedule[] = new int[32]; + private static int[] desSetKey(final byte key[]) { + final int schedule[] = new int[32]; int c = fourBytesToInt(key, 0); int d = fourBytesToInt(key, 4); - int results[] = new int[2]; + final int results[] = new int[2]; permOp(d, c, 4, 0xf0f0f0f, results); d = results[0]; c = results[1]; @@ -370,7 +370,7 @@ public class UnixCrypt { int s = SKB[0][c & 0x3f] | SKB[1][c >>> 6 & 0x3 | c >>> 7 & 0x3c] | SKB[2][c >>> 13 & 0xf | c >>> 14 & 0x30] | SKB[3][c >>> 20 & 0x1 | c >>> 21 & 0x6 | c >>> 22 & 0x38]; - int t = SKB[4][d & 0x3f] | SKB[5][d >>> 7 & 0x3 | d >>> 8 & 0x3c] | SKB[6][d >>> 15 & 0x3f] | + final int t = SKB[4][d & 0x3f] | SKB[5][d >>> 7 & 0x3 | d >>> 8 & 0x3c] | SKB[6][d >>> 15 & 0x3f] | SKB[7][d >>> 21 & 0xf | d >>> 22 & 0x30]; schedule[j++] = (t << 16 | s & 0xffff); s = s >>> 16 | t & 0xffff0000; @@ -381,7 +381,7 @@ public class UnixCrypt { return schedule; } - private static int fourBytesToInt(byte b[], int offset) { + private static int fourBytesToInt(final byte b[], int offset) { int value = byteToUnsigned(b[offset++]); value |= byteToUnsigned(b[offset++]) << 8; value |= byteToUnsigned(b[offset++]) << 16; @@ -389,21 +389,21 @@ public class UnixCrypt { return value; } - private static int hPermOp(int a, int n, int m) { - int t = (a << 16 - n ^ a) & m; + private static int hPermOp(int a, final int n, final int m) { + final int t = (a << 16 - n ^ a) & m; a = a ^ t ^ t >>> 16 - n; return a; } - private static void intToFourBytes(int iValue, byte b[], int offset) { + private static void intToFourBytes(final int iValue, final byte b[], int offset) { b[offset++] = (byte) (iValue & 0xff); b[offset++] = (byte) (iValue >>> 8 & 0xff); b[offset++] = (byte) (iValue >>> 16 & 0xff); b[offset++] = (byte) (iValue >>> 24 & 0xff); } - private static void permOp(int a, int b, int n, int m, int results[]) { - int t = (a >>> n ^ b) & m; + private static void permOp(int a, int b, final int n, final int m, final int results[]) { + final int t = (a >>> n ^ b) & m; a ^= t << n; b ^= t; results[0] = a; Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java Mon Jan 7 16:08:05 2013 @@ -53,7 +53,7 @@ public abstract class AbstractCaverphone * if the parameter supplied is not of type java.lang.String */ @Override - public Object encode(Object source) throws EncoderException { + public Object encode(final Object source) throws EncoderException { if (!(source instanceof String)) { throw new EncoderException("Parameter supplied to Caverphone encode is not of type java.lang.String"); } @@ -72,7 +72,7 @@ public abstract class AbstractCaverphone * @return {@code true} if the encodings of these strings are identical, {@code false} otherwise. * @throws EncoderException */ - public boolean isEncodeEqual(String str1, String str2) throws EncoderException { + public boolean isEncodeEqual(final String str1, final String str2) throws EncoderException { return this.encode(str1).equals(this.encode(str2)); } Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone.java Mon Jan 7 16:08:05 2013 @@ -54,7 +54,7 @@ public class Caverphone implements Strin * String the source string * @return A caverphone code for the given String */ - public String caverphone(String source) { + public String caverphone(final String source) { return this.encoder.encode(source); } @@ -70,7 +70,7 @@ public class Caverphone implements Strin * if the parameter supplied is not of type java.lang.String */ @Override - public Object encode(Object obj) throws EncoderException { + public Object encode(final Object obj) throws EncoderException { if (!(obj instanceof String)) { throw new EncoderException("Parameter supplied to Caverphone encode is not of type java.lang.String"); } @@ -85,7 +85,7 @@ public class Caverphone implements Strin * @return The caverphone code corresponding to the String supplied */ @Override - public String encode(String str) { + public String encode(final String str) { return this.caverphone(str); } @@ -98,7 +98,7 @@ public class Caverphone implements Strin * Second of two strings to compare * @return {@code true} if the caverphones of these strings are identical, {@code false} otherwise. */ - public boolean isCaverphoneEqual(String str1, String str2) { + public boolean isCaverphoneEqual(final String str1, final String str2) { return this.caverphone(str1).equals(this.caverphone(str2)); } Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone1.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone1.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone1.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone1.java Mon Jan 7 16:08:05 2013 @@ -42,7 +42,7 @@ public class Caverphone1 extends Abstrac * @return A caverphone code for the given String */ @Override - public String encode(String source) { + public String encode(final String source) { String txt = source; if (txt == null || txt.length() == 0) { return SIX_1; Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone2.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone2.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone2.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone2.java Mon Jan 7 16:08:05 2013 @@ -42,7 +42,7 @@ public class Caverphone2 extends Abstrac * @return A caverphone code for the given String */ @Override - public String encode(String source) { + public String encode(final String source) { String txt = source; if (txt == null || txt.length() == 0) { return TEN_1; Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java Mon Jan 7 16:08:05 2013 @@ -201,12 +201,12 @@ public class ColognePhonetic implements protected int length = 0; - public CologneBuffer(char[] data) { + public CologneBuffer(final char[] data) { this.data = data; this.length = data.length; } - public CologneBuffer(int buffSize) { + public CologneBuffer(final int buffSize) { this.data = new char[buffSize]; this.length = 0; } @@ -225,18 +225,18 @@ public class ColognePhonetic implements private class CologneOutputBuffer extends CologneBuffer { - public CologneOutputBuffer(int buffSize) { + public CologneOutputBuffer(final int buffSize) { super(buffSize); } - public void addRight(char chr) { + public void addRight(final char chr) { data[length] = chr; length++; } @Override - protected char[] copyData(int start, final int length) { - char[] newData = new char[length]; + protected char[] copyData(final int start, final int length) { + final char[] newData = new char[length]; System.arraycopy(data, start, newData, 0, length); return newData; } @@ -244,18 +244,18 @@ public class ColognePhonetic implements private class CologneInputBuffer extends CologneBuffer { - public CologneInputBuffer(char[] data) { + public CologneInputBuffer(final char[] data) { super(data); } - public void addLeft(char ch) { + public void addLeft(final char ch) { length++; data[getNextPos()] = ch; } @Override - protected char[] copyData(int start, final int length) { - char[] newData = new char[length]; + protected char[] copyData(final int start, final int length) { + final char[] newData = new char[length]; System.arraycopy(data, data.length - this.length + start, newData, 0, length); return newData; } @@ -269,7 +269,7 @@ public class ColognePhonetic implements } public char removeNext() { - char ch = getNextChar(); + final char ch = getNextChar(); length--; return ch; } @@ -294,8 +294,8 @@ public class ColognePhonetic implements /* * Returns whether the array contains the key, or not. */ - private static boolean arrayContains(char[] arr, char key) { - for (char element : arr) { + private static boolean arrayContains(final char[] arr, final char key) { + for (final char element : arr) { if (element == key) { return true; } @@ -321,8 +321,8 @@ public class ColognePhonetic implements text = preprocess(text); - CologneOutputBuffer output = new CologneOutputBuffer(text.length() * 2); - CologneInputBuffer input = new CologneInputBuffer(text.toCharArray()); + final CologneOutputBuffer output = new CologneOutputBuffer(text.length() * 2); + final CologneInputBuffer input = new CologneInputBuffer(text.toCharArray()); char nextChar; @@ -400,7 +400,7 @@ public class ColognePhonetic implements } @Override - public Object encode(Object object) throws EncoderException { + public Object encode(final Object object) throws EncoderException { if (!(object instanceof String)) { throw new EncoderException("This method's parameter was expected to be of the type " + String.class.getName() + @@ -412,11 +412,11 @@ public class ColognePhonetic implements } @Override - public String encode(String text) { + public String encode(final String text) { return colognePhonetic(text); } - public boolean isEncodeEqual(String text1, String text2) { + public boolean isEncodeEqual(final String text1, final String text2) { return colognePhonetic(text1).equals(colognePhonetic(text2)); } @@ -426,11 +426,11 @@ public class ColognePhonetic implements private String preprocess(String text) { text = text.toUpperCase(Locale.GERMAN); - char[] chrs = text.toCharArray(); + final char[] chrs = text.toCharArray(); for (int index = 0; index < chrs.length; index++) { if (chrs[index] > 'Z') { - for (char[] element : PREPROCESS_MAP) { + for (final char[] element : PREPROCESS_MAP) { if (chrs[index] == element[0]) { chrs[index] = element[1]; break; Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java Mon Jan 7 16:08:05 2013 @@ -71,7 +71,7 @@ public class DoubleMetaphone implements * @param value String to encode * @return an encoded string */ - public String doubleMetaphone(String value) { + public String doubleMetaphone(final String value) { return doubleMetaphone(value, false); } @@ -82,16 +82,16 @@ public class DoubleMetaphone implements * @param alternate use alternate encode * @return an encoded string */ - public String doubleMetaphone(String value, boolean alternate) { + public String doubleMetaphone(String value, final boolean alternate) { value = cleanInput(value); if (value == null) { return null; } - boolean slavoGermanic = isSlavoGermanic(value); + final boolean slavoGermanic = isSlavoGermanic(value); int index = isSilentStart(value) ? 1 : 0; - DoubleMetaphoneResult result = new DoubleMetaphoneResult(this.getMaxCodeLen()); + final DoubleMetaphoneResult result = new DoubleMetaphoneResult(this.getMaxCodeLen()); while (!result.isComplete() && index <= value.length() - 1) { switch (value.charAt(index)) { @@ -198,7 +198,7 @@ public class DoubleMetaphone implements * @throws EncoderException encode parameter is not of type String */ @Override - public Object encode(Object obj) throws EncoderException { + public Object encode(final Object obj) throws EncoderException { if (!(obj instanceof String)) { throw new EncoderException("DoubleMetaphone encode parameter is not of type String"); } @@ -212,7 +212,7 @@ public class DoubleMetaphone implements * @return An encoded String */ @Override - public String encode(String value) { + public String encode(final String value) { return doubleMetaphone(value); } @@ -226,7 +226,7 @@ public class DoubleMetaphone implements * {@code false} otherwise. * @see #isDoubleMetaphoneEqual(String,String,boolean) */ - public boolean isDoubleMetaphoneEqual(String value1, String value2) { + public boolean isDoubleMetaphoneEqual(final String value1, final String value2) { return isDoubleMetaphoneEqual(value1, value2, false); } @@ -240,7 +240,7 @@ public class DoubleMetaphone implements * @return {@code true} if the encoded Strings are equal; * {@code false} otherwise. */ - public boolean isDoubleMetaphoneEqual(String value1, String value2, boolean alternate) { + public boolean isDoubleMetaphoneEqual(final String value1, final String value2, final boolean alternate) { return doubleMetaphone(value1, alternate).equals(doubleMetaphone(value2, alternate)); } @@ -256,7 +256,7 @@ public class DoubleMetaphone implements * Sets the maxCodeLen. * @param maxCodeLen The maxCodeLen to set */ - public void setMaxCodeLen(int maxCodeLen) { + public void setMaxCodeLen(final int maxCodeLen) { this.maxCodeLen = maxCodeLen; } @@ -265,7 +265,7 @@ public class DoubleMetaphone implements /** * Handles 'A', 'E', 'I', 'O', 'U', and 'Y' cases. */ - private int handleAEIOUY(DoubleMetaphoneResult result, int index) { + private int handleAEIOUY(final DoubleMetaphoneResult result, final int index) { if (index == 0) { result.append('A'); } @@ -275,7 +275,7 @@ public class DoubleMetaphone implements /** * Handles 'C' cases. */ - private int handleC(String value, DoubleMetaphoneResult result, int index) { + private int handleC(final String value, final DoubleMetaphoneResult result, int index) { if (conditionC0(value, index)) { // very confusing, moved out result.append('K'); index += 2; @@ -327,7 +327,7 @@ public class DoubleMetaphone implements /** * Handles 'CC' cases. */ - private int handleCC(String value, DoubleMetaphoneResult result, int index) { + private int handleCC(final String value, final DoubleMetaphoneResult result, int index) { if (contains(value, index + 2, 1, "I", "E", "H") && !contains(value, index + 2, 2, "HU")) { //-- "bellocchio" but not "bacchus" --// @@ -351,7 +351,7 @@ public class DoubleMetaphone implements /** * Handles 'CH' cases. */ - private int handleCH(String value, DoubleMetaphoneResult result, int index) { + private int handleCH(final String value, final DoubleMetaphoneResult result, final int index) { if (index > 0 && contains(value, index, 4, "CHAE")) { // Michael result.append('K', 'X'); return index + 2; @@ -380,7 +380,7 @@ public class DoubleMetaphone implements /** * Handles 'D' cases. */ - private int handleD(String value, DoubleMetaphoneResult result, int index) { + private int handleD(final String value, final DoubleMetaphoneResult result, int index) { if (contains(value, index, 2, "DG")) { //-- "Edge" --// if (contains(value, index + 2, 1, "I", "E", "Y")) { @@ -404,7 +404,7 @@ public class DoubleMetaphone implements /** * Handles 'G' cases. */ - private int handleG(String value, DoubleMetaphoneResult result, int index, boolean slavoGermanic) { + private int handleG(final String value, final DoubleMetaphoneResult result, int index, final boolean slavoGermanic) { if (charAt(value, index + 1) == 'H') { index = handleGH(value, result, index); } else if (charAt(value, index + 1) == 'N') { @@ -461,7 +461,7 @@ public class DoubleMetaphone implements /** * Handles 'GH' cases. */ - private int handleGH(String value, DoubleMetaphoneResult result, int index) { + private int handleGH(final String value, final DoubleMetaphoneResult result, int index) { if (index > 0 && !isVowel(charAt(value, index - 1))) { result.append('K'); index += 2; @@ -493,7 +493,7 @@ public class DoubleMetaphone implements /** * Handles 'H' cases. */ - private int handleH(String value, DoubleMetaphoneResult result, int index) { + private int handleH(final String value, final DoubleMetaphoneResult result, int index) { //-- only keep if first & before vowel or between 2 vowels --// if ((index == 0 || isVowel(charAt(value, index - 1))) && isVowel(charAt(value, index + 1))) { @@ -509,7 +509,7 @@ public class DoubleMetaphone implements /** * Handles 'J' cases. */ - private int handleJ(String value, DoubleMetaphoneResult result, int index, boolean slavoGermanic) { + private int handleJ(final String value, final DoubleMetaphoneResult result, int index, final boolean slavoGermanic) { if (contains(value, index, 4, "JOSE") || contains(value, 0, 4, "SAN ")) { //-- obvious Spanish, "Jose", "San Jacinto" --// if ((index == 0 && (charAt(value, index + 4) == ' ') || @@ -544,7 +544,7 @@ public class DoubleMetaphone implements /** * Handles 'L' cases. */ - private int handleL(String value, DoubleMetaphoneResult result, int index) { + private int handleL(final String value, final DoubleMetaphoneResult result, int index) { if (charAt(value, index + 1) == 'L') { if (conditionL0(value, index)) { result.appendPrimary('L'); @@ -562,7 +562,7 @@ public class DoubleMetaphone implements /** * Handles 'P' cases. */ - private int handleP(String value, DoubleMetaphoneResult result, int index) { + private int handleP(final String value, final DoubleMetaphoneResult result, int index) { if (charAt(value, index + 1) == 'H') { result.append('F'); index += 2; @@ -576,7 +576,7 @@ public class DoubleMetaphone implements /** * Handles 'R' cases. */ - private int handleR(String value, DoubleMetaphoneResult result, int index, boolean slavoGermanic) { + private int handleR(final String value, final DoubleMetaphoneResult result, final int index, final boolean slavoGermanic) { if (index == value.length() - 1 && !slavoGermanic && contains(value, index - 2, 2, "IE") && !contains(value, index - 4, 2, "ME", "MA")) { @@ -590,7 +590,7 @@ public class DoubleMetaphone implements /** * Handles 'S' cases. */ - private int handleS(String value, DoubleMetaphoneResult result, int index, boolean slavoGermanic) { + private int handleS(final String value, final DoubleMetaphoneResult result, int index, final boolean slavoGermanic) { if (contains(value, index - 1, 3, "ISL", "YSL")) { //-- special cases "island", "isle", "carlisle", "carlysle" --// index++; @@ -639,7 +639,7 @@ public class DoubleMetaphone implements /** * Handles 'SC' cases. */ - private int handleSC(String value, DoubleMetaphoneResult result, int index) { + private int handleSC(final String value, final DoubleMetaphoneResult result, final int index) { if (charAt(value, index + 2) == 'H') { //-- Schlesinger's rule --// if (contains(value, index + 3, 2, "OO", "ER", "EN", "UY", "ED", "EM")) { @@ -668,7 +668,7 @@ public class DoubleMetaphone implements /** * Handles 'T' cases. */ - private int handleT(String value, DoubleMetaphoneResult result, int index) { + private int handleT(final String value, final DoubleMetaphoneResult result, int index) { if (contains(value, index, 4, "TION")) { result.append('X'); index += 3; @@ -695,7 +695,7 @@ public class DoubleMetaphone implements /** * Handles 'W' cases. */ - private int handleW(String value, DoubleMetaphoneResult result, int index) { + private int handleW(final String value, final DoubleMetaphoneResult result, int index) { if (contains(value, index, 2, "WR")) { //-- can also be in middle of word --// result.append('R'); @@ -731,7 +731,7 @@ public class DoubleMetaphone implements /** * Handles 'X' cases. */ - private int handleX(String value, DoubleMetaphoneResult result, int index) { + private int handleX(final String value, final DoubleMetaphoneResult result, int index) { if (index == 0) { result.append('S'); index++; @@ -750,7 +750,7 @@ public class DoubleMetaphone implements /** * Handles 'Z' cases. */ - private int handleZ(String value, DoubleMetaphoneResult result, int index, boolean slavoGermanic) { + private int handleZ(final String value, final DoubleMetaphoneResult result, int index, final boolean slavoGermanic) { if (charAt(value, index + 1) == 'H') { //-- Chinese pinyin e.g. "zhao" or Angelina "Zhang" --// result.append('J'); @@ -772,7 +772,7 @@ public class DoubleMetaphone implements /** * Complex condition 0 for 'C'. */ - private boolean conditionC0(String value, int index) { + private boolean conditionC0(final String value, final int index) { if (contains(value, index, 4, "CHIA")) { return true; } else if (index <= 1) { @@ -782,7 +782,7 @@ public class DoubleMetaphone implements } else if (!contains(value, index - 1, 3, "ACH")) { return false; } else { - char c = charAt(value, index + 2); + final char c = charAt(value, index + 2); return (c != 'I' && c != 'E') || contains(value, index - 2, 6, "BACHER", "MACHER"); } @@ -791,7 +791,7 @@ public class DoubleMetaphone implements /** * Complex condition 0 for 'CH'. */ - private boolean conditionCH0(String value, int index) { + private boolean conditionCH0(final String value, final int index) { if (index != 0) { return false; } else if (!contains(value, index + 1, 5, "HARAC", "HARIS") && @@ -807,7 +807,7 @@ public class DoubleMetaphone implements /** * Complex condition 1 for 'CH'. */ - private boolean conditionCH1(String value, int index) { + private boolean conditionCH1(final String value, final int index) { return ((contains(value, 0, 4, "VAN ", "VON ") || contains(value, 0, 3, "SCH")) || contains(value, index - 2, 6, "ORCHES", "ARCHIT", "ORCHID") || contains(value, index + 2, 1, "T", "S") || @@ -818,7 +818,7 @@ public class DoubleMetaphone implements /** * Complex condition 0 for 'L'. */ - private boolean conditionL0(String value, int index) { + private boolean conditionL0(final String value, final int index) { if (index == value.length() - 3 && contains(value, index - 1, 4, "ILLO", "ILLA", "ALLE")) { return true; @@ -834,7 +834,7 @@ public class DoubleMetaphone implements /** * Complex condition 0 for 'M'. */ - private boolean conditionM0(String value, int index) { + private boolean conditionM0(final String value, final int index) { if (charAt(value, index + 1) == 'M') { return true; } @@ -848,7 +848,7 @@ public class DoubleMetaphone implements * Determines whether or not a value is of slavo-germanic orgin. A value is * of slavo-germanic origin if it contians any of 'W', 'K', 'CZ', or 'WITZ'. */ - private boolean isSlavoGermanic(String value) { + private boolean isSlavoGermanic(final String value) { return value.indexOf('W') > -1 || value.indexOf('K') > -1 || value.indexOf("CZ") > -1 || value.indexOf("WITZ") > -1; } @@ -856,7 +856,7 @@ public class DoubleMetaphone implements /** * Determines whether or not a character is a vowel or not */ - private boolean isVowel(char ch) { + private boolean isVowel(final char ch) { return VOWELS.indexOf(ch) != -1; } @@ -865,9 +865,9 @@ public class DoubleMetaphone implements * return {@code true} if the value starts with any of 'GN', 'KN', * 'PN', 'WR' or 'PS'. */ - private boolean isSilentStart(String value) { + private boolean isSilentStart(final String value) { boolean result = false; - for (String element : SILENT_START) { + for (final String element : SILENT_START) { if (value.startsWith(element)) { result = true; break; @@ -895,7 +895,7 @@ public class DoubleMetaphone implements * it returns Character.MIN_VALUE so that there is some sort * of a default. */ - protected char charAt(String value, int index) { + protected char charAt(final String value, final int index) { if (index < 0 || index >= value.length()) { return Character.MIN_VALUE; } @@ -906,13 +906,13 @@ public class DoubleMetaphone implements * Determines whether value contains any of the criteria starting at index start and * matching up to length length. */ - protected static boolean contains(String value, int start, int length, - String... criteria) { + protected static boolean contains(final String value, final int start, final int length, + final String... criteria) { boolean result = false; if (start >= 0 && start + length <= value.length()) { - String target = value.substring(start, start + length); + final String target = value.substring(start, start + length); - for (String element : criteria) { + for (final String element : criteria) { if (target.equals(element)) { result = true; break; @@ -933,44 +933,44 @@ public class DoubleMetaphone implements private final StringBuilder alternate = new StringBuilder(getMaxCodeLen()); private final int maxLength; - public DoubleMetaphoneResult(int maxLength) { + public DoubleMetaphoneResult(final int maxLength) { this.maxLength = maxLength; } - public void append(char value) { + public void append(final char value) { appendPrimary(value); appendAlternate(value); } - public void append(char primary, char alternate) { + public void append(final char primary, final char alternate) { appendPrimary(primary); appendAlternate(alternate); } - public void appendPrimary(char value) { + public void appendPrimary(final char value) { if (this.primary.length() < this.maxLength) { this.primary.append(value); } } - public void appendAlternate(char value) { + public void appendAlternate(final char value) { if (this.alternate.length() < this.maxLength) { this.alternate.append(value); } } - public void append(String value) { + public void append(final String value) { appendPrimary(value); appendAlternate(value); } - public void append(String primary, String alternate) { + public void append(final String primary, final String alternate) { appendPrimary(primary); appendAlternate(alternate); } - public void appendPrimary(String value) { - int addChars = this.maxLength - this.primary.length(); + public void appendPrimary(final String value) { + final int addChars = this.maxLength - this.primary.length(); if (value.length() <= addChars) { this.primary.append(value); } else { @@ -978,8 +978,8 @@ public class DoubleMetaphone implements } } - public void appendAlternate(String value) { - int addChars = this.maxLength - this.alternate.length(); + public void appendAlternate(final String value) { + final int addChars = this.maxLength - this.alternate.length(); if (value.length() <= addChars) { this.alternate.append(value); } else { Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java Mon Jan 7 16:08:05 2013 @@ -75,8 +75,8 @@ public class MatchRatingApproachEncoder String cleanName(final String name) { String upperName = name.toUpperCase(Locale.ENGLISH); - String[] charsToTrim = { "\\-", "[&]", "\\'", "\\.", "[\\,]" }; - for (String str : charsToTrim) { + final String[] charsToTrim = { "\\-", "[&]", "\\'", "\\.", "[\\,]" }; + for (final String str : charsToTrim) { upperName = upperName.replaceAll(str, EMPTY); } @@ -148,11 +148,11 @@ public class MatchRatingApproachEncoder * @return Annexed first & last 3 letters of input word. */ String getFirst3Last3(final String name) { - int nameLength = name.length(); + final int nameLength = name.length(); if (nameLength > SIX) { - String firstThree = name.substring(0, THREE); - String lastThree = name.substring(nameLength - THREE, nameLength); + final String firstThree = name.substring(0, THREE); + final String lastThree = name.substring(nameLength - THREE, nameLength); return firstThree + lastThree; } else { return name; @@ -238,13 +238,13 @@ public class MatchRatingApproachEncoder // 5. Obtain the minimum rating value by calculating the length sum of the // encoded Strings and sending it down. - int sumLength = Math.abs(name1.length() + name2.length()); + final int sumLength = Math.abs(name1.length() + name2.length()); int minRating = 0; minRating = getMinRating(sumLength); // 6. Process the encoded Strings from left to right and remove any // identical characters found from both Strings respectively. - int count = leftToRightThenRightToLeftProcessing(name1, name2); + final int count = leftToRightThenRightToLeftProcessing(name1, name2); // 7. Each PNI item that has a similarity rating equal to or greater than // the min is considered to be a good candidate match @@ -264,7 +264,7 @@ public class MatchRatingApproachEncoder * The letter under investiagtion * @return True if a vowel, else false */ - boolean isVowel(String letter) { + boolean isVowel(final String letter) { return letter.equalsIgnoreCase("E") || letter.equalsIgnoreCase("A") || letter.equalsIgnoreCase("O") || letter.equalsIgnoreCase("I") || letter.equalsIgnoreCase("U"); } @@ -282,12 +282,12 @@ public class MatchRatingApproachEncoder * name2 * @return */ - int leftToRightThenRightToLeftProcessing(String name1, String name2) { - char[] name1Char = name1.toCharArray(); - char[] name2Char = name2.toCharArray(); + int leftToRightThenRightToLeftProcessing(final String name1, final String name2) { + final char[] name1Char = name1.toCharArray(); + final char[] name2Char = name2.toCharArray(); - int name1Size = name1.length() - 1; - int name2Size = name2.length() - 1; + final int name1Size = name1.length() - 1; + final int name2Size = name2.length() - 1; String name1LtRStart = EMPTY; String name1LtREnd = EMPTY; @@ -320,8 +320,8 @@ public class MatchRatingApproachEncoder } // Char arrays -> string & remove extraneous space - String strA = new String(name1Char).replaceAll("\\s+", EMPTY); - String strB = new String(name2Char).replaceAll("\\s+", EMPTY); + final String strA = new String(name1Char).replaceAll("\\s+", EMPTY); + final String strB = new String(name2Char).replaceAll("\\s+", EMPTY); // Final bit - subtract longest string from 6 and return this int value if (strA.length() > strB.length()) { @@ -344,12 +344,12 @@ public class MatchRatingApproachEncoder return null; } - StringBuilder sb = new StringBuilder(); - int n = accentedWord.length(); + final StringBuilder sb = new StringBuilder(); + final int n = accentedWord.length(); for (int i = 0; i < n; i++) { - char c = accentedWord.charAt(i); - int pos = UNICODE.indexOf(c); + final char c = accentedWord.charAt(i); + final int pos = UNICODE.indexOf(c); if (pos > -1) { sb.append(PLAIN_ASCII.charAt(pos)); } else { @@ -372,14 +372,14 @@ public class MatchRatingApproachEncoder * String to have double consonants removed * @return Single consonant word */ - String removeDoubleConsonants(String name) { - String[] dblCnstArray = new String[] { "BB", "CC", "DD", "FF", "GG", "HH", "JJ", "KK", "LL", "MM", "NN", "PP", "QQ", "RR", "SS", "TT", "VV", + String removeDoubleConsonants(final String name) { + final String[] dblCnstArray = new String[] { "BB", "CC", "DD", "FF", "GG", "HH", "JJ", "KK", "LL", "MM", "NN", "PP", "QQ", "RR", "SS", "TT", "VV", "WW", "XX", "YY", "ZZ" }; String replacedName = name.toUpperCase(); - for (String dc : dblCnstArray) { + for (final String dc : dblCnstArray) { if (replacedName.contains(dc)) { - String singleLetter = dc.substring(0, 1); + final String singleLetter = dc.substring(0, 1); replacedName = replacedName.replace(dc, singleLetter); } } @@ -401,7 +401,7 @@ public class MatchRatingApproachEncoder */ String removeVowels(String name) { // Extract first letter - String firstLetter = name.substring(0, 1); + final String firstLetter = name.substring(0, 1); name = name.replaceAll("A", EMPTY); name = name.replaceAll("E", EMPTY); Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java Mon Jan 7 16:08:05 2013 @@ -82,7 +82,7 @@ public class Metaphone implements String * @param txt String to find the metaphone code for * @return A metaphone code corresponding to the String supplied */ - public String metaphone(String txt) { + public String metaphone(final String txt) { boolean hard = false; if (txt == null || txt.length() == 0) { return ""; @@ -92,10 +92,10 @@ public class Metaphone implements String return txt.toUpperCase(java.util.Locale.ENGLISH); } - char[] inwd = txt.toUpperCase(java.util.Locale.ENGLISH).toCharArray(); + final char[] inwd = txt.toUpperCase(java.util.Locale.ENGLISH).toCharArray(); - StringBuilder local = new StringBuilder(40); // manipulate - StringBuilder code = new StringBuilder(10); // output + final StringBuilder local = new StringBuilder(40); // manipulate + final StringBuilder code = new StringBuilder(10); // output // handle initial 2 characters exceptions switch(inwd[0]) { case 'K': @@ -134,12 +134,12 @@ public class Metaphone implements String local.append(inwd); } // now local has working string with initials fixed - int wdsz = local.length(); + final int wdsz = local.length(); int n = 0; while (code.length() < this.getMaxCodeLen() && n < wdsz ) { // max code size of 4 works well - char symb = local.charAt(n); + final char symb = local.charAt(n); // remove duplicate letters except C if (symb != 'C' && isPreviousChar( local, n, symb ) ) { n++; @@ -327,11 +327,11 @@ public class Metaphone implements String return code.toString(); } - private boolean isVowel(StringBuilder string, int index) { + private boolean isVowel(final StringBuilder string, final int index) { return VOWELS.indexOf(string.charAt(index)) >= 0; } - private boolean isPreviousChar(StringBuilder string, int index, char c) { + private boolean isPreviousChar(final StringBuilder string, final int index, final char c) { boolean matches = false; if( index > 0 && index < string.length() ) { @@ -340,7 +340,7 @@ public class Metaphone implements String return matches; } - private boolean isNextChar(StringBuilder string, int index, char c) { + private boolean isNextChar(final StringBuilder string, final int index, final char c) { boolean matches = false; if( index >= 0 && index < string.length() - 1 ) { @@ -349,17 +349,17 @@ public class Metaphone implements String return matches; } - private boolean regionMatch(StringBuilder string, int index, String test) { + private boolean regionMatch(final StringBuilder string, final int index, final String test) { boolean matches = false; if( index >= 0 && index + test.length() - 1 < string.length() ) { - String substring = string.substring( index, index + test.length()); + final String substring = string.substring( index, index + test.length()); matches = substring.equals( test ); } return matches; } - private boolean isLastChar(int wdsz, int n) { + private boolean isLastChar(final int wdsz, final int n) { return n + 1 == wdsz; } @@ -377,7 +377,7 @@ public class Metaphone implements String * of type java.lang.String */ @Override - public Object encode(Object obj) throws EncoderException { + public Object encode(final Object obj) throws EncoderException { if (!(obj instanceof String)) { throw new EncoderException("Parameter supplied to Metaphone encode is not of type java.lang.String"); } @@ -391,7 +391,7 @@ public class Metaphone implements String * @return The metaphone code corresponding to the String supplied */ @Override - public String encode(String str) { + public String encode(final String str) { return metaphone(str); } @@ -403,7 +403,7 @@ public class Metaphone implements String * @return {@code true} if the metaphones of these strings are identical, * {@code false} otherwise. */ - public boolean isMetaphoneEqual(String str1, String str2) { + public boolean isMetaphoneEqual(final String str1, final String str2) { return metaphone(str1).equals(metaphone(str2)); } @@ -417,6 +417,6 @@ public class Metaphone implements String * Sets the maxCodeLen. * @param maxCodeLen The maxCodeLen to set */ - public void setMaxCodeLen(int maxCodeLen) { this.maxCodeLen = maxCodeLen; } + public void setMaxCodeLen(final int maxCodeLen) { this.maxCodeLen = maxCodeLen; } } Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Nysiis.java Mon Jan 7 16:08:05 2013 @@ -207,7 +207,7 @@ public class Nysiis implements StringEnc * if a character is not mapped */ @Override - public Object encode(Object obj) throws EncoderException { + public Object encode(final Object obj) throws EncoderException { if (!(obj instanceof String)) { throw new EncoderException("Parameter supplied to Nysiis encode is not of type java.lang.String"); } @@ -224,7 +224,7 @@ public class Nysiis implements StringEnc * if a character is not mapped */ @Override - public String encode(String str) { + public String encode(final String str) { return this.nysiis(str); } @@ -270,7 +270,7 @@ public class Nysiis implements StringEnc str = PAT_DT_ETC.matcher(str).replaceFirst("D"); // First character of key = first character of name. - StringBuilder key = new StringBuilder(str.length()); + final StringBuilder key = new StringBuilder(str.length()); key.append(str.charAt(0)); // Transcode remaining characters, incrementing by one character each time Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java Mon Jan 7 16:08:05 2013 @@ -73,7 +73,7 @@ public class RefinedSoundex implements S * Mapping array to use when finding the corresponding code for * a given character */ - public RefinedSoundex(char[] mapping) { + public RefinedSoundex(final char[] mapping) { this.soundexMapping = new char[mapping.length]; System.arraycopy(mapping, 0, this.soundexMapping, 0, mapping.length); } @@ -86,7 +86,7 @@ public class RefinedSoundex implements S * Mapping string to use when finding the corresponding code for a given character * @since 1.4 */ - public RefinedSoundex(String mapping) { + public RefinedSoundex(final String mapping) { this.soundexMapping = mapping.toCharArray(); } @@ -112,7 +112,7 @@ public class RefinedSoundex implements S * if an error occurs encoding one of the strings * @since 1.3 */ - public int difference(String s1, String s2) throws EncoderException { + public int difference(final String s1, final String s2) throws EncoderException { return SoundexUtils.difference(this, s1, s2); } @@ -130,7 +130,7 @@ public class RefinedSoundex implements S * if the parameter supplied is not of type java.lang.String */ @Override - public Object encode(Object obj) throws EncoderException { + public Object encode(final Object obj) throws EncoderException { if (!(obj instanceof String)) { throw new EncoderException("Parameter supplied to RefinedSoundex encode is not of type java.lang.String"); } @@ -145,7 +145,7 @@ public class RefinedSoundex implements S * @return A Soundex code corresponding to the String supplied */ @Override - public String encode(String str) { + public String encode(final String str) { return soundex(str); } @@ -158,7 +158,7 @@ public class RefinedSoundex implements S * char to get mapping for * @return A character (really a numeral) to return for the given char */ - char getMappingCode(char c) { + char getMappingCode(final char c) { if (!Character.isLetter(c)) { return 0; } @@ -181,7 +181,7 @@ public class RefinedSoundex implements S return str; } - StringBuilder sBuf = new StringBuilder(); + final StringBuilder sBuf = new StringBuilder(); sBuf.append(str.charAt(0)); char last, current; Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java Mon Jan 7 16:08:05 2013 @@ -92,7 +92,7 @@ public class Soundex implements StringEn * @param mapping * Mapping array to use when finding the corresponding code for a given character */ - public Soundex(char[] mapping) { + public Soundex(final char[] mapping) { this.soundexMapping = new char[mapping.length]; System.arraycopy(mapping, 0, this.soundexMapping, 0, mapping.length); } @@ -105,7 +105,7 @@ public class Soundex implements StringEn * Mapping string to use when finding the corresponding code for a given character * @since 1.4 */ - public Soundex(String mapping) { + public Soundex(final String mapping) { this.soundexMapping = mapping.toCharArray(); } @@ -128,7 +128,7 @@ public class Soundex implements StringEn * if an error occurs encoding one of the strings * @since 1.3 */ - public int difference(String s1, String s2) throws EncoderException { + public int difference(final String s1, final String s2) throws EncoderException { return SoundexUtils.difference(this, s1, s2); } @@ -146,7 +146,7 @@ public class Soundex implements StringEn * if a character is not mapped */ @Override - public Object encode(Object obj) throws EncoderException { + public Object encode(final Object obj) throws EncoderException { if (!(obj instanceof String)) { throw new EncoderException("Parameter supplied to Soundex encode is not of type java.lang.String"); } @@ -163,7 +163,7 @@ public class Soundex implements StringEn * if a character is not mapped */ @Override - public String encode(String str) { + public String encode(final String str) { return soundex(str); } @@ -180,15 +180,15 @@ public class Soundex implements StringEn * @throws IllegalArgumentException * if the character is not mapped */ - private char getMappingCode(String str, int index) { + private char getMappingCode(final String str, final int index) { // map() throws IllegalArgumentException - char mappedChar = this.map(str.charAt(index)); + final char mappedChar = this.map(str.charAt(index)); // HW rule check if (index > 1 && mappedChar != '0') { - char hwChar = str.charAt(index - 1); + final char hwChar = str.charAt(index - 1); if ('H' == hwChar || 'W' == hwChar) { - char preHWChar = str.charAt(index - 2); - char firstCode = this.map(preHWChar); + final char preHWChar = str.charAt(index - 2); + final char firstCode = this.map(preHWChar); if (firstCode == mappedChar || 'H' == preHWChar || 'W' == preHWChar) { return 0; } @@ -226,8 +226,8 @@ public class Soundex implements StringEn * @throws IllegalArgumentException * Thrown if ch is not mapped. */ - private char map(char ch) { - int index = ch - 'A'; + private char map(final char ch) { + final int index = ch - 'A'; if (index < 0 || index >= this.getSoundexMapping().length) { throw new IllegalArgumentException("The character is not mapped: " + ch); } @@ -242,7 +242,7 @@ public class Soundex implements StringEn * The maxLength to set */ @Deprecated - public void setMaxLength(int maxLength) { + public void setMaxLength(final int maxLength) { this.maxLength = maxLength; } @@ -263,7 +263,7 @@ public class Soundex implements StringEn if (str.length() == 0) { return str; } - char out[] = {'0', '0', '0', '0'}; + final char out[] = {'0', '0', '0', '0'}; char last, mapped; int incount = 1, count = 1; out[0] = str.charAt(0); Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/SoundexUtils.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/SoundexUtils.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/SoundexUtils.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/SoundexUtils.java Mon Jan 7 16:08:05 2013 @@ -38,12 +38,12 @@ final class SoundexUtils { * The String to clean. * @return A clean String. */ - static String clean(String str) { + static String clean(final String str) { if (str == null || str.length() == 0) { return str; } - int len = str.length(); - char[] chars = new char[len]; + final int len = str.length(); + final char[] chars = new char[len]; int count = 0; for (int i = 0; i < len; i++) { if (Character.isLetter(str.charAt(i))) { @@ -82,7 +82,7 @@ final class SoundexUtils { * @throws EncoderException * if an error occurs encoding one of the strings */ - static int difference(StringEncoder encoder, String s1, String s2) throws EncoderException { + static int difference(final StringEncoder encoder, final String s1, final String s2) throws EncoderException { return differenceEncoded(encoder.encode(s1), encoder.encode(s2)); } @@ -106,12 +106,12 @@ final class SoundexUtils { * @see * MS T-SQL DIFFERENCE */ - static int differenceEncoded(String es1, String es2) { + static int differenceEncoded(final String es1, final String es2) { if (es1 == null || es2 == null) { return 0; } - int lengthToMatch = Math.min(es1.length(), es2.length()); + final int lengthToMatch = Math.min(es1.length(), es2.length()); int diff = 0; for (int i = 0; i < lengthToMatch; i++) { if (es1.charAt(i) == es2.charAt(i)) { Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java?rev=1429868&r1=1429867&r2=1429868&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java Mon Jan 7 16:08:05 2013 @@ -76,7 +76,7 @@ public class BeiderMorseEncoder implemen private PhoneticEngine engine = new PhoneticEngine(NameType.GENERIC, RuleType.APPROX, true); @Override - public Object encode(Object source) throws EncoderException { + public Object encode(final Object source) throws EncoderException { if (!(source instanceof String)) { throw new EncoderException("BeiderMorseEncoder encode parameter is not of type String"); } @@ -84,7 +84,7 @@ public class BeiderMorseEncoder implemen } @Override - public String encode(String source) throws EncoderException { + public String encode(final String source) throws EncoderException { if (source == null) { return null; } @@ -125,7 +125,7 @@ public class BeiderMorseEncoder implemen * true if multiple encodings are to be combined with a '|', false if just the first one is * to be considered */ - public void setConcat(boolean concat) { + public void setConcat(final boolean concat) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), concat, @@ -139,7 +139,7 @@ public class BeiderMorseEncoder implemen * @param nameType * the NameType in use */ - public void setNameType(NameType nameType) { + public void setNameType(final NameType nameType) { this.engine = new PhoneticEngine(nameType, this.engine.getRuleType(), this.engine.isConcat(), @@ -152,7 +152,7 @@ public class BeiderMorseEncoder implemen * @param ruleType * {@link RuleType#APPROX} or {@link RuleType#EXACT} for approximate or exact phonetic matches */ - public void setRuleType(RuleType ruleType) { + public void setRuleType(final RuleType ruleType) { this.engine = new PhoneticEngine(this.engine.getNameType(), ruleType, this.engine.isConcat(), @@ -166,7 +166,7 @@ public class BeiderMorseEncoder implemen * the maximum number of phonemes returned by the engine * @since 1.7 */ - public void setMaxPhonemes(int maxPhonemes) { + public void setMaxPhonemes(final int maxPhonemes) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), this.engine.isConcat(),