Commit e0b5fc69 authored by Matija Obreza's avatar Matija Obreza

Fix: Converted NPE to EntityNotFoundException

parent 65a6ffc8
Pipeline #13674 passed with stage
in 1 minute and 29 seconds
......@@ -237,6 +237,9 @@ public class ImageGalleryServiceImpl implements ImageGalleryService {
@Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#imageGallery, 'write')")
public ImageGallery updateImageGalery(final ImageGallery imageGallery, final String title, final String description) {
if (imageGallery.getId() == null) {
throw new EntityNotFoundException("The given id must not be null");
}
final ImageGallery imageGallery2 = imageGalleryPersistence.findById(imageGallery.getId()).orElseThrow(() -> new EntityNotFoundException("Record not found."));
imageGallery2.setTitle(title);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment