From 9956daf822fc9529edd15773f5d6dad4ef6e1257 Mon Sep 17 00:00:00 2001 From: Sebastian Schlatow Date: Sat, 9 Nov 2024 17:53:00 +0000 Subject: [PATCH] Remove double ImagingException --- .../formats/jpeg/xmp/JpegXmpRewriter.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java index 4e2de0bfc..8f72cb18f 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java @@ -101,11 +101,10 @@ public void removeXmpXml(final InputStream src, final OutputStream os) throws Im * @param src Byte array containing JPEG image data. * @param os OutputStream to write the image to. * @param xmpXml String containing XMP XML. - * @throws ImagingException if it fails to read the JFIF segments + * @throws ImagingException if it fails to read or write the JFIF segments * @throws IOException if it fails to read or write the data from the segments - * @throws ImagingException if it fails to write the JFIF segments */ - public void updateXmpXml(final byte[] src, final OutputStream os, final String xmpXml) throws ImagingException, IOException, ImagingException { + public void updateXmpXml(final byte[] src, final OutputStream os, final String xmpXml) throws ImagingException, IOException { final ByteSource byteSource = ByteSource.array(src); updateXmpXml(byteSource, os, xmpXml); } @@ -116,11 +115,10 @@ public void updateXmpXml(final byte[] src, final OutputStream os, final String x * @param byteSource ByteSource containing JPEG image data. * @param os OutputStream to write the image to. * @param xmpXml String containing XMP XML. - * @throws ImagingException if it fails to read the JFIF segments + * @throws ImagingException if it fails to read or write the JFIF segments * @throws IOException if it fails to read or write the data from the segments - * @throws ImagingException if it fails to write the JFIF segments */ - public void updateXmpXml(final ByteSource byteSource, final OutputStream os, final String xmpXml) throws ImagingException, IOException, ImagingException { + public void updateXmpXml(final ByteSource byteSource, final OutputStream os, final String xmpXml) throws ImagingException, IOException { final JFIFPieces jfifPieces = analyzeJfif(byteSource); List pieces = jfifPieces.pieces; pieces = removeXmpSegments(pieces); @@ -146,11 +144,10 @@ public void updateXmpXml(final ByteSource byteSource, final OutputStream os, fin * @param src Image file. * @param os OutputStream to write the image to. * @param xmpXml String containing XMP XML. - * @throws ImagingException if it fails to read the JFIF segments + * @throws ImagingException if it fails to read or write the JFIF segments * @throws IOException if it fails to read or write the data from the segments - * @throws ImagingException if it fails to write the JFIF segments */ - public void updateXmpXml(final File src, final OutputStream os, final String xmpXml) throws ImagingException, IOException, ImagingException { + public void updateXmpXml(final File src, final OutputStream os, final String xmpXml) throws ImagingException, IOException { final ByteSource byteSource = ByteSource.file(src); updateXmpXml(byteSource, os, xmpXml); } @@ -161,11 +158,10 @@ public void updateXmpXml(final File src, final OutputStream os, final String xmp * @param src InputStream containing JPEG image data. * @param os OutputStream to write the image to. * @param xmpXml String containing XMP XML. - * @throws ImagingException if it fails to read the JFIF segments + * @throws ImagingException if it fails to read or write the JFIF segments * @throws IOException if it fails to read or write the data from the segments - * @throws ImagingException if it fails to write the JFIF segments */ - public void updateXmpXml(final InputStream src, final OutputStream os, final String xmpXml) throws ImagingException, IOException, ImagingException { + public void updateXmpXml(final InputStream src, final OutputStream os, final String xmpXml) throws ImagingException, IOException { final ByteSource byteSource = ByteSource.inputStream(src, null); updateXmpXml(byteSource, os, xmpXml); }