directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-549 Fix checkstyle and pmd issues in kadmin-remote branch.
Date Tue, 12 Apr 2016 05:51:01 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/kadmin-remote b5ac8e5a7 -> 6b83c7502


DIRKRB-549 Fix checkstyle and pmd issues in kadmin-remote branch.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/6b83c750
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/6b83c750
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/6b83c750

Branch: refs/heads/kadmin-remote
Commit: 6b83c7502fd2964546f257bcb6ac11fd2cfa38b5
Parents: b5ac8e5
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Tue Apr 12 13:56:04 2016 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Tue Apr 12 13:56:04 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kerby/xdr/XdrDataType.java  |  2 +-
 .../java/org/apache/kerby/xdr/XdrFieldInfo.java |  3 +-
 .../apache/kerby/xdr/type/AbstractXdrType.java  |  6 ++-
 .../org/apache/kerby/xdr/type/XdrBoolean.java   |  6 +--
 .../org/apache/kerby/xdr/type/XdrBytes.java     |  1 -
 .../org/apache/kerby/xdr/type/XdrString.java    | 19 +++++----
 .../kerby/xdr/type/XdrUnsignedInteger.java      |  8 ++--
 .../apache/kerby/xdr/XdrEnumeratedInstance.java |  2 +-
 .../apache/kerby/xdr/XdrStructTypeInstance.java |  5 +--
 .../org/apache/kerby/xdr/XdrStructTypeTest.java |  8 ++--
 .../org/apache/kerby/xdr/XdrUnionInstance.java  | 10 ++---
 .../java/org/apache/kerby/xdr/XdrUnionTest.java |  2 +-
 .../kerby/kerberos/kdc/KerbyKdcServer.java      |  1 -
 .../server/kadmin/AdminServerConfigKey.java     |  4 +-
 .../admin/server/kadmin/AdminServerHandler.java | 11 +++--
 .../kadmin/impl/DefaultAdminServerHandler.java  |  2 -
 .../kerb/admin/server/kpasswd/PasswdServer.java | 44 ++++++++++++++------
 .../server/kpasswd/PasswdServerConfigKey.java   |  4 +-
 .../server/kpasswd/PasswdServerHandler.java     |  1 +
 .../impl/DefaultPasswdServerHandler.java        |  2 -
 .../kerb/admin/admin/AdminServerTest.java       | 10 -----
 .../kerb/admin/kadmin/remote/AdminClient.java   |  5 +--
 .../admin/kadmin/remote/AdminConfigKey.java     |  4 +-
 .../kerb/admin/kadmin/remote/AdminHandler.java  | 12 ++----
 .../impl/AbstractInternalAdminClient.java       |  1 -
 .../remote/impl/DefaultInternalAdminClient.java |  1 -
 .../kadmin/remote/impl/InternalAdminClient.java |  2 -
 .../remote/request/AddPrincipalRequest.java     |  2 -
 .../kerb/admin/kpasswd/PasswdClient.java        |  6 +--
 .../kerb/admin/kpasswd/PasswdConfigKey.java     |  4 +-
 .../kerb/admin/kpasswd/PasswdHandler.java       |  4 --
 .../impl/DefaultInternalPasswdClient.java       |  2 +
 .../kerb/admin/tool/DeletePrincipalReq.java     |  2 +-
 .../kerberos/kerb/admin/admin/AdminTest.java    | 13 ++----
 .../kerberos/kerb/server/ServerSetting.java     |  6 +--
 35 files changed, 98 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrDataType.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrDataType.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrDataType.java
index 7b2d244..34bc014 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrDataType.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrDataType.java
@@ -42,7 +42,7 @@ public enum XdrDataType {
     /**
      * Create an instance of this class
      */
-    private XdrDataType(int value) {
+    XdrDataType(int value) {
         this.value = value;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrFieldInfo.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrFieldInfo.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrFieldInfo.java
index 7804701..3f182ef 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrFieldInfo.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/XdrFieldInfo.java
@@ -34,7 +34,8 @@ public class XdrFieldInfo {
      * @param dataType
      *
      */
-    public XdrFieldInfo(int index, XdrDataType dataType, Object value) {//Class<? extends XdrType> type
+    public XdrFieldInfo(int index, XdrDataType dataType, Object value) {
+        //Class<? extends XdrType> type
         this.index = index;
         //this.type = type;
         this.dataType = dataType;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/AbstractXdrType.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/AbstractXdrType.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/AbstractXdrType.java
index 7e03c85..68facec 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/AbstractXdrType.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/AbstractXdrType.java
@@ -36,8 +36,6 @@ public abstract class AbstractXdrType<T> implements XdrType {
     // The wrapped real value.
     private T value;
 
-    private int bodyLength = -1;
-
     /**
      * Default constructor.
      * @param dataType the dataType
@@ -95,4 +93,8 @@ public abstract class AbstractXdrType<T> implements XdrType {
     public void setValue(T value) {
         this.value = value;
     }
+
+    public XdrDataType getDataType() {
+        return dataType;
+    }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBoolean.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBoolean.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBoolean.java
index 224b681..8f9f60a 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBoolean.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBoolean.java
@@ -82,11 +82,9 @@ public class XdrBoolean extends XdrSimple<Boolean> {
         byte[] bytes = getBytes();
         if (Arrays.equals(bytes, TRUE_BYTE)) {
             setValue(true);
-        }
-        else if (Arrays.equals(bytes, FALSE_BYTE)) {
+        } else if (Arrays.equals(bytes, FALSE_BYTE)) {
             setValue(false);
-        }
-        else {
+        } else {
             throw new IOException("Fail to decode boolean type: " + bytes.toString());
         }
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBytes.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBytes.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBytes.java
index 073b962..105ff74 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBytes.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrBytes.java
@@ -24,7 +24,6 @@ import org.apache.kerby.xdr.XdrDataType;
 import java.io.IOException;
 
 public class XdrBytes extends XdrSimple<byte[]> {
-    private int padding;
 
     public XdrBytes() {
         this(null);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrString.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrString.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrString.java
index 145e48d..7122077 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrString.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrString.java
@@ -54,7 +54,8 @@ public class XdrString extends XdrSimple<String> {
     @Override
     protected void toBytes() {
         if (getValue() != null) {
-            byte[] bytes = new byte[encodingBodyLength()]; /**Default value of byte is 0. So we don't have to initialize it with 0*/
+            /**Default value of byte is 0. So we don't have to initialize it with 0*/
+            byte[] bytes = new byte[encodingBodyLength()];
             int length = bytes.length - padding - 4;
             bytes[0] = (byte) (length >> 24);
             bytes[1] = (byte) (length >> 16);
@@ -78,20 +79,20 @@ public class XdrString extends XdrSimple<String> {
         byte[] bytes = getBytes();
         byte[] header = new byte[4];
         System.arraycopy(bytes, 0, header, 0, 4);
-        int StringLen  = ByteBuffer.wrap(header).getInt();
-        int paddingBytes = (4 - (StringLen % 4)) % 4;
+        int stringLen  = ByteBuffer.wrap(header).getInt();
+        int paddingBytes = (4 - (stringLen % 4)) % 4;
         validatePaddingBytes(paddingBytes);
         setPadding(paddingBytes);
 
-        if (bytes.length != StringLen + 4 + paddingBytes) {
-            int totalLength = StringLen + paddingBytes + 4;
-            byte[] StringBytes = ByteBuffer.allocate(totalLength).put(getBytes(), 0, totalLength).array();
-            setBytes(StringBytes); /**reset bytes in case the enum type is in a struct or union*/
+        if (bytes.length != stringLen + 4 + paddingBytes) {
+            int totalLength = stringLen + paddingBytes + 4;
+            byte[] stringBytes = ByteBuffer.allocate(totalLength).put(getBytes(), 0, totalLength).array();
+            setBytes(stringBytes); /**reset bytes in case the enum type is in a struct or union*/
         }
 
-        byte[] content = new byte[StringLen];
+        byte[] content = new byte[stringLen];
         if (bytes.length > 1) {
-            System.arraycopy(bytes, 4, content, 0, StringLen);
+            System.arraycopy(bytes, 4, content, 0, stringLen);
         }
         setValue(new String(content, StandardCharsets.US_ASCII));
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java
index cfd7ed3..9b1b5d8 100644
--- a/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java
+++ b/kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnsignedInteger.java
@@ -67,7 +67,7 @@ public class XdrUnsignedInteger extends XdrSimple<Long> {
     @Override
     protected void toBytes() throws IOException {
         Long value = getValue();
-        ValidateUnsignedInteger(value); /**Check whether the long value is valid unsigned int*/
+        validateUnsignedInteger(value); /**Check whether the long value is valid unsigned int*/
         ByteBuffer buffer = ByteBuffer.allocate(8);
         buffer.putLong(value);
         byte[] bytes = new byte[4]; /**The encoding length is 4*/
@@ -75,7 +75,7 @@ public class XdrUnsignedInteger extends XdrSimple<Long> {
         setBytes(bytes);
     }
 
-    private void ValidateUnsignedInteger(Long value) throws IOException {
+    private void validateUnsignedInteger(Long value) throws IOException {
         if (value < 0 || value > 4294967295L) {
             throw new IOException("Invalid unsigned integer: " + value);
         }
@@ -87,8 +87,8 @@ public class XdrUnsignedInteger extends XdrSimple<Long> {
     @Override
     protected void toValue() {
         if (getBytes().length != 4) {
-            byte[] Bytes = ByteBuffer.allocate(4).put(getBytes(), 0, 4).array();
-            setBytes(Bytes); /**reset bytes in case the enum type is in a struct or union*/
+            byte[] bytes = ByteBuffer.allocate(4).put(getBytes(), 0, 4).array();
+            setBytes(bytes); /**reset bytes in case the enum type is in a struct or union*/
         }
 
         byte[] longBytes = {(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java
index 2c6a576..4713e59 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrEnumeratedInstance.java
@@ -26,7 +26,7 @@ enum Color implements EnumType {
     YELLOW(3),
     BLUE(5);
     int value;
-    private Color(int value) {
+    Color(int value) {
         this.value = value;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
index 4e3106b..65b8e1e 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
@@ -21,7 +21,6 @@ package org.apache.kerby.xdr;
 
 import org.apache.kerby.xdr.type.AbstractXdrType;
 import org.apache.kerby.xdr.type.XdrBoolean;
-import org.apache.kerby.xdr.type.XdrEnumerated;
 import org.apache.kerby.xdr.type.XdrInteger;
 import org.apache.kerby.xdr.type.XdrString;
 import org.apache.kerby.xdr.type.XdrStructType;
@@ -34,7 +33,7 @@ class MyFile {
     UnionFileTypeSwitch fileType;
     String owner;
 
-    public MyFile(String name, UnionFileTypeSwitch fileType, String owner) {
+    MyFile(String name, UnionFileTypeSwitch fileType, String owner) {
         this.fileName = name;
         this.fileType = fileType;
         this.owner = owner;
@@ -96,7 +95,7 @@ public class XdrStructTypeInstance extends XdrStructType {
     @Override
     protected XdrStructType fieldsToValues(AbstractXdrType[] fields) {
         XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, XdrDataType.STRING, fields[0].getValue()),
-                new XdrFieldInfo(1, XdrDataType.UNION,fields[1].getValue()),
+                new XdrFieldInfo(1, XdrDataType.UNION, fields[1].getValue()),
                 new XdrFieldInfo(2, XdrDataType.STRING, fields[2].getValue())};
         return new XdrStructTypeInstance(fieldInfos);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java
index 2fba220..ca9d86f 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeTest.java
@@ -32,8 +32,8 @@ public class XdrStructTypeTest {
     @Test
     public void testEncoding() throws IOException {
         MyFile file = new MyFile("sillyprog", new UnionFileTypeSwitch(FileKind.EXEC), "john");
-        testEncodingWith(file, "0x00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00 00 00 00 02 " +
-                "00 00 00 04 6c 69 73 70 00 00 00 04 6a 6f 68 6e");
+        testEncodingWith(file, "0x00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00 00 00 00 02 "
+                + "00 00 00 04 6c 69 73 70 00 00 00 04 6a 6f 68 6e");
     }
 
     private void testEncodingWith(MyFile value, String expectedEncoding) throws IOException {
@@ -55,8 +55,8 @@ public class XdrStructTypeTest {
     @Test
     public void testDecoding() throws IOException {
         MyFile file = new MyFile("sillyprog", new UnionFileTypeSwitch(FileKind.EXEC), "john");
-        testDecodingWith(file, "0x00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00 00 00 00 02 " +
-                "00 00 00 04 6c 69 73 70 00 00 00 04 6a 6f 68 6e");
+        testDecodingWith(file, "0x00 00 00 09 73 69 6c 6c 79 70 72 6f 67 00 00 00 00 00 00 02 "
+                + "00 00 00 04 6c 69 73 70 00 00 00 04 6a 6f 68 6e");
     }
 
     private void testDecodingWith(MyFile expectedValue, String content) throws IOException {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java
index 6f86ad9..3adbfdc 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionInstance.java
@@ -44,11 +44,11 @@ enum FileKind implements EnumType {
 
 class FileKindEnumeratedInstance extends XdrEnumerated<FileKind> {
 
-    public FileKindEnumeratedInstance() {
+    FileKindEnumeratedInstance() {
         super(null);
     }
 
-    public FileKindEnumeratedInstance(FileKind value) {
+    FileKindEnumeratedInstance(FileKind value) {
         super(value);
     }
     @Override
@@ -61,7 +61,7 @@ class FileKindEnumeratedInstance extends XdrEnumerated<FileKind> {
 class UnionFileTypeSwitch {
     FileKind fileKind;
     Object arm;
-    public UnionFileTypeSwitch(FileKind fileKind) {
+    UnionFileTypeSwitch(FileKind fileKind) {
         this.fileKind = fileKind;
         switch (fileKind) {
             case TEXT:
@@ -105,7 +105,7 @@ class UnionFileTypeSwitch {
     }
 }
 
-public class XdrUnionInstance extends XdrUnion{
+public class XdrUnionInstance extends XdrUnion {
 
     public XdrUnionInstance() {
         super(XdrDataType.UNION);
@@ -156,7 +156,7 @@ public class XdrUnionInstance extends XdrUnion{
     @Override
     protected XdrUnion fieldsToValues(AbstractXdrType[] fields) {
         XdrFieldInfo[] fieldInfos = {new XdrFieldInfo(0, XdrDataType.ENUM, fields[0].getValue()),
-                new XdrFieldInfo(1, XdrDataType.STRING,fields[1].getValue())};
+                new XdrFieldInfo(1, XdrDataType.STRING, fields[1].getValue())};
         return new XdrUnionInstance(fieldInfos);
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java
index ae8ee6e..31883ee 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrUnionTest.java
@@ -49,7 +49,7 @@ public class XdrUnionTest {
     @Test
     public void testDecoding() throws IOException {
         UnionFileTypeSwitch fileType = new UnionFileTypeSwitch(FileKind.EXEC);
-        testEncodingWith(fileType, "0x00 00 00 02 00 00 00 04 6c 69 73 70");
+        testDecodingWith(fileType, "0x00 00 00 02 00 00 00 04 6c 69 73 70");
     }
 
     private void testDecodingWith(UnionFileTypeSwitch expectedValue, String content) throws IOException {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
----------------------------------------------------------------------
diff --git a/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java b/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
index d60e942..79cc46a 100644
--- a/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
+++ b/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
@@ -22,7 +22,6 @@ package org.apache.kerby.kerberos.kdc;
 import org.apache.kerby.kerberos.kdc.impl.NettyKdcServerImpl;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.local.LocalKadmin;
-import org.apache.kerby.kerberos.kerb.admin.kadmin.local.LocalKadmin;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.local.LocalKadminImpl;
 import org.apache.kerby.kerberos.kerb.server.KdcServer;
 import org.apache.kerby.util.OSUtil;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerConfigKey.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerConfigKey.java b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerConfigKey.java
index 9fc506c..8db6b35 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerConfigKey.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerConfigKey.java
@@ -36,11 +36,11 @@ public enum AdminServerConfigKey implements ConfigKey {
 
     private Object defaultValue;
 
-    private AdminServerConfigKey() {
+    AdminServerConfigKey() {
         this.defaultValue = null;
     }
 
-    private AdminServerConfigKey(Object defaultValue) {
+    AdminServerConfigKey(Object defaultValue) {
         this.defaultValue = defaultValue;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
index 9ea53c9..f9235ae 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/AdminServerHandler.java
@@ -44,6 +44,7 @@ public class AdminServerHandler {
      */
     public AdminServerHandler(AdminServerContext adminServerContext) {
         this.adminServerContext = adminServerContext;
+        LOG.info("Admin realm: " + this.adminServerContext.getAdminRealm());
     }
 
     /**
@@ -58,20 +59,22 @@ public class AdminServerHandler {
                                     InetAddress remoteAddress) throws KrbException, IOException {
         AdminMessage requestMessage = KadminCode.decodeMessage(receivedMessage);
         System.out.println("receive message type: " + requestMessage.getAdminMessageType());
-        String receiveMsg = new String (requestMessage.getMessageBuffer().array());
+        String receiveMsg = new String(requestMessage.getMessageBuffer().array());
         System.out.println("server handleMessage: " + receiveMsg);
         String[] principal = receiveMsg.split("@");
         System.out.println("clientName: " + principal[0]);
         System.out.println("realm: " + principal[1]);
 
         /**Add principal to backend here*/
-        //LocalKadmin localKadmin = new LocalKadminImpl(adminServerContext.getAdminServerSetting().getAdminServerConfig(),
+        //LocalKadmin localKadmin = new LocalKadminImpl(adminServerContext.getAdminServerSetting()
+        // .getAdminServerConfig(),
          //       adminServerContext.getAdminServerSetting().getBackendConfig());
         //localKadmin.addPrincipal(principal[0]);
 
         String message = "add principal of " + principal[0];
-        AdminMessage replyMeesage = new AddPrincipalRep(ByteBuffer.wrap(message.getBytes()));
-        ByteBuffer responseMessage = KadminCode.encodeMessage(replyMeesage);
+        AdminMessage replyMessage = new AddPrincipalRep();
+        replyMessage.setMessageBuffer(ByteBuffer.wrap(message.getBytes()));
+        ByteBuffer responseMessage = KadminCode.encodeMessage(replyMessage);
 
         return responseMessage;
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/impl/DefaultAdminServerHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/impl/DefaultAdminServerHandler.java b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/impl/DefaultAdminServerHandler.java
index 1e230ce..e97009e 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/impl/DefaultAdminServerHandler.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kadmin/impl/DefaultAdminServerHandler.java
@@ -21,7 +21,6 @@ package org.apache.kerby.kerberos.kerb.admin.server.kadmin.impl;
 
 import org.apache.kerby.kerberos.kerb.admin.server.kadmin.AdminServerContext;
 import org.apache.kerby.kerberos.kerb.admin.server.kadmin.AdminServerHandler;
-import org.apache.kerby.kerberos.kerb.transport.KrbTcpTransport;
 import org.apache.kerby.kerberos.kerb.transport.KrbTransport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,7 +60,6 @@ public class DefaultAdminServerHandler extends AdminServerHandler implements Run
 
     protected void handleMessage(ByteBuffer message) {
         InetAddress clientAddress = transport.getRemoteAddress();
-        boolean isTcp = transport instanceof KrbTcpTransport;
 
         try {
             ByteBuffer adminResponse = handleMessage(message, clientAddress);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServer.java b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServer.java
index e6bf9a8..f473c1d 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServer.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServer.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.admin.server.kpasswd;
 
 import org.apache.kerby.KOptions;
 import org.apache.kerby.kerberos.kerb.KrbException;
+import org.apache.kerby.kerberos.kerb.admin.server.kpasswd.impl.DefaultInternalPasswdServerImpl;
 import org.apache.kerby.kerberos.kerb.admin.server.kpasswd.impl.InternalPasswdServer;
 import org.apache.kerby.kerberos.kerb.identity.backend.BackendConfig;
 import org.apache.kerby.kerberos.kerb.identity.backend.IdentityBackend;
@@ -106,7 +107,9 @@ public class PasswdServer {
      * @param passwdHost The passwd host
      */
     public void setPasswdHost(String passwdHost) {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.ADMIN_HOST, passwdHost);
+        startupOptions.add(
+                PasswdServerOption.ADMIN_HOST,
+                passwdHost);
     }
 
     /**
@@ -114,7 +117,9 @@ public class PasswdServer {
      * @param passwdPort The passwd port
      */
     public void setPasswdServerPort(int passwdPort) {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.ADMIN_PORT, passwdPort);
+        startupOptions.add(
+                PasswdServerOption.ADMIN_PORT,
+                passwdPort);
     }
 
     /**
@@ -122,7 +127,9 @@ public class PasswdServer {
      * @param passwdTcpPort The passwd tcp port
      */
     public void setPasswdTcpPort(int passwdTcpPort) {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.ADMIN_TCP_PORT, passwdTcpPort);
+        startupOptions.add(
+                PasswdServerOption.ADMIN_TCP_PORT,
+                passwdTcpPort);
     }
 
     /**
@@ -130,7 +137,9 @@ public class PasswdServer {
      * @param allowUdp true if allow udp
      */
     public void setAllowUdp(boolean allowUdp) {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.ALLOW_UDP, allowUdp);
+        startupOptions.add(
+                PasswdServerOption.ALLOW_UDP,
+                allowUdp);
     }
 
     /**
@@ -138,14 +147,18 @@ public class PasswdServer {
      * @param allowTcp true if allow tcp
      */
     public void setAllowTcp(boolean allowTcp) {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.ALLOW_TCP, allowTcp);
+        startupOptions.add(
+                PasswdServerOption.ALLOW_TCP,
+                allowTcp);
     }
     /**
      * Set Passwd udp port. Only makes sense when allowUdp is set.
      * @param passwdUdpPort The passwd udp port
      */
     public void setPasswdUdpPort(int passwdUdpPort) {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.ADMIN_UDP_PORT, passwdUdpPort);
+        startupOptions.add(
+                PasswdServerOption.ADMIN_UDP_PORT,
+                passwdUdpPort);
     }
 
     /**
@@ -153,14 +166,17 @@ public class PasswdServer {
      * @param workDir The work dir
      */
     public void setWorkDir(File workDir) {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.WORK_DIR, workDir);
+        startupOptions.add(
+                PasswdServerOption.WORK_DIR,
+                workDir);
     }
 
     /**
      * Allow to debug so have more logs.
      */
     public void enableDebug() {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.ENABLE_DEBUG);
+        startupOptions.add(
+                PasswdServerOption.ENABLE_DEBUG);
     }
 
     /**
@@ -169,14 +185,16 @@ public class PasswdServer {
      * @param innerPasswdServerImpl The inner passwd implementation
      */
     public void setInnerPasswdServerImpl(InternalPasswdServer innerPasswdServerImpl) {
-        startupOptions.add(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.INNER_ADMIN_IMPL, innerPasswdServerImpl);
+        startupOptions.add(
+                PasswdServerOption.INNER_ADMIN_IMPL,
+                innerPasswdServerImpl);
     }
 
     /**
      * Get Passwd setting from startup options and configs.
      * @return setting
      */
-    public org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerSetting getPasswdServerSetting() {
+    public PasswdServerSetting getPasswdServerSetting() {
         return passwdServerSetting;
     }
 
@@ -214,12 +232,12 @@ public class PasswdServer {
      * @throws KrbException e.
      */
     public void init() throws KrbException {
-        if (startupOptions.contains(org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.INNER_ADMIN_IMPL)) {
+        if (startupOptions.contains(PasswdServerOption.INNER_ADMIN_IMPL)) {
             innerPasswdServer = (InternalPasswdServer) startupOptions.getOptionValue(
-                org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerOption.INNER_ADMIN_IMPL);
+                PasswdServerOption.INNER_ADMIN_IMPL);
         } else {
             innerPasswdServer =
-                new org.apache.kerby.kerberos.kerb.admin.server.kpasswd.impl.DefaultInternalPasswdServerImpl(passwdServerSetting);
+                new DefaultInternalPasswdServerImpl(passwdServerSetting);
         }
 
         innerPasswdServer.init();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerConfigKey.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerConfigKey.java b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerConfigKey.java
index 1d5f386..8f7651e 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerConfigKey.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerConfigKey.java
@@ -36,11 +36,11 @@ public enum PasswdServerConfigKey implements ConfigKey {
 
     private Object defaultValue;
 
-    private PasswdServerConfigKey() {
+    PasswdServerConfigKey() {
         this.defaultValue = null;
     }
 
-    private PasswdServerConfigKey(Object defaultValue) {
+    PasswdServerConfigKey(Object defaultValue) {
         this.defaultValue = defaultValue;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerHandler.java b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerHandler.java
index 78edd5c..aa7ba55 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerHandler.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/PasswdServerHandler.java
@@ -40,6 +40,7 @@ public class PasswdServerHandler {
      */
     public PasswdServerHandler(PasswdServerContext passwdServerContext) {
         this.passwdServerContext = passwdServerContext;
+        LOG.info("Passwd contex realm:" + this.passwdServerContext.getPasswdRealm());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/impl/DefaultPasswdServerHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/impl/DefaultPasswdServerHandler.java b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/impl/DefaultPasswdServerHandler.java
index b62a35f..f9bd6ce 100644
--- a/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/impl/DefaultPasswdServerHandler.java
+++ b/kerby-kerb/kerb-admin-server/src/main/java/org/apache/kerby/kerberos/kerb/admin/server/kpasswd/impl/DefaultPasswdServerHandler.java
@@ -21,7 +21,6 @@ package org.apache.kerby.kerberos.kerb.admin.server.kpasswd.impl;
 
 import org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerContext;
 import org.apache.kerby.kerberos.kerb.admin.server.kpasswd.PasswdServerHandler;
-import org.apache.kerby.kerberos.kerb.transport.KrbTcpTransport;
 import org.apache.kerby.kerberos.kerb.transport.KrbTransport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,7 +60,6 @@ public class DefaultPasswdServerHandler extends PasswdServerHandler implements R
 
     protected void handleMessage(ByteBuffer message) {
         InetAddress clientAddress = transport.getRemoteAddress();
-        boolean isTcp = transport instanceof KrbTcpTransport;
 
         try {
             ByteBuffer krbResponse = handleMessage(message, clientAddress);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin-server/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminServerTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin-server/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminServerTest.java b/kerby-kerb/kerb-admin-server/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminServerTest.java
index dea13f6..520aa9c 100644
--- a/kerby-kerb/kerb-admin-server/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminServerTest.java
+++ b/kerby-kerb/kerb-admin-server/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminServerTest.java
@@ -22,16 +22,6 @@ package org.apache.kerby.kerberos.kerb.admin.admin;
 
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.server.kadmin.AdminServer;
-import org.apache.kerby.util.NetworkUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.nio.ByteBuffer;
-import java.nio.channels.SocketChannel;
 
 public class AdminServerTest {
     public static void main(String[] args) throws KrbException {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminClient.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminClient.java
index f2f309c..ab94349 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminClient.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminClient.java
@@ -22,10 +22,8 @@ package org.apache.kerby.kerberos.kerb.admin.kadmin.remote;
 import org.apache.kerby.KOptions;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.Kadmin;
-import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.impl.InternalAdminClient;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.impl.DefaultInternalAdminClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.impl.InternalAdminClient;
 
 import java.io.File;
 
@@ -33,7 +31,6 @@ import java.io.File;
  * A Krb client API for applications to interact with KDC
  */
 public class AdminClient {
-    private static final Logger LOG = LoggerFactory.getLogger(AdminClient.class);
 
     private final AdminConfig adminConfig;
     private final KOptions commonOptions;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminConfigKey.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminConfigKey.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminConfigKey.java
index fa4af61..ccae0df 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminConfigKey.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminConfigKey.java
@@ -35,11 +35,11 @@ public enum AdminConfigKey implements ConfigKey {
 
     private Object defaultValue;
 
-    private AdminConfigKey() {
+    AdminConfigKey() {
         this.defaultValue = null;
     }
 
-    private AdminConfigKey(Object defaultValue) {
+    AdminConfigKey(Object defaultValue) {
         this.defaultValue = defaultValue;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminHandler.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminHandler.java
index faa81e2..dcd9eee 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminHandler.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/AdminHandler.java
@@ -19,22 +19,18 @@
  */
 package org.apache.kerby.kerberos.kerb.admin.kadmin.remote;
 
-import org.apache.kerby.kerberos.kerb.admin.tool.KadminCode;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.request.AdminRequest;
-import org.apache.kerby.kerberos.kerb.admin.tool.AdminReq;
 import org.apache.kerby.kerberos.kerb.admin.tool.AdminMessage;
 import org.apache.kerby.kerberos.kerb.admin.tool.AdminMessageType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.kerby.kerberos.kerb.admin.tool.AdminReq;
+import org.apache.kerby.kerberos.kerb.admin.tool.KadminCode;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
 public abstract class AdminHandler {
 
-    private static final Logger LOG = LoggerFactory.getLogger(AdminHandler.class);
-
     /**
      * Init with krbcontext.
      *
@@ -80,8 +76,8 @@ public abstract class AdminHandler {
             throw new KrbException("Kadmin decoding message failed", e);
         }
         AdminMessageType messageType = replyMessage.getAdminMessageType();
-        if (messageType == AdminMessageType.AD_REP &&
-                adminRequest.getAdminReq().getAdminMessageType() == AdminMessageType.AD_REQ) {
+        if (messageType == AdminMessageType.AD_REP
+                && adminRequest.getAdminReq().getAdminMessageType() == AdminMessageType.AD_REQ) {
             String receiveMsg = new String(replyMessage.getMessageBuffer().array());
             System.out.println("Admin receive message success: " + receiveMsg);
         } else {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/AbstractInternalAdminClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/AbstractInternalAdminClient.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/AbstractInternalAdminClient.java
index 0123488..1f1635f 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/AbstractInternalAdminClient.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/AbstractInternalAdminClient.java
@@ -22,7 +22,6 @@ package org.apache.kerby.kerberos.kerb.admin.kadmin.remote.impl;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminContext;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminSetting;
-import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.request.AdminRequest;
 
 /**
  * A krb client API for applications to interact with KDC

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/DefaultInternalAdminClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/DefaultInternalAdminClient.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/DefaultInternalAdminClient.java
index 109570f..2d40b6f 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/DefaultInternalAdminClient.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/DefaultInternalAdminClient.java
@@ -23,7 +23,6 @@ import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminHandler;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminSetting;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminUtil;
-import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.request.AdminRequest;
 import org.apache.kerby.kerberos.kerb.transport.KrbNetwork;
 import org.apache.kerby.kerberos.kerb.transport.KrbTransport;
 import org.apache.kerby.kerberos.kerb.transport.TransportPair;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/InternalAdminClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/InternalAdminClient.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/InternalAdminClient.java
index b862703..47bfd3d 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/InternalAdminClient.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/impl/InternalAdminClient.java
@@ -21,8 +21,6 @@ package org.apache.kerby.kerberos.kerb.admin.kadmin.remote.impl;
 
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminSetting;
-import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.request.AdminRequest;
-import org.apache.kerby.kerberos.kerb.transport.KrbTransport;
 
 /**
  * An internal krb client interface.

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/request/AddPrincipalRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/request/AddPrincipalRequest.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/request/AddPrincipalRequest.java
index 4e70eea..0198b62 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/request/AddPrincipalRequest.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kadmin/remote/request/AddPrincipalRequest.java
@@ -23,8 +23,6 @@ import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminContext;
 import org.apache.kerby.kerberos.kerb.admin.tool.AddPrincipalReq;
 
-import java.nio.ByteBuffer;
-
 /**
  * AddPrincipal request
  */

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdClient.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdClient.java
index aa91ce1..c3da724 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdClient.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdClient.java
@@ -21,12 +21,9 @@ package org.apache.kerby.kerberos.kerb.admin.kpasswd;
 
 import org.apache.kerby.KOptions;
 import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminClient;
+import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminOption;
 import org.apache.kerby.kerberos.kerb.admin.kpasswd.impl.DefaultInternalPasswdClient;
 import org.apache.kerby.kerberos.kerb.admin.kpasswd.impl.InternalPasswdClient;
-import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminOption;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 
@@ -34,7 +31,6 @@ import java.io.File;
  * A Krb client API for applications to interact with KDC
  */
 public class PasswdClient {
-    private static final Logger LOG = LoggerFactory.getLogger(AdminClient.class);
 
     private final PasswdConfig passwdConfig;
     private final KOptions commonOptions;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdConfigKey.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdConfigKey.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdConfigKey.java
index c01284b..8ea2a83 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdConfigKey.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdConfigKey.java
@@ -35,11 +35,11 @@ public enum PasswdConfigKey implements ConfigKey {
 
     private Object defaultValue;
 
-    private PasswdConfigKey() {
+    PasswdConfigKey() {
         this.defaultValue = null;
     }
 
-    private PasswdConfigKey(Object defaultValue) {
+    PasswdConfigKey(Object defaultValue) {
         this.defaultValue = defaultValue;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdHandler.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdHandler.java
index bb6788b..7286273 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdHandler.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/PasswdHandler.java
@@ -21,16 +21,12 @@ package org.apache.kerby.kerberos.kerb.admin.kpasswd;
 
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kpasswd.request.PasswdRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
 public abstract class PasswdHandler {
 
-    private static final Logger LOG = LoggerFactory.getLogger(PasswdHandler.class);
-
     /**
      * Init with krbcontext.
      *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/impl/DefaultInternalPasswdClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/impl/DefaultInternalPasswdClient.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/impl/DefaultInternalPasswdClient.java
index a4e70d7..561de7c 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/impl/DefaultInternalPasswdClient.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/kpasswd/impl/DefaultInternalPasswdClient.java
@@ -57,6 +57,8 @@ public class DefaultInternalPasswdClient extends AbstractInternalPasswdClient {
             transport = network.connect(tpair);
         } catch (IOException e) {
             throw new KrbException("Failed to create transport", e);
+        } finally {
+            transport.release();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/tool/DeletePrincipalReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/tool/DeletePrincipalReq.java b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/tool/DeletePrincipalReq.java
index 6affec4..32f535c 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/tool/DeletePrincipalReq.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/tool/DeletePrincipalReq.java
@@ -23,7 +23,7 @@ package org.apache.kerby.kerberos.kerb.admin.tool;
 /**
  * Delete principal request, to general admin message
  */
-public class DeletePrincipalReq extends AdminReq{
+public class DeletePrincipalReq extends AdminReq {
     public DeletePrincipalReq() {
         super(AdminMessageType.DE_REQ);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-admin/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminTest.java b/kerby-kerb/kerb-admin/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminTest.java
index 6a5f2f3..7e46620 100644
--- a/kerby-kerb/kerb-admin/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminTest.java
+++ b/kerby-kerb/kerb-admin/src/test/java/org/apache/kerby/kerberos/kerb/admin/admin/AdminTest.java
@@ -21,26 +21,19 @@ package org.apache.kerby.kerberos.kerb.admin.admin;
 
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.admin.kadmin.remote.AdminClient;
-import org.apache.kerby.util.NetworkUtil;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 
-import java.net.InetSocketAddress;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.SocketChannel;
-
 public class AdminTest {
-    private final String KDC_REALM = "TEST.COM";
+    private final String kdcRealm = "TEST.COM";
     private final String clientPrincipalName = "alice";
     private final String clientPrincipal =
-            clientPrincipalName + "@" + KDC_REALM;
+            clientPrincipalName + "@" + kdcRealm;
     private AdminClient adminClient;
 
     @Test
     public void testAdminClient() throws KrbException {
         adminClient = new AdminClient();
-        adminClient.setAdminRealm(KDC_REALM);
+        adminClient.setAdminRealm(kdcRealm);
         adminClient.setAllowTcp(true);
         adminClient.setAllowUdp(false);
         adminClient.setAdminTcpPort(65417);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6b83c750/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/ServerSetting.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/ServerSetting.java b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/ServerSetting.java
index 3c369b1..7044693 100644
--- a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/ServerSetting.java
+++ b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/ServerSetting.java
@@ -27,9 +27,9 @@ import org.apache.kerby.kerberos.kerb.identity.backend.BackendConfig;
  * LocalKadminImpl (KdcSetting or AdminServerSetting).
  */
 public interface ServerSetting {
-    public String getKdcRealm();
+    String getKdcRealm();
 
-    public KdcConfig getKdcConfig();
+    KdcConfig getKdcConfig();
 
-    public BackendConfig getBackendConfig();
+    BackendConfig getBackendConfig();
 }


Mime
View raw message