diff --git a/make/java/security/Makefile b/make/java/security/Makefile index c05ecdd1e5720f23cb79b4705735a2e9c363ca16..60bcc75ee0dd9cfaa0ce095a5d2a216548ba28cc 100644 --- a/make/java/security/Makefile +++ b/make/java/security/Makefile @@ -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 diff --git a/make/javax/Makefile b/make/javax/Makefile index 251628c83814aaea039b38748f82cd90385d13a2..ebeec3c4eea8d9f86a602409e90f085dfa0f682d 100644 --- a/make/javax/Makefile +++ b/make/javax/Makefile @@ -30,7 +30,7 @@ BUILDDIR = .. include $(BUILDDIR)/common/Defs.gmk -SUBDIRS = others +SUBDIRS = others security SUBDIRS_management = management diff --git a/make/javax/others/Makefile b/make/javax/others/Makefile index 1283dcea892e0589635ea5e5a2fe3f2cd4a0af46..77401632231b345459d1d7c0ec8acc88394d5ba7 100644 --- a/make/javax/others/Makefile +++ b/make/javax/others/Makefile @@ -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 diff --git a/make/javax/security/Makefile b/make/javax/security/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..88d7abb30c7f43e739c26c7f6d20d39687834071 --- /dev/null +++ b/make/javax/security/Makefile @@ -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 + diff --git a/make/org/ietf/jgss/Makefile b/make/org/ietf/jgss/Makefile index 9887e71aac03f7509978be0871fbcc570a4f9b7d..26f0219866f684df07630a64075a433d7a14a499 100644 --- a/make/org/ietf/jgss/Makefile +++ b/make/org/ietf/jgss/Makefile @@ -26,6 +26,8 @@ BUILDDIR = ../../.. PACKAGE = org.ietf.jgss PRODUCT = sun +JAVAC_MAX_WARNINGS = true +JAVAC_WARNINGS_FATAL = true include $(BUILDDIR)/common/Defs.gmk # diff --git a/make/sun/security/other/Makefile b/make/sun/security/other/Makefile index ab74d580d59e97c5b9fee8135d60a71c1e40b6b1..78893730edd7cc99b4db81c2d7875c76757e3160 100644 --- a/make/sun/security/other/Makefile +++ b/make/sun/security/other/Makefile @@ -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 diff --git a/src/share/classes/java/security/Signature.java b/src/share/classes/java/security/Signature.java index b92a16b9fa492794d291f616d247de39d6b2c6cd..72d2b0883c3380ea583b87df22d2fb1da530cdcb 100644 --- a/src/share/classes/java/security/Signature.java +++ b/src/share/classes/java/security/Signature.java @@ -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; diff --git a/src/share/classes/javax/security/auth/PrivateCredentialPermission.java b/src/share/classes/javax/security/auth/PrivateCredentialPermission.java index 87afbedbe23f44bc2f70a95fe32f0710f521759e..3f5e708f5ca3924c9b1c7a9cdc1019048fa250ce 100644 --- a/src/share/classes/javax/security/auth/PrivateCredentialPermission.java +++ b/src/share/classes/javax/security/auth/PrivateCredentialPermission.java @@ -117,7 +117,7 @@ public final class PrivateCredentialPermission extends Permission { * The set contains elements of type, * PrivateCredentialPermission.CredOwner. */ - private Set principals; // ignored - kept around for compatibility + private Set principals; // ignored - kept around for compatibility private transient CredOwner[] credOwners; /** diff --git a/src/share/classes/javax/security/auth/Subject.java b/src/share/classes/javax/security/auth/Subject.java index 56e864c491cd3eba1dad09b831de237ca6fcdf4e..5a9ecea226bbb1cc1b59c4c836cdbe51e930db2e 100644 --- a/src/share/classes/javax/security/auth/Subject.java +++ b/src/share/classes/javax/security/auth/Subject.java @@ -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) { diff --git a/src/share/classes/javax/security/auth/SubjectDomainCombiner.java b/src/share/classes/javax/security/auth/SubjectDomainCombiner.java index 676137f8cfdfe988ae5a43d2fe72f55eb3ffa447..9da411cc1bdac43969341c1453f71fba71e0be9f 100644 --- a/src/share/classes/javax/security/auth/SubjectDomainCombiner.java +++ b/src/share/classes/javax/security/auth/SubjectDomainCombiner.java @@ -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() { + @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 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() { + @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) diff --git a/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java b/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java index 3ab9bebd662f48b797a53b6e59d6a138503464f6..3304ac872dc2e53effb95324055f5b4e93e2418d 100644 --- a/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java +++ b/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java @@ -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() diff --git a/src/share/classes/javax/security/auth/kerberos/ServicePermission.java b/src/share/classes/javax/security/auth/kerberos/ServicePermission.java index 566c71993cacfe6206d9787cc1e47b36cf2d429b..c79d0e11e4cd49e3eab0a646dd8858c51b13d09e 100644 --- a/src/share/classes/javax/security/auth/kerberos/ServicePermission.java +++ b/src/share/classes/javax/security/auth/kerberos/ServicePermission.java @@ -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() diff --git a/src/share/classes/javax/security/auth/login/LoginContext.java b/src/share/classes/javax/security/auth/login/LoginContext.java index 6fb484aa094d148f9646b03d344209c984c24ef1..f76c6ed6cdc381b68a9cfac4b05cfe1021b13740 100644 --- a/src/share/classes/javax/security/auth/login/LoginContext.java +++ b/src/share/classes/javax/security/auth/login/LoginContext.java @@ -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 state = new HashMap(); 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 diff --git a/src/share/classes/javax/security/auth/x500/X500Principal.java b/src/share/classes/javax/security/auth/x500/X500Principal.java index 5636856313c4273a891a7a8c99f2593db098a039..64a54f1509aa4f543798ddb33aea468722a317f1 100644 --- a/src/share/classes/javax/security/auth/x500/X500Principal.java +++ b/src/share/classes/javax/security/auth/x500/X500Principal.java @@ -118,7 +118,7 @@ public final class X500Principal implements Principal, java.io.Serializable { * is improperly specified */ public X500Principal(String name) { - this(name, (Map) Collections.EMPTY_MAP); + this(name, Collections.emptyMap()); } /** diff --git a/src/share/classes/javax/security/cert/CertificateEncodingException.java b/src/share/classes/javax/security/cert/CertificateEncodingException.java index 9eb53156c0734f32fe6b401379eb5f0578ad193e..866d104c77e1855f79caed0608e3e8b73c437124 100644 --- a/src/share/classes/javax/security/cert/CertificateEncodingException.java +++ b/src/share/classes/javax/security/cert/CertificateEncodingException.java @@ -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 diff --git a/src/share/classes/javax/security/cert/CertificateException.java b/src/share/classes/javax/security/cert/CertificateException.java index 44cebf782674be8a7b78ad34ee3b5a144213347a..95d0d3f662360dfe64e97b9fa2158c9c2c9b2ff6 100644 --- a/src/share/classes/javax/security/cert/CertificateException.java +++ b/src/share/classes/javax/security/cert/CertificateException.java @@ -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. diff --git a/src/share/classes/javax/security/cert/CertificateExpiredException.java b/src/share/classes/javax/security/cert/CertificateExpiredException.java index 405344e1a6fab8dc79e7703ed9f08e55dcb4bcd4..889e7860819a751bc695120e61e1be9086a600fa 100644 --- a/src/share/classes/javax/security/cert/CertificateExpiredException.java +++ b/src/share/classes/javax/security/cert/CertificateExpiredException.java @@ -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 diff --git a/src/share/classes/javax/security/cert/CertificateNotYetValidException.java b/src/share/classes/javax/security/cert/CertificateNotYetValidException.java index 2e6b4c3ba100fce95b20813a444922a8c0c03696..20ed15667ef7fe54a58f7433a7d4171d668e20e1 100644 --- a/src/share/classes/javax/security/cert/CertificateNotYetValidException.java +++ b/src/share/classes/javax/security/cert/CertificateNotYetValidException.java @@ -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 diff --git a/src/share/classes/javax/security/cert/CertificateParsingException.java b/src/share/classes/javax/security/cert/CertificateParsingException.java index d935e12c2e1104988e292fff55b49e88d438d961..c60ffe4f1f536b745c47b9a238b562538e405289 100644 --- a/src/share/classes/javax/security/cert/CertificateParsingException.java +++ b/src/share/classes/javax/security/cert/CertificateParsingException.java @@ -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 diff --git a/src/share/classes/javax/security/cert/X509Certificate.java b/src/share/classes/javax/security/cert/X509Certificate.java index 7f16f027bb98cd6a03d0654f488791ac2bc2f356..39b24ec98bb8383d0e06b14f4cfe128aad6e8783 100644 --- a/src/share/classes/javax/security/cert/X509Certificate.java +++ b/src/share/classes/javax/security/cert/X509Certificate.java @@ -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); diff --git a/src/share/classes/javax/security/sasl/Sasl.java b/src/share/classes/javax/security/sasl/Sasl.java index 4188c4121342ba901addc005cb82efc80e06c14c..ca9eb2aff006400a01f0866fd70732ab3df865f5 100644 --- a/src/share/classes/javax/security/sasl/Sasl.java +++ b/src/share/classes/javax/security/sasl/Sasl.java @@ -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 e = providers[i].keys(); e.hasMoreElements(); ) { String currentKey = (String)e.nextElement(); if (currentKey.startsWith(serviceName)) { // We should skip the currentKey if it contains a diff --git a/src/share/classes/javax/smartcardio/TerminalFactory.java b/src/share/classes/javax/smartcardio/TerminalFactory.java index d1d598388fff7420b6aa2f258e8fa8096c7157fa..38a80bc3f8bad3ee1d01b4a3dd71ee5217acf79c 100644 --- a/src/share/classes/javax/smartcardio/TerminalFactory.java +++ b/src/share/classes/javax/smartcardio/TerminalFactory.java @@ -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"); diff --git a/src/share/classes/sun/security/ec/ECPublicKeyImpl.java b/src/share/classes/sun/security/ec/ECPublicKeyImpl.java index 6d471e941dcfda9fa110773222df409fb7654195..aae485c12415d1b317d103b43d5c4a10ec83137f 100644 --- a/src/share/classes/sun/security/ec/ECPublicKeyImpl.java +++ b/src/share/classes/sun/security/ec/ECPublicKeyImpl.java @@ -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(); diff --git a/src/share/classes/sun/security/validator/PKIXValidator.java b/src/share/classes/sun/security/validator/PKIXValidator.java index a1860a732a89efe3fa1532941b074365bf57f147..7c010e11958de81714c74d6c62d1a80c977a84c5 100644 --- a/src/share/classes/sun/security/validator/PKIXValidator.java +++ b/src/share/classes/sun/security/validator/PKIXValidator.java @@ -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); diff --git a/src/share/classes/sun/security/validator/SimpleValidator.java b/src/share/classes/sun/security/validator/SimpleValidator.java index dc68032faa73caf60b815069945250daeef5f560..850dfa0734e8e21e7269e5e2db901cc765f4efbe 100644 --- a/src/share/classes/sun/security/validator/SimpleValidator.java +++ b/src/share/classes/sun/security/validator/SimpleValidator.java @@ -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(); diff --git a/src/share/classes/sun/security/x509/X509CertImpl.java b/src/share/classes/sun/security/x509/X509CertImpl.java index 83f9588551abc62302839355ee1f29793484a637..178f79755280305669b651673905e59b605a5f28 100644 --- a/src/share/classes/sun/security/x509/X509CertImpl.java +++ b/src/share/classes/sun/security/x509/X509CertImpl.java @@ -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; }