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:
Keith Woodlock
2013-10-22 01:16:12 +01:00
parent 3bbf7538b2
commit 85cd5ff5c0
@@ -71,7 +71,13 @@ public class ImageReadPlatformServiceImpl implements ImageReadPlatformService {
final ImageData imageData = this.jdbcTemplate.queryForObject(sql, imageMapper, new Object[] { clientId });
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) {
throw new ImageNotFoundException("clients", clientId);
}