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-357 Fix findbugs Problems for kerby-backend. Contributed by Yaning.
Date Wed, 15 Jul 2015 07:47:42 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 02ccc7354 -> 57e0f302b


DIRKRB-357 Fix findbugs Problems for kerby-backend. Contributed by Yaning.


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

Branch: refs/heads/master
Commit: 57e0f302be012fe22dbb2a5a4e3291794c2ea6f0
Parents: 02ccc73
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Wed Jul 15 15:52:59 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Wed Jul 15 15:52:59 2015 +0800

----------------------------------------------------------------------
 .../typeAdapter/KerberosTimeAdapter.java        |  2 +-
 .../identitybackend/LdapIdentityBackend.java    | 70 ++++++++++----------
 .../java/org/apache/kerby/MavibotBackend.java   |  4 +-
 .../ZookeeperIdentityBackend.java               | 10 +--
 4 files changed, 44 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/57e0f302/kerby-backend/json-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/typeAdapter/KerberosTimeAdapter.java
----------------------------------------------------------------------
diff --git a/kerby-backend/json-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/typeAdapter/KerberosTimeAdapter.java
b/kerby-backend/json-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/typeAdapter/KerberosTimeAdapter.java
index 45207c7..7c4b6eb 100644
--- a/kerby-backend/json-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/typeAdapter/KerberosTimeAdapter.java
+++ b/kerby-backend/json-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/typeAdapter/KerberosTimeAdapter.java
@@ -38,7 +38,7 @@ public class KerberosTimeAdapter implements JsonSerializer<KerberosTime>,
                                     JsonDeserializationContext jsonDeserializationContext)
             throws JsonParseException {
         String timeString = jsonElement.getAsString();
-        long time = Long.valueOf(timeString);
+        long time = Long.parseLong(timeString);
         return new KerberosTime(time);
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/57e0f302/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
----------------------------------------------------------------------
diff --git a/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
b/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
index a49dc61..2cfe374 100644
--- a/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
+++ b/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
@@ -147,6 +147,41 @@ public class LdapIdentityBackend extends AbstractIdentityBackend {
     }
 
     /**
+     * An inner class, used to encapsulate key information
+     */
+    static class KeysInfo {
+        private String[] etypes;
+        private byte[][] keys;
+        private String[] kvnos;
+
+        public KeysInfo(KrbIdentity identity) {
+            Map<EncryptionType, EncryptionKey> keymap = identity.getKeys();
+            this.etypes = new String[keymap.size()];
+            this.keys = new byte[keymap.size()][];
+            this.kvnos = new String[keymap.size()];
+            int i = 0;
+            for (Map.Entry<EncryptionType, EncryptionKey> entryKey : keymap.entrySet())
{
+                etypes[i] = entryKey.getKey().getValue() + "";
+                keys[i] = entryKey.getValue().encode();
+                kvnos[i] = entryKey.getValue().getKvno() + "";
+                i++;
+            }
+        }
+
+        public String[] getEtypes() {
+            return etypes;
+        }
+
+        public byte[][] getKeys() {
+            return keys;
+        }
+
+        public String[] getKvnos() {
+            return kvnos;
+        }
+    }
+
+    /**
      * {@inheritDoc}
      */
     @Override
@@ -306,39 +341,4 @@ public class LdapIdentityBackend extends AbstractIdentityBackend {
         }
         return identityNames;
     }
-
-    /**
-     * An inner class, used to encapsulate key information
-     */
-    class KeysInfo {
-        private String[] etypes;
-        private byte[][] keys;
-        private String[] kvnos;
-
-        public KeysInfo(KrbIdentity identity) {
-            Map<EncryptionType, EncryptionKey> keymap = identity.getKeys();
-            this.etypes = new String[keymap.size()];
-            this.keys = new byte[keymap.size()][];
-            this.kvnos = new String[keymap.size()];
-            int i = 0;
-            for (Map.Entry<EncryptionType, EncryptionKey> entryKey : keymap.entrySet())
{
-                etypes[i] = entryKey.getKey().getValue() + "";
-                keys[i] = entryKey.getValue().encode();
-                kvnos[i] = entryKey.getValue().getKvno() + "";
-                i++;
-            }
-        }
-
-        public String[] getEtypes() {
-            return etypes;
-        }
-
-        public byte[][] getKeys() {
-            return keys;
-        }
-
-        public String[] getKvnos() {
-            return kvnos;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/57e0f302/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/MavibotBackend.java
----------------------------------------------------------------------
diff --git a/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/MavibotBackend.java
b/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/MavibotBackend.java
index 941b734..f0abc7e 100644
--- a/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/MavibotBackend.java
+++ b/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/MavibotBackend.java
@@ -68,8 +68,8 @@ public class MavibotBackend extends AbstractIdentityBackend {
 
         LOG.info("Initializing the mavibot backend");
         
-        if (!location.exists()) {
-            location.mkdirs();
+        if (!location.exists() && !location.mkdirs()) {
+            throw new KrbException("Can't create location file");
         }
 
         if (location.isDirectory()) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/57e0f302/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
----------------------------------------------------------------------
diff --git a/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
b/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
index a28123a..841a653 100644
--- a/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
+++ b/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
@@ -91,8 +91,8 @@ public class ZookeeperIdentityBackend extends AbstractIdentityBackend {
         }
 
         dataFile = new File(dataDir);
-        if (!dataFile.exists()) {
-            dataFile.mkdirs();
+        if (!dataFile.exists() && !dataFile.mkdirs()) {
+            throw new KrbException("Dir file not exits");
         }
 
         String dataLogDir = getConfig().getString(ZKConfKey.DATA_LOG_DIR);
@@ -103,8 +103,10 @@ public class ZookeeperIdentityBackend extends AbstractIdentityBackend
{
         }
 
         dataLogFile = new File(dataLogDir);
-        if (!dataLogFile.exists()) {
-            dataLogFile.mkdirs();
+
+
+        if (!dataLogFile.exists() && !dataFile.mkdirs()) {
+            throw new KrbException("DataLogfile file not exits");
         }
 
         startEmbeddedZookeeper();


Mime
View raw message