MIFOSX-715: if the image resource is missing for whatever reason (backup didnt copy filestructure, someone removed file) pass back approp error message from API.
This commit is contained in:
+7
-1
@@ -71,7 +71,13 @@ public class ImageReadPlatformServiceImpl implements ImageReadPlatformService {
|
|||||||
|
|
||||||
final ImageData imageData = this.jdbcTemplate.queryForObject(sql, imageMapper, new Object[] { clientId });
|
final ImageData imageData = this.jdbcTemplate.queryForObject(sql, imageMapper, new Object[] { clientId });
|
||||||
final ContentRepository contentRepository = this.contentRepositoryFactory.getRepository(imageData.storageType());
|
final ContentRepository contentRepository = this.contentRepositoryFactory.getRepository(imageData.storageType());
|
||||||
return contentRepository.fetchImage(imageData);
|
final ImageData result = contentRepository.fetchImage(imageData);
|
||||||
|
|
||||||
|
if (result.getContent() == null) {
|
||||||
|
throw new ImageNotFoundException("clients", clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
} catch (final EmptyResultDataAccessException e) {
|
} catch (final EmptyResultDataAccessException e) {
|
||||||
throw new ImageNotFoundException("clients", clientId);
|
throw new ImageNotFoundException("clients", clientId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user