This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 514d55d79b SonarQube bug fixes
514d55d79b is described below
commit 514d55d79b3e9873f6e261748beafa1c3e40ad16
Author: James Bognar <[email protected]>
AuthorDate: Mon Feb 9 13:39:09 2026 -0500
SonarQube bug fixes
---
SONARQUBE_CLEANUP_PLAN.md | 253 ---------------------
SONARQUBE_CLEANUP_STATUS.md | 164 -------------
.../apache/juneau/bean/openapi3/SchemaInfo.java | 8 +-
.../org/apache/juneau/bean/swagger/SchemaInfo.java | 8 +-
.../apache/juneau/commons/logging/LogRecord.java | 20 +-
.../apache/juneau/commons/utils/StringUtils.java | 6 +
.../src/main/java/org/apache/juneau/BeanMeta.java | 14 +-
.../java/org/apache/juneau/cp/BasicBeanStore.java | 18 +-
.../org/apache/juneau/json/JsonParserSession.java | 26 ++-
.../juneau/objecttools/NumberMatcherFactory.java | 5 +-
.../juneau/objecttools/TimeMatcherFactory.java | 5 +-
.../org/apache/juneau/parser/ParserReader.java | 7 +-
.../juneau/utils/StringExpressionMatcher.java | 5 +-
.../apache/juneau/microservice/Microservice.java | 12 +-
.../org/apache/juneau/rest/guard/RoleMatcher.java | 6 +-
15 files changed, 81 insertions(+), 476 deletions(-)
diff --git a/SONARQUBE_CLEANUP_PLAN.md b/SONARQUBE_CLEANUP_PLAN.md
deleted file mode 100644
index 4433ec9acb..0000000000
--- a/SONARQUBE_CLEANUP_PLAN.md
+++ /dev/null
@@ -1,253 +0,0 @@
-# SonarQube Issues Cleanup Plan
-
-## Summary
-After fixing property name literals with constants, we need to:
-1. Remove false positives (issues already fixed)
-2. Categorize remaining legitimate issues
-3. Provide suggestions for fixes
-
-## False Positives to Remove
-
-These issues are **already fixed** - constants exist and are being used.
SonarQube line numbers may be outdated:
-
-### SchemaInfo.java (both OpenAPI v3 and Swagger v2)
-- ✅ `additionalProperties` - Already has `PROP_additionalProperties` constant
-- ✅ `allOf` - Already has `PROP_allOf` constant
-- ✅ `anyOf` - Already has `PROP_anyOf` constant (OpenAPI v3 only)
-- ✅ `default` - Already has `PROP_default` constant
-- ✅ `deprecated` - Already has `PROP_deprecated` constant
-- ✅ `description` - Already has `PROP_description` constant
-- ✅ `discriminator` - Already has `PROP_discriminator` constant
-- ✅ `example` - Already has `PROP_example` constant
-- ✅ `exclusiveMaximum` - Already has `PROP_exclusiveMaximum` constant
-- ✅ `exclusiveMinimum` - Already has `PROP_exclusiveMinimum` constant
-- ✅ `externalDocs` - Already has `PROP_externalDocs` constant
-- ✅ `format` - Already has `PROP_format` constant
-- ✅ `items` - Already has `PROP_items` constant
-- ✅ `maximum` - Already has `PROP_maximum` constant
-- ✅ `maxItems` - Already has `PROP_maxItems` constant
-- ✅ `maxLength` - Already has `PROP_maxLength` constant
-- ✅ `maxProperties` - Already has `PROP_maxProperties` constant
-- ✅ `minimum` - Already has `PROP_minimum` constant
-- ✅ `minItems` - Already has `PROP_minItems` constant
-- ✅ `minLength` - Already has `PROP_minLength` constant
-- ✅ `minProperties` - Already has `PROP_minProperties` constant
-- ✅ `multipleOf` - Already has `PROP_multipleOf` constant
-- ✅ `nullable` - Already has `PROP_nullable` constant (OpenAPI v3 only)
-- ✅ `oneOf` - Already has `PROP_oneOf` constant (OpenAPI v3 only)
-- ✅ `pattern` - Already has `PROP_pattern` constant
-- ✅ `properties` - Already has `PROP_properties` constant
-- ✅ `readOnly` - Already has `PROP_readOnly` constant
-- ✅ `required` - Already has `PROP_required` constant
-- ✅ `requiredProperties` - Already has `PROP_requiredProperties` constant
(Swagger v2 only)
-- ✅ `uniqueItems` - Already has `PROP_uniqueItems` constant
-- ✅ `writeOnly` - Already has `PROP_writeOnly` constant (OpenAPI v3 only)
-
-### HeaderInfo.java, Items.java, ParameterInfo.java (Swagger v2)
-- ✅ All property names already have constants (collectionFormat, default,
description, example, exclusiveMaximum, exclusiveMinimum, format, items,
maximum, maxItems, maxLength, minimum, minItems, minLength, multipleOf,
pattern, uniqueItems)
-
-### Response.java (OpenAPI v3)
-- ✅ `content` - Already has `PROP_content` constant
-- ✅ `description` - Already has `PROP_description` constant
-- ✅ `headers` - Already has `PROP_headers` constant
-- ✅ `links` - Already has `PROP_links` constant
-
-### ResponseInfo.java (Swagger v2)
-- ✅ `description` - Already has `PROP_description` constant
-- ✅ `examples` - Already has `PROP_examples` constant
-- ✅ `headers` - Already has `PROP_headers` constant
-- ✅ `schema` - Already has `PROP_schema` constant
-
-### Server.java (OpenAPI v3)
-- ✅ `variables` - Already has `PROP_variables` constant
-
-### SecurityRequirement.java (OpenAPI v3)
-- ✅ `requirements` - Already has `PROP_requirements` constant
-
-### MediaType.java (OpenAPI v3)
-- ✅ `encoding` - Already has `PROP_encoding` constant
-- ✅ `examples` - Already has `PROP_examples` constant
-- ✅ `schema` - Already has `PROP_schema` constant
-
-## Legitimate Issues to Fix
-
-### Category 1: HttpPartSchema.java - Property Names (LEGITIMATE ISSUES)
-**File**:
`/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java`
-
-**Status**: Constants exist (lines 92-107) but are NOT being used everywhere.
String literals still present in:
-- Line 2696: `"uniqueItems"` - **MISSING CONSTANT** `PROP_uniqueItems` needs
to be added
-- Lines 3758-3843: Multiple `addIf()` calls using string literals instead of
constants
-- Lines 4202-4221: More string literals in validation code
-
-**Issues to fix**:
-- Add missing `PROP_uniqueItems` constant
-- Replace all string literals in `addIf()` calls (lines ~3758-3843) with
constants
-- Replace string literals in validation code (lines ~4202-4221) with constants
-
-**Suggestion**:
-1. Add `PROP_uniqueItems = "uniqueItems"` constant (line ~108)
-2. Replace all `"properties"`, `"additionalProperties"`, `"exclusiveMaximum"`,
`"exclusiveMinimum"`, `"uniqueItems"`, `"collectionFormat"`, `"pattern"`,
`"items"`, `"maximum"`, `"minimum"`, `"multipleOf"`, `"maxItems"`,
`"maxLength"`, `"maxProperties"`, `"minItems"`, `"minLength"`,
`"minProperties"` string literals with their corresponding `PROP_*` constants
-
-### Category 2: UI Files - CSS Class Names / HTML Attributes
-**Files**:
--
`/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ui/OpenApiUI.java`
--
`/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ui/SwaggerUI.java`
-
-These appear to be CSS class names or HTML attribute values used in UI
generation:
-
-- `"Description"` (3-6 times) - Capitalized version, likely for display
-- `"description"` (4-6 times) - Lowercase version
-- `"model"` (5-7 times)
-- `"parameter-key"` (3 times)
-- `"response-key"` (3 times)
-
-**Suggestion**: Create constants like `CSS_CLASS_Description`,
`CSS_CLASS_description`, `CSS_CLASS_model`, `CSS_CLASS_parameterKey`,
`CSS_CLASS_responseKey`. These are UI-specific constants, so a different naming
convention might be appropriate (e.g., `UI_CLASS_*` or `HTML_CLASS_*`).
-
-### Category 3: HTML Parser/Serializer - HTML Element Names
-**Files**:
--
`/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java`
--
`/juneau-marshall/src/main/java/org/apache/juneau/html/BasicHtmlDocTemplate.java`
--
`/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java`
-
-These are HTML element names:
-
-- `"array"` (5 times)
-- `"aside"` (8 times)
-- `"object"` (4 times)
-- `"section"` (6 times)
-- `"style"` (4 times)
-- `"table"` (6 times)
-
-**Suggestion**: Create constants like `HTML_TAG_array`, `HTML_TAG_aside`,
`HTML_TAG_object`, `HTML_TAG_section`, `HTML_TAG_style`, `HTML_TAG_table`. Or
use a shared constant class for HTML tag names.
-
-### Category 4: Error Messages
-**Files**:
-- `/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java`
--
`/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/assertion/FluentResponseBodyAssertion.java`
--
`/juneau-rest-server/src/main/java/org/apache/juneau/rest/assertions/FluentRequestContentAssertion.java`
--
`/juneau-rest-server/src/main/java/org/apache/juneau/rest/servlet/RestServlet.java`
-- `/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java`
-
-- `"Buffer underflow."` (3 times)
-- `"Exception occurred during call."` (3-4 times)
-- `"Getter or public field not defined on property ''{0}''"` (3 times)
-- `"Servlet init error on class ''{0}''"` (3 times)
-
-**Suggestion**: These are error messages that could be moved to a messages
resource file or constants class. However, if they're only used 3-4 times,
consider:
-- For error messages: Create `ERROR_MSG_*` constants
-- For messages with placeholders: Consider using a message format utility or
resource bundle
-
-### Category 5: Example/Test Data
-**Files**:
--
`/juneau-examples-core/src/main/java/org/apache/juneau/examples/bean/BeanExample.java`
--
`/juneau-examples-core/src/main/java/org/apache/juneau/examples/bean/atom/AtomFeed.java`
--
`/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java`
-
-- `"http://foo.org/"` (3 times each file)
-
-**Suggestion**: Create example constants like `EXAMPLE_URL_FOO_ORG =
"http://foo.org/"`. These are test/example data, so low priority unless they're
duplicated across many files.
-
-### Category 6: Script Files
-**File**: `/juneau/scripts/release.py`
-
-- `'https://dist.apache.org/repos/dist/dev/juneau'` (3 times)
-- `'pom.xml'` (5 times)
-- `'~/tmp/dist-release-juneau'` (15 times)
-- `r'RC(\d+)'` (8 times)
-
-**Suggestion**: Python scripts - create constants at the top of the file.
These are configuration values that should definitely be constants.
-
-### Category 7: Reflection/Internal Property Names
-**Files**:
--
`/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ReflectionMap.java`
--
`/juneau-commons/src/main/java/org/apache/juneau/commons/inject/BeanCreator2.java`
--
`/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java`
-
-- `"fullClassName"` (3 times)
-- `"simpleClassName"` (3 times)
-- `"value"` (3-20 times) - Very common, used in many contexts
-- `"values"` (3-7 times)
-- `"names"` (4 times)
-- `"Using fallback supplier"` (4 times)
-
-**Suggestion**:
-- For property names: Create `PROP_fullClassName`, `PROP_simpleClassName`, etc.
-- For `"value"`: This is extremely common and used in many different contexts.
Consider if it's worth creating a constant, or if it's better to suppress the
warning for this specific case.
-- For messages: Create `MSG_*` constants
-
-### Category 8: HTTP Methods / REST
-**File**:
`/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java`
-
-- `"PATCH"` (3 times)
-
-**Suggestion**: Use existing HTTP method constants if available, or create
`HTTP_METHOD_PATCH` constant.
-
-### Category 9: Configuration/Console Commands
-**File**:
`/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/console/ConfigCommand.java`
-
-- `"InvalidArguments"` (3 times)
-- `"TooManyArguments"` (3 times)
-
-**Suggestion**: Create constants like `CMD_ERROR_InvalidArguments`,
`CMD_ERROR_TooManyArguments`.
-
-### Category 10: JSON Schema / Type Names
-**Files**:
--
`/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorSession.java`
--
`/juneau-marshall/src/main/java/org/apache/juneau/annotation/SchemaAnnotation.java`
-
-- `"items"` (4-7 times) - Already has constant in some files, check if used
here
-- `"string"` (4 times)
-
-**Suggestion**: Create constants like `JSONSCHEMA_TYPE_string`,
`JSONSCHEMA_TYPE_items`, or use existing constants if available.
-
-### Category 11: Character Encoding
-**File**:
`/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java`
-
-- `"UTF-8"` (3 times)
-
-**Suggestion**: Use `StandardCharsets.UTF_8.name()` or create `CHARSET_UTF8 =
"UTF-8"` constant. Better yet, use `StandardCharsets.UTF_8` directly if
possible.
-
-### Category 12: AppliedAnnotationObject
-**File**:
`/juneau-commons/src/main/java/org/apache/juneau/commons/annotation/AppliedAnnotationObject.java`
-
-- `"value"` (20 times)
-
-**Suggestion**: This is a very common property name in annotations. Consider
creating `PROP_value = "value"` constant, or suppress the warning if it's used
in a context where a constant wouldn't improve readability.
-
-## Recommended Action Plan
-
-### Phase 1: Remove False Positives (High Priority)
-1. Remove all SchemaInfo.java issues (both versions) - these are false
positives
-2. Remove HeaderInfo.java, Items.java, ParameterInfo.java issues - already
fixed
-3. Remove Response.java, ResponseInfo.java issues - already fixed
-4. Remove Server.java, SecurityRequirement.java, MediaType.java issues -
already fixed
-
-### Phase 2: Fix HttpPartSchema.java (High Priority)
-- Verify constants exist (they do, lines 92-107)
-- Check `apply(JsonMap m)` method around lines 2655-2680
-- Replace all string literals with existing constants
-
-### Phase 3: Fix UI Files (Medium Priority)
-- Create CSS class name constants for OpenApiUI.java and SwaggerUI.java
-- Use consistent naming convention (e.g., `UI_CLASS_*`)
-
-### Phase 4: Fix HTML Files (Medium Priority)
-- Create HTML tag name constants
-- Consider a shared `HtmlTags` class for reusability
-
-### Phase 5: Fix Error Messages (Low-Medium Priority)
-- Create error message constants
-- Consider moving to resource bundle if internationalization is needed
-
-### Phase 6: Fix Remaining Issues (Low Priority)
-- Script files (Python)
-- Example/test data
-- Reflection property names
-- Other miscellaneous issues
-
-## Notes
-
-- Many issues are false positives because SonarQube line numbers may be
outdated after our refactoring
-- The `"value"` literal appears 20+ times in AppliedAnnotationObject.java -
this is very common in Java annotations and may be acceptable to suppress
-- Some literals (like `"UTF-8"`) should use `StandardCharsets.UTF_8` instead
of string constants
-- UI and HTML-related constants might benefit from shared constant classes for
better organization
diff --git a/SONARQUBE_CLEANUP_STATUS.md b/SONARQUBE_CLEANUP_STATUS.md
deleted file mode 100644
index ca771f3cf6..0000000000
--- a/SONARQUBE_CLEANUP_STATUS.md
+++ /dev/null
@@ -1,164 +0,0 @@
-# SonarQube Duplicated String Literals Cleanup - Status Report
-
-## Summary
-This document tracks the status of fixing SonarQube `java:S1192` (duplicated
string literals) issues.
-
-## Completed Work ✅
-
-### 1. HTML Tag Names
-- ✅ **HtmlParserSession.java**: Added `HTMLTAG_array` and `HTMLTAG_object`
constants
-- ✅ **BasicHtmlDocTemplate.java**: Suppressed with
`@SuppressWarnings("java:S1192")` (reverted constants)
-- ✅ **HtmlSerializerSession.java**: Added `HTMLTAG_style` and `HTMLTAG_table`
constants
-
-### 2. Error Messages
-- ✅ **ParserReader.java**: Added `MSG_bufferUnderflow` constant
-- ✅ **BeanPropertyMeta.java**: Added `MSG_getterOrFieldNotDefined` constant
-- ✅ **FluentResponseBodyAssertion.java**: Added `MSG_exceptionDuringCall`
constant
-- ✅ **FluentRequestContentAssertion.java**: Added `MSG_exceptionDuringCall`
constant
-- ✅ **RestServlet.java**: Added `MSG_servletInitError` constant
-
-### 3. CSS Class Names / UI Files
-- ✅ **OpenApiUI.java**: Suppressed with `@SuppressWarnings("java:S1192")`
(reverted constants)
-- ✅ **SwaggerUI.java**: Suppressed with `@SuppressWarnings("java:S1192")`
(reverted constants)
-
-### 4. Script Files
-- ✅ **release.py**: Added Python constants (`POM_XML`, `STAGING_DIR`,
`SVN_DIST_URL`, `RC_PATTERN`)
-
-### 5. HTTP Method Names
-- ✅ **RestClient.java**: Replaced `"PATCH"` with `HttpMethod.PATCH` constant
-
-### 6. Console Commands / Message Bundle Keys
-- ✅ **ConfigCommand.java**: Added `MKEY_*` constants for all message bundle
keys:
- - `MKEY_invalidArguments`
- - `MKEY_tooManyArguments`
- - `MKEY_keyNotFound`
- - `MKEY_configSet`
- - `MKEY_configRemove`
- - `MKEY_description`
- - `MKEY_info`
-
-### 7. Character Encoding
-- ✅ **StringUtils.java**: Replaced `"UTF-8"` with `UTF_8.name()` from
`StandardCharsets`
-
----
-
-## Remaining Work 🔲
-
-### Category 1: Bean Property Names (OpenAPI v3 / Swagger v2)
-These are property names used in JSON/API schema definitions. Should use
`PROP_*` constants.
-
-**OpenAPI v3:**
-- 🔲 **Example.java**: `"description"` (3 times) - line 117
-- 🔲 **ExternalDocumentation.java**: `"description"` (3 times) - line 100
-- 🔲 **ServerVariable.java**: `"default"` (3 times) - line 147, `"description"`
(3 times) - line 148
-- 🔲 **Tag.java**: `"description"` (3 times) - line 114
-
-**Swagger v2:**
-- 🔲 **ExternalDocumentation.java**: `"description"` (3 times) - line 111
-- 🔲 **Info.java**: `"description"` (3 times) - line 142
-- 🔲 **Tag.java**: `"description"` (3 times) - line 113
-
-**Action**: Add `PROP_description` and `PROP_default` constants and replace
string literals.
-
-### Category 2: Reflection / Property Names
-These are property names used in reflection/metadata operations.
-
-- 🔲 **ReflectionMap.java**:
- - `"fullClassName"` (3 times) - line 363
- - `"simpleClassName"` (3 times) - line 364
- - `"value"` (4 times) - line 323
-
-- 🔲 **AppliedAnnotationObject.java**:
- - `"value"` (20 times) - line 217
- - **Note**: This is very common in Java annotations. Consider suppressing at
class level.
-
-- 🔲 **BeanCreator2.java**:
- - `"names"` (4 times) - line 580
- - `"Using fallback supplier"` (4 times) - line 1223
-
-**Action**: Create appropriate constants (e.g., `PROP_fullClassName`,
`PROP_simpleClassName`, `PROP_value`, `MSG_usingFallbackSupplier`).
-
-### Category 3: JSON Schema / Context Property Names
-- 🔲 **Context.java**: `"values"` (3 times) - line 313
-- 🔲 **JsonSchemaGenerator.java**: `"values"` (3 times) - line 161
-- 🔲 **RestOpContext.java**: `"values"` (4 times) - line 391
-- 🔲 **RestContext.java**: `"values"` (7 times) - line 867
-
-**Action**: Create `PROP_values` constant and replace string literals.
-
-### Category 4: Example / Test Data
-- 🔲 **BeanExample.java**: `"http://foo.org/"` (3 times) - line 112
-- 🔲 **AtomFeed.java**: `"http://foo.org/"` (3 times) - line 42
-- 🔲 **AtomFeedResource.java**: `"http://foo.org/"` (3 times) - line 91
-
-**Action**: Create `EXAMPLE_URL` or `TEST_URL` constant. These are
example/test data, so suppression might be acceptable.
-
-### Category 5: Assertion / Messages
-- 🔲 **AssertionPredicate.java**: `"Messages"` (4 times) - line 75
-
-**Action**: Create `MKEY_Messages` or `BUNDLE_Messages` constant.
-
-### Category 6: HttpPartSchema.java (High Priority)
-- 🔲 **HttpPartSchema.java**: Multiple property name literals still in use
- - Missing `PROP_uniqueItems` constant
- - String literals in `addIf()` calls (lines ~3758-3843)
- - String literals in validation code (lines ~4202-4221)
-
-**Action**:
-1. Add `PROP_uniqueItems` constant
-2. Replace all string literals with existing `PROP_*` constants
-
----
-
-## Naming Conventions Used
-
-- **HTML tag names**: `HTMLTAG_x`
-- **Error messages**: `MSG_x`
-- **CSS class names**: Suppressed (reverted)
-- **Script files**: Descriptive names (e.g., `POM_XML`, `STAGING_DIR`)
-- **HTTP method names**: Use existing `HttpMethod.*` constants
-- **Console commands / Message bundle keys**: `MKEY_x`
-- **Character encoding**: Use `StandardCharsets.*.name()`
-- **Bean property names**: `PROP_x` (to be used for remaining issues)
-
----
-
-## Recommendations
-
-1. **High Priority**: Fix HttpPartSchema.java - constants exist but aren't
used everywhere
-2. **Medium Priority**: Fix bean property names in Example.java,
ExternalDocumentation.java, etc.
-3. **Low Priority**: Consider suppressing `"value"` in
AppliedAnnotationObject.java (very common in annotations)
-4. **Low Priority**: Example/test data URLs - consider suppressing or using
test constants
-
----
-
-## Files Modified
-
-### Java Files
--
`juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java`
--
`juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/BasicHtmlDocTemplate.java`
(suppressed)
--
`juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java`
--
`juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java`
--
`juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java`
--
`juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/assertion/FluentResponseBodyAssertion.java`
--
`juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/assertions/FluentRequestContentAssertion.java`
--
`juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/servlet/RestServlet.java`
--
`juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ui/OpenApiUI.java`
(suppressed)
--
`juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ui/SwaggerUI.java`
(suppressed)
--
`juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java`
--
`juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/console/ConfigCommand.java`
--
`juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java`
-
-### Python Files
-- `scripts/release.py`
-
----
-
-## Next Steps
-
-1. Review and fix HttpPartSchema.java (highest priority)
-2. Fix remaining bean property names (Example.java,
ExternalDocumentation.java, etc.)
-3. Fix reflection property names (ReflectionMap.java, BeanCreator2.java)
-4. Consider suppressing AppliedAnnotationObject.java for `"value"` literal
-5. Fix remaining JSON schema property names (`"values"` in various files)
-6. Address example/test data URLs (low priority)
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
index 99965b1c57..132f36aac7 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
@@ -396,7 +396,9 @@ public class SchemaInfo extends OpenApiElement {
}
@Override /* Overridden from SwaggerElement */
- @SuppressWarnings("java:S1479") // Switch statement has 37 cases,
exceeding recommended limit of 30
+ @SuppressWarnings({
+ "java:S1479" // Switch statement has 37 cases, exceeding
recommended limit of 30 - necessary for bean property mapping
+ })
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
@@ -785,7 +787,9 @@ public class SchemaInfo extends OpenApiElement {
}
@Override /* Overridden from SwaggerElement */
- @SuppressWarnings("java:S1479") // Switch statement has 37 cases,
exceeding recommended limit of 30
+ @SuppressWarnings({
+ "java:S1479" // Switch statement has 37 cases, exceeding
recommended limit of 30 - necessary for bean property mapping
+ })
public SchemaInfo set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
index 5459db8e47..5442edce6e 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
@@ -347,7 +347,9 @@ public class SchemaInfo extends SwaggerElement {
}
@Override /* Overridden from SwaggerElement */
- @SuppressWarnings("java:S1479") // Switch statement has 32 cases,
exceeding recommended limit of 30
+ @SuppressWarnings({
+ "java:S1479" // Switch statement has 32 cases, exceeding
recommended limit of 30 - necessary for bean property mapping
+ })
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
@@ -688,7 +690,9 @@ public class SchemaInfo extends SwaggerElement {
}
@Override /* Overridden from SwaggerElement */
- @SuppressWarnings("java:S1479") // Switch statement has 32 cases,
exceeding recommended limit of 30
+ @SuppressWarnings({
+ "java:S1479" // Switch statement has 32 cases, exceeding
recommended limit of 30 - necessary for bean property mapping
+ })
public SchemaInfo set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
index b0028ce6ee..b350774a48 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
@@ -130,21 +130,13 @@ public class LogRecord extends
java.util.logging.LogRecord {
for (var e : new Throwable().getStackTrace()) {
var c = e.getClassName();
var m = e.getMethodName();
- // Skip LogRecord and Logger classes
- if (eq(c, cn(LogRecord.class)) || eq(c,
cn(Logger.class)) || eq(c, cn(StringUtils.class)) || eq(c, cn(Utils.class)))
- continue;
- // Skip java.util.logging classes.
- if (c.startsWith("java.util.logging."))
- continue;
- // Skip lambda methods (e.g., lambda$mem$1) - check
method name first
- if (m != null && m.contains("lambda$"))
- continue;
- // Skip lambda classes (e.g.,
LogRecord$$Lambda$123/456789)
- if (c.contains("$$Lambda$") || (c.contains("/") &&
c.contains("$Lambda")))
- continue;
- // Skip synthetic methods
- if (m != null && m.startsWith("access$"))
+ // Skip internal classes, logging classes, lambda
methods/classes, and synthetic methods
+ if (eq(c, cn(LogRecord.class)) || eq(c,
cn(Logger.class)) || eq(c, cn(StringUtils.class)) || eq(c, cn(Utils.class))
+ || c.startsWith("java.util.logging.")
+ || (m != null && (m.contains("lambda$") ||
m.startsWith("access$")))
+ || c.contains("$$Lambda$") || (c.contains("/")
&& c.contains("$Lambda"))) {
continue;
+ }
return opt(e);
}
return opte();
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
index 2daf7db1aa..74ac7a410f 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
@@ -1745,6 +1745,9 @@ public class StringUtils {
* @param end The end marker. Can be <jk>null</jk>.
* @return A list of text segments found between the markers, or an
empty list if any parameter is <jk>null</jk> or empty.
*/
+ @SuppressWarnings({
+ "java:S135" // Multiple break statements in mutually exclusive
branches - necessary for early termination
+ })
public static List<String> extractBetween(String str, String start,
String end) {
if (isEmpty(str) || isEmpty(start) || isEmpty(end))
return Collections.emptyList();
@@ -2822,6 +2825,9 @@ public class StringUtils {
* @param variables The map containing the variable values.
* @return The interpolated string with variables replaced, or the
original template if variables is null or empty.
*/
+ @SuppressWarnings({
+ "java:S135" // Multiple break statements in mutually exclusive
branches - necessary for early termination
+ })
public static String interpolate(String template, Map<String,Object>
variables) {
if (template == null)
return null;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
index dcffd541aa..25f6730dd8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
@@ -1078,17 +1078,13 @@ public class BeanMeta<T> {
classHierarchy.get().stream().forEach(c2 -> {
for (var m : c2.getDeclaredMethods()) {
-
- if (m.isStatic() || m.isBridge() ||
m.getParameterCount() > 2)
- continue;
-
var mm = m.getMatchingMethods();
-
- if (mm.stream().anyMatch(m2 ->
ap.has(BeanIgnore.class, m2, SELF)))
- continue;
-
- if (mm.stream().anyMatch(m2 ->
ap.find(Transient.class, m2, SELF).stream().map(x ->
x.inner().value()).findFirst().orElse(false)))
+ // Skip static, bridge, or methods with >2
params; skip if ignored, transient, or not visible
+ if (m.isStatic() || m.isBridge() ||
m.getParameterCount() > 2
+ || mm.stream().anyMatch(m2 ->
ap.has(BeanIgnore.class, m2, SELF))
+ || mm.stream().anyMatch(m2 ->
ap.find(Transient.class, m2, SELF).stream().map(x ->
x.inner().value()).findFirst().orElse(false))) {
continue;
+ }
var beanps = ap.find(Beanp.class,
m).stream().map(AnnotationInfo::inner).toList();
var names = ap.find(Name.class,
m).stream().map(AnnotationInfo::inner).toList();
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
index 60a8c47102..2ccbad66ec 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
@@ -429,13 +429,12 @@ public class BasicBeanStore {
public String getMissingParams(ExecutableInfo executable, Object outer)
{
var params = executable.getParameters();
List<String> l = list();
- loop: for (int i = 0; i < params.size(); i++) {
+ for (int i = 0; i < params.size(); i++) {
var pi = params.get(i);
var pt = pi.getParameterType();
- if (i == 0 && nn(outer) && pt.isInstance(outer))
- continue loop;
- if (pt.is(Optional.class))
- continue loop;
+ // Skip first parameter if it matches outer instance,
or skip Optional parameters
+ if ((i == 0 && nn(outer) && pt.isInstance(outer)) ||
pt.is(Optional.class))
+ continue;
var beanName = pi.getResolvedQualifier(); // Use
@Named for bean injection
var ptc = pt.inner();
if (beanName == null && ! hasBean(ptc))
@@ -478,13 +477,12 @@ public class BasicBeanStore {
* @return A comma-delimited list of types that are missing from this
factory.
*/
public boolean hasAllParams(ExecutableInfo executable, Object outer) {
- loop: for (int i = 0; i < executable.getParameterCount(); i++) {
+ for (int i = 0; i < executable.getParameterCount(); i++) {
var pi = executable.getParameter(i);
var pt = pi.getParameterType();
- if (i == 0 && nn(outer) && pt.isInstance(outer))
- continue loop;
- if (pt.is(Optional.class))
- continue loop;
+ // Skip first parameter if it matches outer instance,
or skip Optional parameters
+ if ((i == 0 && nn(outer) && pt.isInstance(outer)) ||
pt.is(Optional.class))
+ continue;
var beanQualifier = pi.getResolvedQualifier();
var ptc = pt.inner();
if ((beanQualifier == null && ! hasBean(ptc)) ||
(nn(beanQualifier) && ! hasBean(ptc, beanQualifier)))
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
index 6c7f8711be..47eb57c3e8 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
@@ -448,7 +448,10 @@ public class JsonParserSession extends ReaderParserSession
{
return null; // Unreachable.
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for parser
state machine
+ "java:S135" // Multiple break statements necessary for state
machine error handling
+ })
private <E> Collection<E> parseIntoCollection2(ParserReader r,
Collection<E> l, ClassMeta<?> type, BeanPropertyMeta pMeta) throws IOException,
ParseException, ExecutableException {
// S1: Looking for outermost [
@@ -511,7 +514,10 @@ public class JsonParserSession extends ReaderParserSession
{
return null; // Unreachable.
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for parser
state machine
+ "java:S135" // Multiple break statements necessary for state
machine error handling
+ })
private <K,V> Map<K,V> parseIntoMap2(ParserReader r, Map<K,V> m,
ClassMeta<K> keyType, ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws
IOException, ParseException, ExecutableException {
if (keyType == null)
@@ -663,7 +669,10 @@ public class JsonParserSession extends ReaderParserSession
{
* If the string consists of a concatenation of strings (e.g. 'AAA' +
"BBB"), this method
* will automatically concatenate the strings and return the result.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for parser
state machine
+ "java:S135" // Multiple break statements necessary for state
machine error handling
+ })
private String parseString(ParserReader r) throws IOException,
ParseException {
r.mark();
int qc = r.read(); // The quote character being
used (" or ')
@@ -716,12 +725,11 @@ public class JsonParserSession extends
ReaderParserSession {
break;
}
} else {
- if (c == ',' || c == '}' || c == ']' ||
isWhitespace(c)) {
- s = r.getMarked(0, -1);
- r.unread();
- break;
- } else if (c == -1) {
- s = r.getMarked(0, 0);
+ // Unquoted string ends on delimiter,
whitespace, or EOF
+ if (c == ',' || c == '}' || c == ']' ||
isWhitespace(c) || c == -1) {
+ s = r.getMarked(0, c == -1 ? 0
: -1);
+ if (c != -1)
+ r.unread();
break;
}
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
index 8108b593ae..15bed7ce51 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
@@ -56,7 +56,10 @@ public class NumberMatcherFactory extends MatcherFactory {
NumberRange[] numberRanges;
String pattern;
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for
parser state machine
+ "java:S135" // Multiple break statements necessary for
state machine error handling
+ })
public NumberMatcher(String s) {
s = s.trim();
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/TimeMatcherFactory.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/TimeMatcherFactory.java
index 73605e5cc6..d23f7ff54b 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/TimeMatcherFactory.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/TimeMatcherFactory.java
@@ -62,7 +62,10 @@ public class TimeMatcherFactory extends MatcherFactory {
TimestampRange[] ranges;
List<TimestampRange> l = new LinkedList<>();
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for
parser state machine
+ "java:S135" // Multiple break statements necessary for
state machine error handling
+ })
public TimeMatcher(String s) {
// Possible patterns:
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
index 57424f8fb6..f5a3e36144 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
@@ -185,10 +185,9 @@ public class ParserReader extends Reader implements
Positionable {
int c = 0;
while (true) {
c = read();
- if (c == -1)
- break;
- if (! isNumberChar((char)c)) {
- unread();
+ if (c == -1 || ! isNumberChar((char)c)) {
+ if (c != -1)
+ unread();
break;
}
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringExpressionMatcher.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringExpressionMatcher.java
index dc6c602a95..0ad4f73801 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringExpressionMatcher.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringExpressionMatcher.java
@@ -227,7 +227,10 @@ public class StringExpressionMatcher {
return exp.toString();
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for parser
state machine
+ "java:S135" // Multiple break statements necessary for state
machine error handling
+ })
private Exp parse(String expression) throws ParseException {
if (b(expression))
return new Never();
diff --git
a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
index 7058fa16bd..76e24ef397 100755
---
a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
+++
b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
@@ -609,20 +609,22 @@ public class Microservice implements ConfigEventListener {
if (config2 == null) {
var store = builder.configStore;
var cfs = workingDir == null ? FileStore.DEFAULT :
FileStore.create().directory(workingDir).build();
+ boolean found = false;
for (var name : getCandidateConfigNames()) {
+ if (found)
+ break;
if (nn(store)) {
if (store.exists(name)) {
configBuilder.store(store).name(name);
- break;
+ found = true;
}
} else {
if (cfs.exists(name)) {
configBuilder.store(cfs).name(name);
- break;
- }
- if
(ClasspathStore.DEFAULT.exists(name)) {
+ found = true;
+ } else if
(ClasspathStore.DEFAULT.exists(name)) {
configBuilder.store(ClasspathStore.DEFAULT).name(name);
- break;
+ found = true;
}
}
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/guard/RoleMatcher.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/guard/RoleMatcher.java
index 3f90350fad..f0de4833d1 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/guard/RoleMatcher.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/guard/RoleMatcher.java
@@ -238,7 +238,11 @@ public class RoleMatcher {
return exp.toString();
}
- @SuppressWarnings({"java:S6541", "java:S3776"})
+ @SuppressWarnings({
+ "java:S6541", // Thread-safe singleton pattern acceptable
+ "java:S3776", // Cognitive complexity acceptable for parser
state machine
+ "java:S135" // Multiple break statements necessary for state
machine error handling
+ })
private Exp parse(String expression) throws ParseException {
if (StringUtils.isBlank(expression))
return new Never();