Adding validation to exclude cases where the 'directory' field in batch group configuration consists solely of spaces

Description

Steps to reproduce:

  1. Login to FOLIO X environment

  2. Open settings → Invoices → batch group configuration

  3. Choose any batch group and fill in the fields(url, port, username, password, location type, format) with correct credenentials and save

  4. Remove url, port, username, password, location type and leave as it was location type and format, save it

  5. Create invoice and select batch group from step #3

  6. Add invoice line and pay invoice

  7. Open Invoices app → Actions → Voucher export → Choose batch group from step #3 → Run manual export

Actual result: export status - Error, message - Cannot invoke "String.length()" because "this.input" is null
Expected Result: some message to show root cause as description
Cause:

Currently, if we skip the validation for spaces in the 'uploadDirectory' field, there's a high likelihood of encountering an NPE (NullPointerException):

In implementation, if uri is empty, code throws error

 

Approach:

We need to decide on the approach for validation. Currently, I have two options in mind:

  1. Show correct description for cause.

  2. Add validation for empy string for both directory and url

Environment

None

Potential Workaround

None

Attachments

4

Checklist

hide

Activity

Show:

Serhii_Nosko February 28, 2024 at 6:51 AM

We checked that when user specifies “ “ as upload folder this error was triggerring previously:

We improved by using StringUtils.isBlank() instead of Objects.nonNull() that considering “ “ as empty string so default upload directory will be used for “ “ case.

Link with related change

https://github.com/folio-org/mod-invoice/pull/471/files#diff-7b10d17714538ab95e01be2b5688a7492d3bbfabfbb8cefe269cf9b4ed71da74R119

Closing this improvement as Done.

Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Fix versions

Release

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created February 6, 2024 at 12:23 PM
Updated February 28, 2024 at 6:51 AM
Resolved February 28, 2024 at 6:51 AM
TestRail: Cases
TestRail: Runs