Skip to content

Commit

Permalink
Specify caught exceptions in probeDimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOellerer committed Dec 10, 2024
1 parent 81b42e9 commit b6956e3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 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 = '6.0.0'
version = '7.0.0'

java {
toolchain {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public static XWPFPicture insertImage(XWPFParagraph paragraph, Path path, ImageS
public static Optional<Dimension> probeDimensions(Path path, ImageStrategy imageStrategy) {
try {
return Optional.of(imageStrategy.getDimensions(path));
} catch (Exception any) {
logger.error("Could not probe image '%s' for dimensions.".formatted(path), any);
} catch (IOException | IllegalArgumentException e) {
logger.error("Could not probe image '%s' for dimensions.".formatted(path), e);
return Optional.empty();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.docutools.jocument.image.ImageReference;
import com.docutools.jocument.image.NoWriterFoundException;
import com.docutools.jocument.impl.word.CustomWordPlaceholderData;
import com.docutools.jocument.impl.word.ElementRemovalException;
import com.docutools.jocument.impl.word.WordImageUtils;
import com.docutools.jocument.impl.word.WordUtilities;
import java.io.IOException;
Expand Down Expand Up @@ -74,8 +73,6 @@ protected void transform(IBodyElement placeholder, IBody part, Locale locale, Ge
WordUtilities.removeIfExists(placeholder);
} catch (IllegalArgumentException e) {
logger.error("Could not insert image", e);
} catch (ElementRemovalException e) {
logger.error("Could not remove placeholder paragraph", e);
} finally {
if (path != null && !path.equals(imagePath)) {
try {
Expand Down

0 comments on commit b6956e3

Please sign in to comment.