You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2020/06/30 13:16:48 UTC
[lucene-solr] branch jira/solr14404_2 updated: review comments
implemented
This is an automated email from the ASF dual-hosted git repository.
noble pushed a commit to branch jira/solr14404_2
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/jira/solr14404_2 by this push:
new 555951f review comments implemented
555951f is described below
commit 555951f894008891fa6100c914780e118a487f33
Author: noblepaul <no...@gmail.com>
AuthorDate: Tue Jun 30 23:16:24 2020 +1000
review comments implemented
---
solr/core/src/java/org/apache/solr/api/AnnotatedApi.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/api/AnnotatedApi.java b/solr/core/src/java/org/apache/solr/api/AnnotatedApi.java
index d9548c9..1ef8b68 100644
--- a/solr/core/src/java/org/apache/solr/api/AnnotatedApi.java
+++ b/solr/core/src/java/org/apache/solr/api/AnnotatedApi.java
@@ -84,12 +84,7 @@ public class AnnotatedApi extends Api implements PermissionNameProvider , Closea
return getApis(obj.getClass(), obj);
}
public static List<Api> getApis(Class<? extends Object> theClass , Object obj) {
- Class<?> klas = null;
- try {
- klas = MethodHandles.publicLookup().accessClass(theClass);
- } catch (IllegalAccessException e) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Method may be non-public/inaccessible", e);
- }
+ final Class<?> klas = checkPublic(theClass);
if (klas.getAnnotation(EndPoint.class) != null) {
EndPoint endPoint = klas.getAnnotation(EndPoint.class);
List<Method> methods = new ArrayList<>();
@@ -126,6 +121,14 @@ public class AnnotatedApi extends Api implements PermissionNameProvider , Closea
}
}
+ private static Class<?> checkPublic(Class<?> theClass) {
+ try {
+ return MethodHandles.publicLookup().accessClass(theClass);
+ } catch (IllegalAccessException e) {
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Method may be non-public/inaccessible", e);
+ }
+ }
+
private AnnotatedApi(SpecProvider specProvider, EndPoint endPoint, Map<String, Cmd> commands, Api fallback) {
super(specProvider);