Internal Server Error occurs when trying to change the catalog item's manufacturer to null

Description

During exploratory tests, I noticed the internal server error is returned when one tries to change a catalog item's manufacturer to null.

Reproduction steps:

  1. Using the administrator's token, fetch the data of any catalog item with the use of the GET catalog items/id endpoint, e.g. the item's ID could be 94c6e021-0020-4af3-b789-306f2cd1dabb.

  2. Try to change the item's manufacturer to null with the use of the PUT catalog items/id endpoint:

{ "fromPqsCatalog": true, "equipmentCode": "E3/88-M", "type": "Gas", "model": "RCW 50 EG", "manufacturer": "", "energySource": "GASOLINE", "dateOfPrequal": 2007, "storageTemperature": "MINUS5", "maxOperatingTemp": 43, "minOperatingTemp": 5, "energyConsumption": "3.50kW/day", "holdoverTime": 4, "netVolume": 24, "visibleInCatalog": true, "archived": false }
  1. The 500 code and the following error message are returned:

{ "timestamp": "2018-12-14T12:33:20.547+0000", "status": 500, "error": "Internal Server Error", "exception": "org.springframework.dao.DataIntegrityViolationException", "message": "could not execute statement; SQL [n/a]; constraint [unq_catalog_items_man_model]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement", "path": "/api/catalogItems/94c6e021-0020-4af3-b789-306f2cd1dabb" }
  1. .

Expected behavior:

  • The 400 code and "Bad Request" should be returned, as well as an error message stating that the manufacturer is required.

Environment

None

Attachments

1
  • 14 Dec 2018, 12:29 PM

Activity

Joanna Bebak 
January 10, 2019 at 12:08 PM

The issue no longer occurs. I was able to update the manufacturer, and the returned status code was 200.

Won't Fix
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Components

Priority

Time Assistant

Created December 14, 2018 at 12:29 PM
Updated February 8, 2023 at 1:28 PM
Resolved January 10, 2019 at 12:08 PM