Skip to content

Commit ecf1812

Browse files
committed
ImageService(save): use Throwables.propagate() from Guava.
Fixed PMD warning about throwing raw exception type. No functional changes.
1 parent 17c4d42 commit ecf1812

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/ru/mystamps/web/service/ImageService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import org.springframework.transaction.annotation.Transactional;
2828
import org.springframework.web.multipart.MultipartFile;
2929

30+
import com.google.common.base.Throwables;
31+
3032
import static com.google.common.base.Preconditions.checkArgument;
3133
import static com.google.common.base.Preconditions.checkState;
3234

@@ -61,7 +63,7 @@ String save(final MultipartFile file) {
6163
image.setImage(file.getBytes());
6264
} catch (final IOException e) {
6365
// throw RuntimeException for rolling back transaction
64-
throw new RuntimeException(e);
66+
throw Throwables.propagate(e);
6567
}
6668

6769
final Image entity = imageDao.save(image);

0 commit comments

Comments
 (0)