diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-04-05 15:08:18 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-04-09 10:22:03 -0500 |
commit | 3f24e55923fc986af4c6a08b2b8d45704a905627 (patch) | |
tree | 716415853b5676b801f6707634305b59b9af8603 /base/common/src/com/netscape/certsrv/base | |
parent | 7c7b9d023cd466c1771068badc020dab36beb553 (diff) | |
download | pki-3f24e55923fc986af4c6a08b2b8d45704a905627.tar.gz pki-3f24e55923fc986af4c6a08b2b8d45704a905627.tar.xz pki-3f24e55923fc986af4c6a08b2b8d45704a905627.zip |
Removed unnecessary type casts.
Unnecessary type casts have been removed using Eclipse Quick Fix.
Ticket #134
Diffstat (limited to 'base/common/src/com/netscape/certsrv/base')
4 files changed, 19 insertions, 22 deletions
diff --git a/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java b/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java index a9a1e448f..63480478f 100644 --- a/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java +++ b/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java @@ -111,13 +111,13 @@ public class MetaAttributeDef { MetaAttributeDef newDef = new MetaAttributeDef(name, valueClass, oid); MetaAttributeDef oldDef; - if ((oldDef = (MetaAttributeDef) mNameToAttrDef.get(name)) != null && + if ((oldDef = mNameToAttrDef.get(name)) != null && !oldDef.equals(newDef)) { throw new IllegalArgumentException( "Attribute \'" + name + "\' is already defined"); } if (oid != null && - (oldDef = (MetaAttributeDef) mOidToAttrDef.get(oid)) != null && + (oldDef = mOidToAttrDef.get(oid)) != null && !oldDef.equals(newDef)) { throw new IllegalArgumentException( "OID \'" + oid + "\' is already in use"); @@ -162,7 +162,7 @@ public class MetaAttributeDef { * @return attribute definition or null if not found */ public static MetaAttributeDef forName(String name) { - return (MetaAttributeDef) mNameToAttrDef.get(name); + return mNameToAttrDef.get(name); } /** @@ -173,7 +173,7 @@ public class MetaAttributeDef { * @return attribute definition or null if not found */ public static MetaAttributeDef forOID(ObjectIdentifier oid) { - return (MetaAttributeDef) mOidToAttrDef.get(oid); + return mOidToAttrDef.get(oid); } /** diff --git a/base/common/src/com/netscape/certsrv/base/MetaInfo.java b/base/common/src/com/netscape/certsrv/base/MetaInfo.java index 1ad561489..64f9fe821 100644 --- a/base/common/src/com/netscape/certsrv/base/MetaInfo.java +++ b/base/common/src/com/netscape/certsrv/base/MetaInfo.java @@ -60,7 +60,7 @@ public class MetaInfo implements IAttrSet { Enumeration<String> enum1 = content.keys(); while (enum1.hasMoreElements()) { - String key = (String) enum1.nextElement(); + String key = enum1.nextElement(); sb.append(" " + key + " : " + content.get(key) + "\n"); } diff --git a/base/common/src/com/netscape/certsrv/base/Nonces.java b/base/common/src/com/netscape/certsrv/base/Nonces.java index c041ec777..c28a74fae 100644 --- a/base/common/src/com/netscape/certsrv/base/Nonces.java +++ b/base/common/src/com/netscape/certsrv/base/Nonces.java @@ -48,17 +48,17 @@ public class Nonces { long i; long k = 0; long n = nonce; - long m = (long) ((mNonceLimit / 2) + 1); + long m = (mNonceLimit / 2) + 1; for (i = 0; i < m; i++) { k = n + i; // avoid collisions - if (!mNonceList.contains((Object) k)) { + if (!mNonceList.contains(k)) { break; } k = n - i; // avoid collisions - if (!mNonceList.contains((Object) k)) { + if (!mNonceList.contains(k)) { break; } } @@ -66,9 +66,9 @@ public class Nonces { mNonceList.add(k); mNonces.put(k, cert); if (mNonceList.size() > mNonceLimit) { - n = ((Long) (mNonceList.firstElement())).longValue(); + n = mNonceList.firstElement().longValue(); mNonceList.remove(0); - mNonces.remove((Object) n); + mNonces.remove(n); } } else { // failed to resolved collision @@ -78,15 +78,15 @@ public class Nonces { } public X509Certificate getCertificate(long nonce) { - X509Certificate cert = (X509Certificate) mNonces.get(nonce); + X509Certificate cert = mNonces.get(nonce); return cert; } public X509Certificate getCertificate(int index) { X509Certificate cert = null; if (index >= 0 && index < mNonceList.size()) { - long nonce = ((Long) (mNonceList.elementAt(index))).longValue(); - cert = (X509Certificate) mNonces.get(nonce); + long nonce = mNonceList.elementAt(index).longValue(); + cert = mNonces.get(nonce); } return cert; } @@ -94,14 +94,14 @@ public class Nonces { public long getNonce(int index) { long nonce = 0; if (index >= 0 && index < mNonceList.size()) { - nonce = ((Long) (mNonceList.elementAt(index))).longValue(); + nonce = mNonceList.elementAt(index).longValue(); } return nonce; } public void removeNonce(long nonce) { - mNonceList.remove((Object) nonce); - mNonces.remove((Object) nonce); + mNonceList.remove(nonce); + mNonces.remove(nonce); } public int size() { diff --git a/base/common/src/com/netscape/certsrv/base/SessionContext.java b/base/common/src/com/netscape/certsrv/base/SessionContext.java index c3c568f77..79b75508f 100644 --- a/base/common/src/com/netscape/certsrv/base/SessionContext.java +++ b/base/common/src/com/netscape/certsrv/base/SessionContext.java @@ -125,8 +125,7 @@ public class SessionContext extends Hashtable<Object, Object> { * @return sesssion context */ public static SessionContext getContext() { - SessionContext sc = (SessionContext) mContexts.get( - Thread.currentThread()); + SessionContext sc = mContexts.get(Thread.currentThread()); if (sc == null) { sc = createContext(); @@ -142,8 +141,7 @@ public class SessionContext extends Hashtable<Object, Object> { * @return sesssion context */ public static SessionContext getExistingContext() { - SessionContext sc = (SessionContext) - mContexts.get(Thread.currentThread()); + SessionContext sc = mContexts.get(Thread.currentThread()); if (sc == null) { return null; @@ -156,8 +154,7 @@ public class SessionContext extends Hashtable<Object, Object> { * Releases the current session context. */ public static void releaseContext() { - SessionContext sc = (SessionContext) mContexts.get( - Thread.currentThread()); + SessionContext sc = mContexts.get(Thread.currentThread()); if (sc != null) { mContexts.remove(Thread.currentThread()); |