lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r1690427 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
Date Sun, 12 Jul 2015 05:37:09 GMT
Author: shalin
Date: Sun Jul 12 05:37:08 2015
New Revision: 1690427

URL: http://svn.apache.org/r1690427
Log:
SOLR-7529: CoreAdminHandler Reload throws NPE on null core name instead of a bad request error

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1690427&r1=1690426&r2=1690427&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Sun Jul 12 05:37:08 2015
@@ -167,6 +167,9 @@ Bug Fixes
 * SOLR-7705: CoreAdminHandler Unload no longer handles null core name and throws NPE
   instead of a bad request error. (John Call, Edward Ribeiro via shalin)
 
+* SOLR-7529: CoreAdminHandler Reload throws NPE on null core name instead of a bad
+  request error. (Jellyfrog, Edward Ribeiro via shalin)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java?rev=1690427&r1=1690426&r2=1690427&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
Sun Jul 12 05:37:08 2015
@@ -766,7 +766,7 @@ public class CoreAdminHandler extends Re
     SolrParams params = req.getParams();
     String cname = params.get(CoreAdminParams.CORE);
 
-    if(!coreContainer.getCoreNames().contains(cname)) {
+    if (cname == null || !coreContainer.getCoreNames().contains(cname)) {
       throw new SolrException(ErrorCode.BAD_REQUEST, "Core with core name [" + cname + "]
does not exist.");
     }
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java?rev=1690427&r1=1690426&r2=1690427&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
Sun Jul 12 05:37:08 2015
@@ -243,5 +243,21 @@ public class CoreAdminHandlerTest extend
     } catch (Exception e) {
       assertEquals("Expected error message for non-existent core.", "Core with core name
[non-existent-core] does not exist.", e.getMessage());
     }
+
+    // test null core
+    try {
+      admin.handleRequestBody(
+          req(CoreAdminParams.ACTION,
+              CoreAdminParams.CoreAdminAction.RELOAD.toString())
+          , resp);
+      fail("Was able to successfully reload null core");
+    }
+    catch (Exception e) {
+      if (!(e instanceof SolrException)) {
+        fail("Expected SolrException but got " + e);
+      }
+      assertEquals("Expected error message for non-existent core.", "Core with core name
[null] does not exist.", e.getMessage());
+    }
+
   }
 }



Mime
View raw message