Admin can't assign user to 'On-Call Role Schedule'

Description

Steps:

  1. login as admin user (Admin role/ Admin group)

  2. open 'User and Groups' (http://localhost:8980/opennms/admin/userGroupView/index.jsp)

  3. open 'Configure On-Call Roles'

  4. created a Role 'new role'

  5. click on that role 

  6. in On-Call Role Schedule table click on any button to assign user on it

  7. In 'Edit Schedule Entry' (http://localhost:8980/opennms/admin/userGroupView/roles) select any user and set up any date.

  8. click Save

Expected:
User will be assigned on this date

 

Actual:

 

1) on 'Edit Schedule Entry' user sees empty alert notification message. 

2) after click on Save button UI sends

 

startAmOrPm=AM
endAmOrPm=AM 

that causes backend issue:

in that class org/opennms/web/admin/roles/AdminRoleServlet.java at 241th row:
 

Root cause?

it's not clear what triggered this issue.

From what I see:

Since we have AM / PM from UI data, it couldn't be parsed by this pattern because it expects a.m. / p.m. 

But this issue could be solved by adding `Locale.US` (it works on local env)

Environment

Local env : opennms-31.0.0-SNAPSHOT Default locale : en_CA

Acceptance / Success Criteria

None

Attachments

1

Lucidchart Diagrams

Activity

Show:

Jeff Gehlbach November 8, 2022 at 4:18 PM

and I agree that this is sufficiently low risk to pull into 31.0.0 even though it didn't make the cut. We have merging to do anyway, so it's no extra work.

Alberto November 8, 2022 at 2:44 PM

merged to 31.x

Alberto November 8, 2022 at 12:26 AM
Edited

The issue is whenever we use SimpleDateFormat without specifying a locale will use the default locale. In my case the default iocale is EN_CA (English Canada) and this causes parsing exceptions.

From the documentation SimpleDateFormat is Locale sensitive. And parsing a formatted date using SimpleDateFormat without specifying an especific Locale will become an issue in different parts of OpenNMS.

I will create a new Jira to ensure we use at least Locale.ROOT (that seems to be the implemented in a few places already in OpenNMS) in all the SimpleDateFormat instantiations.

Jeff Gehlbach September 28, 2022 at 1:52 PM

Big if reproducible.

Fixed

Details

Assignee

Reporter

HB Grooming Date

HB Backlog Status

Sprint

Fix versions

Affects versions

Priority

PagerDuty

Created September 8, 2022 at 9:03 PM
Updated November 8, 2022 at 4:18 PM
Resolved November 8, 2022 at 2:44 PM
Loading...