Skip to content

Commit

Permalink
Throw exception if no writer for jpeg found
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOellerer committed Nov 7, 2024
1 parent 5c67904 commit 15fbcc0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group 'com.docutools'
version = '4.2.7'
version = '4.2.8'

java {
toolchain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public Path saveAsJpeg() throws IOException {
var filePath = Files.createTempFile("jocument-", ".jpg");
log.trace("Saving image {} to '{}'...", id, filePath);

ImageIO.write(image, "JPEG", filePath.toFile());
boolean foundWriter = ImageIO.write(image, "JPEG", filePath.toFile());
if (!foundWriter) {
throw new IOException("Found no JPG writer");
}
log.trace("Successfully saved image {} to '{}'!", id, filePath);

return filePath;
Expand Down

0 comments on commit 15fbcc0

Please sign in to comment.