# HG changeset patch # User robm # Date 1396621454 -3600 # Node ID 75ad6f000a10f4d4516f1bb9674f315b119edfb2 # Parent ad775235b3f9d16e4e93bc02491fd8e23c4ba197 8035004: Provider provides less service Reviewed-by: mullan, coffeys diff -r ad775235b3f9 -r 75ad6f000a10 src/share/classes/java/security/Provider.java --- a/src/share/classes/java/security/Provider.java Wed Mar 05 20:56:53 2014 -0800 +++ b/src/share/classes/java/security/Provider.java Fri Apr 04 15:24:14 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2014, 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 @@ -1017,7 +1017,7 @@ *
This class defines the methods {@link #supportsParameter
* supportsParameter()} and {@link #newInstance newInstance()}
* which are used by the Java security framework when it searches for
- * suitable services and instantes them. The valid arguments to those
+ * suitable services and instantiates them. The valid arguments to those
* methods depend on the type of service. For the service types defined
* within Java SE, see the
*
@@ -1207,7 +1207,7 @@
*
* @throws InvalidParameterException if the value of
* constructorParameter is invalid for this type of service.
- * @throws NoSuchAlgorithmException if instantation failed for
+ * @throws NoSuchAlgorithmException if instantiation failed for
* any other reason.
*/
public Object newInstance(Object constructorParameter)
@@ -1235,7 +1235,9 @@
+ " engines");
}
Class clazz = getImplClass();
- return clazz.newInstance();
+ Class>[] empty = {};
+ Constructor> con = clazz.getConstructor(empty);
+ return con.newInstance();
} else {
Class paramClass = cap.getConstructorParameterClass();
if (constructorParameter != null) {
@@ -1278,13 +1280,18 @@
} else {
clazz = cl.loadClass(className);
}
+ if (!Modifier.isPublic(clazz.getModifiers())) {
+ throw new NoSuchAlgorithmException
+ ("class configured for " + type + " (provider: " +
+ provider.getName() + ") is not public.");
+ }
classRef = new WeakReference