diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-02-06 15:44:34 -0600 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-02-14 16:32:25 -0600 |
commit | d5c6e6c69e678a79f9e8cd312e6007ad88026a36 (patch) | |
tree | 2e5934f2ff9aeb3b5014808799f2862ee262a723 /pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java | |
parent | a4979af45554d97190180a038a4b438e3161d609 (diff) | |
download | pki-d5c6e6c69e678a79f9e8cd312e6007ad88026a36.tar.gz pki-d5c6e6c69e678a79f9e8cd312e6007ad88026a36.tar.xz pki-d5c6e6c69e678a79f9e8cd312e6007ad88026a36.zip |
Added generics (part 4).
This patch brings down the warnings from 3427 to 2917.
Ticket #2
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java index 6219bab0c..3b2186b23 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java @@ -21,6 +21,7 @@ import java.math.BigInteger; import java.security.PublicKey; import java.util.Date; import java.util.Enumeration; +import java.util.Vector; import netscape.security.x509.X500Name; @@ -372,32 +373,38 @@ public class KeyRepository extends Repository implements IKeyRepository { return result; } - public Enumeration<Object> searchKeys(String filter, int maxSize) + public Enumeration<IKeyRecord> searchKeys(String filter, int maxSize) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration<Object> e = null; + Vector<IKeyRecord> v = new Vector<IKeyRecord>(); try { - e = s.search(getDN(), filter, maxSize); + IDBSearchResults sr = s.search(getDN(), filter, maxSize); + while (sr.hasMoreElements()) { + v.add((IKeyRecord) sr.nextElement()); + } } finally { if (s != null) s.close(); } - return e; + return v.elements(); } - public Enumeration<Object> searchKeys(String filter, int maxSize, int timeLimit) + public Enumeration<IKeyRecord> searchKeys(String filter, int maxSize, int timeLimit) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration<Object> e = null; + Vector<IKeyRecord> v = new Vector<IKeyRecord>(); try { - e = s.search(getDN(), filter, maxSize, timeLimit); + IDBSearchResults sr = s.search(getDN(), filter, maxSize, timeLimit); + while (sr.hasMoreElements()) { + v.add((IKeyRecord) sr.nextElement()); + } } finally { if (s != null) s.close(); } - return e; + return v.elements(); } /** @@ -418,7 +425,7 @@ public class KeyRepository extends Repository implements IKeyRepository { try { if (s != null) { list = new KeyRecordList( - s.createVirtualList(getDN(), "(&(objectclass=" + + s.<IKeyRecord>createVirtualList(getDN(), "(&(objectclass=" + KeyRecord.class.getName() + ")" + filter + ")", attrs, sortKey, pageSize)); } @@ -448,7 +455,7 @@ public class KeyRepository extends Repository implements IKeyRepository { try { if (s != null) { list = new KeyRecordList( - s.createVirtualList(getDN(), "(&(objectclass=" + + s.<IKeyRecord>createVirtualList(getDN(), "(&(objectclass=" + KeyRecord.class.getName() + ")" + filter + ")", attrs, jumpToVal, sortKey, pageSize)); } |