Skip to content

Fix: try-catch block added#2923

Closed
bjagg wants to merge 4 commits intouPortal-Project:masterfrom
bjagg:fix/url-syntax-prvdr-try-catch
Closed

Fix: try-catch block added#2923
bjagg wants to merge 4 commits intouPortal-Project:masterfrom
bjagg:fix/url-syntax-prvdr-try-catch

Conversation

@bjagg
Copy link
Member

@bjagg bjagg commented Mar 5, 2026

Checklist
  • the individual contributor license agreement is signed
  • commit message follows commit guidelines
  • tests are included
  • documentation is changed or added
  • new security keys and comments added to security.properties
  • new general keys and comments added to portal.properties
  • any changes that impact configuration or the database DDL added to CHANGES.md
  • message properties have been updated with new phrases
  • view conforms with WCAG 2.0 AA
Description of change

Exception is not caught around removed links. This should clean up the logs.

@bjagg bjagg requested review from Naenyn and Copilot March 5, 2026 08:49
@bjagg bjagg self-assigned this Mar 5, 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

Adds exception handling to URL query-parameter parsing so stale/removed portlet window ids don’t throw during request parsing, aiming to reduce noisy failures in logs.

Changes:

  • Wrap portletWindowRegistry.getPortletWindowId(...) in parsePortletParameterName() with a try/catch for IllegalArgumentException
  • Log and fall back to treating the parameter as “unscoped” when window id parsing fails

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

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


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

this.logger.debug(
"Failed to parse portlet window id '{}' from parameter '{}', treating as unscoped parameter",
additionalPortletId,
name);
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The caught IllegalArgumentException is ignored entirely (not logged/passed through), which makes diagnosing unexpected parsing issues harder and leaves the local e unused. Consider either logging the exception as a debug cause (third argument) or renaming the variable to ignored if intentionally discarding it.

Suggested change
name);
name,
e);

Copilot uses AI. Check for mistakes.
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


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

Comment on lines +908 to +912
try {
final IPortletWindowId portletWindowId =
this.portletWindowRegistry.getPortletWindowId(request, additionalPortletId);
return new Tuple<String, IPortletWindowId>(paramName, portletWindowId);
} catch (IllegalArgumentException e) {
Comment on lines 904 to +908
name.substring(
PORTLET_PARAM_PREFIX.length()
+ additionalPortletId.length()
+ SEPARATOR.length());
final IPortletWindowId portletWindowId =
this.portletWindowRegistry.getPortletWindowId(request, additionalPortletId);
return new Tuple<String, IPortletWindowId>(paramName, portletWindowId);
try {
@bjagg bjagg requested a review from Copilot March 19, 2026 16:59
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.

Copilot wasn't able to review any files in this pull request.


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

@bjagg bjagg closed this Mar 19, 2026
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.

3 participants