[java-identity-provider] 01/03: CheckStyle: replace deprecated clazz.newInstance()
Rod Widdowson
rdw at steadingsoftware.com
Tue Feb 12 10:33:56 EST 2019
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=6ccc68b11b951666e301a15b9c1f508286af9696
commit 6ccc68b11b951666e301a15b9c1f508286af9696
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Feb 12 15:28:49 2019 +0000
CheckStyle: replace deprecated clazz.newInstance()
... with clazz.getDeclaredConstructor().newInstance() which is
declared correctly to hrow the correct exceptions.
---
.../shibboleth/idp/authn/impl/PopulateAuthenticationContext.java | 1 -
.../idp/authn/impl/ValidateUsernamePasswordAgainstKerberos.java | 6 ++++--
.../shibboleth/idp/authn/spnego/impl/GSSAcceptorLoginModule.java | 6 ++++--
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateAuthenticationContext.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateAuthenticationContext.java
index a93c15e..4208bb6 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateAuthenticationContext.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateAuthenticationContext.java
@@ -156,7 +156,6 @@ public class PopulateAuthenticationContext extends AbstractAuthenticationAction
// Checkstyle: CyclomaticComplexity OFF
/** {@inheritDoc} */
- @SuppressWarnings("deprecation")
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext,
@Nonnull final AuthenticationContext authenticationContext) {
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstKerberos.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstKerberos.java
index aa3ff66..5070266 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstKerberos.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstKerberos.java
@@ -193,7 +193,8 @@ public class ValidateUsernamePasswordAgainstKerberos extends AbstractUsernamePas
@Nonnull final AuthenticationContext authenticationContext) {
try {
- final LoginModule clientLoginModule = (LoginModule) Class.forName(loginModuleClassName).newInstance();
+ final LoginModule clientLoginModule = (LoginModule) Class.forName(loginModuleClassName).
+ getDeclaredConstructor().newInstance();
clientLoginModule.initialize(getSubject(), new SimpleCallbackHandler(), new HashMap(), clientOptions);
if (!clientLoginModule.login() || !clientLoginModule.commit()) {
clientLoginModule.abort();
@@ -254,7 +255,8 @@ public class ValidateUsernamePasswordAgainstKerberos extends AbstractUsernamePas
LoginModule serverLoginModule = null;
try {
- serverLoginModule = (LoginModule) Class.forName(loginModuleClassName).newInstance();
+ serverLoginModule = (LoginModule) Class.forName(loginModuleClassName).
+ getDeclaredConstructor().newInstance();
final Subject serverSubject = new Subject();
serverLoginModule.initialize(serverSubject, null, new HashMap(), serverOptions);
if (!serverLoginModule.login() || !serverLoginModule.commit()) {
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/spnego/impl/GSSAcceptorLoginModule.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/spnego/impl/GSSAcceptorLoginModule.java
index 16a44aa..1622cb6 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/spnego/impl/GSSAcceptorLoginModule.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/spnego/impl/GSSAcceptorLoginModule.java
@@ -18,6 +18,7 @@
package net.shibboleth.idp.authn.spnego.impl;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
@@ -78,8 +79,9 @@ public class GSSAcceptorLoginModule {
options.put("storeKey", "true");
try {
- krbModule = (LoginModule) Class.forName(loginModuleClassName).newInstance();
- } catch (final InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+ krbModule = (LoginModule) Class.forName(loginModuleClassName).getDeclaredConstructor().newInstance();
+ } catch (final InstantiationException | IllegalAccessException | ClassNotFoundException |
+ IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
log.error("Unable to instantiate JAAS module for Kerberos", e);
// no module available; login() will throw an exception later
krbModule = null;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list