Github user tflobbe commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/342#discussion_r176834866
  
    --- Diff: solr/core/src/java/org/apache/solr/core/CoreContainer.java ---
    @@ -328,6 +331,38 @@ private synchronized void 
initializeAuthorizationPlugin(Map<String, Object> auth
         }
       }
     
    +  private void initializeAuditloggerPlugin(Map<String, Object> auditConf) {
    +    auditConf = Utils.getDeepCopy(auditConf, 4);
    +    //Initialize the Auditlog module
    +    SecurityPluginHolder<AuditLoggerPlugin> old = auditloggerPlugin;
    +    SecurityPluginHolder<AuditLoggerPlugin> auditloggerPlugin = null;
    +    if (auditConf != null) {
    +      String klas = (String) auditConf.get("class");
    +      if (klas == null) {
    +        throw new SolrException(ErrorCode.SERVER_ERROR, "class is required 
for auditlogger plugin");
    +      }
    +      if (old != null && old.getZnodeVersion() == readVersion(auditConf)) {
    +        return;
    +      }
    +      log.info("Initializing auditlogger plugin: " + klas);
    +      auditloggerPlugin = new 
SecurityPluginHolder<>(readVersion(auditConf),
    +          getResourceLoader().newInstance(klas, AuditLoggerPlugin.class));
    +
    +      // Read and pass the authorization context to the plugin
    +      auditloggerPlugin.plugin.init(auditConf);
    +    } else {
    +      log.debug("Security conf doesn't exist. Skipping setup for audit 
logging module.");
    +    }
    +    this.auditloggerPlugin = auditloggerPlugin;
    +    if (old != null) {
    +      try {
    +        old.plugin.close();
    +      } catch (Exception e) {
    --- End diff --
    
    But why not log it? `plugin.close()` is code that we don't know what it 
does and could be throwing an exception that operators may want to know about. 
One thing that comes to mind is some resource leak. Don't know what the 
rationale was in authplugin though.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to