Skip to content

Fix the Build Error#130

Merged
drtechie merged 1 commit intomainfrom
nd/vs/build_fix
Apr 24, 2026
Merged

Fix the Build Error#130
drtechie merged 1 commit intomainfrom
nd/vs/build_fix

Conversation

@vanitha1822
Copy link
Copy Markdown
Member

@vanitha1822 vanitha1822 commented Apr 24, 2026

📋 Description

JIRA ID:

AMM-2280


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)

Summary by CodeRabbit

  • Refactor
    • Eliminated duplicate code and consolidated redundant logic in version endpoint handling and authentication filter processing.
    • Streamlined endpoint-skipping conditions for improved maintainability.

@vanitha1822 vanitha1822 self-assigned this Apr 24, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

📝 Walkthrough

Walkthrough

The pull request removes duplicate code from two Java classes: redundant imports, field declarations, and duplicate method implementations in VersionController, and early bypass logic plus duplicate endpoint-skipping conditions in JwtUserIdValidationFilter. The net result consolidates existing functionality without altering external behavior.

Changes

Cohort / File(s) Summary
Duplicate Code Removal – Controller
src/main/java/com/iemr/admin/controller/version/VersionController.java
Eliminated duplicate imports, class fields (logger, UNKNOWN_VALUE), a duplicate versionInformation() method, and redundant repeated calls to loadGitProperties() and field insertions in both try and catch blocks.
Endpoint Skip Logic Consolidation – Filter
src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java
Removed early health/version endpoint bypass block and duplicate path/contextPath redeclarations; consolidated endpoint-skipping logic into a single set of skip conditions, shifting health/version handling from early return to later consolidated skip logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A rabbit hops through tangled code,
Finding doubles down the road,
With a snip and snip, they're gone away—
One clean path leads us here to stay! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fix the Build Error' is vague and generic, using non-descriptive terms that don't convey meaningful information about the specific changes made. Consider revising the title to be more specific about the actual changes, such as 'Remove duplicate declarations and methods in VersionController and JwtUserIdValidationFilter' to better reflect the actual cleanup performed.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nd/vs/build_fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java (1)

44-50: ⚠️ Potential issue | 🟡 Minor

Lines 125–126 are unreachable dead code due to the early bypass above.

The early health/version check at lines 44–50 returns before reaching the consolidated skip list. Lines 125–126 then re-check the same contextPath + HEALTH_ENDPOINT and contextPath + VERSION_ENDPOINT conditions, but those paths will never match because the early return already handled them.

To fix, remove the duplicate health/version entries from the consolidated skip list (lines 125–126):

Suggested cleanup
 		// Skip login and public endpoints
 		if (path.equals(contextPath + "/user/userAuthenticate")
 				|| path.equalsIgnoreCase(contextPath + "/user/logOutUserFromConcurrentSession")
 				|| path.startsWith(contextPath + "/swagger-ui")
 				|| path.startsWith(contextPath + "/v3/api-docs")
 				|| path.startsWith(contextPath + "/user/refreshToken")
-				|| path.startsWith(contextPath + "/public")
-			|| path.equals(contextPath + HEALTH_ENDPOINT)
-			|| path.equals(contextPath + VERSION_ENDPOINT)) {
+				|| path.startsWith(contextPath + "/public")) {
 			logger.info("Skipping filter for path: " + path);
 			filterChain.doFilter(servletRequest, servletResponse);
 			return;
 		}

Also applies to: 119–124

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java` around
lines 44 - 50, The early bypass in JwtUserIdValidationFilter checks
HEALTH_ENDPOINT and VERSION_ENDPOINT (including contextPath variants) and
returns, making the later consolidated skip list redundant; remove the duplicate
contextPath + HEALTH_ENDPOINT and contextPath + VERSION_ENDPOINT entries from
the consolidated skip list in the method (i.e., update the skip list used later
in doFilter to exclude those two entries) so the health/version checks are only
handled by the initial early-return block and no unreachable conditions remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java`:
- Around line 44-50: The early bypass in JwtUserIdValidationFilter checks
HEALTH_ENDPOINT and VERSION_ENDPOINT (including contextPath variants) and
returns, making the later consolidated skip list redundant; remove the duplicate
contextPath + HEALTH_ENDPOINT and contextPath + VERSION_ENDPOINT entries from
the consolidated skip list in the method (i.e., update the skip list used later
in doFilter to exclude those two entries) so the health/version checks are only
handled by the initial early-return block and no unreachable conditions remain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff739bd9-5dff-4083-8b76-2b347ecf105d

📥 Commits

Reviewing files that changed from the base of the PR and between 9fb367a and a25c7c6.

📒 Files selected for processing (2)
  • src/main/java/com/iemr/admin/controller/version/VersionController.java
  • src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java
💤 Files with no reviewable changes (1)
  • src/main/java/com/iemr/admin/controller/version/VersionController.java

@drtechie drtechie merged commit fc7f351 into main Apr 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants