directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject [2/6] directory-kerby git commit: [DIRKRB-326]-Fix CheckStyle Problems. Contributed by Yaning.
Date Thu, 09 Jul 2015 02:50:27 GMT
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-simplekdc/src/main/java/org/apache/kerby/kerberos/kerb/client/Krb5Conf.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-simplekdc/src/main/java/org/apache/kerby/kerberos/kerb/client/Krb5Conf.java b/kerby-kerb/kerb-simplekdc/src/main/java/org/apache/kerby/kerberos/kerb/client/Krb5Conf.java
index 780574d..6b5fcd0 100644
--- a/kerby-kerb/kerb-simplekdc/src/main/java/org/apache/kerby/kerberos/kerb/client/Krb5Conf.java
+++ b/kerby-kerb/kerb-simplekdc/src/main/java/org/apache/kerby/kerberos/kerb/client/Krb5Conf.java
@@ -37,8 +37,8 @@ public class Krb5Conf {
 
         content = content.replaceAll("_REALM_", "" + setting.getKdcRealm());
 
-        int kdcPort = setting.allowUdp() ? setting.getKdcUdpPort() :
-                setting.getKdcTcpPort();
+        int kdcPort = setting.allowUdp() ? setting.getKdcUdpPort()
+                : setting.getKdcTcpPort();
         content = content.replaceAll("_PORT_",
                 String.valueOf(kdcPort));
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java
index 18e5bd8..ca54db3 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java
@@ -28,8 +28,7 @@ import java.io.DataInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
-public abstract class KrbInputStream extends DataInputStream
-{
+public abstract class KrbInputStream extends DataInputStream {
     public KrbInputStream(InputStream in) {
         super(in);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java
index 0e49bac..69686dc 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java
@@ -27,8 +27,7 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
-public abstract class KrbOutputStream extends DataOutputStream
-{
+public abstract class KrbOutputStream extends DataOutputStream {
     public KrbOutputStream(OutputStream out) {
         super(out);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheInputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheInputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheInputStream.java
index 5a7e52c..ff685a1 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheInputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheInputStream.java
@@ -24,7 +24,12 @@ import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.ad.AuthorizationData;
 import org.apache.kerby.kerberos.kerb.spec.ad.AuthorizationDataEntry;
 import org.apache.kerby.kerberos.kerb.spec.ad.AuthorizationType;
-import org.apache.kerby.kerberos.kerb.spec.base.*;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
+import org.apache.kerby.kerberos.kerb.spec.base.HostAddrType;
+import org.apache.kerby.kerberos.kerb.spec.base.HostAddress;
+import org.apache.kerby.kerberos.kerb.spec.base.HostAddresses;
+import org.apache.kerby.kerberos.kerb.spec.base.NameType;
+import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import org.apache.kerby.kerberos.kerb.spec.ticket.Ticket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TicketFlags;
 
@@ -33,8 +38,7 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 
-public class CredCacheInputStream extends KrbInputStream
-{
+public class CredCacheInputStream extends KrbInputStream {
     public CredCacheInputStream(InputStream in) {
         super(in);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java
index ee8ca3d..75e720d 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java
@@ -23,7 +23,10 @@ import org.apache.kerby.kerberos.kerb.KrbOutputStream;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.ad.AuthorizationData;
 import org.apache.kerby.kerberos.kerb.spec.ad.AuthorizationDataEntry;
-import org.apache.kerby.kerberos.kerb.spec.base.*;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
+import org.apache.kerby.kerberos.kerb.spec.base.HostAddress;
+import org.apache.kerby.kerberos.kerb.spec.base.HostAddresses;
+import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import org.apache.kerby.kerberos.kerb.spec.ticket.Ticket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TicketFlags;
 
@@ -31,8 +34,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
-public class CredCacheOutputStream extends KrbOutputStream
-{
+public class CredCacheOutputStream extends KrbOutputStream {
     public CredCacheOutputStream(OutputStream out) {
         super(out);
     }
@@ -47,7 +49,7 @@ public class CredCacheOutputStream extends KrbOutputStream
 
         int numComponents = nameComponents.size();
         if (version == CredentialCache.FCC_FVNO_1) {
-            numComponents ++;
+            numComponents++;
         }
         writeInt(numComponents);
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredentialCache.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredentialCache.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredentialCache.java
index fb59eef..bf8f4cb 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredentialCache.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredentialCache.java
@@ -23,7 +23,12 @@ import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.Ticket;
 
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -163,7 +168,7 @@ public class CredentialCache implements KrbCredentialCache {
 
     @Override
     public void load(File ccacheFile) throws IOException {
-        if (! ccacheFile.exists() || ! ccacheFile.canRead()) {
+        if (!ccacheFile.exists() || !ccacheFile.canRead()) {
             throw new IllegalArgumentException("Invalid ccache file: "
                     + ccacheFile.getAbsolutePath());
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/Keytab.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/Keytab.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/Keytab.java
index a04687e..2a50413 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/Keytab.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/Keytab.java
@@ -19,6 +19,10 @@
  */
 package org.apache.kerby.kerberos.kerb.keytab;
 
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
+import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -31,10 +35,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
-import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
-import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
-
 /**
  * Keytab management util.
  */
@@ -71,8 +71,8 @@ public final class Keytab implements KrbKeytab {
     @Override
     public void removeKeytabEntries(PrincipalName principal, int kvno) {
         List<KeytabEntry> entries = getKeytabEntries(principal);
-        for(KeytabEntry entry : entries) {
-            if(entry.getKvno() == kvno) {
+        for (KeytabEntry entry : entries) {
+            if (entry.getKvno() == kvno) {
                 removeKeytabEntry(entry);
             }
         }
@@ -136,7 +136,7 @@ public final class Keytab implements KrbKeytab {
 
     @Override
     public void load(File keytabFile) throws IOException {
-        if (! keytabFile.exists() || ! keytabFile.canRead()) {
+        if (!keytabFile.exists() || !keytabFile.canRead()) {
             throw new IllegalArgumentException("Invalid keytab file: " + keytabFile.getAbsolutePath());
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabEntry.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabEntry.java
index c9ad3ca..1ccec6f 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabEntry.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabEntry.java
@@ -26,8 +26,7 @@ import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
-public class KeytabEntry
-{
+public class KeytabEntry {
     private PrincipalName principal;
     private KerberosTime timestamp;
     private int kvno;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabInputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabInputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabInputStream.java
index 8f91bb9..bd2d1ac 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabInputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabInputStream.java
@@ -31,8 +31,7 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 
-public class KeytabInputStream extends KrbInputStream
-{
+public class KeytabInputStream extends KrbInputStream {
     public KeytabInputStream(InputStream in) {
         super(in);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java
index 0c8ed32..3fe2280 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java
@@ -27,8 +27,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
-public class KeytabOutputStream extends KrbOutputStream
-{
+public class KeytabOutputStream extends KrbOutputStream {
     public KeytabOutputStream(OutputStream out) {
         super(out);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/EncryptionTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/EncryptionTest.java b/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/EncryptionTest.java
index 37222bc..159fc8d 100644
--- a/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/EncryptionTest.java
+++ b/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/EncryptionTest.java
@@ -19,14 +19,18 @@
  */
 package org.apache.kerby.kerberos.kerb.util;
 
+import org.apache.kerby.kerberos.kerb.KrbCodec;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.ccache.CredentialCache;
 import org.apache.kerby.kerberos.kerb.crypto.EncryptionHandler;
 import org.apache.kerby.kerberos.kerb.keytab.Keytab;
-import org.apache.kerby.kerberos.kerb.spec.base.*;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptedData;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
+import org.apache.kerby.kerberos.kerb.spec.base.KeyUsage;
+import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import org.apache.kerby.kerberos.kerb.spec.ticket.EncTicketPart;
 import org.apache.kerby.kerberos.kerb.spec.ticket.Ticket;
-import org.apache.kerby.kerberos.kerb.KrbCodec;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -108,7 +112,7 @@ public class EncryptionTest {
         Ticket ticket = getTicket();
         EncryptionType keyType = ticket.getEncryptedEncPart().getEType();
         EncryptionKey key = getServerKey(keyType);
-        if (! EncryptionHandler.isImplemented(keyType)) {
+        if (!EncryptionHandler.isImplemented(keyType)) {
             System.err.println("Key type not supported yet: " + keyType.getName());
             return;
         }
@@ -126,7 +130,7 @@ public class EncryptionTest {
 
         byte[] decrypted2 = EncryptionHandler.decrypt(
                 encrypted, key, KeyUsage.KDC_REP_TICKET);
-        if (! Arrays.equals(decrypted, decrypted2)) {
+        if (!Arrays.equals(decrypted, decrypted2)) {
             System.err.println("Encryption checking failed after decryption for key type: "
                     + keyType.getName());
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/KeysTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/KeysTest.java b/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/KeysTest.java
index 695a41b..735088e 100644
--- a/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/KeysTest.java
+++ b/kerby-kerb/kerb-util/src/test/java/org/apache/kerby/kerberos/kerb/util/KeysTest.java
@@ -73,7 +73,7 @@ public class KeysTest {
             if (EncryptionHandler.isImplemented(keyType)) {
                 EncryptionKey genKey = EncryptionHandler.string2Key(principal.getName(),
                         TEST_PASSWORD, keyType);
-                if(! ke.getKey().equals(genKey)) {
+                if (!ke.getKey().equals(genKey)) {
                     fail("str2key failed for key type: " + keyType.getName());
                     //System.err.println("str2key failed for key type: " + keyType.getName());
                 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java
----------------------------------------------------------------------
diff --git a/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java b/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java
index 374026f..6d64323 100644
--- a/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java
+++ b/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java
@@ -68,7 +68,7 @@ public class JwtTokenDecoder implements TokenDecoder {
             PlainJWT plainObject = (PlainJWT) jwt;
             try {
 
-                if(verifyToken(jwt)) {
+                if (verifyToken(jwt)) {
                     return new JwtAuthToken(plainObject.getJWTClaimsSet());
                 } else {
                     return null;
@@ -93,7 +93,7 @@ public class JwtTokenDecoder implements TokenDecoder {
                 }
             } else {
                 try {
-                    if(verifyToken(encryptedJWT)) {
+                    if (verifyToken(encryptedJWT)) {
                         return new JwtAuthToken(encryptedJWT.getJWTClaimsSet());
                     } else {
                         return null;
@@ -185,11 +185,11 @@ public class JwtTokenDecoder implements TokenDecoder {
         boolean valid = false;
         try {
             List<String> tokenAudiences = jwtToken.getJWTClaimsSet().getAudience();
-            if(audiences == null) {
+            if (audiences == null) {
                 valid = true;
             } else {
-                for(String audience : tokenAudiences) {
-                    if(audiences.contains(audience)) {
+                for (String audience : tokenAudiences) {
+                    if (audiences.contains(audience)) {
                         valid = true;
                         break;
                     }
@@ -205,7 +205,7 @@ public class JwtTokenDecoder implements TokenDecoder {
         boolean valid = false;
         try {
             Date expire = jwtToken.getJWTClaimsSet().getExpirationTime();
-            if(expire != null && new Date().before(expire)) {
+            if (expire != null && new Date().before(expire)) {
                 valid = true;
             }
         } catch (ParseException e) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java
----------------------------------------------------------------------
diff --git a/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java b/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java
index 61e994b..e318e95 100644
--- a/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java
+++ b/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java
@@ -59,7 +59,7 @@ public class JwtTokenEncoder implements TokenEncoder {
 
     @Override
     public String encodeAsString(AuthToken token) throws KrbException {
-        if (! (token instanceof JwtAuthToken) ) {
+        if (!(token instanceof JwtAuthToken)) {
             throw new KrbException("Unexpected AuthToken, not JwtAuthToken");
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
----------------------------------------------------------------------
diff --git a/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java b/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
index d3fa8b2..6cb9a9c 100644
--- a/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
+++ b/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
@@ -84,7 +84,7 @@ public class TokenTest {
 
         TokenDecoder tokenDecoder = KrbRuntime.getTokenProvider().createTokenDecoder();
 
-        setAudience((JwtTokenDecoder)tokenDecoder, auds);
+        setAudience((JwtTokenDecoder) tokenDecoder, auds);
 
         AuthToken token2 = tokenDecoder.decodeFromString(tokenStr);
         Assertions.assertThat(token2.getSubject()).isEqualTo(SUBJECT);
@@ -99,7 +99,7 @@ public class TokenTest {
 
         TokenDecoder tokenDecoder = KrbRuntime.getTokenProvider().createTokenDecoder();
 
-        setAudience((JwtTokenDecoder)tokenDecoder, auds);
+        setAudience((JwtTokenDecoder) tokenDecoder, auds);
 
         AuthToken token2 = tokenDecoder.decodeFromBytes(tokenStr);
         Assertions.assertThat(token2.getSubject()).isEqualTo(SUBJECT);
@@ -111,8 +111,8 @@ public class TokenTest {
         TokenEncoder tokenEncoder = KrbRuntime.getTokenProvider().createTokenEncoder();
         TokenDecoder tokenDecoder = KrbRuntime.getTokenProvider().createTokenDecoder();
 
-        setEncryptKey((JwtTokenEncoder)tokenEncoder, (JwtTokenDecoder)tokenDecoder);
-        setAudience((JwtTokenDecoder)tokenDecoder, auds);
+        setEncryptKey((JwtTokenEncoder) tokenEncoder, (JwtTokenDecoder) tokenDecoder);
+        setAudience((JwtTokenDecoder) tokenDecoder, auds);
 
         String tokenStr = tokenEncoder.encodeAsString(authToken);
         Assertions.assertThat(tokenStr).isNotNull();
@@ -145,7 +145,7 @@ public class TokenTest {
 
         setSignKey((JwtTokenEncoder) tokenEncoder, (JwtTokenDecoder) tokenDecoder);
         setEncryptKey((JwtTokenEncoder) tokenEncoder, (JwtTokenDecoder) tokenDecoder);
-        setAudience((JwtTokenDecoder)tokenDecoder, auds);
+        setAudience((JwtTokenDecoder) tokenDecoder, auds);
 
         String tokenStr = tokenEncoder.encodeAsString(authToken);
         Assertions.assertThat(tokenStr).isNotNull();
@@ -165,7 +165,7 @@ public class TokenTest {
 
         setSignKey((JwtTokenEncoder) tokenEncoder, (JwtTokenDecoder) tokenDecoder);
         setEncryptKey((JwtTokenEncoder) tokenEncoder, (JwtTokenDecoder) tokenDecoder);
-        setAudience((JwtTokenDecoder)tokenDecoder, audiences);
+        setAudience((JwtTokenDecoder) tokenDecoder, audiences);
 
         String tokenStr = tokenEncoder.encodeAsString(authToken);
         Assertions.assertThat(tokenStr).isNotNull();
@@ -181,7 +181,7 @@ public class TokenTest {
         TokenEncoder tokenEncoder = KrbRuntime.getTokenProvider().createTokenEncoder();
         TokenDecoder tokenDecoder = KrbRuntime.getTokenProvider().createTokenDecoder();
 
-        setSignKey((JwtTokenEncoder)tokenEncoder, (JwtTokenDecoder)tokenDecoder);
+        setSignKey((JwtTokenEncoder) tokenEncoder, (JwtTokenDecoder) tokenDecoder);
         setEncryptKey((JwtTokenEncoder) tokenEncoder, (JwtTokenDecoder) tokenDecoder);
         setAudience((JwtTokenDecoder) tokenDecoder, auds);
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitOption.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitOption.java b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitOption.java
index 6ba8606..da31558 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitOption.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitOption.java
@@ -47,8 +47,7 @@ public enum KinitOption implements KOption {
     KRB5_CACHE("-c", "Kerberos 5 cache name", KOptionType.STR),
     SERVICE("-S", "service", KOptionType.STR),
     ARMOR_CACHE("-T", "armor credential cache", KOptionType.FILE),
-    XATTR("-X", "<attribute>[=<value>]", KOptionType.STR),
-    ;
+    XATTR("-X", "<attribute>[=<value>]", KOptionType.STR);
 
     private String name;
     private KOptionType type = KOptionType.NONE;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
index 114193a..c512296 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
@@ -39,37 +39,37 @@ import java.util.Scanner;
 public class KinitTool {
 
     private static final String USAGE =
-            "Usage: kinit [-V] [-l lifetime] [-s start_time]\n" +
-                    "\t\t[-r renewable_life] [-f | -F] [-p | -P] -n [-a | -A] [-C] [-E]\n" +
-                    "\t\t[-v] [-R] [-k [-i|-t keytab_file]] [-c cachename]\n" +
-                    "\t\t[-S service_name] [-T ticket_armor_cache]\n" +
-                    "\t\t[-X <attribute>[=<value>]] <principal>\n\n" +
-                    "\tDESCRIPTION:\n" +
-                    "\t\tkinit obtains and caches an initial ticket-granting ticket for principal.\n\n" +
-                    "\tOPTIONS:\n" +
-                    "\t\t-V verbose\n" +
-                    "\t\t-l lifetime\n" +
-                    "\t\t--s start time\n" +
-                    "\t\t-r renewable lifetime\n" +
-                    "\t\t-f forwardable\n" +
-                    "\t\t-F not forwardable\n" +
-                    "\t\t-p proxiable\n" +
-                    "\t\t-P not proxiable\n" +
-                    "\t\t-n anonymous\n" +
-                    "\t\t-a include addresses\n" +
-                    "\t\t-A do not include addresses\n" +
-                    "\t\t-v validate\n" +
-                    "\t\t-R renew\n" +
-                    "\t\t-C canonicalize\n" +
-                    "\t\t-E client is enterprise principal name\n" +
-                    "\t\t-k use keytab\n" +
-                    "\t\t-i use default client keytab (with -k)\n" +
-                    "\t\t-t filename of keytab to use\n" +
-                    "\t\t-c Kerberos 5 cache name\n" +
-                    "\t\t-S service\n" +
-                    "\t\t-T armor credential cache\n" +
-                    "\t\t-X <attribute>[=<value>]\n" +
-                    "\n";
+            "Usage: kinit [-V] [-l lifetime] [-s start_time]\n"
+                    + "\t\t[-r renewable_life] [-f | -F] [-p | -P] -n [-a | -A] [-C] [-E]\n"
+                    + "\t\t[-v] [-R] [-k [-i|-t keytab_file]] [-c cachename]\n"
+                    + "\t\t[-S service_name] [-T ticket_armor_cache]\n"
+                    + "\t\t[-X <attribute>[=<value>]] <principal>\n\n"
+                    + "\tDESCRIPTION:\n"
+                    + "\t\tkinit obtains and caches an initial ticket-granting ticket for principal.\n\n"
+                    + "\tOPTIONS:\n"
+                    + "\t\t-V verbose\n"
+                    + "\t\t-l lifetime\n"
+                    + "\t\t--s start time\n"
+                    + "\t\t-r renewable lifetime\n"
+                    + "\t\t-f forwardable\n"
+                    + "\t\t-F not forwardable\n"
+                    + "\t\t-p proxiable\n"
+                    + "\t\t-P not proxiable\n"
+                    + "\t\t-n anonymous\n"
+                    + "\t\t-a include addresses\n"
+                    + "\t\t-A do not include addresses\n"
+                    + "\t\t-v validate\n"
+                    + "\t\t-R renew\n"
+                    + "\t\t-C canonicalize\n"
+                    + "\t\t-E client is enterprise principal name\n"
+                    + "\t\t-k use keytab\n"
+                    + "\t\t-i use default client keytab (with -k)\n"
+                    + "\t\t-t filename of keytab to use\n"
+                    + "\t\t-c Kerberos 5 cache name\n"
+                    + "\t\t-S service\n"
+                    + "\t\t-T armor credential cache\n"
+                    + "\t\t-X <attribute>[=<value>]\n"
+                    + "\n";
 
 
     private static void printUsage(String error) {
@@ -84,9 +84,9 @@ public class KinitTool {
     private static String getPassword(String principal) {
         Console console = System.console();
         if (console == null) {
-            System.out.println("Couldn't get Console instance, " +
-                    "maybe you're running this from within an IDE. " +
-                    "Use scanner to read password.");
+            System.out.println("Couldn't get Console instance, "
+                    + "maybe you're running this from within an IDE. "
+                    + "Use scanner to read password.");
             System.out.println("Password for " + principal + ":");
             try (Scanner scanner = new Scanner(System.in)) {
                 return scanner.nextLine().trim();
@@ -105,7 +105,7 @@ public class KinitTool {
         ktOptions.add(KinitOption.CLIENT_PRINCIPAL, principal);
 
         //If not request tickets by keytab than by password.
-        if (! ktOptions.contains(KinitOption.USE_KEYTAB)) {
+        if (!ktOptions.contains(KinitOption.USE_KEYTAB)) {
             ktOptions.add(KinitOption.USE_PASSWD);
             String password = getPassword(principal);
             ktOptions.add(KinitOption.USER_PASSWD, password);
@@ -115,7 +115,7 @@ public class KinitTool {
         TgtTicket tgt = krbClient.requestTgtWithOptions(
                 ToolUtil.convertOptions(ktOptions));
 
-        if(tgt == null) {
+        if (tgt == null) {
             System.err.println("Requesting TGT failed");
             return;
         }
@@ -131,8 +131,8 @@ public class KinitTool {
         }
 
         krbClient.storeTicket(tgt, ccacheFile);
-        System.out.println("Successfully requested and stored ticket in " +
-                                    ccacheFile.getAbsolutePath());
+        System.out.println("Successfully requested and stored ticket in "
+                + ccacheFile.getAbsolutePath());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistOption.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistOption.java b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistOption.java
index adbd7d2..d4e4d31 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistOption.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistOption.java
@@ -22,7 +22,7 @@ package org.apache.kerby.kerberos.tool.klist;
 import org.apache.kerby.KOption;
 import org.apache.kerby.KOptionType;
 
-public enum KlistOption implements KOption{
+public enum KlistOption implements KOption {
     NONE("NONE"),
     CREDENTIALS_CACHE("-c", "specifies path of credentials cache", KOptionType.STR),
     KEYTAB("-k", "specifies keytab"),
@@ -35,10 +35,9 @@ public enum KlistOption implements KOption{
     CREDENTIALS_FLAGS("-f", "show credential flags"),
     EXIT_TGT_EXISTENCE("-s", "sets exit status based on valid tgt existence"),
     DISPL_ADDRESS_LIST("-a", "displays the address list"),
-    NO_REVERSE_RESOLVE("-n","do not reverse resolve"),
-    SHOW_KTAB_ENTRY_TS("-t","shows keytab entry timestamps"),
-    SHOW_KTAB_ENTRY_KEY("-K", "show keytab entry keys"),
-    ;
+    NO_REVERSE_RESOLVE("-n", "do not reverse resolve"),
+    SHOW_KTAB_ENTRY_TS("-t", "shows keytab entry timestamps"),
+    SHOW_KTAB_ENTRY_KEY("-K", "show keytab entry keys");
 
     private String name;
     private KOptionType type = KOptionType.NONE;
@@ -65,7 +64,7 @@ public enum KlistOption implements KOption{
     }
 
     public static KlistOption fromName(String name) {
-        if (name != null ) {
+        if (name != null) {
             for (KlistOption klopt : values()) {
                 if (klopt.getName().equals(name)) {
                     return (KlistOption) klopt;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
index a15aaad..9359450 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/klist/KlistTool.java
@@ -43,25 +43,25 @@ import java.util.List;
 public class KlistTool {
 
     private static  final String USAGE =
-            "Usage: klist [-e] [-V] [[-c] [-l] [-A] [-d] [-f] [-s] " +
-                    "[-a [-n]]] [-k [-t] [-K]] [name]\n" +
-                    "\t-c specifies credentials cache\n" +
-                    "\t-k specifies keytab\n" +
-                    "\t   (Default is credentials cache)\n" +
-                    "\t-i uses default client keytab if no name given\n" +
-                    "\t-l lists credential caches in collection\n" +
-                    "\t-A shows content of all credential caches\n" +
-                    "\t-e shows the encryption type\n" +
-                    "\t-V shows the Kerberos version and exits\n" +
-                    "\toptions for credential caches:\n" +
-                    "\t\t-d shows the submitted authorization data types\n" +
-                    "\t\t-f shows credentials flags\n" +
-                    "\t\t-s sets exit status based on valid tgt existence\n" +
-                    "\t\t-a displays the address list\n" +
-                    "\t\t\t-n do not reverse-resolve\n" +
-                    "\toptions for keytabs:\n" +
-                    "\t\t-t shows keytab entry timestamps\n" +
-                    "\t\t-K shows keytab entry keys\n";
+            "Usage: klist [-e] [-V] [[-c] [-l] [-A] [-d] [-f] [-s] "
+                    + "[-a [-n]]] [-k [-t] [-K]] [name]\n"
+                    + "\t-c specifies credentials cache\n"
+                    + "\t-k specifies keytab\n"
+                    + "\t   (Default is credentials cache)\n"
+                    + "\t-i uses default client keytab if no name given\n"
+                    + "\t-l lists credential caches in collection\n"
+                    + "\t-A shows content of all credential caches\n"
+                    + "\t-e shows the encryption type\n"
+                    + "\t-V shows the Kerberos version and exits\n"
+                    + "\toptions for credential caches:\n"
+                    + "\t\t-d shows the submitted authorization data types\n"
+                    + "\t\t-f shows credentials flags\n"
+                    + "\t\t-s sets exit status based on valid tgt existence\n"
+                    + "\t\t-a displays the address list\n"
+                    + "\t\t\t-n do not reverse-resolve\n"
+                    + "\toptions for keytabs:\n"
+                    + "\t\t-t shows keytab entry timestamps\n"
+                    + "\t\t-K shows keytab entry keys\n";
 
     // option "-k" hava a optional parameter, "/etc/krb5.keytab" if not specified
     private static String keytabFilePath = null;
@@ -75,7 +75,7 @@ public class KlistTool {
     private static int printCredentialCacheInfo(KOptions klOptions) {
         CredentialCache cc = new CredentialCache();
         List<Credential> credentials;
-        InputStream cis = null ;
+        InputStream cis = null;
         String error;
         String fileName = null;
 
@@ -108,9 +108,9 @@ public class KlistTool {
                 System.out.println("Valid starting\t\tExpires\t\t\tService principal");
 
                 for (Credential crd : credentials) {
-                    System.out.println( df.format(crd.getStartTime().getTime()) + "\t" +
-                                        df.format(crd.getEndTime().getTime()) + "\t" +
-                                        crd.getServerName());
+                    System.out.println(df.format(crd.getStartTime().getTime()) + "\t"
+                            + df.format(crd.getEndTime().getTime()) + "\t"
+                            + crd.getServerName());
                 }
             }
 
@@ -121,11 +121,11 @@ public class KlistTool {
 
     private static int printKeytabInfo(KOptions klOptions) {
         String[] header = new String[4];
-        header[0] = "KVNO Principal\n" +
-                "---- --------------------------------------------------------------------------";
+        header[0] = "KVNO Principal\n"
+                + "---- --------------------------------------------------------------------------";
         header[1] = header[0];
-        header[2] = "KVNO Timestamp           Principal\n" +
-                "---- ------------------- ------------------------------------------------------";
+        header[2] = "KVNO Timestamp           Principal\n"
+                + "---- ------------------- ------------------------------------------------------";
         header[3] = header[2];
         int outputIndex = 0;
         if (klOptions.contains(KlistOption.SHOW_KTAB_ENTRY_TS)) {
@@ -138,7 +138,7 @@ public class KlistTool {
         try {
             File keytabFile = new File(keytabFilePath);
             if (!keytabFile.exists()) {
-                System.out.println("klist: Key table file '" + keytabFilePath +"' not found. ");
+                System.out.println("klist: Key table file '" + keytabFilePath + "' not found. ");
                 return 0;
             }
             System.out.println(header[outputIndex]);
@@ -166,7 +166,7 @@ public class KlistTool {
             }
 
         } catch (IOException e) {
-            System.err.println("klist: Error while scan key table file '" + keytabFilePath +"'");
+            System.err.println("klist: Error while scan key table file '" + keytabFilePath + "'");
         }
         return 0;
     }
@@ -213,7 +213,7 @@ public class KlistTool {
                 }
             }
 
-            if ( error != null ) {
+            if (error != null) {
                 printUsage(error);
             }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java
index 7583121..e88085b 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java
@@ -19,7 +19,13 @@
  */
 package org.apache.kerby.kerberos.tool.token;
 
-import java.io.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
 
 public class TokenCache {
     private static final String DEFAULT_TOKEN_CACHE_PATH = ".tokenauth";
@@ -28,7 +34,7 @@ public class TokenCache {
     public static String readToken(String tokenCacheFile) {
         File cacheFile = null;
 
-        if (tokenCacheFile != null && ! tokenCacheFile.isEmpty()) {
+        if (tokenCacheFile != null && !tokenCacheFile.isEmpty()) {
             cacheFile = new File(tokenCacheFile);
             if (!cacheFile.exists()) {
                 throw new RuntimeException("Invalid token cache specified: " + tokenCacheFile);
@@ -49,7 +55,7 @@ public class TokenCache {
                 token = line;
             }
         } catch (IOException ex) { //NOPMD
-            //
+            System.out.println(ex);
         }
 
         return token;
@@ -66,8 +72,7 @@ public class TokenCache {
             cacheFile.setReadable(false, false);
             cacheFile.setReadable(true, true);
             cacheFile.setWritable(true, true);
-        }
-        catch (IOException ioe) {
+        } catch (IOException ioe) {
             // if case of any error we just delete the cache, if user-only
             // write permissions are not properly set a security exception
             // is thrown and the file will be deleted.

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenInit.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenInit.java b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenInit.java
index eb8fef5..d257f76 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenInit.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenInit.java
@@ -75,8 +75,8 @@ public class TokenInit {
         String principal, group, role = null;
 
         if (args.length != 2 && args.length != 3) {
-            System.out.println("This is a simple token issuing tool just for " +
-                    "kerb-token PoC usage\n");
+            System.out.println("This is a simple token issuing tool just for "
+                    + "kerb-token PoC usage\n");
             System.out.println("tokeninit <username> <group> [role]\n");
             System.exit(1);
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
index e8a963c..5c85e0f 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
@@ -21,7 +21,16 @@ package org.apache.kerby.kerberos.tool.kadmin;
 
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.Kadmin;
-import org.apache.kerby.kerberos.tool.kadmin.command.*;
+import org.apache.kerby.kerberos.tool.kadmin.command.AddPrincipalCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.ChangePasswordCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.DeletePrincipalCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.GetPrincipalCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.KadminCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.KeytabAddCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.KeytabRemoveCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.ListPrincipalCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.ModifyPrincipalCommand;
+import org.apache.kerby.kerberos.tool.kadmin.command.RenamePrincipalCommand;
 
 import java.io.File;
 import java.util.Map;
@@ -29,78 +38,78 @@ import java.util.Scanner;
 
 public class KadminTool {
     private static final String PROMPT = KadminTool.class.getSimpleName() + ".local";
-    private static final String REQUEST_LIST = "Available " + PROMPT + " requests:\n" +
-            "\n" +
-            "add_principal, addprinc, ank\n" +
-            "                         Add principal\n" +
-            "delete_principal, delprinc\n" +
-            "                         Delete principal\n" +
-            "modify_principal, modprinc\n" +
-            "                         Modify principal\n" +
-            "rename_principal, renprinc\n" +
-            "                         Rename principal\n" +
-            "change_password, cpw     Change password\n" +
-            "get_principal, getprinc  Get principal\n" +
-            "list_principals, listprincs, get_principals, getprincs\n" +
-            "                         List principals\n" +
-            "add_policy, addpol       Add policy\n" +
-            "modify_policy, modpol    Modify policy\n" +
-            "delete_policy, delpol    Delete policy\n" +
-            "get_policy, getpol       Get policy\n" +
-            "list_policies, listpols, get_policies, getpols\n" +
-            "                         List policies\n" +
-            "get_privs, getprivs      Get privileges\n" +
-            "ktadd, xst               Add entry(s) to a keytab\n" +
-            "ktremove, ktrem          Remove entry(s) from a keytab\n" +
-            "lock                     Lock database exclusively (use with extreme caution!)\n" +
-            "unlock                   Release exclusive database lock\n" +
-            "purgekeys                Purge previously retained old keys from a principal\n" +
-            "get_strings, getstrs     Show string attributes on a principal\n" +
-            "set_string, setstr       Set a string attribute on a principal\n" +
-            "del_string, delstr       Delete a string attribute on a principal\n" +
-            "list_requests, lr, ?     List available requests.\n" +
-            "quit, exit, q            Exit program.";
+    private static final String REQUEST_LIST = "Available " + PROMPT + " requests:\n"
+            + "\n"
+            + "add_principal, addprinc, ank\n"
+            + "                         Add principal\n"
+            + "delete_principal, delprinc\n"
+            + "                         Delete principal\n"
+            + "modify_principal, modprinc\n"
+            + "                         Modify principal\n"
+            + "rename_principal, renprinc\n"
+            + "                         Rename principal\n"
+            + "change_password, cpw     Change password\n"
+            + "get_principal, getprinc  Get principal\n"
+            + "list_principals, listprincs, get_principals, getprincs\n"
+            + "                         List principals\n"
+            + "add_policy, addpol       Add policy\n"
+            + "modify_policy, modpol    Modify policy\n"
+            + "delete_policy, delpol    Delete policy\n"
+            + "get_policy, getpol       Get policy\n"
+            + "list_policies, listpols, get_policies, getpols\n"
+            + "                         List policies\n"
+            + "get_privs, getprivs      Get privileges\n"
+            + "ktadd, xst               Add entry(s) to a keytab\n"
+            + "ktremove, ktrem          Remove entry(s) from a keytab\n"
+            + "lock                     Lock database exclusively (use with extreme caution!)\n"
+            + "unlock                   Release exclusive database lock\n"
+            + "purgekeys                Purge previously retained old keys from a principal\n"
+            + "get_strings, getstrs     Show string attributes on a principal\n"
+            + "set_string, setstr       Set a string attribute on a principal\n"
+            + "del_string, delstr       Delete a string attribute on a principal\n"
+            + "list_requests, lr, ?     List available requests.\n"
+            + "quit, exit, q            Exit program.";
 
 
     private static void execute(Kadmin kadmin, String command) {
         //Omit the leading and trailing whitespace.
         command = command.trim();
-        if (command.equals("list_requests") ||
-                command.equals("lr") ||
-                command.equals("?")) {
+        if (command.equals("list_requests")
+                || command.equals("lr")
+                || command.equals("?")) {
             System.out.println(REQUEST_LIST);
             return;
         }
 
         KadminCommand executor = null;
-        if (command.startsWith("add_principal") ||
-                command.startsWith("addprinc") ||
-                command.startsWith("ank")) {
+        if (command.startsWith("add_principal")
+                || command.startsWith("addprinc")
+                || command.startsWith("ank")) {
             executor = new AddPrincipalCommand(kadmin);
-        } else if (command.startsWith("ktadd") ||
-                command.startsWith("xst")) {
+        } else if (command.startsWith("ktadd")
+                || command.startsWith("xst")) {
             executor = new KeytabAddCommand(kadmin);
-        } else if (command.startsWith("ktremove") ||
-                command.startsWith("ktrem")) {
+        } else if (command.startsWith("ktremove")
+                || command.startsWith("ktrem")) {
             executor = new KeytabRemoveCommand(kadmin);
-        } else if (command.startsWith("delete_principal") ||
-                command.startsWith("delprinc")) {
+        } else if (command.startsWith("delete_principal")
+                || command.startsWith("delprinc")) {
             executor = new DeletePrincipalCommand(kadmin);
-        } else if (command.startsWith("modify_principal") ||
-                command.startsWith("modprinc")) {
+        } else if (command.startsWith("modify_principal")
+                || command.startsWith("modprinc")) {
             executor = new ModifyPrincipalCommand(kadmin);
-        } else if (command.startsWith("rename_principal") ||
-                command.startsWith("renprinc")) {
+        } else if (command.startsWith("rename_principal")
+                || command.startsWith("renprinc")) {
             executor = new RenamePrincipalCommand(kadmin);
-        } else if (command.startsWith("change_password") ||
-                command.startsWith("cpw")) {
+        } else if (command.startsWith("change_password")
+                || command.startsWith("cpw")) {
             executor = new ChangePasswordCommand(kadmin);
-        } else if (command.startsWith("get_principal") || command.startsWith("getprinc") ||
-                command.startsWith("Get principal")) {
+        } else if (command.startsWith("get_principal") || command.startsWith("getprinc")
+                || command.startsWith("Get principal")) {
             executor = new GetPrincipalCommand(kadmin);
-        } else if (command.startsWith("list_principals") ||
-                command.startsWith("listprincs") || command.startsWith("get_principals") ||
-                command.startsWith("getprincs") || command.startsWith("List principals")) {
+        } else if (command.startsWith("list_principals")
+                || command.startsWith("listprincs") || command.startsWith("get_principals")
+                || command.startsWith("getprincs") || command.startsWith("List principals")) {
             executor = new ListPrincipalCommand(kadmin);
         }
         if (executor == null) {
@@ -120,10 +129,10 @@ public class KadminTool {
             } catch (SecurityException e) {
                 envDir = null;
             }
-            if(envDir != null) {
+            if (envDir != null) {
                 confDir = new File(envDir);
             } else {
-                confDir = new File("/etc/kerby/");// for Linux. TODO: fix for Win etc.
+                confDir = new File("/etc/kerby/"); // for Linux. TODO: fix for Win etc.
             }
         } else {
             confDir = new File(args[0]);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/ToolUtil.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/ToolUtil.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/ToolUtil.java
index 2cf2955..27668f3 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/ToolUtil.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/ToolUtil.java
@@ -27,16 +27,16 @@ import java.util.Scanner;
 
 public class ToolUtil {
 
-    public static void printUsage(String error, String USAGE) {
+    public static void printUsage(String error, String usage) {
         System.err.println(error + "\n");
-        System.err.println(USAGE);
+        System.err.println(usage);
     }
 
     public static KOptions parseOptions(String[] commands, int beginIndex, int endIndex) {
         KadminOption kOption;
         String opt, error, param;
 
-        if(beginIndex < 0) {
+        if (beginIndex < 0) {
             System.out.println("Invalid function parameter(s).");
             return null;
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
index b728dca..7c3aa6a 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/AddPrincipalCommand.java
@@ -30,24 +30,25 @@ import java.util.Arrays;
 import java.util.Scanner;
 
 public class AddPrincipalCommand extends KadminCommand {
-    private static final String USAGE = "Usage: add_principal [options] principal\n" +
-            "\toptions are:\n" +
-            "\t\t[-randkey|-nokey] [-x db_princ_args]* [-expire expdate] [-pwexpire pwexpdate] [-maxlife maxtixlife]\n" +
-            "\t\t[-kvno kvno] [-policy policy] [-clearpolicy]\n" +
-            "\t\t[-pw password] [-maxrenewlife maxrenewlife]\n" +
-            "\t\t[-e keysaltlist]\n" +
-            "\t\t[{+|-}attribute]\n" +
-            "\tattributes are:\n" +
-            "\t\tallow_postdated allow_forwardable allow_tgs_req allow_renewable\n" +
-            "\t\tallow_proxiable allow_dup_skey allow_tix requires_preauth\n" +
-            "\t\trequires_hwauth needchange allow_svr password_changing_service\n" +
-            "\t\tok_as_delegate ok_to_auth_as_delegate no_auth_data_required\n" +
-            "\n" +
-            "\twhere,\n" +
-            "\t[-x db_princ_args]* - any number of database specific arguments.\n" +
-            "\t\t\tLook at each database documentation for supported arguments.\n" +
-            "\tExample:\n" +
-            "\t\tadd_principal -expire 23/04/15:01:01:01 -kvno 1 -pw mypassword test@EXAMPLE.COM";
+    private static final String USAGE = "Usage: add_principal [options] principal\n"
+            + "\toptions are:\n"
+            + "\t\t[-randkey|-nokey] [-x db_princ_args]* [-expire expdate] "
+            + "[-pwexpire pwexpdate] [-maxlife maxtixlife]\n"
+            + "\t\t[-kvno kvno] [-policy policy] [-clearpolicy]\n"
+            + "\t\t[-pw password] [-maxrenewlife maxrenewlife]\n"
+            + "\t\t[-e keysaltlist]\n"
+            + "\t\t[{+|-}attribute]\n"
+            + "\tattributes are:\n"
+            + "\t\tallow_postdated allow_forwardable allow_tgs_req allow_renewable\n"
+            + "\t\tallow_proxiable allow_dup_skey allow_tix requires_preauth\n"
+            + "\t\trequires_hwauth needchange allow_svr password_changing_service\n"
+            + "\t\tok_as_delegate ok_to_auth_as_delegate no_auth_data_required\n"
+            + "\n"
+            + "\twhere,\n"
+            + "\t[-x db_princ_args]* - any number of database specific arguments.\n"
+            + "\t\t\tLook at each database documentation for supported arguments.\n"
+            + "\tExample:\n"
+            + "\t\tadd_principal -expire 23/04/15:01:01:01 -kvno 1 -pw mypassword test@EXAMPLE.COM";
 
 
     private KOptions kOptions;
@@ -65,13 +66,13 @@ public class AddPrincipalCommand extends KadminCommand {
         }
 
         kOptions = ToolUtil.parseOptions(commands, 1, commands.length - 2);
-        if(kOptions == null) {
+        if (kOptions == null) {
             System.err.println(USAGE);
             return;
         }
         String principal = commands[commands.length - 1];
         String password;
-        if(kOptions.contains(KadminOption.PW)) {
+        if (kOptions.contains(KadminOption.PW)) {
             password = kOptions.getStringOption(KadminOption.PW);
         } else {
             password = getPassword(principal);
@@ -98,9 +99,9 @@ public class AddPrincipalCommand extends KadminCommand {
 
         Console console = System.console();
         if (console == null) {
-            System.out.println("Couldn't get Console instance, " +
-                    "maybe you're running this from within an IDE. " +
-                    "Use scanner to read password.");
+            System.out.println("Couldn't get Console instance, "
+                    + "maybe you're running this from within an IDE. "
+                    + "Use scanner to read password.");
             Scanner scanner = new Scanner(System.in);
             passwordOnce = getPassword(scanner,
                     "Enter password for principal \"" + principal + "\":");
@@ -115,7 +116,8 @@ public class AddPrincipalCommand extends KadminCommand {
         }
 
         if (!passwordOnce.equals(passwordTwice)) {
-            System.err.println("add_principal: Password mismatch while reading password for \"" + principal + "\".");
+            System.err.println("add_principal: Password mismatch while reading password for \""
+                    + principal + "\".");
             return null;
         }
         return passwordOnce;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ChangePasswordCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ChangePasswordCommand.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ChangePasswordCommand.java
index a8dbc28..25a7c41 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ChangePasswordCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ChangePasswordCommand.java
@@ -30,8 +30,8 @@ import java.util.Arrays;
 import java.util.Scanner;
 
 public class ChangePasswordCommand extends KadminCommand {
-    private static final String USAGE = "Usage: change_password [-randkey] " +
-            "[-keepold] [-e keysaltlist] [-pw password] principal";
+    private static final String USAGE = "Usage: change_password [-randkey] "
+            + "[-keepold] [-e keysaltlist] [-pw password] principal";
 
     private KOptions kOptions;
 
@@ -42,7 +42,7 @@ public class ChangePasswordCommand extends KadminCommand {
     @Override
     public void execute(String input) {
         String[] commands = input.split("\\s");
-        String principal = commands[commands.length -1];
+        String principal = commands[commands.length - 1];
         String password;
 
         if (commands.length <= 1) {
@@ -50,9 +50,9 @@ public class ChangePasswordCommand extends KadminCommand {
             return;
         }
 
-        if (commands.length == 2) {//only principal is given
+        if (commands.length == 2) { //only principal is given
             password = getPassword(principal);
-            if(password == null) {
+            if (password == null) {
                 System.out.println("Did not get new password successfully. Please try again");
                 return;
             }
@@ -68,7 +68,7 @@ public class ChangePasswordCommand extends KadminCommand {
                 System.err.println(USAGE);
                 return;
             }
-            if (kOptions.contains(KadminOption.PW)){
+            if (kOptions.contains(KadminOption.PW)) {
                 password = kOptions.getStringOption(KadminOption.PW);
                 try {
                     getKadmin().updatePassword(principal, password);
@@ -76,7 +76,7 @@ public class ChangePasswordCommand extends KadminCommand {
                 } catch (KrbException e) {
                     System.err.println("Fail to update password. " + e.getCause());
                 }
-            } else if( kOptions.contains(KadminOption.RANDKEY)){
+            } else if (kOptions.contains(KadminOption.RANDKEY)) {
                 try {
                     getKadmin().updateKeys(principal);
                 } catch (KrbException e) {
@@ -95,9 +95,9 @@ public class ChangePasswordCommand extends KadminCommand {
 
         Console console = System.console();
         if (console == null) {
-            System.out.println("Couldn't get Console instance, " +
-                    "maybe you're running this from within an IDE. " +
-                    "Use scanner to read password.");
+            System.out.println("Couldn't get Console instance, "
+                    + "maybe you're running this from within an IDE. "
+                    + "Use scanner to read password.");
             Scanner scanner = new Scanner(System.in);
             passwordOnce = getPassword(scanner,
                     "Please enter new password  \"" + principal + "\":");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/DeletePrincipalCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/DeletePrincipalCommand.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/DeletePrincipalCommand.java
index efcb0a8..77d8126 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/DeletePrincipalCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/DeletePrincipalCommand.java
@@ -27,10 +27,10 @@ import java.util.Scanner;
 
 public class DeletePrincipalCommand extends KadminCommand {
 
-    private static final String USAGE = "Usage: delete_principal [options] principal\n" +
-            "This command prompts for deletion, unless the -force option is given.\n" +
-            "\toptions are:\n" +
-            "\t\t[-force]" + " no prompts for deletion.";
+    private static final String USAGE = "Usage: delete_principal [options] principal\n"
+            + "This command prompts for deletion, unless the -force option is given.\n"
+            + "\toptions are:\n"
+            + "\t\t[-force]" + " no prompts for deletion.";
 
     private Boolean force = false;
 
@@ -56,9 +56,9 @@ public class DeletePrincipalCommand extends KadminCommand {
             Console console = System.console();
             String prompt = "Are you sure want to delete the principal? (yes/no, YES/NO, y/n, Y/N) ";
             if (console == null) {
-                System.out.println("Couldn't get Console instance, " +
-                    "maybe you're running this from within an IDE. " +
-                    "Use scanner to read password.");
+                System.out.println("Couldn't get Console instance, "
+                        + "maybe you're running this from within an IDE. "
+                        + "Use scanner to read password.");
                 Scanner scanner = new Scanner(System.in);
                 reply = getReply(scanner, prompt);
             } else {
@@ -67,7 +67,7 @@ public class DeletePrincipalCommand extends KadminCommand {
             if (reply.equals("yes") || reply.equals("YES") || reply.equals("y") || reply.equals("Y")) {
                 deletePrincipal(getKadmin(), principal);
             } else if (reply.equals("no") || reply.equals("NO") || reply.equals("n") || reply.equals("N")) {
-                System.out.println("Pincipal \"" + principal + "\"  not deleted." );
+                System.out.println("Pincipal \"" + principal + "\"  not deleted.");
             } else {
                 System.err.println("Unknow request, fail to delete the principal.");
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/GetPrincipalCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/GetPrincipalCommand.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/GetPrincipalCommand.java
index 1e3b95d..2b63db6 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/GetPrincipalCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/GetPrincipalCommand.java
@@ -28,8 +28,8 @@ import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
 import java.util.Map;
 
 public class GetPrincipalCommand extends KadminCommand {
-    private static final String USAGE = "Usage: getprinc principalName\n" +
-            "such as, getprinc hello@TEST.COM";
+    private static final String USAGE = "Usage: getprinc principalName\n"
+            + "such as, getprinc hello@TEST.COM";
 
     public GetPrincipalCommand(Kadmin kadmin) {
         super(kadmin);
@@ -61,12 +61,13 @@ public class GetPrincipalCommand extends KadminCommand {
         Map<EncryptionType, EncryptionKey> key = identity.getKeys();
 
         System.out.println(
-                "Principal: " + identity.getPrincipalName() + "\n" +
-                "Expiration data: " + identity.getExpireTime() + "\n" +
-                "Created time: " + identity.getCreatedTime() + "\n" +
-                "KDC flags: " + identity.getKdcFlags() + "\n" +
-                "Key version: " + identity.getKeyVersion() + "\n" +
-                "Number of keys: " + key.size()
+                "Principal: " + identity.getPrincipalName() + "\n"
+                        + "Expiration data: " + identity.getExpireTime() + "\n"
+                        + "Created time: "
+                        + identity.getCreatedTime() + "\n"
+                        + "KDC flags: " + identity.getKdcFlags() + "\n"
+                        + "Key version: " + identity.getKeyVersion() + "\n"
+                        + "Number of keys: " + key.size()
         );
 
         for (EncryptionType keyType : key.keySet()) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabAddCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabAddCommand.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabAddCommand.java
index c130f56..9cdf9b4 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabAddCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabAddCommand.java
@@ -53,7 +53,7 @@ public class KeytabAddCommand extends KadminCommand {
                 }
                 keytabFileLocation = commands[index].trim();
 
-            } else if (!command.startsWith("-")){
+            } else if (!command.startsWith("-")) {
                 principal = command;
             }
             index++;
@@ -73,8 +73,8 @@ public class KeytabAddCommand extends KadminCommand {
             getKadmin().exportKeytab(keytabFile, principal);
             System.out.println("Done!");
         } catch (KrbException e) {
-            System.err.println("Principal \"" + principal + "\" fail to add entry to keytab." +
-                e.getCause());
+            System.err.println("Principal \"" + principal + "\" fail to add entry to keytab."
+                    + e.getCause());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabRemoveCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabRemoveCommand.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabRemoveCommand.java
index 81dcfb2..324ef29 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabRemoveCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/KeytabRemoveCommand.java
@@ -48,7 +48,7 @@ public class KeytabRemoveCommand extends KadminCommand {
         String principal;
         String keytabFileLocation;
         String removeOption = null;
-        int lastIndex ;
+        int lastIndex;
 
         if (commands[commands.length - 1].matches("^all|old|-?\\d+$")) {
             if (commands.length < 3) {
@@ -64,14 +64,15 @@ public class KeytabRemoveCommand extends KadminCommand {
         }
         KOptions kOptions = ToolUtil.parseOptions(commands, 1, lastIndex);
 
-        if (principal == null || kOptions == null ||
-                kOptions.contains(KadminOption.K) && kOptions.contains(KadminOption.KEYTAB)) {
+        if (principal == null || kOptions == null
+                || kOptions.contains(KadminOption.K) && kOptions.contains(KadminOption.KEYTAB)) {
             System.err.println(USAGE);
             return;
         }
 
-        keytabFileLocation = kOptions.contains(KadminOption.K)?
-                kOptions.getStringOption(KadminOption.K):kOptions.getStringOption(KadminOption.KEYTAB);
+        keytabFileLocation = kOptions.contains(KadminOption.K)
+                ? kOptions.getStringOption(KadminOption.K)
+                : kOptions.getStringOption(KadminOption.KEYTAB);
 
         if (keytabFileLocation == null) {
             keytabFileLocation = DEFAULT_KEYTAB_FILE;
@@ -89,8 +90,8 @@ public class KeytabRemoveCommand extends KadminCommand {
             }
             System.out.println("Done!");
         } catch (KrbException e) {
-            System.err.println("Principal \"" + principal + "\" fail to remove entry from keytab." +
-                e.getMessage());
+            System.err.println("Principal \"" + principal + "\" fail to remove entry from keytab."
+                    + e.getMessage());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ModifyPrincipalCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ModifyPrincipalCommand.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ModifyPrincipalCommand.java
index 86c19e3..9dbf4a6 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ModifyPrincipalCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/ModifyPrincipalCommand.java
@@ -27,13 +27,14 @@ import org.apache.kerby.kerberos.kerb.admin.KadminOption;
 import org.apache.kerby.kerberos.tool.kadmin.ToolUtil;
 
 public class ModifyPrincipalCommand extends KadminCommand {
-    private static final String USAGE = "Usage: modify_principal [options] principal\n" +
-        "\toptions are:\n" +
-        "\t\t[-expire dd/MM/yy:HH:mm:ss]\n" +
-        "\t\t[-disabled true/false]\n" +
-        "\t\t[-locked true/false]\n" +
-        "\tExample:\n" +
-        "\t\tmodify_principal -expire 23/04/15:01:01:01 -disabled false -locked true test@EXAMPLE.COM";
+    private static final String USAGE = "Usage: modify_principal [options] principal\n"
+            + "\toptions are:\n"
+            + "\t\t[-expire dd/MM/yy:HH:mm:ss]\n"
+            + "\t\t[-disabled true/false]\n"
+            + "\t\t[-locked true/false]\n"
+            + "\tExample:\n"
+            + "\t\tmodify_principal -expire 23/04/15:01:01:01 -disabled false "
+            + "-locked true test@EXAMPLE.COM";
 
     private KOptions kOptions;
     private String principal;
@@ -93,7 +94,7 @@ public class ModifyPrincipalCommand extends KadminCommand {
             }
             kOptions.add(kOption);
         }
-        if(principal == null) {
+        if (principal == null) {
             ToolUtil.printUsage("missing principal name!", USAGE);
         }
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/RenamePrincipalCommand.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/RenamePrincipalCommand.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/RenamePrincipalCommand.java
index 07952a5..9edac54 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/RenamePrincipalCommand.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/command/RenamePrincipalCommand.java
@@ -46,7 +46,7 @@ public class RenamePrincipalCommand extends KadminCommand {
         }
 
         kOptions = ToolUtil.parseOptions(commands, 1, commands.length - 3);
-        if(kOptions==null) {
+        if (kOptions == null) {
             System.err.println(USAGE);
             return;
         }
@@ -61,7 +61,7 @@ public class RenamePrincipalCommand extends KadminCommand {
             if (reply.equals("yes") || reply.equals("YES") || reply.equals("y") || reply.equals("Y")) {
                 renamePrincipal(getKadmin());
             } else if (reply.equals("no") || reply.equals("NO") || reply.equals("n") || reply.equals("N")) {
-                System.out.println("Principal \"" + oldPrincipalName + "\"  not renamed." );
+                System.out.println("Principal \"" + oldPrincipalName + "\"  not renamed.");
             } else {
                 System.err.println("Unknown response, fail to rename the principal.");
             }
@@ -71,8 +71,8 @@ public class RenamePrincipalCommand extends KadminCommand {
     public void renamePrincipal(Kadmin kadmin) {
         try {
             kadmin.renamePrincipal(oldPrincipalName, newPrincipalName);
-            System.out.println("Principal \"" + oldPrincipalName + "\" renamed to \"" +
-                newPrincipalName + "\".");
+            System.out.println("Principal \"" + oldPrincipalName + "\" renamed to \""
+                    + newPrincipalName + "\".");
         } catch (KrbException e) {
             System.err.println("Principal rename failed! Exception happened. " + e.getCause());
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-config/src/main/java/org/apache/kerby/config/Conf.java
----------------------------------------------------------------------
diff --git a/lib/kerby-config/src/main/java/org/apache/kerby/config/Conf.java b/lib/kerby-config/src/main/java/org/apache/kerby/config/Conf.java
index 7edfdef..a207f52 100644
--- a/lib/kerby-config/src/main/java/org/apache/kerby/config/Conf.java
+++ b/lib/kerby-config/src/main/java/org/apache/kerby/config/Conf.java
@@ -24,7 +24,12 @@ import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
 
 public class Conf implements Config {
     private static final Logger LOGGER = LoggerFactory.getLogger(Conf.class);
@@ -80,8 +85,10 @@ public class Conf implements Config {
         try {
             loader = loaderClass.newInstance();
         } catch (Exception e) {
-            LOGGER.error("Failed to create " + Conf.class.getPackage().getName() + " for " + loaderClass.getName(), e);
-            throw new RuntimeException("Failed to create " + Conf.class.getPackage().getName() + " for " + loaderClass.getName(), e);
+            LOGGER.error("Failed to create " + Conf.class.getPackage().getName()
+                    + " for " + loaderClass.getName(), e);
+            throw new RuntimeException("Failed to create "
+                    + Conf.class.getPackage().getName() + " for " + loaderClass.getName(), e);
         }
         loader.setResource(resource);
         return loader;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-config/src/main/java/org/apache/kerby/config/ConfigImpl.java
----------------------------------------------------------------------
diff --git a/lib/kerby-config/src/main/java/org/apache/kerby/config/ConfigImpl.java b/lib/kerby-config/src/main/java/org/apache/kerby/config/ConfigImpl.java
index 9836792..e8a5b50 100644
--- a/lib/kerby-config/src/main/java/org/apache/kerby/config/ConfigImpl.java
+++ b/lib/kerby-config/src/main/java/org/apache/kerby/config/ConfigImpl.java
@@ -20,7 +20,14 @@
  */
 package org.apache.kerby.config;
 
-import java.util.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 public class ConfigImpl implements Config {
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-config/src/main/java/org/apache/kerby/config/Resource.java
----------------------------------------------------------------------
diff --git a/lib/kerby-config/src/main/java/org/apache/kerby/config/Resource.java b/lib/kerby-config/src/main/java/org/apache/kerby/config/Resource.java
index eec6fdf..7973e7e 100644
--- a/lib/kerby-config/src/main/java/org/apache/kerby/config/Resource.java
+++ b/lib/kerby-config/src/main/java/org/apache/kerby/config/Resource.java
@@ -75,7 +75,7 @@ public final class Resource {
         return new Resource(jsonUrl, Format.JSON_FILE);
     }
 
-    public static Resource createMapResource(Map<String,String> mapConfig) {
+    public static Resource createMapResource(Map<String, String> mapConfig) {
         return new Resource("mapConfig", mapConfig, Format.MAP);
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-config/src/main/java/org/apache/kerby/config/XmlConfigLoader.java
----------------------------------------------------------------------
diff --git a/lib/kerby-config/src/main/java/org/apache/kerby/config/XmlConfigLoader.java b/lib/kerby-config/src/main/java/org/apache/kerby/config/XmlConfigLoader.java
index feab854..425cb44 100644
--- a/lib/kerby-config/src/main/java/org/apache/kerby/config/XmlConfigLoader.java
+++ b/lib/kerby-config/src/main/java/org/apache/kerby/config/XmlConfigLoader.java
@@ -21,7 +21,13 @@ package org.apache.kerby.config;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.w3c.dom.*;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -83,7 +89,7 @@ public class XmlConfigLoader extends ConfigLoader {
                 continue;
             }
 
-            Element prop = (Element)subNode;
+            Element prop = (Element) subNode;
             String name = getElementName(prop);
             if (name == null) {
                 continue;
@@ -107,7 +113,7 @@ public class XmlConfigLoader extends ConfigLoader {
 
     private static ConfigObject loadProperty(Element ele) {
         if (ele.getFirstChild() instanceof Text) {
-            String value = ((Text)ele.getFirstChild()).getData();
+            String value = ((Text) ele.getFirstChild()).getData();
             return new ConfigObject(value);
         }
 
@@ -120,9 +126,9 @@ public class XmlConfigLoader extends ConfigLoader {
                 continue;
             }
 
-            Element valueEle = (Element)valueNode;
+            Element valueEle = (Element) valueNode;
             if ("value".equals(valueEle.getTagName()) && valueEle.hasChildNodes()) {
-                value = ((Text)valueEle.getFirstChild()).getData();
+                value = ((Text) valueEle.getFirstChild()).getData();
             }
 
             if (value != null) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-config/src/test/java/org/apache/kerby/config/ConfigImplTest.java
----------------------------------------------------------------------
diff --git a/lib/kerby-config/src/test/java/org/apache/kerby/config/ConfigImplTest.java b/lib/kerby-config/src/test/java/org/apache/kerby/config/ConfigImplTest.java
index d029d96..f8c927f 100644
--- a/lib/kerby-config/src/test/java/org/apache/kerby/config/ConfigImplTest.java
+++ b/lib/kerby-config/src/test/java/org/apache/kerby/config/ConfigImplTest.java
@@ -48,7 +48,7 @@ public class ConfigImplTest {
         sectionB.set("kdc", "FILE:/var/log/krb5kdc.log");
 
         assertThat(rootConfig.getString("globalConfig")).isEqualTo("true");
-        assertThat(rootConfig.getString("default_realm")).isNull();//section config should not get the global value
+        assertThat(rootConfig.getString("default_realm")).isNull(); //section config should not get the global value
 
         Config subA = rootConfig.getConfig("libdefaults");
         assertThat(subA.getString("default_realm")).isEqualTo("EXAMPLE.COM");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-config/src/test/java/org/apache/kerby/config/IniConfigTest.java
----------------------------------------------------------------------
diff --git a/lib/kerby-config/src/test/java/org/apache/kerby/config/IniConfigTest.java b/lib/kerby-config/src/test/java/org/apache/kerby/config/IniConfigTest.java
index 7b670df..4198560 100644
--- a/lib/kerby-config/src/test/java/org/apache/kerby/config/IniConfigTest.java
+++ b/lib/kerby-config/src/test/java/org/apache/kerby/config/IniConfigTest.java
@@ -32,12 +32,12 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 public class IniConfigTest {
 
-    private static final File TEST_DIR = new File(System.getProperty("test.dir","target"));
+    private static final File TEST_DIR = new File(System.getProperty("test.dir", "target"));
     private static final File TEST_FILE = new File(TEST_DIR, "test-ini-config");
 
     @Before
     public void setUp() throws IOException {
-        if (TEST_FILE.exists()){
+        if (TEST_FILE.exists()) {
             TEST_FILE.delete();
         }
         buildFile();
@@ -71,7 +71,7 @@ public class IniConfigTest {
         conf.addIniConfig(TEST_FILE);
 
         assertThat(conf.getString("default")).isEqualTo("FILE:/var/log/krb5libs.log");
-        assertThat(conf.getString("#note")).isNull();//Comments should be ignored when loading.
+        assertThat(conf.getString("#note")).isNull(); //Comments should be ignored when loading.
 
         Config config = conf.getConfig("libdefaults");
         assertThat(config.getBoolean("dns_lookup_realm")).isFalse();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java
----------------------------------------------------------------------
diff --git a/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java b/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java
index 2cccdf2..eba79a2 100644
--- a/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java
+++ b/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java
@@ -57,7 +57,7 @@ public class KOptions {
             kopt.setValue(new File(strValue));
         } else if (kt == KOptionType.DIR) {
             File dir = new File(strValue);
-            if (! dir.exists()) {
+            if (!dir.exists()) {
                 throw new IllegalArgumentException("Invalid dir:" + strValue);
             }
             kopt.setValue(dir);
@@ -109,7 +109,7 @@ public class KOptions {
     }
 
     public KOption getOption(KOption option) {
-        if (! options.containsKey(option)) {
+        if (!options.containsKey(option)) {
             return null;
         }
 
@@ -117,7 +117,7 @@ public class KOptions {
     }
 
     public Object getOptionValue(KOption option) {
-        if (! contains(option)) {
+        if (!contains(option)) {
             return null;
         }
         return options.get(option).getValue();
@@ -135,13 +135,13 @@ public class KOptions {
         Object value = getOptionValue(option);
         if (value instanceof String) {
             String strVal = (String) value;
-            if (strVal.equalsIgnoreCase("true") ||
-                strVal.equalsIgnoreCase("yes") ||
-                strVal.equals("1")) {
+            if (strVal.equalsIgnoreCase("true")
+                    || strVal.equalsIgnoreCase("yes")
+                    || strVal.equals("1")) {
                 return true;
-            } else if (strVal.equalsIgnoreCase("false") ||
-                strVal.equalsIgnoreCase("no") ||
-                strVal.equals("0")) {
+            } else if (strVal.equalsIgnoreCase("false")
+                    || strVal.equalsIgnoreCase("no")
+                    || strVal.equals("0")) {
                 return false;
             }
         } else if (value instanceof Boolean) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-util/src/main/java/org/apache/kerby/util/Base64.java
----------------------------------------------------------------------
diff --git a/lib/kerby-util/src/main/java/org/apache/kerby/util/Base64.java b/lib/kerby-util/src/main/java/org/apache/kerby/util/Base64.java
index 5e333ec..b384856 100644
--- a/lib/kerby-util/src/main/java/org/apache/kerby/util/Base64.java
+++ b/lib/kerby-util/src/main/java/org/apache/kerby/util/Base64.java
@@ -801,10 +801,8 @@ public class Base64 {
 
         long len = getEncodeLength(binaryData, CHUNK_SIZE, CHUNK_SEPARATOR);
         if (len > maxResultSize) {
-            throw new IllegalArgumentException("Input array too big, the output array would be bigger (" +
-                len +
-                ") than the specified maxium size of " +
-                maxResultSize);
+            throw new IllegalArgumentException("Input array too big, the output array would be bigger ("
+                    + len + ") than the specified maxium size of " + maxResultSize);
         }
 
         Base64 b64 = isChunked ? new Base64(urlSafe) : new Base64(0, CHUNK_SEPARATOR, urlSafe);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/lib/kerby-util/src/main/java/org/apache/kerby/util/HexUtil.java
----------------------------------------------------------------------
diff --git a/lib/kerby-util/src/main/java/org/apache/kerby/util/HexUtil.java b/lib/kerby-util/src/main/java/org/apache/kerby/util/HexUtil.java
index c57204e..39442ee 100644
--- a/lib/kerby-util/src/main/java/org/apache/kerby/util/HexUtil.java
+++ b/lib/kerby-util/src/main/java/org/apache/kerby/util/HexUtil.java
@@ -20,7 +20,7 @@
 package org.apache.kerby.util;
 
 public final class HexUtil {
-    private HexUtil() {}
+    private HexUtil() { }
 
     private static final String HEX_CHARS_STR = "0123456789ABCDEF";
     private static final char[] HEX_CHARS = HEX_CHARS_STR.toCharArray();
@@ -32,7 +32,7 @@ public final class HexUtil {
     public static String bytesToHex(byte[] bytes) {
         int len = bytes.length * 2;
         char[] hexChars = new char[len];
-        for ( int j = 0; j < bytes.length; j++ ) {
+        for (int j = 0; j < bytes.length; j++) {
             int v = bytes[j] & 0xFF;
             hexChars[j * 2] = HEX_CHARS[v >>> 4];
             hexChars[j * 2 + 1] = HEX_CHARS[v & 0x0F];


Mime
View raw message