diff --git a/build.gradle b/build.gradle index b3222fb..f246f46 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group 'com.docutools' -version = '6.0.0' +version = '7.0.0' java { toolchain { diff --git a/src/main/java/com/docutools/jocument/impl/word/ElementRemovalException.java b/src/main/java/com/docutools/jocument/impl/word/ElementRemovalException.java deleted file mode 100644 index 80b870a..0000000 --- a/src/main/java/com/docutools/jocument/impl/word/ElementRemovalException.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.docutools.jocument.impl.word; - -//TODO move to checked expression on major version bump -public class ElementRemovalException extends RuntimeException { - public ElementRemovalException(Exception e) { - super(e); - } -} diff --git a/src/main/java/com/docutools/jocument/impl/word/WordImageUtils.java b/src/main/java/com/docutools/jocument/impl/word/WordImageUtils.java index 9926b26..ea4379d 100644 --- a/src/main/java/com/docutools/jocument/impl/word/WordImageUtils.java +++ b/src/main/java/com/docutools/jocument/impl/word/WordImageUtils.java @@ -80,8 +80,8 @@ public static XWPFPicture insertImage(XWPFParagraph paragraph, Path path, ImageS public static Optional 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(); } } diff --git a/src/main/java/com/docutools/jocument/impl/word/placeholders/ImagePlaceholderData.java b/src/main/java/com/docutools/jocument/impl/word/placeholders/ImagePlaceholderData.java index 09cc2d2..9cfbe9c 100644 --- a/src/main/java/com/docutools/jocument/impl/word/placeholders/ImagePlaceholderData.java +++ b/src/main/java/com/docutools/jocument/impl/word/placeholders/ImagePlaceholderData.java @@ -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; @@ -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 {