You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/11/02 23:59:18 UTC

[21/50] [abbrv] lucene-solr:apiv2: SOLR-9481: Uppering debug level on the failing test and inserting extra logging. Also throw instead of swallow in case of problems parsing local security.json file

SOLR-9481: Uppering debug level on the failing test and inserting extra logging. Also throw instead of swallow in case of problems parsing local security.json file


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/dbc2bc7c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/dbc2bc7c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/dbc2bc7c

Branch: refs/heads/apiv2
Commit: dbc2bc7ce8f76b30138fc47bc5e0a98b2028d504
Parents: 42eab70
Author: Jan H�ydahl <ja...@apache.org>
Authored: Mon Oct 31 00:57:34 2016 +0100
Committer: Jan H�ydahl <ja...@apache.org>
Committed: Mon Oct 31 00:57:34 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/solr/handler/admin/SecurityConfHandler.java  | 4 ++++
 .../org/apache/solr/handler/admin/SecurityConfHandlerLocal.java  | 4 +++-
 .../test/org/apache/solr/security/BasicAuthStandaloneTest.java   | 4 ++++
 3 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dbc2bc7c/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandler.java
index 1fea431..88e4b01 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandler.java
@@ -234,6 +234,10 @@ public abstract class SecurityConfHandler extends RequestHandlerBase implements
     public SecurityConfig setData(InputStream securityJsonInputStream) {
       return setData(Utils.fromJSON(securityJsonInputStream));
     }
+
+    public String toString() {
+      return "SecurityConfig: version=" + version + ", data=" + Utils.toJSONString(data);
+    } 
   }
 }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dbc2bc7c/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java b/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java
index 34a635f..852d501 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java
@@ -56,7 +56,9 @@ public class SecurityConfHandlerLocal extends SecurityConfHandler {
     if (Files.exists(securityJsonPath)) {
       try (InputStream securityJsonIs = Files.newInputStream(securityJsonPath)) {
         return new SecurityConfig().setData(securityJsonIs);
-      } catch (IOException e) { /* Fall through */ }
+      } catch (Exception e) { 
+        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Failed opening existing security.json file: " + securityJsonPath, e);
+      }
     }
     return new SecurityConfig();
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dbc2bc7c/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java
index 55e78e7..e5fec06 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java
@@ -42,6 +42,7 @@ import org.apache.solr.common.util.Utils;
 import org.apache.solr.handler.admin.SecurityConfHandler;
 import org.apache.solr.handler.admin.SecurityConfHandlerLocalForTesting;
 import org.apache.solr.util.AbstractSolrTestCase;
+import org.apache.solr.util.LogLevel;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -82,6 +83,7 @@ public class BasicAuthStandaloneTest extends AbstractSolrTestCase {
   }
 
   @Test
+  @LogLevel("org.apache.solr=DEBUG")
   public void testBasicAuth() throws Exception {
 
     String authcPrefix = "/admin/authentication";
@@ -99,6 +101,8 @@ public class BasicAuthStandaloneTest extends AbstractSolrTestCase {
       securityConfHandler.persistConf(new SecurityConfHandler.SecurityConfig()
           .setData(Utils.fromJSONString(STD_CONF.replaceAll("'", "\""))));
       securityConfHandler.securityConfEdited();
+      log.debug("Newly written security.json is " + securityConfHandler.getSecurityConfig(false) +
+        " and baseUrl is " + baseUrl);
       verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/class", "solr.BasicAuthPlugin", 20);
 
       String command = "{\n" +