7092375: Security Libraries don't build with javac -Werror
Changes to security related java and make files to remove warnings Reviewed-by: xuelei
This commit is contained in:
parent
08d82ca044
commit
e83fde21ff
@ -26,8 +26,8 @@
|
||||
BUILDDIR = ../..
|
||||
PACKAGE = java.security
|
||||
PRODUCT = sun
|
||||
JAVAC_MAX_WARNINGS = false
|
||||
JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
|
||||
JAVAC_MAX_WARNINGS = true
|
||||
JAVAC_LINT_OPTIONS = -Xlint:all
|
||||
JAVAC_WARNINGS_FATAL = true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
BUILDDIR = ..
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
SUBDIRS = others
|
||||
SUBDIRS = others security
|
||||
|
||||
SUBDIRS_management = management
|
||||
|
||||
|
@ -38,10 +38,6 @@ AUTO_FILES_JAVA_DIRS = \
|
||||
com/sun/naming/internal \
|
||||
javax/net \
|
||||
javax/script \
|
||||
javax/security/auth \
|
||||
javax/security/cert \
|
||||
javax/security/sasl \
|
||||
javax/smartcardio \
|
||||
javax/tools \
|
||||
javax/xml
|
||||
|
||||
|
49
jdk/make/javax/security/Makefile
Normal file
49
jdk/make/javax/security/Makefile
Normal file
@ -0,0 +1,49 @@
|
||||
#
|
||||
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
#
|
||||
# Makefile for building javax (security classes)
|
||||
#
|
||||
|
||||
BUILDDIR = ../..
|
||||
JAVAC_MAX_WARNINGS = true
|
||||
JAVAC_WARNINGS_FATAL = true
|
||||
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
# Files to compile
|
||||
#
|
||||
AUTO_FILES_JAVA_DIRS = \
|
||||
javax/security/auth \
|
||||
javax/security/cert \
|
||||
javax/security/sasl \
|
||||
javax/smartcardio
|
||||
|
||||
#
|
||||
# Rules
|
||||
#
|
||||
include $(BUILDDIR)/common/Classes.gmk
|
||||
|
@ -26,6 +26,8 @@
|
||||
BUILDDIR = ../../..
|
||||
PACKAGE = org.ietf.jgss
|
||||
PRODUCT = sun
|
||||
JAVAC_MAX_WARNINGS = true
|
||||
JAVAC_WARNINGS_FATAL = true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
|
@ -26,7 +26,7 @@
|
||||
BUILDDIR = ../../..
|
||||
PACKAGE = sun.security.other
|
||||
PRODUCT = sun
|
||||
JAVAC_MAX_WARNINGS=false
|
||||
JAVAC_MAX_WARNINGS=true
|
||||
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||
JAVAC_WARNINGS_FATAL=true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
@ -899,6 +899,7 @@ public abstract class Signature extends SignatureSpi {
|
||||
* and its original parent (Object).
|
||||
*/
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static class Delegate extends Signature {
|
||||
|
||||
// The provider implementation (delegate)
|
||||
@ -1203,6 +1204,7 @@ public abstract class Signature extends SignatureSpi {
|
||||
}
|
||||
|
||||
// adapter for RSA/ECB/PKCS1Padding ciphers
|
||||
@SuppressWarnings("deprecation")
|
||||
private static class CipherAdapter extends SignatureSpi {
|
||||
|
||||
private final Cipher cipher;
|
||||
|
@ -117,7 +117,7 @@ public final class PrivateCredentialPermission extends Permission {
|
||||
* The set contains elements of type,
|
||||
* <code>PrivateCredentialPermission.CredOwner</code>.
|
||||
*/
|
||||
private Set principals; // ignored - kept around for compatibility
|
||||
private Set<Principal> principals; // ignored - kept around for compatibility
|
||||
private transient CredOwner[] credOwners;
|
||||
|
||||
/**
|
||||
|
@ -1291,6 +1291,7 @@ public final class Subject implements java.io.Serializable {
|
||||
oos.writeFields();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void readObject(ObjectInputStream ois)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
@ -1329,6 +1330,7 @@ public final class Subject implements java.io.Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") /*To suppress warning from line 1374*/
|
||||
private void populateSet() {
|
||||
final Iterator<?> iterator;
|
||||
switch(which) {
|
||||
|
@ -56,6 +56,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
|
||||
sun.security.util.Debug.getInstance("combiner",
|
||||
"\t[SubjectDomainCombiner]");
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
// Note: check only at classloading time, not dynamically during combine()
|
||||
private static final boolean useJavaxPolicy =
|
||||
javax.security.auth.Policy.isCustomPolicySet(debug);
|
||||
@ -300,6 +301,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
|
||||
if (!allowCaching) {
|
||||
java.security.AccessController.doPrivileged
|
||||
(new PrivilegedAction<Void>() {
|
||||
@SuppressWarnings("deprecation")
|
||||
public Void run() {
|
||||
// Call refresh only caching is disallowed
|
||||
javax.security.auth.Policy.getPolicy().refresh();
|
||||
@ -308,6 +310,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
int cLen = (currentDomains == null ? 0 : currentDomains.length);
|
||||
int aLen = (assignedDomains == null ? 0 : assignedDomains.length);
|
||||
|
||||
@ -348,13 +351,13 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
|
||||
// get the original perms
|
||||
Permissions perms = new Permissions();
|
||||
PermissionCollection coll = pd.getPermissions();
|
||||
java.util.Enumeration e;
|
||||
java.util.Enumeration<Permission> e;
|
||||
if (coll != null) {
|
||||
synchronized (coll) {
|
||||
e = coll.elements();
|
||||
while (e.hasMoreElements()) {
|
||||
Permission newPerm =
|
||||
(Permission)e.nextElement();
|
||||
e.nextElement();
|
||||
perms.add(newPerm);
|
||||
}
|
||||
}
|
||||
@ -367,6 +370,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
|
||||
PermissionCollection newPerms =
|
||||
java.security.AccessController.doPrivileged
|
||||
(new PrivilegedAction<PermissionCollection>() {
|
||||
@SuppressWarnings("deprecation")
|
||||
public PermissionCollection run() {
|
||||
return
|
||||
javax.security.auth.Policy.getPolicy().getPermissions
|
||||
@ -379,7 +383,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
|
||||
synchronized (newPerms) {
|
||||
e = newPerms.elements();
|
||||
while (e.hasMoreElements()) {
|
||||
Permission newPerm = (Permission)e.nextElement();
|
||||
Permission newPerm = e.nextElement();
|
||||
if (!perms.implies(newPerm)) {
|
||||
perms.add(newPerm);
|
||||
if (debug != null)
|
||||
|
@ -375,6 +375,7 @@ final class KrbDelegationPermissionCollection extends PermissionCollection
|
||||
/*
|
||||
* Reads in a Vector of DelegationPermissions and saves them in the perms field.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void readObject(ObjectInputStream in) throws IOException,
|
||||
ClassNotFoundException {
|
||||
// Don't call defaultReadObject()
|
||||
|
@ -583,6 +583,7 @@ final class KrbServicePermissionCollection extends PermissionCollection
|
||||
/*
|
||||
* Reads in a Vector of ServicePermissions and saves them in the perms field.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void readObject(ObjectInputStream in) throws IOException,
|
||||
ClassNotFoundException {
|
||||
// Don't call defaultReadObject()
|
||||
|
@ -214,14 +214,14 @@ public class LoginContext {
|
||||
private boolean subjectProvided = false;
|
||||
private boolean loginSucceeded = false;
|
||||
private CallbackHandler callbackHandler;
|
||||
private Map state = new HashMap();
|
||||
private Map<String,?> state = new HashMap<String,Object>();
|
||||
|
||||
private Configuration config;
|
||||
private boolean configProvided = false;
|
||||
private AccessControlContext creatorAcc = null;
|
||||
private ModuleInfo[] moduleStack;
|
||||
private ClassLoader contextClassLoader = null;
|
||||
private static final Class[] PARAMS = { };
|
||||
private static final Class<?>[] PARAMS = { };
|
||||
|
||||
// state saved in the event a user-specified asynchronous exception
|
||||
// was specified and thrown
|
||||
@ -306,7 +306,7 @@ public class LoginContext {
|
||||
(DEFAULT_HANDLER);
|
||||
if (defaultHandler == null || defaultHandler.length() == 0)
|
||||
return null;
|
||||
Class c = Class.forName(defaultHandler,
|
||||
Class<?> c = Class.forName(defaultHandler,
|
||||
true,
|
||||
finalLoader);
|
||||
return (CallbackHandler)c.newInstance();
|
||||
@ -743,12 +743,12 @@ public class LoginContext {
|
||||
} else {
|
||||
|
||||
// instantiate the LoginModule
|
||||
Class c = Class.forName
|
||||
Class<?> c = Class.forName
|
||||
(moduleStack[i].entry.getLoginModuleName(),
|
||||
true,
|
||||
contextClassLoader);
|
||||
|
||||
Constructor constructor = c.getConstructor(PARAMS);
|
||||
Constructor<?> constructor = c.getConstructor(PARAMS);
|
||||
Object[] args = { };
|
||||
|
||||
// allow any object to be a LoginModule
|
||||
|
@ -118,7 +118,7 @@ public final class X500Principal implements Principal, java.io.Serializable {
|
||||
* is improperly specified
|
||||
*/
|
||||
public X500Principal(String name) {
|
||||
this(name, (Map<String, String>) Collections.EMPTY_MAP);
|
||||
this(name, Collections.<String, String>emptyMap());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,7 @@ package javax.security.cert;
|
||||
*/
|
||||
public class CertificateEncodingException extends CertificateException {
|
||||
|
||||
private static final long serialVersionUID = -8187642723048403470L;
|
||||
/**
|
||||
* Constructs a CertificateEncodingException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
|
@ -41,6 +41,7 @@ package javax.security.cert;
|
||||
*/
|
||||
public class CertificateException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -5757213374030785290L;
|
||||
/**
|
||||
* Constructs a certificate exception with no detail message. A detail
|
||||
* message is a String that describes this particular exception.
|
||||
|
@ -43,6 +43,7 @@ package javax.security.cert;
|
||||
*/
|
||||
public class CertificateExpiredException extends CertificateException {
|
||||
|
||||
private static final long serialVersionUID = 5091601212177261883L;
|
||||
/**
|
||||
* Constructs a CertificateExpiredException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
|
@ -43,6 +43,7 @@ package javax.security.cert;
|
||||
*/
|
||||
public class CertificateNotYetValidException extends CertificateException {
|
||||
|
||||
private static final long serialVersionUID = -8976172474266822818L;
|
||||
/**
|
||||
* Constructs a CertificateNotYetValidException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -42,6 +42,8 @@ package javax.security.cert;
|
||||
*/
|
||||
public class CertificateParsingException extends CertificateException {
|
||||
|
||||
private static final long serialVersionUID = -8449352422951136229L;
|
||||
|
||||
/**
|
||||
* Constructs a CertificateParsingException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
|
@ -219,11 +219,11 @@ public abstract class X509Certificate extends Certificate {
|
||||
className = "com.sun.security.cert.internal.x509.X509V1CertImpl";
|
||||
}
|
||||
try {
|
||||
Class[] params = null;
|
||||
Class<?>[] params = null;
|
||||
if (value instanceof InputStream) {
|
||||
params = new Class[] { InputStream.class };
|
||||
params = new Class<?>[] { InputStream.class };
|
||||
} else if (value instanceof byte[]) {
|
||||
params = new Class[] { value.getClass() };
|
||||
params = new Class<?>[] { value.getClass() };
|
||||
} else
|
||||
throw new CertificateException("Unsupported argument type");
|
||||
Class<?> certClass = Class.forName(className);
|
||||
|
@ -395,7 +395,7 @@ public class Sasl {
|
||||
* will be thrown.
|
||||
*/
|
||||
ClassLoader cl = p.getClass().getClassLoader();
|
||||
Class implClass;
|
||||
Class<?> implClass;
|
||||
implClass = Class.forName(className, true, cl);
|
||||
return implClass.newInstance();
|
||||
} catch (ClassNotFoundException e) {
|
||||
@ -576,7 +576,7 @@ public class Sasl {
|
||||
classes.clear();
|
||||
|
||||
// Check the keys for each provider.
|
||||
for (Enumeration e = providers[i].keys(); e.hasMoreElements(); ) {
|
||||
for (Enumeration<Object> e = providers[i].keys(); e.hasMoreElements(); ) {
|
||||
String currentKey = (String)e.nextElement();
|
||||
if (currentKey.startsWith(serviceName)) {
|
||||
// We should skip the currentKey if it contains a
|
||||
|
@ -113,7 +113,7 @@ public final class TerminalFactory {
|
||||
type = "PC/SC";
|
||||
Provider sun = Security.getProvider("SunPCSC");
|
||||
if (sun == null) {
|
||||
Class clazz = Class.forName("sun.security.smartcardio.SunPCSC");
|
||||
Class<?> clazz = Class.forName("sun.security.smartcardio.SunPCSC");
|
||||
sun = (Provider)clazz.newInstance();
|
||||
}
|
||||
factory = TerminalFactory.getInstance(type, null, sun);
|
||||
@ -131,6 +131,8 @@ public final class TerminalFactory {
|
||||
}
|
||||
|
||||
private static final class NoneProvider extends Provider {
|
||||
|
||||
private static final long serialVersionUID = 2745808869881593918L;
|
||||
final static Provider INSTANCE = new NoneProvider();
|
||||
private NoneProvider() {
|
||||
super("None", 1.0d, "none");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,6 +51,7 @@ public final class ECPublicKeyImpl extends X509Key implements ECPublicKey {
|
||||
* Construct a key from its components. Used by the
|
||||
* ECKeyFactory and SunPKCS11.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public ECPublicKeyImpl(ECPoint w, ECParameterSpec params)
|
||||
throws InvalidKeyException {
|
||||
this.w = w;
|
||||
@ -85,6 +86,7 @@ public final class ECPublicKeyImpl extends X509Key implements ECPublicKey {
|
||||
|
||||
// Internal API to get the encoded point. Currently used by SunPKCS11.
|
||||
// This may change/go away depending on what we do with the public API.
|
||||
@SuppressWarnings("deprecation")
|
||||
public byte[] getEncodedPublicValue() {
|
||||
return key.clone();
|
||||
}
|
||||
@ -92,6 +94,7 @@ public final class ECPublicKeyImpl extends X509Key implements ECPublicKey {
|
||||
/**
|
||||
* Parse the key. Called by X509Key.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void parseKeyBits() throws InvalidKeyException {
|
||||
try {
|
||||
AlgorithmParameters algParams = this.algid.getParameters();
|
||||
|
@ -327,6 +327,7 @@ public final class PKIXValidator extends Validator {
|
||||
* Set the check date (for debugging).
|
||||
*/
|
||||
private void setDate(PKIXBuilderParameters params) {
|
||||
@SuppressWarnings("deprecation")
|
||||
Date date = validationDate;
|
||||
if (date != null) {
|
||||
params.setDate(date);
|
||||
|
@ -131,6 +131,7 @@ public final class SimpleValidator extends Validator {
|
||||
// make sure chain includes a trusted cert
|
||||
chain = buildTrustedChain(chain);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
Date date = validationDate;
|
||||
if (date == null) {
|
||||
date = new Date();
|
||||
|
@ -1323,7 +1323,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
|
||||
|
||||
for (Extension ex : exts.getAllExtensions()) {
|
||||
ObjectIdentifier inCertOID = ex.getExtensionId();
|
||||
if (inCertOID.equals(findOID)) {
|
||||
if (inCertOID.equals((Object)findOID)) {
|
||||
certExt = ex;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user