[java-identity-provider] 03/04: Remove use of deprecated #newInstance() method
Rod Widdowson
rdw at steadingsoftware.com
Sat Mar 30 07:15:27 EDT 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=d6e5afd65421a37f6328920d36d723d2369eb5f7
commit d6e5afd65421a37f6328920d36d723d2369eb5f7
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Mar 30 11:12:17 2019 +0000
Remove use of deprecated #newInstance() method
---
idp-core/src/main/java/net/shibboleth/idp/cli/CLI.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/idp-core/src/main/java/net/shibboleth/idp/cli/CLI.java b/idp-core/src/main/java/net/shibboleth/idp/cli/CLI.java
index 2612772..8b06d92 100644
--- a/idp-core/src/main/java/net/shibboleth/idp/cli/CLI.java
+++ b/idp-core/src/main/java/net/shibboleth/idp/cli/CLI.java
@@ -21,15 +21,16 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
import java.net.MalformedURLException;
import java.net.URL;
import javax.annotation.Nonnull;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-
import com.beust.jcommander.JCommander;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+
/**
* Entry point for command line attribute utility.
@@ -48,8 +49,12 @@ public final class CLI {
* Command line entry point.
*
* @param args command line arguments
+ * @throws SecurityException from the object construction
+ * @throws ReflectiveOperationException from the object construction
+ * @throws IllegalArgumentException from the object construction
*/
- public static void main(@Nonnull final String[] args) {
+ public static void main(@Nonnull final String[] args) throws ReflectiveOperationException,
+ SecurityException, IllegalArgumentException {
// Get name of parameter class to load using system property.
final String argType = System.getProperty(ARGS_PROPERTY);
@@ -60,7 +65,8 @@ public final class CLI {
CommandLineArguments argObject = null;
try {
- final Object obj = Class.forName(argType).newInstance();
+ final Constructor construct = Class.forName(argType).getConstructor();
+ final Object obj = construct.newInstance();
if (!(obj instanceof CommandLineArguments)) {
errorAndExit("Argument class was not of the correct type");
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list