Skip to content

Conversation

@balazs-szucs
Copy link
Collaborator

Description of Changes

This pull request primarily focuses on code quality improvements and minor refactoring across several modules. The main themes are: refactoring for clarity and efficiency, standardizing file extension and quote removal logic in controllers, and minor bug fixes and consistency improvements. No major new features are introduced.

Refactoring and Code Quality Improvements:

  • Refactored multiple loops in EndpointConfiguration.java to use Map.Entry instead of repeatedly fetching values by key, improving efficiency and readability in endpoint group checks.
  • Replaced method calls to getter functions with direct field access in Role.java and Provider.java for improved clarity and consistency.
  • Updated ReplaceAndInvertColorStrategy.java and CreateSignatureBase.java to use direct field assignment instead of setter methods for better transparency and code simplicity.
  • Fixed a bug in YamlHelper.java by assigning the updated node directly to updatedRootNode instead of using a setter, ensuring correct state updates.

Controller Logic Standardization:

  • Standardized file extension removal logic across multiple controllers (BookletImpositionController, ConvertPdfJsonController, PageNumbersController) by using a shared Pattern and matcher.replaceFirst("") instead of inline regex replacements, improving maintainability and reducing duplication.

  • Standardized quote removal in MergeController by compiling the regex pattern once and reusing it, instead of using replaceAll inline.
    Application Startup and Logging:

  • Refactored SPDFApplication.java to move startup log printing and server port handling into dedicated methods, and improved logging for runtime port assignment. Also removed obsolete desktop UI cleanup code.

Miscellaneous:

  • Added missing imports for Pattern in several controllers to support the new regex-based logic.

Checklist

General

Documentation

Translations (if applicable)

UI Changes (if applicable)

  • Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)

Testing (if applicable)

  • I have tested my changes locally. Refer to the Testing Guide for more details.

Copilot AI review requested due to automatic review settings January 1, 2026 00:38
@dosubot dosubot bot added size:L This PR changes 100-499 lines ignoring generated files. Bugfix Pull requests that fix bugs labels Jan 1, 2026
@stirlingbot stirlingbot bot added Java Pull requests that update Java code Front End Issues or pull requests related to front-end development Back End Issues related to back-end development API API-related issues or pull requests Test Testing-related issues or pull requests perf Changes that improve performance and removed Bugfix Pull requests that fix bugs labels Jan 1, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request optimizes regex usage across the codebase by compiling frequently-used regex patterns as static constants rather than recompiling them on each use. Additionally, it refactors field access patterns and improves code efficiency through Map.Entry usage in loops.

Key Changes:

  • Refactored regex operations to use pre-compiled Pattern constants across multiple service and controller classes, improving performance for frequently-executed operations
  • Replaced getter method calls with direct field access in several model classes (Role.java, Provider.java, AuditEventType.java) for improved clarity
  • Optimized loop iterations in EndpointConfiguration.java to use Map.Entry instead of repeated key-based lookups

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
SignatureService.java Added VALID_FILENAME_PATTERN constant and made ALL_USERS_FOLDER static final
SharedSignatureService.java Added VALID_FILENAME_PATTERN constant and made ALL_USERS_FOLDER static final
PdfJsonFallbackFontService.java Added Pattern constants for bold weight detection, delimiter splitting, and whitespace handling
PdfJsonConversionService.java Added Pattern constants for whitespace, normalization, and subset prefix removal
ReactRoutingController.java Added BASE_HREF_PATTERN constant for HTML base tag replacement
PipelineDirectoryProcessor.java Added WATCHED_FOLDERS_PATTERN constant for directory path processing
PageNumbersController.java Added FILE_EXTENSION_PATTERN constant for filename processing
ConvertPdfJsonController.java Added FILE_EXTENSION_PATTERN constant for filename processing
MergeController.java Added QUOTE_REMOVAL_PATTERN constant for quote stripping
BookletImpositionController.java Added FILE_EXTENSION_PATTERN constant for filename processing
ConvertWebsiteToPdfTest.java Added PDF_FILENAME_PATTERN constant for test assertions
AuditEventType.java Replaced getter call with direct field access
Provider.java Replaced getter calls with direct field access in toString()
Role.java Replaced getter calls with direct field access in multiple methods
CreateSignatureBase.java Replaced setter calls with direct field assignment
ReplaceAndInvertColorStrategy.java Replaced setter call with direct field assignment
YamlHelper.java Fixed bug by assigning updated node directly instead of using setter
EndpointConfiguration.java Refactored loops to use Map.Entry for improved efficiency
SPDFApplication.java Reorganized methods (moved printStartupLogs and related methods) with no functional changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API API-related issues or pull requests Back End Issues related to back-end development Front End Issues or pull requests related to front-end development Java Pull requests that update Java code perf Changes that improve performance size:L This PR changes 100-499 lines ignoring generated files. Test Testing-related issues or pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant