summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-04-05 15:08:18 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-04-09 10:22:03 -0500
commit3f24e55923fc986af4c6a08b2b8d45704a905627 (patch)
tree716415853b5676b801f6707634305b59b9af8603 /base/common/src/com/netscape/certsrv
parent7c7b9d023cd466c1771068badc020dab36beb553 (diff)
downloadpki-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')
-rw-r--r--base/common/src/com/netscape/certsrv/acls/ACL.java4
-rw-r--r--base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java8
-rw-r--r--base/common/src/com/netscape/certsrv/base/MetaInfo.java2
-rw-r--r--base/common/src/com/netscape/certsrv/base/Nonces.java22
-rw-r--r--base/common/src/com/netscape/certsrv/base/SessionContext.java9
-rw-r--r--base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java2
-rw-r--r--base/common/src/com/netscape/certsrv/pattern/Pattern.java2
-rw-r--r--base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java5
-rw-r--r--base/common/src/com/netscape/certsrv/property/PropertySet.java2
-rw-r--r--base/common/src/com/netscape/certsrv/request/ARequestNotifier.java16
-rw-r--r--base/common/src/com/netscape/certsrv/request/AgentApprovals.java2
-rw-r--r--base/common/src/com/netscape/certsrv/template/ArgList.java2
-rw-r--r--base/common/src/com/netscape/certsrv/template/ArgSet.java2
13 files changed, 37 insertions, 41 deletions
diff --git a/base/common/src/com/netscape/certsrv/acls/ACL.java b/base/common/src/com/netscape/certsrv/acls/ACL.java
index ea962975c..086b26015 100644
--- a/base/common/src/com/netscape/certsrv/acls/ACL.java
+++ b/base/common/src/com/netscape/certsrv/acls/ACL.java
@@ -155,7 +155,7 @@ public class ACL implements IACL, java.io.Serializable {
Enumeration<ACLEntry> e = entries();
for (; e.hasMoreElements();) {
- ACLEntry entry = (ACLEntry) e.nextElement();
+ ACLEntry entry = e.nextElement();
entries += entry.toString();
if (e.hasMoreElements())
@@ -180,7 +180,7 @@ public class ACL implements IACL, java.io.Serializable {
* @return true if it's one of the "rights"; false otherwise
*/
public boolean checkRight(String permission) {
- return (mRights.contains((Object) permission));
+ return mRights.contains(permission);
}
/**
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());
diff --git a/base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java b/base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java
index 036840633..5b6c5f334 100644
--- a/base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java
+++ b/base/common/src/com/netscape/certsrv/pattern/AttrSetCollection.java
@@ -48,7 +48,7 @@ public class AttrSetCollection extends Hashtable<String, IAttrSet> {
* @return attribute set
*/
public IAttrSet getAttrSet(String name) {
- return (IAttrSet) get(name);
+ return get(name);
}
/**
diff --git a/base/common/src/com/netscape/certsrv/pattern/Pattern.java b/base/common/src/com/netscape/certsrv/pattern/Pattern.java
index 3d33bcae8..496b1d4c3 100644
--- a/base/common/src/com/netscape/certsrv/pattern/Pattern.java
+++ b/base/common/src/com/netscape/certsrv/pattern/Pattern.java
@@ -70,7 +70,7 @@ public class Pattern {
Enumeration<String> keys = attrSetCollection.keys();
while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
+ String key = keys.nextElement();
Pattern p = new Pattern(temp);
temp = p.substitute(key,
diff --git a/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java b/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java
index 5c192e9cd..38379c283 100644
--- a/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java
+++ b/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java
@@ -43,7 +43,7 @@ public class CertInfoProfile {
mProfileSetIDMapping = config.getString("profileSetIDMapping");
StringTokenizer st = new StringTokenizer(config.getString("list"), ",");
while (st.hasMoreTokens()) {
- String id = (String) st.nextToken();
+ String id = st.nextToken();
String c = config.getString(id + ".default.class");
try {
/* load defaults */
@@ -89,8 +89,7 @@ public class CertInfoProfile {
public void populate(X509CertInfo info) {
Enumeration<ICertInfoPolicyDefault> e1 = mDefaults.elements();
while (e1.hasMoreElements()) {
- ICertInfoPolicyDefault def =
- (ICertInfoPolicyDefault) e1.nextElement();
+ ICertInfoPolicyDefault def = e1.nextElement();
try {
def.populate(null /* request */, info);
} catch (Exception e) {
diff --git a/base/common/src/com/netscape/certsrv/property/PropertySet.java b/base/common/src/com/netscape/certsrv/property/PropertySet.java
index dc839deb1..3ffedffcb 100644
--- a/base/common/src/com/netscape/certsrv/property/PropertySet.java
+++ b/base/common/src/com/netscape/certsrv/property/PropertySet.java
@@ -39,7 +39,7 @@ public class PropertySet {
}
public IDescriptor getDescriptor(String name) {
- return (IDescriptor) mProperties.get(name);
+ return mProperties.get(name);
}
public void remove(String name) {
diff --git a/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java b/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
index 98338601a..ac57c1313 100644
--- a/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
+++ b/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java
@@ -161,7 +161,7 @@ public class ARequestNotifier implements IRequestNotifier {
* @return listener
*/
public IRequestListener getListener(String name) {
- return (IRequestListener) mListeners.get(name);
+ return mListeners.get(name);
}
/**
@@ -205,7 +205,7 @@ public class ARequestNotifier implements IRequestNotifier {
CMS.debug("getRequest mRequests=" + mRequests.size() + " mSearchForRequests=" + mSearchForRequests);
if (mSearchForRequests && mRequests.size() == 1) {
- id = (String) mRequests.elementAt(0);
+ id = mRequests.elementAt(0);
if (mCA != null && mRequestQueue == null)
mRequestQueue = mCA.getRequestQueue();
if (id != null && mRequestQueue != null) {
@@ -258,7 +258,7 @@ public class ARequestNotifier implements IRequestNotifier {
}
}
if (mRequests.size() > 0) {
- id = (String) mRequests.elementAt(0);
+ id = mRequests.elementAt(0);
if (id != null) {
CMS.debug("getRequest getting request: " + id);
if (mCA != null && mRequestQueue == null)
@@ -332,7 +332,7 @@ public class ARequestNotifier implements IRequestNotifier {
Enumeration<IRequestListener> listeners = mListeners.elements();
if (listeners != null && r != null) {
while (listeners.hasMoreElements()) {
- IRequestListener l = (IRequestListener) listeners.nextElement();
+ IRequestListener l = listeners.nextElement();
CMS.debug("RunListeners: IRequestListener = " + l.getClass().getName());
l.accept(r);
}
@@ -428,7 +428,7 @@ public class ARequestNotifier implements IRequestNotifier {
" requests by adding request " + r.getRequestId().toString());
if (morePublishingThreads()) {
try {
- Thread notifierThread = new Thread(new RunListeners((IRequestNotifier) this));
+ Thread notifierThread = new Thread(new RunListeners(this));
if (notifierThread != null) {
mNotifierThreads.addElement(notifierThread);
CMS.debug("Number of publishing threads: " + mNotifierThreads.size());
@@ -462,7 +462,7 @@ public class ARequestNotifier implements IRequestNotifier {
if (morePublishingThreads()) {
mSearchForRequests = true;
try {
- Thread notifierThread = new Thread(new RunListeners((IRequestNotifier) this));
+ Thread notifierThread = new Thread(new RunListeners(this));
if (notifierThread != null) {
mNotifierThreads.addElement(notifierThread);
CMS.debug("Number of publishing threads: " + mNotifierThreads.size());
@@ -520,10 +520,10 @@ class RunListeners implements Runnable {
" " + ((mRequest != null) ? " SingleRequest" : " noSingleRequest"));
do {
if (mRequestNotifier != null)
- mRequest = (IRequest) mRequestNotifier.getRequest();
+ mRequest = mRequestNotifier.getRequest();
if (mListeners != null && mRequest != null) {
while (mListeners.hasMoreElements()) {
- IRequestListener l = (IRequestListener) mListeners.nextElement();
+ IRequestListener l = mListeners.nextElement();
CMS.debug("RunListeners: IRequestListener = " + l.getClass().getName());
l.accept(mRequest);
}
diff --git a/base/common/src/com/netscape/certsrv/request/AgentApprovals.java b/base/common/src/com/netscape/certsrv/request/AgentApprovals.java
index 2c957b6ee..cb3dd2ceb 100644
--- a/base/common/src/com/netscape/certsrv/request/AgentApprovals.java
+++ b/base/common/src/com/netscape/certsrv/request/AgentApprovals.java
@@ -113,7 +113,7 @@ public class AgentApprovals
public Vector<String> toStringVector() {
Vector<String> retval = new Vector<String>(mVector.size());
for (int i = 0; i < mVector.size(); i++) {
- AgentApproval a = (AgentApproval) mVector.elementAt(i);
+ AgentApproval a = mVector.elementAt(i);
retval.add(a.getDate().getTime() + ";" + a.getUserName());
}
diff --git a/base/common/src/com/netscape/certsrv/template/ArgList.java b/base/common/src/com/netscape/certsrv/template/ArgList.java
index 03b2b5645..34d931c84 100644
--- a/base/common/src/com/netscape/certsrv/template/ArgList.java
+++ b/base/common/src/com/netscape/certsrv/template/ArgList.java
@@ -63,6 +63,6 @@ public class ArgList implements IArgValue {
* @return argument
*/
public IArgValue get(int pos) {
- return (IArgValue) mList.elementAt(pos);
+ return mList.elementAt(pos);
}
}
diff --git a/base/common/src/com/netscape/certsrv/template/ArgSet.java b/base/common/src/com/netscape/certsrv/template/ArgSet.java
index 8f3ff8b04..d65e6ad56 100644
--- a/base/common/src/com/netscape/certsrv/template/ArgSet.java
+++ b/base/common/src/com/netscape/certsrv/template/ArgSet.java
@@ -69,6 +69,6 @@ public class ArgSet implements IArgValue {
* @return argument value
*/
public IArgValue get(String name) {
- return (IArgValue) mArgs.get(name);
+ return mArgs.get(name);
}
}