diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-02-22 01:15:56 -0600 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-13 10:53:47 -0500 |
commit | 2bd9e3b8555fddcb9f8d762988384fc1c78ef37c (patch) | |
tree | f0589a2a175eeced2e99d9b8b69c75ee0dcd8201 /pki/base | |
parent | c24c8f080f987ed63034abcedf9320e962c4c415 (diff) | |
download | pki-2bd9e3b8555fddcb9f8d762988384fc1c78ef37c.tar.gz pki-2bd9e3b8555fddcb9f8d762988384fc1c78ef37c.tar.xz pki-2bd9e3b8555fddcb9f8d762988384fc1c78ef37c.zip |
Fixed IAttrSet.getElements() implementations.
This patch fixes incorrect implementation of getElement() in
some subclasses of IAttrSet. The method is supposed return the
attribute names as an enumeration of strings.
Ticket #42
Diffstat (limited to 'pki/base')
17 files changed, 39 insertions, 111 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/authentication/AuthCredentials.java b/pki/base/common/src/com/netscape/certsrv/authentication/AuthCredentials.java index 1475683eb..5a0cdd3b8 100644 --- a/pki/base/common/src/com/netscape/certsrv/authentication/AuthCredentials.java +++ b/pki/base/common/src/com/netscape/certsrv/authentication/AuthCredentials.java @@ -61,7 +61,7 @@ public class AuthCredentials implements IAuthCredentials { * @return the authentication credential for the given name */ public Object get(String name) { - return ((Object) authCreds.get(name)); + return authCreds.get(name); } /** @@ -76,14 +76,14 @@ public class AuthCredentials implements IAuthCredentials { } /** - * Returns an enumeration of the credentials in this credential + * Returns an enumeration of the credential names in this credential * set. Use the Enumeration methods on the returned object to * fetch the elements sequentially. * - * @return an enumeration of the values in this credential set + * @return an enumeration of the names in this credential set */ - public Enumeration<Object> getElements() { - return (authCreds.elements()); + public Enumeration<String> getElements() { + return authCreds.keys(); } /** diff --git a/pki/base/common/src/com/netscape/certsrv/authorization/AuthzToken.java b/pki/base/common/src/com/netscape/certsrv/authorization/AuthzToken.java index b6e2d1446..262902e62 100644 --- a/pki/base/common/src/com/netscape/certsrv/authorization/AuthzToken.java +++ b/pki/base/common/src/com/netscape/certsrv/authorization/AuthzToken.java @@ -129,7 +129,7 @@ public class AuthzToken implements IAttrSet { * @return Enumeration of all attribute names in this AuthzToken. */ public Enumeration<String> getElements() { - return (mAttrs.keys()); + return mAttrs.keys(); } /** @@ -138,7 +138,7 @@ public class AuthzToken implements IAttrSet { * @return Enumeration of all attribute names in this AuthzToken. */ public Enumeration<Object> getVals() { - return (mAttrs.elements()); + return mAttrs.elements(); } /** @@ -149,7 +149,7 @@ public class AuthzToken implements IAttrSet { * this token. */ public String getAuthzManagerInstName() { - return ((String) mAttrs.get(TOKEN_AUTHZMGR_INST_NAME)); + return (String) mAttrs.get(TOKEN_AUTHZMGR_INST_NAME); } /** @@ -160,7 +160,7 @@ public class AuthzToken implements IAttrSet { * token. */ public String getAuthzManagerImplName() { - return ((String) mAttrs.get(TOKEN_AUTHZMGR_IMPL_NAME)); + return (String) mAttrs.get(TOKEN_AUTHZMGR_IMPL_NAME); } /** @@ -169,6 +169,6 @@ public class AuthzToken implements IAttrSet { * @return The time of authorization */ public Date getAuthzTime() { - return ((Date) mAttrs.get(TOKEN_AUTHZTIME)); + return (Date) mAttrs.get(TOKEN_AUTHZTIME); } } diff --git a/pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java b/pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java index f7567292e..e396b072a 100644 --- a/pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java +++ b/pki/base/common/src/com/netscape/certsrv/base/IAttrSet.java @@ -66,5 +66,5 @@ public interface IAttrSet extends Serializable { * * @return an enumeration of the attribute names. */ - public Enumeration<?> getElements(); + public Enumeration<String> getElements(); } diff --git a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java index 11e91fdeb..ac6534afd 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java @@ -748,7 +748,7 @@ class TempCRLIssuingPointRecord implements ICRLIssuingPointRecord { } - public Enumeration<Object> getElements() { + public Enumeration<String> getElements() { return null; } } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthCredentials.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthCredentials.java index 9d4c4f00e..69cfd9aaf 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthCredentials.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthCredentials.java @@ -83,15 +83,15 @@ public class AuthCredentials implements IAuthCredentials { } /** - * returns an enumeration of the credentials in this credential + * returns an enumeration of the credential names in this credential * set. Use the Enumeration methods on the returned object to * fetch the elements sequentially. * - * @return an enumeration of the values in this credential set + * @return an enumeration of the names in this credential set * @see java.util.Enumeration */ - public Enumeration<Object> getElements() { - return authCreds.elements(); + public Enumeration<String> getElements() { + return authCreds.keys(); } // Inserted by bskim diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/AuthCredentials.java b/pki/base/common/src/com/netscape/cms/servlet/common/AuthCredentials.java index a55406068..88369ace3 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/AuthCredentials.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/AuthCredentials.java @@ -83,15 +83,15 @@ public class AuthCredentials implements IAuthCredentials { } /** - * returns an enumeration of the credentials in this credential + * returns an enumeration of the credential names in this credential * set. Use the Enumeration methods on the returned object to * fetch the elements sequentially. * - * @return an enumeration of the values in this credential set + * @return an enumeration of the names in this credential set * @see java.util.Enumeration */ - public Enumeration<Object> getElements() { - return authCreds.elements(); + public Enumeration<String> getElements() { + return authCreds.keys(); } // Inserted by bskim diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java index 5af8e533d..a752c1e29 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java @@ -17,13 +17,9 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.ldap; -import java.util.Enumeration; -import java.util.Hashtable; import java.util.Vector; import com.netscape.certsrv.apps.CMS; -import com.netscape.certsrv.base.EBaseException; -import com.netscape.certsrv.base.IAttrSet; import com.netscape.certsrv.ldap.ELdapException; import com.netscape.certsrv.publish.ILdapExpression; import com.netscape.cmscore.util.Debug; @@ -344,35 +340,3 @@ class PredicateTokenizer { } } } - -class AttributeSet implements IAttrSet { - /** - * - */ - private static final long serialVersionUID = -3155846653754028803L; - Hashtable<String, Object> ht = new Hashtable<String, Object>(); - - public AttributeSet() { - } - - public void delete(String name) - throws EBaseException { - Object ob = ht.get(name); - - ht.remove(ob); - } - - public Object get(String name) - throws EBaseException { - return ht.get(name); - } - - public void set(String name, Object ob) - throws EBaseException { - ht.put(name, ob); - } - - public Enumeration<Object> getElements() { - return ht.elements(); - } -} diff --git a/pki/base/common/src/com/netscape/cmscore/notification/EmailResolverKeys.java b/pki/base/common/src/com/netscape/cmscore/notification/EmailResolverKeys.java index d0dedafa7..cd63841eb 100644 --- a/pki/base/common/src/com/netscape/cmscore/notification/EmailResolverKeys.java +++ b/pki/base/common/src/com/netscape/cmscore/notification/EmailResolverKeys.java @@ -80,14 +80,14 @@ public class EmailResolverKeys implements IEmailResolverKeys { } /** - * returns an enumeration of the keys in this key + * returns an enumeration of the key names in this key * set. Use the Enumeration methods on the returned object to * fetch the elements sequentially. * * @return an enumeration of the values in this key set * @see java.util.Enumeration */ - public Enumeration<Object> getElements() { - return mKeys.elements(); + public Enumeration<String> getElements() { + return mKeys.keys(); } } diff --git a/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java b/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java index 2386f6e0f..4046c789f 100644 --- a/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java +++ b/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java @@ -17,13 +17,9 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.policy; -import java.util.Enumeration; -import java.util.Hashtable; import java.util.Vector; import com.netscape.certsrv.apps.CMS; -import com.netscape.certsrv.base.EBaseException; -import com.netscape.certsrv.base.IAttrSet; import com.netscape.certsrv.policy.EPolicyException; import com.netscape.certsrv.policy.IExpression; import com.netscape.cmscore.util.Debug; @@ -344,35 +340,3 @@ class PredicateTokenizer { } } } - -class AttributeSet implements IAttrSet { - /** - * - */ - private static final long serialVersionUID = -3985810281989018413L; - Hashtable<String, Object> ht = new Hashtable<String, Object>(); - - public AttributeSet() { - } - - public void delete(String name) - throws EBaseException { - Object ob = ht.get(name); - - ht.remove(ob); - } - - public Object get(String name) - throws EBaseException { - return ht.get(name); - } - - public void set(String name, Object ob) - throws EBaseException { - ht.put(name, ob); - } - - public Enumeration<Object> getElements() { - return ht.elements(); - } -} diff --git a/pki/base/migrate/60ToTxt/src/Main.java b/pki/base/migrate/60ToTxt/src/Main.java index 380baab99..72de924c4 100644 --- a/pki/base/migrate/60ToTxt/src/Main.java +++ b/pki/base/migrate/60ToTxt/src/Main.java @@ -318,9 +318,9 @@ class CMS60LdifParser // to "com.netscape.cmscore.dbs.KeyRecord" com.netscape.cmscore.dbs.KeyRecord o = (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration e = o.getElements(); + Enumeration<String> e = o.getElements(); while (e.hasMoreElements()) { - String k = (String)e.nextElement(); + String k = e.nextElement(); Object ob = o.get(k); if (ob != null) { if (ob instanceof java.util.Date) { diff --git a/pki/base/migrate/61ToTxt/src/Main.java b/pki/base/migrate/61ToTxt/src/Main.java index 298ee027d..cd235f73f 100644 --- a/pki/base/migrate/61ToTxt/src/Main.java +++ b/pki/base/migrate/61ToTxt/src/Main.java @@ -319,9 +319,9 @@ class CMS61LdifParser // to "com.netscape.cmscore.dbs.KeyRecord" com.netscape.cmscore.dbs.KeyRecord o = (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration e = o.getElements(); + Enumeration<String> e = o.getElements(); while (e.hasMoreElements()) { - String k = (String)e.nextElement(); + String k = e.nextElement(); Object ob = o.get(k); if (ob != null) { if (ob instanceof java.util.Date) { diff --git a/pki/base/migrate/62ToTxt/src/Main.java b/pki/base/migrate/62ToTxt/src/Main.java index 95f8d56be..109162475 100644 --- a/pki/base/migrate/62ToTxt/src/Main.java +++ b/pki/base/migrate/62ToTxt/src/Main.java @@ -319,9 +319,9 @@ class CMS62LdifParser // to "com.netscape.cmscore.dbs.KeyRecord" com.netscape.cmscore.dbs.KeyRecord o = (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration e = o.getElements(); + Enumeration<String> e = o.getElements(); while (e.hasMoreElements()) { - String k = (String)e.nextElement(); + String k = e.nextElement(); Object ob = o.get(k); if (ob != null) { if (ob instanceof java.util.Date) { diff --git a/pki/base/migrate/63ToTxt/src/Main.java b/pki/base/migrate/63ToTxt/src/Main.java index 1a13f833b..6066801e2 100644 --- a/pki/base/migrate/63ToTxt/src/Main.java +++ b/pki/base/migrate/63ToTxt/src/Main.java @@ -319,9 +319,9 @@ class CMS63LdifParser // to "com.netscape.cmscore.dbs.KeyRecord" com.netscape.cmscore.dbs.KeyRecord o = (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration e = o.getElements(); + Enumeration<String> e = o.getElements(); while (e.hasMoreElements()) { - String k = (String)e.nextElement(); + String k = e.nextElement(); Object ob = o.get(k); if (ob != null) { if (ob instanceof java.util.Date) { diff --git a/pki/base/migrate/70ToTxt/src/Main.java b/pki/base/migrate/70ToTxt/src/Main.java index b406a5765..133671267 100644 --- a/pki/base/migrate/70ToTxt/src/Main.java +++ b/pki/base/migrate/70ToTxt/src/Main.java @@ -319,9 +319,9 @@ class CMS70LdifParser // to "com.netscape.cmscore.dbs.KeyRecord" com.netscape.cmscore.dbs.KeyRecord o = (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration e = o.getElements(); + Enumeration<String> e = o.getElements(); while (e.hasMoreElements()) { - String k = (String)e.nextElement(); + String k = e.nextElement(); Object ob = o.get(k); if (ob != null) { if (ob instanceof java.util.Date) { diff --git a/pki/base/migrate/71ToTxt/src/Main.java b/pki/base/migrate/71ToTxt/src/Main.java index 3ff4930a4..f7f3a5b95 100644 --- a/pki/base/migrate/71ToTxt/src/Main.java +++ b/pki/base/migrate/71ToTxt/src/Main.java @@ -319,9 +319,9 @@ class CMS71LdifParser // to "com.netscape.cmscore.dbs.KeyRecord" com.netscape.cmscore.dbs.KeyRecord o = (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration e = o.getElements(); + Enumeration<String> e = o.getElements(); while (e.hasMoreElements()) { - String k = (String)e.nextElement(); + String k = e.nextElement(); Object ob = o.get(k); if (ob != null) { if (ob instanceof java.util.Date) { diff --git a/pki/base/migrate/72ToTxt/src/Main.java b/pki/base/migrate/72ToTxt/src/Main.java index 3bd1a333a..0a0dc812e 100644 --- a/pki/base/migrate/72ToTxt/src/Main.java +++ b/pki/base/migrate/72ToTxt/src/Main.java @@ -319,9 +319,9 @@ class CMS72LdifParser // to "com.netscape.cmscore.dbs.KeyRecord" com.netscape.cmscore.dbs.KeyRecord o = (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration e = o.getElements(); + Enumeration<String> e = o.getElements(); while (e.hasMoreElements()) { - String k = (String)e.nextElement(); + String k = e.nextElement(); Object ob = o.get(k); if (ob != null) { if (ob instanceof java.util.Date) { diff --git a/pki/base/migrate/73ToTxt/src/Main.java b/pki/base/migrate/73ToTxt/src/Main.java index 088ae441f..be26e9858 100644 --- a/pki/base/migrate/73ToTxt/src/Main.java +++ b/pki/base/migrate/73ToTxt/src/Main.java @@ -319,9 +319,9 @@ class CMS73LdifParser // to "com.netscape.cmscore.dbs.KeyRecord" com.netscape.cmscore.dbs.KeyRecord o = (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration e = o.getElements(); + Enumeration<String> e = o.getElements(); while (e.hasMoreElements()) { - String k = (String)e.nextElement(); + String k = e.nextElement(); Object ob = o.get(k); if (ob != null) { if (ob instanceof java.util.Date) { |