Skip to content

Commit

Permalink
Complete firs phase of deprecation warnings annotation already started
Browse files Browse the repository at this point in the history
Addresses https://pagure.io/jss/issue/19
Added needed @Deprecation annotations where we already had a @Deprecation warning
Added @Deprecation and @Depecations combo warnings that where missing
  • Loading branch information
emaldona committed Aug 16, 2018
1 parent 8bfb6dd commit 5305574
Show file tree
Hide file tree
Showing 32 changed files with 162 additions and 14 deletions.
1 change: 1 addition & 0 deletions org/mozilla/jss/CryptoManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,7 @@ private native int verifyCertificateNowCUNative(String nickname,
* with the given nickname.
* @deprecated Use verifyCertificate() instead
*/
@Deprecated
public boolean isCertValid(String nickname, boolean checkSig,
CertificateUsage certificateUsage)
throws ObjectNotFoundException, InvalidNicknameException
Expand Down
1 change: 1 addition & 0 deletions org/mozilla/jss/crypto/Algorithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public OBJECT_IDENTIFIER toOID() throws NoSuchAlgorithmException {
* @return Parameter type.
* @deprecated Call <tt>getParameterClasses()</tt> instead.
*/
@Deprecated
public Class<?> getParameterClass() {
if( parameterClasses.length == 0) {
return null;
Expand Down
1 change: 1 addition & 0 deletions org/mozilla/jss/crypto/BadPaddingException.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/**
* @deprecated Use javax.crypto.BadPaddingException.
*/
@Deprecated
public class BadPaddingException extends javax.crypto.BadPaddingException {
private static final long serialVersionUID = 1L;
public BadPaddingException() {
Expand Down
2 changes: 2 additions & 0 deletions org/mozilla/jss/crypto/EncryptionAlgorithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public static EncryptionAlgorithm fromOID(OBJECT_IDENTIFIER oid)
* don't contain key length, which is necessary to distinguish between
* AES algorithms.
*/
@Deprecated
public static EncryptionAlgorithm fromString(String name)
throws NoSuchAlgorithmException
{
Expand Down Expand Up @@ -276,6 +277,7 @@ public int getBlockSize() {
* @return <code>true</code> if this algorithm performs padding.
* @deprecated Call <tt>getPaddingType()</tt> instead.
*/
@Deprecated
public boolean isPadded() {
return ! Padding.NONE.equals(padding);
}
Expand Down
4 changes: 4 additions & 0 deletions org/mozilla/jss/crypto/PBEKeyGenParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ public void clear() {
pass.clear();
}

/**
* @deprecated finalize() in Object has been deprecated
*/
@Deprecated
protected void finalize() throws Throwable {
pass.clear();
}
Expand Down
1 change: 1 addition & 0 deletions org/mozilla/jss/crypto/PrivateKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public interface PrivateKey extends java.security.PrivateKey
* another way, such as a function that directly matches a cert and
* key.
*/
@Deprecated
public byte[] getUniqueID() throws TokenException;

/**
Expand Down
1 change: 1 addition & 0 deletions org/mozilla/jss/crypto/TokenCertificate.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public interface TokenCertificate extends X509Certificate {
* another way, such as a function that directly matches a cert and
* key.
*/
@Deprecated
public abstract byte[] getUniqueID();

/**
Expand Down
4 changes: 3 additions & 1 deletion org/mozilla/jss/netscape/security/acl/AclEntryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ public Enumeration<Permission> permissions() {

/**
* Return a string representation of the contents of the ACL entry.
* @deprecated Group and Permission in java.security.acl have been deprecated and marked for removal
*/
@Deprecated
public String toString() {
StringBuffer s = new StringBuffer();
if (negative)
Expand All @@ -152,7 +154,7 @@ public String toString() {
s.append(user + "=");
Enumeration<Permission> e = permissions();
while (e.hasMoreElements()) {
Permission p = e.nextElement();
@Deprecated Permission p = e.nextElement();
s.append(p);
if (e.hasMoreElements())
s.append(",");
Expand Down
32 changes: 31 additions & 1 deletion org/mozilla/jss/netscape/security/acl/AclImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
* An Access Control List (ACL) is encapsulated by this class.
*
* @author Satish Dharmaraj
* @deprecated Owner in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
public class AclImpl extends OwnerImpl implements Acl {
//
// Maintain four tables. one each for positive and negative
Expand Down Expand Up @@ -165,7 +167,9 @@ public synchronized boolean removeEntry(Principal caller, AclEntry entry)
*
* @param user the principal for which the ACL entry is returned.
* @return The resulting permission set that the principal is allowed.
* @deprecated Permission in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
public synchronized Enumeration<Permission> getPermissions(Principal user) {

Enumeration<Permission> individualPositive;
Expand Down Expand Up @@ -313,6 +317,10 @@ private <T> Enumeration<T> subtract(Enumeration<T> e1, Enumeration<T> e2) {
return v.elements();
}

/**
* @deprecated Permission in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
private Enumeration<Permission> getGroupPositive(Principal user) {
Enumeration<Permission> groupPositive = zeroSet.elements();
Enumeration<Principal> e = allowedGroupsTable.keys();
Expand All @@ -326,6 +334,10 @@ private Enumeration<Permission> getGroupPositive(Principal user) {
return groupPositive;
}

/**
* @deprecated Permission in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
private Enumeration<Permission> getGroupNegative(Principal user) {
Enumeration<Permission> groupNegative = zeroSet.elements();
Enumeration<Principal> e = deniedGroupsTable.keys();
Expand All @@ -339,6 +351,10 @@ private Enumeration<Permission> getGroupNegative(Principal user) {
return groupNegative;
}

/**
* @deprecated Permission in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
private Enumeration<Permission> getIndividualPositive(Principal user) {
Enumeration<Permission> individualPositive = zeroSet.elements();
AclEntry ae = allowedUsersTable.get(user);
Expand All @@ -347,6 +363,10 @@ private Enumeration<Permission> getIndividualPositive(Principal user) {
return individualPositive;
}

/**
* @deprecated Permission in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
private Enumeration<Permission> getIndividualNegative(Principal user) {
Enumeration<Permission> individualNegative = zeroSet.elements();
AclEntry ae = deniedUsersTable.get(user);
Expand All @@ -356,10 +376,20 @@ private Enumeration<Permission> getIndividualNegative(Principal user) {
}
}

/**
* @deprecated Acl in java.security.acl has been deprecated and marked for removal
* @deprecated AclEntry in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
final class AclEnumerator implements Enumeration<AclEntry> {
Acl acl;
@Deprecated Acl acl;
Enumeration<AclEntry> u1, u2, g1, g2;

/**
* @deprecated AclEntry in java.security.acl has been deprecated and marked for removal
* @deprecated Acl in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
AclEnumerator(Acl acl, Hashtable<Principal, AclEntry> u1, Hashtable<Principal, AclEntry> g1,
Hashtable<Principal, AclEntry> u2, Hashtable<Principal, AclEntry> g2) {
this.acl = acl;
Expand Down
25 changes: 17 additions & 8 deletions org/mozilla/jss/netscape/security/acl/GroupImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
* This class implements a group of principals.
*
* @author Satish Dharmaraj
* @deprecated Group in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
public class GroupImpl implements Group {
private Vector<Principal> groupMembers = new Vector<Principal>(50, 100);
private String group;
Expand Down Expand Up @@ -82,7 +84,9 @@ public Enumeration<Principal> members() {
* the group represented in this interface.
*
* @param another The group to compare this group to.
* @deprecation Group in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
public boolean equals(Group another) {
return group.equals(another.toString());
}
Expand All @@ -107,7 +111,9 @@ public int hashCode() {
* @param member The principal whose membership must be checked for.
* @return true if the principal is a member of this group,
* false otherwise
* @deprecated Group in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
public boolean isMember(Principal member) {

//
Expand All @@ -130,12 +136,15 @@ public String getName() {
return group;
}

//
// This function is the recursive search of groups for this
// implementation of the Group. The search proceeds building up
// a vector of already seen groups. Only new groups are considered,
// thereby avoiding loops.
//
/**
* This function is the recursive search of groups for this
* implementation of the Group. The search proceeds building up
* a vector of already seen groups. Only new groups are considered,
* thereby avoiding loops.
*
* @deprecated Group in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
boolean isMemberRecurse(Principal member, Vector<Group> alreadySeen) {
Enumeration<Principal> e = members();
while (e.hasMoreElements()) {
Expand All @@ -155,12 +164,12 @@ boolean isMemberRecurse(Principal member, Vector<Group> alreadySeen) {
// case rather than clutter the interface by forcing the
// implementation of this method.)
//
GroupImpl g = (GroupImpl) p;
@Deprecated GroupImpl g = (GroupImpl) p;
alreadySeen.addElement(this);
if (!alreadySeen.contains(g))
mem = g.isMemberRecurse(member, alreadySeen);
} else if (p instanceof Group) {
Group g = (Group) p;
@Deprecated Group g = (Group) p;
if (!alreadySeen.contains(g))
mem = g.isMember(member);
}
Expand Down
11 changes: 8 additions & 3 deletions org/mozilla/jss/netscape/security/acl/OwnerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
* part of the constructor.
*
* @author Satish Dharmaraj
* @deprecated Owner in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
public class OwnerImpl implements Owner {
private Group ownerGroup;
@Deprecated private Group ownerGroup;

public OwnerImpl(Principal owner) {
ownerGroup = new GroupImpl("AclOwners");
Expand All @@ -51,7 +53,9 @@ public OwnerImpl(Principal owner) {
* @return true if success, false if already an owner.
* @exception NotOwnerException if the caller principal is not on
* the owners list of the Acl.
* @deprecated LastOwnerException in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
public synchronized boolean addOwner(Principal caller, Principal owner)
throws NotOwnerException {
if (!isOwner(caller))
Expand All @@ -75,7 +79,9 @@ public synchronized boolean addOwner(Principal caller, Principal owner)
* the owners list of the Acl.
* @exception LastOwnerException if there is only one owner left in the group, then
* deleteOwner would leave the ACL owner-less. This exception is raised in such a case.
* @deprecated LastOwnerException in java.security.acl has been deprecated and marked for removal
*/
@Deprecated
public synchronized boolean deleteOwner(Principal caller, Principal owner)
throws NotOwnerException, LastOwnerException {
if (!isOwner(caller))
Expand All @@ -89,8 +95,7 @@ public synchronized boolean deleteOwner(Principal caller, Principal owner)
if (e.hasMoreElements())
return ownerGroup.removeMember(owner);
else
throw new LastOwnerException();

throw new LastOwnerException();
}

/**
Expand Down
8 changes: 8 additions & 0 deletions org/mozilla/jss/netscape/security/acl/WorldGroupImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@
* This class implements a group of principals.
*
* @author Satish Dharmaraj
* @deprecated GroupImpl in org.mozilla.jss.netscape.security.acl has been deprecated
*/
@Deprecated
public class WorldGroupImpl extends GroupImpl {

/**
* @deprecated GroupImpl in org.mozilla.jss.netscape.security.acl has been deprecated
*/
@Deprecated
public WorldGroupImpl(String s) {
super(s);
}
Expand All @@ -35,7 +41,9 @@ public WorldGroupImpl(String s) {
*
* @param member The principal whose membership must be checked in this Group.
* @return true always since this is the "world" group.
* @deprecated isMember(Principal) in GroupImpl has been deprecated
*/
@Deprecated
public boolean isMember(Principal member) {
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions org/mozilla/jss/netscape/security/provider/DSA.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ static int[] SHA_7(int[] m1, int[] h) {
*
* @deprecated
*/
@Deprecated
protected void engineSetParameter(String key, Object param) {

if (key.equals("KSEED")) {
Expand Down Expand Up @@ -472,6 +473,7 @@ protected void engineSetParameter(String key, Object param) {
*
* @deprecated
*/
@Deprecated
protected Object engineGetParameter(String key) {
if (key.equals("KSEED")) {
return KseedAsByteArray;
Expand Down
1 change: 1 addition & 0 deletions org/mozilla/jss/netscape/security/x509/AlgorithmId.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ private AlgorithmId(ObjectIdentifier oid, DerValue params)
*
* @deprecated use one of the other constructors.
*/
@Deprecated
public AlgorithmId() {
}

Expand Down
2 changes: 2 additions & 0 deletions org/mozilla/jss/netscape/security/x509/CertAndKeyGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public CertAndKeyGen(String keyType, String sigAlg)
*
* @deprecated All random numbers come from PKCS #11 now.
*/
@Deprecated
public void setRandom(SecureRandom generator) {
}

Expand Down Expand Up @@ -166,6 +167,7 @@ public PrivateKey getPrivateKey() {
* @param myname X.500 name of the subject (who is also the issuer)
* @param validity how long the certificate should be valid, in seconds
*/
@Deprecated
public X509Cert getSelfCert(X500Name myname, long validity)
throws InvalidKeyException, SignatureException, NoSuchAlgorithmException {
X509Certificate cert;
Expand Down
1 change: 1 addition & 0 deletions org/mozilla/jss/netscape/security/x509/X509Cert.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* @deprecated Use the new X509Certificate class.
* This class is only restored for backwards compatibility.
*/
@Deprecated
public class X509Cert implements Certificate, Serializable {

/**
Expand Down
1 change: 1 addition & 0 deletions org/mozilla/jss/pkcs11/KeyType.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public String toString() {
* @deprecated As of NSS 3.11, FORTEZZA is no longer supported.
* This is just a placeholder for backward compatibility.
*/
@Deprecated
static public final KeyType
FORTEZZA = new KeyType(new Algorithm[0], "FORTEZZA");

Expand Down

0 comments on commit 5305574

Please sign in to comment.