From dcf1b75a08c9bd97997231d61f53f66a1d31a7f2 Mon Sep 17 00:00:00 2001 From: congyuluo Date: Tue, 30 Jul 2024 14:04:31 -0700 Subject: [PATCH] Refactored Identifiers --- .../stirling/software/SPDF/SPdfApplication.java | 8 ++++---- .../software/SPDF/config/CleanUrlInterceptor.java | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index fb682998c8f..f49fe300024 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -79,13 +79,13 @@ public static void main(String[] args) throws IOException, InterruptedException // custom javs settings file if (Files.exists(Paths.get("configs/custom_settings.yml"))) { - String existing = propertyFiles.getOrDefault("spring.config.additional-location", ""); - if (!existing.isEmpty()) { - existing += ","; + String existingLocation = propertyFiles.getOrDefault("spring.config.additional-location", ""); + if (!existingLocation.isEmpty()) { + existingLocation += ","; } propertyFiles.put( "spring.config.additional-location", - existing + "file:configs/custom_settings.yml"); + existingLocation + "file:configs/custom_settings.yml"); } else { logger.warn("Custom configuration file 'configs/custom_settings.yml' does not exist."); } diff --git a/src/main/java/stirling/software/SPDF/config/CleanUrlInterceptor.java b/src/main/java/stirling/software/SPDF/config/CleanUrlInterceptor.java index 8c1ed05f2a3..0fb1e26fc99 100644 --- a/src/main/java/stirling/software/SPDF/config/CleanUrlInterceptor.java +++ b/src/main/java/stirling/software/SPDF/config/CleanUrlInterceptor.java @@ -32,25 +32,25 @@ public boolean preHandle( String queryString = request.getQueryString(); if (queryString != null && !queryString.isEmpty()) { String requestURI = request.getRequestURI(); - Map parameters = new HashMap<>(); + Map allowedParameters = new HashMap<>(); // Keep only the allowed parameters String[] queryParameters = queryString.split("&"); for (String param : queryParameters) { - String[] keyValue = param.split("="); - if (keyValue.length != 2) { + String[] keyValuePair = param.split("="); + if (keyValuePair.length != 2) { continue; } - if (ALLOWED_PARAMS.contains(keyValue[0])) { - parameters.put(keyValue[0], keyValue[1]); + if (ALLOWED_PARAMS.contains(keyValuePair[0])) { + allowedParameters.put(keyValuePair[0], keyValuePair[1]); } } // If there are any parameters that are not allowed - if (parameters.size() != queryParameters.length) { + if (allowedParameters.size() != queryParameters.length) { // Construct new query string StringBuilder newQueryString = new StringBuilder(); - for (Map.Entry entry : parameters.entrySet()) { + for (Map.Entry entry : allowedParameters.entrySet()) { if (newQueryString.length() > 0) { newQueryString.append("&"); }