From 8025d2cbaa475dc3cd285154cf0b68f2434b2c56 Mon Sep 17 00:00:00 2001 From: A-Little-Excited <3030036858@qq.com> Date: Sun, 7 Apr 2024 16:34:02 +0800 Subject: [PATCH] fix-newInstance --- .../java/com/paiondata/athena/application/ResourceConfig.java | 4 +++- .../athena/example/books/application/BooksBinderFactory.java | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/athena-core/src/main/java/com/paiondata/athena/application/ResourceConfig.java b/athena-core/src/main/java/com/paiondata/athena/application/ResourceConfig.java index dd810308d..7014b48ab 100644 --- a/athena-core/src/main/java/com/paiondata/athena/application/ResourceConfig.java +++ b/athena-core/src/main/java/com/paiondata/athena/application/ResourceConfig.java @@ -57,10 +57,12 @@ public class ResourceConfig extends org.glassfish.jersey.server.ResourceConfig { * @throws ClassNotFoundException if a class was not found when attempting to load it * @throws InstantiationException if a class was not able to be instantiated * @throws IllegalAccessException if there was a problem accessing something due to security restrictions + * @throws NoSuchMethodException if a matching method is not found + * @throws InvocationTargetException if the underlying constructor throws an exception */ @Inject public ResourceConfig() throws ClassNotFoundException, InstantiationException, IllegalAccessException, - NoSuchMethodException, InvocationTargetException { + NoSuchMethodException, InvocationTargetException{ final Class binderClass = Class.forName(getBindingFactory()) .asSubclass(BinderFactory.class); final BinderFactory binderFactory = binderClass.getDeclaredConstructor().newInstance(); diff --git a/athena-examples/athena-example-books/src/main/java/com/paiondata/athena/example/books/application/BooksBinderFactory.java b/athena-examples/athena-example-books/src/main/java/com/paiondata/athena/example/books/application/BooksBinderFactory.java index c6e3afdb5..dc170cb63 100644 --- a/athena-examples/athena-example-books/src/main/java/com/paiondata/athena/example/books/application/BooksBinderFactory.java +++ b/athena-examples/athena-example-books/src/main/java/com/paiondata/athena/example/books/application/BooksBinderFactory.java @@ -201,8 +201,7 @@ private static Provider initProvider(final @NotNull String dataSourc throw new IllegalStateException(message, exception); } catch (final InvocationTargetException exception) { final String message = String.format( - "this Constructor of '%s' is enforcing Java language access control and the underlying " + - "constructor is inaccessible", + "the underlying constructor of '%s' throws an exception", dataSourceProviderClass ); throw new IllegalStateException(message, exception);