This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new e23f3decded SOLR-18108: remove deprecated method from AuditEvent
(#4143)
e23f3decded is described below
commit e23f3decdedd1b09647dd83f185713d1fa54cfa6
Author: Eric Pugh <[email protected]>
AuthorDate: Mon Feb 23 10:27:14 2026 -0500
SOLR-18108: remove deprecated method from AuditEvent (#4143)
---
changelog/unreleased/SOLR-18108.yml | 8 +++++
.../java/org/apache/solr/security/AuditEvent.java | 36 +++++++---------------
.../solr/security/AuditLoggerPluginTest.java | 2 --
3 files changed, 19 insertions(+), 27 deletions(-)
diff --git a/changelog/unreleased/SOLR-18108.yml
b/changelog/unreleased/SOLR-18108.yml
new file mode 100644
index 00000000000..e80fa568e02
--- /dev/null
+++ b/changelog/unreleased/SOLR-18108.yml
@@ -0,0 +1,8 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: Remove the deprecated getRequestUrl method from AuditEvent
+type: removed # added, changed, fixed, deprecated, removed, dependency_update,
security, other
+authors:
+ - name: Eric Pugh
+links:
+ - name: SOLR-18108
+ url: https://issues.apache.org/jira/browse/SOLR-18108
diff --git a/solr/core/src/java/org/apache/solr/security/AuditEvent.java
b/solr/core/src/java/org/apache/solr/security/AuditEvent.java
index dc7de8b572b..e3367e8d8ea 100644
--- a/solr/core/src/java/org/apache/solr/security/AuditEvent.java
+++ b/solr/core/src/java/org/apache/solr/security/AuditEvent.java
@@ -19,7 +19,6 @@ package org.apache.solr.security;
import static org.apache.solr.security.AuditEvent.EventType.ANONYMOUS;
import static org.apache.solr.security.AuditEvent.EventType.ERROR;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.servlet.http.HttpServletRequest;
import java.lang.invoke.MethodHandles;
import java.security.Principal;
@@ -100,7 +99,7 @@ public class AuditEvent {
/**
* Empty event, must be filled by user using setters. Message and Loglevel
will be initialized
- * from EventType but can be overridden with setters afterwards.
+ * from EventType but can be overridden with setters afterward.
*
* @param eventType a predefined or custom EventType
*/
@@ -121,7 +120,7 @@ public class AuditEvent {
/**
* Event based on an HttpServletRequest, typically used during
authentication. Solr will fill in
- * details such as ip, http method etc from the request, and username if
Principal exists on the
+ * details such as ip, http method etc. from the request, and username if
Principal exists on the
* request.
*
* @param eventType a predefined or custom EventType
@@ -163,7 +162,7 @@ public class AuditEvent {
/**
* Event based on request and AuthorizationContext. Solr will fill in
details such as collections,
- * ip, http method etc from the context.
+ * ip, http method etc. from the context.
*
* @param eventType a predefined or custom EventType
* @param httpRequest the request to initialize from
@@ -192,7 +191,7 @@ public class AuditEvent {
/**
* Event to log completed requests. Takes time and status. Solr will fill in
details such as
- * collections, ip, http method etc from the HTTP request and context.
+ * collections, ip, http method etc. from the HTTP request and context.
*
* @param eventType a predefined or custom EventType
* @param httpRequest the request to initialize from
@@ -248,7 +247,7 @@ public class AuditEvent {
}
}
- /** The human readable message about this event */
+ /** The human-readable message about this event */
public String getMessage() {
return message;
}
@@ -267,7 +266,7 @@ public class AuditEvent {
return date;
}
- /** Username of logged in user, or null if no authenticated user */
+ /** Username of logged-in user, or null if no authenticated user */
public String getUsername() {
return username;
}
@@ -349,7 +348,7 @@ public class AuditEvent {
* Gets first value of a certain Solr request parameter
*
* @param key name of request parameter to retrieve
- * @return String value of the first value, regardless of number of valies
+ * @return String value of the first value, regardless of number of values
*/
public String getSolrParamAsString(String key) {
List<String> v = getSolrParams().get(key);
@@ -393,19 +392,6 @@ public class AuditEvent {
return exception;
}
- /**
- * Get baseUrl as StringBuffer for back compat with previous version
- *
- * @deprecated Please use {@link #getBaseUrl()} instead
- * @return StringBuffer of the base url without query part
- */
- @Deprecated
- @JsonIgnore
- @SuppressWarnings("JdkObsolete")
- public StringBuffer getRequestUrl() {
- return new StringBuffer(baseUrl);
- }
-
/**
* Full URL of the original request. This is {@link #baseUrl} + "?" + {@link
#httpQueryString}.
* Returns null if not set
@@ -580,11 +566,11 @@ public class AuditEvent {
Arrays.asList(".*/select.*", ".*/query.*");
private static final List<Pattern> ADMIN_PATH_PATTERNS =
-
ADMIN_PATH_REGEXES.stream().map(Pattern::compile).collect(Collectors.toList());
+ ADMIN_PATH_REGEXES.stream().map(Pattern::compile).toList();
private static final List<Pattern> STREAMING_PATH_PATTERNS =
-
STREAMING_PATH_REGEXES.stream().map(Pattern::compile).collect(Collectors.toList());
+ STREAMING_PATH_REGEXES.stream().map(Pattern::compile).toList();
private static final List<Pattern> INDEXING_PATH_PATTERNS =
-
INDEXING_PATH_REGEXES.stream().map(Pattern::compile).collect(Collectors.toList());
+ INDEXING_PATH_REGEXES.stream().map(Pattern::compile).toList();
private static final List<Pattern> SEARCH_PATH_PATTERNS =
-
SEARCH_PATH_REGEXES.stream().map(Pattern::compile).collect(Collectors.toList());
+ SEARCH_PATH_REGEXES.stream().map(Pattern::compile).toList();
}
diff --git
a/solr/core/src/test/org/apache/solr/security/AuditLoggerPluginTest.java
b/solr/core/src/test/org/apache/solr/security/AuditLoggerPluginTest.java
index 32dec177433..3e2b3165cca 100644
--- a/solr/core/src/test/org/apache/solr/security/AuditLoggerPluginTest.java
+++ b/solr/core/src/test/org/apache/solr/security/AuditLoggerPluginTest.java
@@ -229,8 +229,6 @@ public class AuditLoggerPluginTest extends SolrTestCaseJ4 {
@Test
public void getBaseUrl() {
assertEquals("http://myserver/mypath", EVENT_WITH_URL.getBaseUrl());
- // Deprecated
- assertEquals("http://myserver/mypath",
EVENT_WITH_URL.getRequestUrl().toString());
}
@Test