You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ge...@apache.org on 2023/06/27 19:38:25 UTC

[solr] 02/02: SOLR-16395: Avoid Jersey resource inheritance

This is an automated email from the ASF dual-hosted git repository.

gerlowskija pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 608a5444c808ffc89b9ba9976a5aaf3c9521b6f4
Author: Jason Gerlowski <ge...@apache.org>
AuthorDate: Tue Jun 27 14:08:47 2023 -0400

    SOLR-16395: Avoid Jersey resource inheritance
    
    Prior to this commit GetSchemaFieldAPI inherited from a parent resource
    class, GetSchemaAPI.
    
    The "strict validation" linting that Jersey offers (see the config
    setting in JerseyApplications.java) complained about this, as it was
    detecting that the endpoints offered by GetSchemaAPI were being
    shadowed.
    
    This commit removes this inheritance, so that Jersey's validation (when
    enabled) can complete successfully on newly created SolrCores.
---
 .../java/org/apache/solr/handler/admin/api/GetSchemaFieldAPI.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/handler/admin/api/GetSchemaFieldAPI.java b/solr/core/src/java/org/apache/solr/handler/admin/api/GetSchemaFieldAPI.java
index b5c3fbbb2a7..2ad7db4d863 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/api/GetSchemaFieldAPI.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/api/GetSchemaFieldAPI.java
@@ -28,6 +28,7 @@ import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
+import org.apache.solr.api.JerseyResource;
 import org.apache.solr.common.MapWriter;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.cloud.SolrClassLoader;
@@ -54,15 +55,17 @@ import org.apache.solr.security.PermissionNameProvider;
  *   <li>/fieldtypes/{fieldTypeName}
  * </ul>
  */
-public class GetSchemaFieldAPI extends GetSchemaAPI {
+@Path("/{a:cores|collections}/{collectionName}/schema")
+public class GetSchemaFieldAPI /*extends GetSchemaAPI*/ extends JerseyResource {
 
+  private final IndexSchema indexSchema;
   private final SolrParams params;
 
   // TODO Stop using SolrParams here and instead give API methods parameters representing only those
   // query-params that they support
   @Inject
   public GetSchemaFieldAPI(IndexSchema indexSchema, SolrParams params) {
-    super(indexSchema);
+    this.indexSchema = indexSchema;
     this.params = params;
   }