You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/11/13 21:11:43 UTC

[GitHub] [solr] sonatype-lift[bot] commented on a diff in pull request #1126: SOLR-16462: Create v2 equivalent of v1 'CREATESNAPSHOT', 'LISTSNAPSHOT' and 'DELETESNAPSHOT' (core level)

sonatype-lift[bot] commented on code in PR #1126:
URL: https://github.com/apache/solr/pull/1126#discussion_r1020964514


##########
solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java:
##########
@@ -278,31 +282,16 @@ public enum CoreAdminOperation implements CoreAdminOp {
       LISTSNAPSHOTS,
       it -> {
         final SolrParams params = it.req.getParams();
-        String cname = params.required().get(CoreAdminParams.CORE);
+        final String coreName = params.required().get(CoreAdminParams.CORE);
 
-        CoreContainer cc = it.handler.getCoreContainer();
+        final CoreContainer coreContainer = it.handler.getCoreContainer();
+        final CoreSnapshotAPI coreSnapshotAPI =
+            new CoreSnapshotAPI(it.req, it.rsp, coreContainer, null);
 
-        try (SolrCore core = cc.getCore(cname)) {
-          if (core == null) {
-            throw new SolrException(ErrorCode.BAD_REQUEST, "Unable to locate core " + cname);
-          }
+        final CoreSnapshotAPI.ListSnapshotsResponse response =
+            coreSnapshotAPI.listSnapshots(coreName, null);

Review Comment:
   đŸ’Ŧ 2 similar findings have been found in this PR
   
   ---
   
   *NULL_DEREFERENCE:*  object `coreSnapshotAPI.coreAdminAsyncTracker` last assigned on line 288 could be null and is dereferenced by call to `listSnapshots(...)` at line 292.
   
   ---
   
   <details><summary><b>🔎 Expand here to view all instances of this finding</b></summary><br/>
   
   <div align="center">
   
   | **File Path** | **Line Number** |
   | ------------- | ------------- |
   | solr/core/src/java/org/apache/solr/handler/admin/CreateSnapshotOp.java | [38](https://github.com/Jdurham2843/solr/blob/1b14c72db477f9f66aac04313e304dcc1797b0e7/solr/core/src/java/org/apache/solr/handler/admin/CreateSnapshotOp.java#L38)|
   | solr/core/src/java/org/apache/solr/handler/admin/DeleteSnapshotOp.java | [39](https://github.com/Jdurham2843/solr/blob/1b14c72db477f9f66aac04313e304dcc1797b0e7/solr/core/src/java/org/apache/solr/handler/admin/DeleteSnapshotOp.java#L39)|
   <p><a href="https://lift.sonatype.com/results/github.com/apache/solr/01GHSAW71J7A3ZF3T03364RD45?t=Infer|NULL_DEREFERENCE" target="_blank">Visit the Lift Web Console</a> to find more details in your report.</p></div></details>
   
   
   
   ---
   
   <details><summary><b>ℹī¸ Learn about @sonatype-lift commands</b></summary>
   
   You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
   | **Command** | **Usage** |
   | ------------- | ------------- |
   | `@sonatype-lift ignore` | Leave out the above finding from this PR |
   | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
   | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
   
   **Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
   <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
   
   
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=352787933&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=352787933&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=352787933&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=352787933&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=352787933&lift_comment_rating=5) ]



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org