Skip to content

Can't save or print rourke2020 form#623

Merged
yingbull merged 2 commits into
develop/dogfishfrom
604-cant-save-or-print-rourke2020
Sep 24, 2025
Merged

Can't save or print rourke2020 form#623
yingbull merged 2 commits into
develop/dogfishfrom
604-cant-save-or-print-rourke2020

Conversation

@LiamStanziani

@LiamStanziani LiamStanziani commented Sep 23, 2025

Copy link
Copy Markdown
Collaborator

In this PR I have fixed:

  • Possible null ref early exit with conditional checks in Frm2Action
  • JNA dependency mismatch in dependency lock (can revert if wanted, but this was an issue brought up in yesterdays standup)
  • Old struts 1 styleId attributes on rourke 2009, 2017, and 2020 that caused the submit type to always be null

Summary by Sourcery

Fix form submission and printing errors for Rourke forms by preventing null pointer exceptions, updating JSP form attributes, and resolving a JNA dependency mismatch.

Bug Fixes:

  • Use null-safe equals checks for request parameters in Frm2Action to avoid NullPointerException
  • Replace deprecated styleId attributes with id and name on Rourke 2009, 2017, and 2020 JSP forms to correctly pass submit parameters

Build:

  • Update JNA dependency version in dependency-lock.json to resolve mismatch

@LiamStanziani LiamStanziani self-assigned this Sep 23, 2025
@LiamStanziani LiamStanziani linked an issue Sep 23, 2025 that may be closed by this pull request
@sourcery-ai

sourcery-ai Bot commented Sep 23, 2025

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Implements safe parameter equals checks to prevent NullPointerExceptions in Frm2Action, replaces deprecated styleId attributes with id and name on Rourke JSP form tags to restore submit behavior, and updates the JNA dependency version in the lock file.

File-Level Changes

Change Details Files
Prevent NullPointerExceptions in form action handling
  • Replaced request.getParameter().equals(...) with "literal".equals(request.getParameter(...)) for submit and update checks
  • Added null-safe conditional checks to avoid early exit NPEs in Frm2Action
src/main/java/ca/openosp/openo/form/Frm2Action.java
Restore form submission on Rourke JSPs by replacing deprecated styleId attributes
  • Replaced styleId attribute with id and name on form tags
src/main/webapp/form/formrourke2020complete.jsp
src/main/webapp/form/formrourke2009complete.jsp
src/main/webapp/form/formrourke2017complete.jsp
Align JNA dependency version in lock file
  • Updated JNA version in dependencies-lock.json to resolve mismatch
dependencies-lock.json

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

Copy link
Copy Markdown

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

pom.xml

PackageVersionLicenseIssue Type
net.java.dev.jna:jna5.18.0NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
maven/net.java.dev.jna:jna 5.18.0 🟢 4.1
Details
CheckScoreReason
Code-Review🟢 5Found 8/16 approved changesets -- score normalized to 5
Maintained⚠️ 21 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 2
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions🟢 10GitHub workflow tokens follow principle of least privilege
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Security-Policy⚠️ 0security policy file not detected
Binary-Artifacts⚠️ 0binaries present in source code
Vulnerabilities🟢 100 existing vulnerabilities detected
License🟢 9license file detected
Signed-Releases⚠️ -1no releases found
Fuzzing⚠️ 0project is not fuzzed
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0

Scanned Files

  • pom.xml

@LiamStanziani LiamStanziani marked this pull request as ready for review September 23, 2025 13:17

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `src/main/java/ca/openosp/openo/form/Frm2Action.java:112` </location>
<code_context>
                 newID = formId;
             }
             //if we are printing all pages of form, grab info from db and merge with current page info
-            else if (request.getParameter("submit").equals("printAll") || request.getParameter("submit").equals("printAllJasperReport")) {
+            else if ("printAll".equals(request.getParameter("submit")) || "printAllJasperReport".equals(request.getParameter("submit"))) {

                 if (rec instanceof JasperReportPdfPrint) {
</code_context>

<issue_to_address>
**suggestion:** Use of constant-first equals improves null safety.

This change prevents NullPointerExceptions if 'submit' is not present, enhancing code robustness.

Suggested implementation:

```java
            else if ("printAll".equals(request.getParameter("submit")) || "printAllJasperReport".equals(request.getParameter("submit"))) {

```

```java
            } else if ("true".equals(request.getParameter("update"))) {

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/main/java/ca/openosp/openo/form/Frm2Action.java
@yingbull yingbull merged commit c53c0a2 into develop/dogfish Sep 24, 2025
14 of 15 checks passed
@yingbull yingbull deleted the 604-cant-save-or-print-rourke2020 branch January 8, 2026 18:56
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.

Can't save or print the Rourke2020 form

2 participants