Aarti Panchal created FINERACT-2980:
---------------------------------------

             Summary: Month-day parameters return HTTP 500 instead of a 
validation error when monthDayFormat or locale is missing
                 Key: FINERACT-2980
                 URL: https://issues.apache.org/jira/browse/FINERACT-2980
             Project: Apache Fineract
          Issue Type: Bug
            Reporter: Aarti Panchal


JsonParserHelper.extractMonthDayNamed passes monthDayFormat and locale straight 
to DateTimeFormatterBuilder. When a request sends a month-day value without 
monthDayFormat (or without locale), appendPattern(null) or toFormatter(null) 
throws a NullPointerException, which is not caught, so the API answers HTTP 
500. For example, adding a savings account charge with feeOnMonthDay but no 
monthDayFormat:

POST /savingsaccounts/\{id}/charges
{"chargeId": 5, "amount": 10, "feeOnMonthDay": "15 March", "dateFormat": "dd 
MMMM yyyy", "locale": "en"}

-> HTTP 500

Expected: HTTP 400 with a validation error, the same way missing dateFormat / 
locale is reported for date parameters.

This affects every endpoint that reads a month-day value through this helper: 
savings and deposit charges, savings products, charge definitions and standing 
instructions. Requests that send both monthDayFormat and locale are not 
affected. Happens on all databases.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to