Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package xmlgraphics-commons for openSUSE:Factory checked in at 2023-02-13 16:39:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xmlgraphics-commons (Old) and /work/SRC/openSUSE:Factory/.xmlgraphics-commons.new.1848 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xmlgraphics-commons" Mon Feb 13 16:39:15 2023 rev:30 rq:1058903 version:2.8 Changes: -------- --- /work/SRC/openSUSE:Factory/xmlgraphics-commons/xmlgraphics-commons.changes 2022-10-12 18:25:06.417726749 +0200 +++ /work/SRC/openSUSE:Factory/.xmlgraphics-commons.new.1848/xmlgraphics-commons.changes 2023-02-13 16:41:23.687535413 +0100 @@ -1,0 +2,6 @@ +Wed Dec 28 12:37:08 UTC 2022 - Dirk Müller <dmuel...@suse.com> + +- update to 2.8: + * Minor changes to support FOP 2.8 release + +------------------------------------------------------------------- Old: ---- xmlgraphics-commons-2.6-src.tar.gz New: ---- xmlgraphics-commons-2.8-src.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xmlgraphics-commons.spec ++++++ --- /var/tmp/diff_new_pack.cLQK0R/_old 2023-02-13 16:41:24.347539685 +0100 +++ /var/tmp/diff_new_pack.cLQK0R/_new 2023-02-13 16:41:24.351539710 +0100 @@ -18,13 +18,13 @@ Name: xmlgraphics-commons -Version: 2.6 +Version: 2.8 Release: 0 Summary: XML Graphics Commons License: Apache-2.0 Group: Development/Libraries/Java -URL: http://xmlgraphics.apache.org/ -Source0: http://archive.apache.org/dist/xmlgraphics/commons/source/xmlgraphics-commons-%{version}-src.tar.gz +URL: https://xmlgraphics.apache.org/commons/ +Source0: https://archive.apache.org/dist/xmlgraphics/commons/source/xmlgraphics-commons-%{version}-src.tar.gz Patch0: xmlgraphics-commons-build_xml.patch Patch1: xmlgraphics-commons-jdk10.patch BuildRequires: ant >= 1.6.5 ++++++ xmlgraphics-commons-2.6-src.tar.gz -> xmlgraphics-commons-2.8-src.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/NOTICE new/xmlgraphics-commons-2.8/NOTICE --- old/xmlgraphics-commons-2.6/NOTICE 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/NOTICE 2022-11-02 12:57:57.000000000 +0100 @@ -1,5 +1,5 @@ Apache XML Graphics Commons -Copyright 2006-2021 The Apache Software Foundation +Copyright 2006-2022 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/README new/xmlgraphics-commons-2.8/README --- old/xmlgraphics-commons-2.6/README 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/README 2022-11-02 12:57:57.000000000 +0100 @@ -1,4 +1,4 @@ -$Id: README 1885379 2021-01-12 09:32:59Z ssteiner $ +$Id: README 1905001 2022-11-02 11:49:58Z ssteiner $ ============================================================================== APACHE XML GRAPHICS COMMONS - README @@ -82,6 +82,16 @@ For more detailed info about the changes, please see: http://xmlgraphics.apache.org/commons/changes.html +Version 2.8 +-------------- + +Minor release to be used with FOP 2.8 + +Version 2.7 +-------------- + +Minor release to be used with FOP 2.7 + Version 2.6 -------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/build.properties new/xmlgraphics-commons-2.8/build.properties --- old/xmlgraphics-commons-2.6/build.properties 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/build.properties 2022-11-02 12:57:57.000000000 +0100 @@ -34,7 +34,7 @@ ## =================================================================== ## 3. Project specific properties -version = 2.6 +version = 2.8 ## Allows you to switch off the compilation of the internal image ## codecs which depend on Sun-private classes. Setting this to true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/build.xml new/xmlgraphics-commons-2.8/build.xml --- old/xmlgraphics-commons-2.6/build.xml 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/build.xml 2022-11-02 12:57:57.000000000 +0100 @@ -25,13 +25,13 @@ <property name="Name" value="Apache XML Graphics Commons"/> <property name="name" value="xmlgraphics-commons"/> - <property name="year" value="1999-2021"/> + <property name="year" value="1999-2022"/> <property name="javac.debug" value="on"/> <property name="javac.optimize" value="off"/> <property name="javac.deprecation" value="on"/> - <property name="javac.source" value="1.7"/> - <property name="javac.target" value="1.7"/> + <property name="javac.source" value="1.8"/> + <property name="javac.target" value="1.8"/> <property name="javac.fork" value="no"/> <property name="junit.fork" value="on"/> @@ -232,6 +232,7 @@ <src path="${src.java.dir}"/> <patternset refid="compile-pattern"/> <classpath refid="libs-build-classpath"/> + <compilerarg value="-Xlint:cast"/> </javac> </target> @@ -321,6 +322,7 @@ <include name="${name}-${version}.jar"/> </fileset> </classpath> + <compilerarg value="-Xlint:cast"/> </javac> <copy todir="${build.dir}/test-classes" includeEmptyDirs="false"> <fileset dir="${test.res.dir}"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/lib/build/mockito-core-1.8.5.LICENCE.txt new/xmlgraphics-commons-2.8/lib/build/mockito-core-1.8.5.LICENCE.txt --- old/xmlgraphics-commons-2.6/lib/build/mockito-core-1.8.5.LICENCE.txt 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/lib/build/mockito-core-1.8.5.LICENCE.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2007 Mockito contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/lib/build/mockito-core-1.8.5.NOTICE.txt new/xmlgraphics-commons-2.8/lib/build/mockito-core-1.8.5.NOTICE.txt --- old/xmlgraphics-commons-2.6/lib/build/mockito-core-1.8.5.NOTICE.txt 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/lib/build/mockito-core-1.8.5.NOTICE.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ -Mockito license - MIT. - -Libraries used: - -Cglib - Apache License 2.0 -ASM - BSD license - -Mockito all distribution: - -Objenesis - MIT license -Hamcrest - BSD license \ No newline at end of file Binary files old/xmlgraphics-commons-2.6/lib/build/mockito-core-1.8.5.jar and new/xmlgraphics-commons-2.8/lib/build/mockito-core-1.8.5.jar differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/lib/build/mockito-core-2.28.2.LICENCE.txt new/xmlgraphics-commons-2.8/lib/build/mockito-core-2.28.2.LICENCE.txt --- old/xmlgraphics-commons-2.6/lib/build/mockito-core-2.28.2.LICENCE.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlgraphics-commons-2.8/lib/build/mockito-core-2.28.2.LICENCE.txt 2022-11-02 12:57:57.000000000 +0100 @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2007 Mockito contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/lib/build/mockito-core-2.28.2.NOTICE.txt new/xmlgraphics-commons-2.8/lib/build/mockito-core-2.28.2.NOTICE.txt --- old/xmlgraphics-commons-2.6/lib/build/mockito-core-2.28.2.NOTICE.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlgraphics-commons-2.8/lib/build/mockito-core-2.28.2.NOTICE.txt 2022-11-02 12:57:57.000000000 +0100 @@ -0,0 +1,11 @@ +Mockito license - MIT. + +Libraries used: + +Cglib - Apache License 2.0 +ASM - BSD license + +Mockito all distribution: + +Objenesis - MIT license +Hamcrest - BSD license \ No newline at end of file Binary files old/xmlgraphics-commons-2.6/lib/build/mockito-core-2.28.2.jar and new/xmlgraphics-commons-2.8/lib/build/mockito-core-2.28.2.jar differ Binary files old/xmlgraphics-commons-2.6/lib/commons-io-1.3.1.jar and new/xmlgraphics-commons-2.8/lib/commons-io-1.3.1.jar differ Binary files old/xmlgraphics-commons-2.6/lib/commons-io-2.11.0.jar and new/xmlgraphics-commons-2.8/lib/commons-io-2.11.0.jar differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/pom.xml new/xmlgraphics-commons-2.8/pom.xml --- old/xmlgraphics-commons-2.6/pom.xml 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/pom.xml 2022-11-02 12:57:57.000000000 +0100 @@ -4,7 +4,7 @@ <groupId>org.apache.xmlgraphics</groupId> <artifactId>xmlgraphics-commons</artifactId> - <version>2.6</version> + <version>2.8</version> <name>${project.groupId}:${project.artifactId}</name> <description>XML Graphics Commons</description> <url>http://xmlgraphics.apache.org/commons/</url> @@ -13,7 +13,7 @@ <checkstyle.version>2.15</checkstyle.version> <exec.version>1.4.0</exec.version> <findbugs.version>3.0.4</findbugs.version> - <java.version>1.7</java.version> + <java.version>1.8</java.version> <junit.version>4.11</junit.version> <project.info.reports.version>2.8</project.info.reports.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> @@ -52,7 +52,7 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>1.3.2</version> + <version>2.11.0</version> </dependency> <dependency> <groupId>commons-logging</groupId> @@ -68,7 +68,7 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> - <version>1.8.5</version> + <version>2.28.2</version> <scope>test</scope> </dependency> <dependency> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: PNGEncodeParam.java 1732018 2016-02-24 04:51:06Z gadams $ */ +/* $Id: PNGEncodeParam.java 1902007 2022-06-17 09:51:56Z ssteiner $ */ package org.apache.xmlgraphics.image.codec.png; @@ -174,7 +174,7 @@ IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam1")); } - palette = (int[])(rgb.clone()); + palette = rgb.clone(); paletteSet = true; } @@ -192,7 +192,7 @@ if (!paletteSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam3")); } - return (int[])(palette.clone()); + return palette.clone(); } /** @@ -530,7 +530,7 @@ * <p> The 'tRNS' chunk will encode this information. */ public void setTransparentRGB(int[] transparentRGB) { - transparency = (int[])(transparentRGB.clone()); + transparency = transparentRGB.clone(); transparencySet = true; } @@ -547,7 +547,7 @@ if (!transparencySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam10")); } - return (int[])(transparency.clone()); + return transparency.clone(); } } @@ -653,7 +653,7 @@ if (chromaticity.length != 8) { throw new IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam28")); } - this.chromaticity = (float[])(chromaticity.clone()); + this.chromaticity = chromaticity.clone(); chromaticitySet = true; } @@ -692,7 +692,7 @@ if (!chromaticitySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam12")); } - return (float[])(chromaticity.clone()); + return chromaticity.clone(); } /** @@ -767,7 +767,7 @@ * <p> The 'hIST' chunk will encode this information. */ public void setPaletteHistogram(int[] paletteHistogram) { - this.paletteHistogram = (int[])(paletteHistogram.clone()); + this.paletteHistogram = paletteHistogram.clone(); paletteHistogramSet = true; } @@ -813,7 +813,7 @@ * <p> The 'iCCP' chunk will encode this information. */ public void setICCProfileData(byte[] iccProfileData) { - this.iccProfileData = (byte[])(iccProfileData.clone()); + this.iccProfileData = iccProfileData.clone(); iccProfileDataSet = true; } @@ -829,7 +829,7 @@ if (!iccProfileDataSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam15")); } - return (byte[])(iccProfileData.clone()); + return iccProfileData.clone(); } /** @@ -862,7 +862,7 @@ * <p> The 'pHYS' chunk will encode this information. */ public void setPhysicalDimension(int[] physicalDimension) { - this.physicalDimension = (int[])(physicalDimension.clone()); + this.physicalDimension = physicalDimension.clone(); physicalDimensionSet = true; } @@ -895,7 +895,7 @@ if (!physicalDimensionSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam16")); } - return (int[])(physicalDimension.clone()); + return physicalDimension.clone(); } /** @@ -926,7 +926,7 @@ * <p> The 'sPLT' chunk will encode this information. */ public void setSuggestedPalette(PNGSuggestedPaletteEntry[] palette) { - suggestedPalette = (PNGSuggestedPaletteEntry[])(palette.clone()); + suggestedPalette = palette.clone(); suggestedPaletteSet = true; } @@ -945,7 +945,7 @@ if (!suggestedPaletteSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam17")); } - return (PNGSuggestedPaletteEntry[])(suggestedPalette.clone()); + return suggestedPalette.clone(); } /** @@ -979,7 +979,7 @@ * <p> The 'sBIT' chunk will encode this information. */ public void setSignificantBits(int[] significantBits) { - this.significantBits = (int[])(significantBits.clone()); + this.significantBits = significantBits.clone(); significantBitsSet = true; } @@ -997,7 +997,7 @@ if (!significantBitsSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam18")); } - return (int[])significantBits.clone(); + return significantBits.clone(); } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: TIFFFaxDecoder.java 1732018 2016-02-24 04:51:06Z gadams $ */ +/* $Id: TIFFFaxDecoder.java 1902007 2022-06-17 09:51:56Z ssteiner $ */ package org.apache.xmlgraphics.image.codec.tiff; @@ -813,7 +813,7 @@ entry = nextLesserThan8Bits(7); // Run these through the 2DCodes table - entry = (int)(twoDCodes[entry] & 0xff); + entry = twoDCodes[entry] & 0xff; // Get the code and the number of bits used up code = (entry & 0x78) >>> 3; @@ -963,7 +963,7 @@ // Get the next seven bits entry = nextLesserThan8Bits(7); // Run these through the 2DCodes table - entry = (int)(twoDCodes[entry] & 0xff); + entry = twoDCodes[entry] & 0xff; // Get the code and the number of bits used up code = (entry & 0x78) >>> 3; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/ImageFlavor.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/ImageFlavor.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/ImageFlavor.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/ImageFlavor.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: ImageFlavor.java 829060 2009-10-23 13:42:53Z jeremias $ */ +/* $Id: ImageFlavor.java 1894758 2021-11-05 13:34:47Z ssteiner $ */ package org.apache.xmlgraphics.image.loader; @@ -55,6 +55,8 @@ /** An image in form of a raw EPS (Encapsulated PostScript) file/stream */ public static final ImageFlavor RAW_EPS = new MimeEnabledImageFlavor(RAW, MimeConstants.MIME_EPS); + public static final ImageFlavor RAW_PDF = new MimeEnabledImageFlavor(RAW, MimeConstants.MIME_PDF); + /** An image in form of a raw LZW file/stream */ public static final ImageFlavor RAW_LZW = new ImageFlavor("RawLZW"); /** An image in form of a raw CCITTFax stream */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: AbstractImageSessionContext.java 1796008 2017-05-24 08:16:01Z ssteiner $ */ +/* $Id: AbstractImageSessionContext.java 1895651 2021-12-07 08:03:10Z ssteiner $ */ package org.apache.xmlgraphics.image.loader.impl; @@ -29,6 +29,8 @@ import java.lang.reflect.Proxy; import java.net.MalformedURLException; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import javax.imageio.ImageIO; import javax.imageio.stream.ImageInputStream; @@ -59,11 +61,16 @@ private static boolean noSourceReuse; static { - //TODO Temporary measure to track down a problem - //See: http://markmail.org/message/k6mno3jsxmovaz2e - String noSourceReuseString = System.getProperty( - AbstractImageSessionContext.class.getName() + ".no-source-reuse"); - noSourceReuse = Boolean.valueOf(noSourceReuseString); + noSourceReuse = AccessController.doPrivileged( + new PrivilegedAction<Boolean>() { + public Boolean run() { + //See: http://markmail.org/message/k6mno3jsxmovaz2e + String noSourceReuseString = System.getProperty( + AbstractImageSessionContext.class.getName() + ".no-source-reuse"); + return Boolean.valueOf(noSourceReuseString); + } + } + ); } private final FallbackResolver fallbackResolver; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRaw.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRaw.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRaw.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRaw.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,12 +15,22 @@ * limitations under the License. */ -/* $Id: ImageLoaderFactoryRaw.java 1681137 2015-05-22 14:54:05Z ssteiner $ */ +/* $Id: ImageLoaderFactoryRaw.java 1904425 2022-10-06 12:37:37Z ssteiner $ */ package org.apache.xmlgraphics.image.loader.impl; +import java.util.Map; + +import javax.imageio.metadata.IIOMetadata; +import javax.imageio.metadata.IIOMetadataNode; + +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; + import org.apache.xmlgraphics.image.loader.ImageFlavor; +import org.apache.xmlgraphics.image.loader.ImageInfo; import org.apache.xmlgraphics.image.loader.spi.ImageLoader; +import org.apache.xmlgraphics.image.loader.util.Penalty; import org.apache.xmlgraphics.util.MimeConstants; /** @@ -93,4 +103,34 @@ return true; } + @Override + public boolean isSupported(ImageInfo imageInfo) { + if ("image/png".equals(imageInfo.getMimeType())) { + Map additionalPenalties = (Map) imageInfo.getCustomObjects().get("additionalPenalties"); + int penalty = 0; + Penalty penaltyObj = ((Penalty)additionalPenalties.get(ImageLoaderRawPNG.class.getName())); + if (penaltyObj != null) { + penalty = penaltyObj.getValue(); + } + IIOMetadata metadata = (IIOMetadata) imageInfo.getCustomObjects().get(IIOMetadata.class); + if (metadata != null) { + IIOMetadataNode children = (IIOMetadataNode)metadata.getAsTree("javax_imageio_png_1.0").getChildNodes(); + NamedNodeMap attr = children.getElementsByTagName("IHDR").item(0).getAttributes(); + String bitDepth = attr.getNamedItem("bitDepth").getNodeValue(); + String interlaceMethod = attr.getNamedItem("interlaceMethod").getNodeValue(); + String colorType = attr.getNamedItem("colorType").getNodeValue(); + if (!bitDepth.equals("8") || !interlaceMethod.equals("none") + || ((colorType.equals("RGBAlpha") || colorType.equals("GrayAlpha")) && penalty >= 0)) { + return false; + } + children = (IIOMetadataNode)metadata.getAsTree("javax_imageio_1.0").getChildNodes(); + Node numChannels = children.getElementsByTagName("NumChannels").item(0); + String numChannelsStr = numChannels.getAttributes().getNamedItem("value").getNodeValue(); + if ("4".equals(numChannelsStr) && "Palette".equals(colorType) && penalty >= 0) { + return false; + } + } + } + return true; + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawPNG.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawPNG.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawPNG.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawPNG.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: ImageLoaderRawPNG.java 1843559 2018-10-11 14:59:17Z ssteiner $ */ +/* $Id: ImageLoaderRawPNG.java 1904425 2022-10-06 12:37:37Z ssteiner $ */ // Original author: Matthias Reichenbacher @@ -74,13 +74,4 @@ ImageRawPNG irpng = im.getImageRawPNG(info); return irpng; } - - /** {@inheritDoc} */ - public int getUsagePenalty() { - // since this image loader does not handle all kinds of PNG images then we add some penalty to it - // so that it is not chosen by default; instead, users need to give it a negative penalty in - // fop.xconf so that it is used - return 1000; - } - } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/PreloaderImageIO.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/PreloaderImageIO.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/PreloaderImageIO.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/PreloaderImageIO.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: PreloaderImageIO.java 1452610 2013-03-05 01:00:35Z lbernardo $ */ +/* $Id: PreloaderImageIO.java 1904425 2022-10-06 12:37:37Z ssteiner $ */ package org.apache.xmlgraphics.image.loader.impl.imageio; @@ -52,6 +52,7 @@ return null; } ImageInputStream in = ImageUtil.needImageInputStream(src); + long startPos = in.getStreamPosition(); Iterator iter = ImageIO.getImageReaders(in); if (!iter.hasNext()) { return null; @@ -85,15 +86,8 @@ } if (iiometa == null) { - if (firstIOException == null) { - throw new ImageException("Could not extract image metadata"); - } else { - throw new ImageException("I/O error while extracting image metadata" - + (firstIOException.getMessage() != null - ? ": " + firstIOException.getMessage() - : ""), - firstIOException); - } + in.seek(startPos); + return null; } //Resolution (first a default, then try to read the metadata) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: PipelineFactory.java 1804124 2017-08-04 14:13:54Z ssteiner $ */ +/* $Id: PipelineFactory.java 1902007 2022-06-17 09:51:56Z ssteiner $ */ package org.apache.xmlgraphics.image.loader.pipeline; @@ -117,7 +117,7 @@ //Choose best pipeline if (candidates.length > 0) { Arrays.sort(candidates, new PipelineComparator()); - ImageProviderPipeline pipeline = (ImageProviderPipeline)candidates[0]; + ImageProviderPipeline pipeline = candidates[0]; if (pipeline != null && log.isDebugEnabled()) { log.debug("Pipeline: " + pipeline + " with penalty " + pipeline.getConversionPenalty()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: ImageImplRegistry.java 1804124 2017-08-04 14:13:54Z ssteiner $ */ +/* $Id: ImageImplRegistry.java 1904425 2022-10-06 12:37:37Z ssteiner $ */ package org.apache.xmlgraphics.image.loader.spi; @@ -322,6 +322,7 @@ public ImageLoaderFactory[] getImageLoaderFactories(ImageInfo imageInfo, ImageFlavor flavor) { String mime = imageInfo.getMimeType(); Collection matches = new java.util.TreeSet(new ImageLoaderFactoryComparator(flavor)); + imageInfo.getCustomObjects().put("additionalPenalties", additionalPenalties); Map flavorMap = (Map) loaders.get(mime); if (flavorMap != null) { for (Object i : flavorMap.entrySet()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: PSGraphics2D.java 1845492 2018-11-01 15:54:06Z ssteiner $ */ +/* $Id: PSGraphics2D.java 1903802 2022-09-01 09:35:58Z ssteiner $ */ package org.apache.xmlgraphics.java2d.ps; @@ -61,7 +61,7 @@ * therefore of <tt>Graphics2D</tt>) which is able to generate PostScript * code. * - * @version $Id: PSGraphics2D.java 1845492 2018-11-01 15:54:06Z ssteiner $ + * @version $Id: PSGraphics2D.java 1903802 2022-09-01 09:35:58Z ssteiner $ * @see org.apache.xmlgraphics.java2d.AbstractGraphics2D * * Originally authored by Keiron Liddle. @@ -254,6 +254,10 @@ } public boolean drawImage(Image img, int x, int y, ImageObserver observer, Color mask) { + return drawImage(img, x, y, observer, mask, null); + } + + public boolean drawImage(Image img, int x, int y, ImageObserver observer, Color mask, RenderedImage imageMask) { preparePainting(); if (DEBUG) { System.out.println("drawImage: " + x + ", " + y + " " + img.getClass().getName()); @@ -285,7 +289,11 @@ gen.concatMatrix(at); Shape imclip = getClip(); writeClip(imclip); - PSImageUtils.renderBitmapImage(buf, x, y, width, height, gen, mask); + if (imageMask == null) { + PSImageUtils.renderBitmapImage(buf, x, y, width, height, gen, mask, false); + } else { + PSImageUtils.renderBitmapImage(imageMask, x, y, width, height, gen, mask, true); + } gen.restoreGraphicsState(); } catch (IOException ioe) { handleIOException(ioe); @@ -685,7 +693,7 @@ Shape imclip = getClip(); writeClip(imclip); PSImageUtils.renderBitmapImage(img, - 0, 0, img.getWidth(), img.getHeight(), gen, null); + 0, 0, img.getWidth(), img.getHeight(), gen, null, false); gen.restoreGraphicsState(); } catch (IOException ioe) { handleIOException(ioe); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/ps/FormGenerator.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/ps/FormGenerator.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/ps/FormGenerator.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/ps/FormGenerator.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: FormGenerator.java 750418 2009-03-05 11:03:54Z vhennebert $ */ +/* $Id: FormGenerator.java 1898073 2022-02-14 14:54:16Z ssteiner $ */ package org.apache.xmlgraphics.ps; @@ -129,10 +129,13 @@ gen.writeln(" grestore"); gen.writeln(" } bind"); gen.writeln(">> def"); - generateAdditionalDataStream(gen); - gen.writeDSCComment(DSCConstants.END_RESOURCE); PSResource res = new PSResource(PSResource.TYPE_FORM, formName); - gen.getResourceTracker().registerSuppliedResource(res); + try { + generateAdditionalDataStream(gen); + } finally { + gen.writeDSCComment(DSCConstants.END_RESOURCE); + gen.getResourceTracker().registerSuppliedResource(res); + } return res; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,10 +15,12 @@ * limitations under the License. */ -/* $Id: ImageEncodingHelper.java 1713619 2015-11-10 11:55:53Z ssteiner $ */ +/* $Id: ImageEncodingHelper.java 1896317 2021-12-23 14:30:49Z ssteiner $ */ package org.apache.xmlgraphics.ps; +import java.awt.Color; +import java.awt.Graphics2D; import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; @@ -487,8 +489,18 @@ private final RenderedImage img; - public RenderedImageEncoder(RenderedImage img) { - this.img = img; + public RenderedImageEncoder(RenderedImage ri) { + if (ri instanceof BufferedImage && ((BufferedImage) ri).getType() == BufferedImage.TYPE_4BYTE_ABGR) { + BufferedImage convertedImg = + new BufferedImage(ri.getWidth(), ri.getHeight(), BufferedImage.TYPE_INT_RGB); + Graphics2D g = (Graphics2D) convertedImg.getGraphics(); + g.setBackground(Color.WHITE); + g.clearRect(0, 0, ri.getWidth(), ri.getHeight()); + g.drawImage((BufferedImage)ri, 0, 0, null); + g.dispose(); + ri = convertedImg; + } + img = ri; } public void writeTo(OutputStream out) throws IOException { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/ps/PSImageUtils.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/ps/PSImageUtils.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/ps/PSImageUtils.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/ps/PSImageUtils.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: PSImageUtils.java 1792872 2017-04-27 12:30:09Z ssteiner $ */ +/* $Id: PSImageUtils.java 1903802 2022-09-01 09:35:58Z ssteiner $ */ package org.apache.xmlgraphics.ps; @@ -146,7 +146,7 @@ public static void writeImage(ImageEncoder encoder, Dimension imgDim, String imgDescription, Rectangle2D targetRect, ColorModel colorModel, PSGenerator gen) throws IOException { - writeImage(encoder, imgDim, imgDescription, targetRect, colorModel, gen, null); + writeImage(encoder, imgDim, imgDescription, targetRect, colorModel, gen, null, false); } /** @@ -160,7 +160,7 @@ * @throws IOException In case of an I/O exception */ public static void writeImage(ImageEncoder encoder, Dimension imgDim, String imgDescription, - Rectangle2D targetRect, ColorModel colorModel, PSGenerator gen, RenderedImage ri) + Rectangle2D targetRect, ColorModel colorModel, PSGenerator gen, RenderedImage ri, boolean maskBitmap) throws IOException { gen.saveGraphicsState(); @@ -193,7 +193,7 @@ imageDict.put("/BitsPerComponent", 8); } } - writeImageCommand(imageDict, colorModel, gen); + writeImageCommand(imageDict, colorModel, gen, maskBitmap); /* * the following two lines could be enabled if something still goes wrong @@ -256,7 +256,7 @@ imageDict.put("/BitsPerComponent", 8); } } - writeImageCommand(imageDict, colorModel, gen); + writeImageCommand(imageDict, colorModel, gen, false); /* * the following two lines could be enabled if something still goes wrong @@ -411,14 +411,20 @@ Dimension imgDim = new Dimension(img.getWidth(), img.getHeight()); populateImageDictionary(imgDim, cm, imageDict); - writeImageCommand(imageDict, cm, gen); + writeImageCommand(imageDict, cm, gen, false); } - static void writeImageCommand(PSDictionary imageDict, ColorModel cm, PSGenerator gen) + static void writeImageCommand(PSDictionary imageDict, ColorModel cm, PSGenerator gen, boolean maskBitmap) throws IOException { - prepareColorSpace(gen, cm); + if (!maskBitmap) { + prepareColorSpace(gen, cm); + } gen.write(imageDict.toString()); - gen.writeln(" image"); + if (maskBitmap) { + gen.writeln(" imagemask"); + } else { + gen.writeln(" image"); + } } static void writeImageCommand(PSDictionary imageDict, @@ -463,7 +469,7 @@ * @throws IOException In case of an I/O problem while rendering the image */ public static void renderBitmapImage(RenderedImage img, - float x, float y, float w, float h, PSGenerator gen, Color mask) + float x, float y, float w, float h, PSGenerator gen, Color mask, boolean maskBitmap) throws IOException { Rectangle2D targetRect = new Rectangle2D.Double(x, y, w, h); ImageEncoder encoder = ImageEncodingHelper.createRenderedImageEncoder(img); @@ -473,7 +479,7 @@ ColorModel cm = helper.getEncodedColorModel(); if (mask == null) { - writeImage(encoder, imgDim, imgDescription, targetRect, cm, gen, img); + writeImage(encoder, imgDim, imgDescription, targetRect, cm, gen, img, maskBitmap); } else { writeImage(encoder, imgDim, imgDescription, targetRect, cm, gen, img, mask); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/xmp/XMPHandler.java new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/xmp/XMPHandler.java --- old/xmlgraphics-commons-2.6/src/main/java/org/apache/xmlgraphics/xmp/XMPHandler.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/main/java/org/apache/xmlgraphics/xmp/XMPHandler.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: XMPHandler.java 1681108 2015-05-22 13:26:12Z ssteiner $ */ +/* $Id: XMPHandler.java 1902231 2022-06-24 12:44:08Z ssteiner $ */ package org.apache.xmlgraphics.xmp; @@ -287,7 +287,9 @@ if (prop.getName() == null) { throw new IllegalStateException("No content in XMP property"); } - assert getCurrentProperties() != null : "no current property"; + if (getCurrentProperties() == null) { + startStructure(); + } getCurrentProperties().setProperty(prop); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/image/loader/CorruptImagesTestCase.java new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/image/loader/CorruptImagesTestCase.java --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/image/loader/CorruptImagesTestCase.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/image/loader/CorruptImagesTestCase.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,14 +15,13 @@ * limitations under the License. */ -/* $Id: CorruptImagesTestCase.java 1830541 2018-04-30 09:30:55Z ssteiner $ */ +/* $Id: CorruptImagesTestCase.java 1904425 2022-10-06 12:37:37Z ssteiner $ */ package org.apache.xmlgraphics.image.loader; import org.junit.Test; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.Assert.assertEquals; /** * Tests for error behaviour with corrupt images. @@ -38,13 +37,8 @@ ImageSessionContext sessionContext = imageContext.newSessionContext(); ImageManager manager = imageContext.getImageManager(); - try { - manager.preloadImage(uri, sessionContext); - fail("Expected an ImageException!"); - } catch (Exception ie) { - //Expected exception - assertNotNull(ie.getMessage()); - } + ImageInfo imageInfo = manager.preloadImage(uri, sessionContext); + assertEquals(imageInfo.getMimeType(), "image/png"); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawPNGTestCase.java new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawPNGTestCase.java --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawPNGTestCase.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawPNGTestCase.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: ImageLoaderRawPNGTestCase.java 1732019 2016-02-24 05:01:10Z gadams $ */ +/* $Id: ImageLoaderRawPNGTestCase.java 1904425 2022-10-06 12:37:37Z ssteiner $ */ package org.apache.xmlgraphics.image.loader.impl; @@ -48,7 +48,7 @@ @Test public void testGetUsagePenalty() { - assertEquals(1000, ilrpng.getUsagePenalty()); + assertEquals(0, ilrpng.getUsagePenalty()); } @Test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/io/URIResolverAdapterTestCase.java new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/io/URIResolverAdapterTestCase.java --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/io/URIResolverAdapterTestCase.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/io/URIResolverAdapterTestCase.java 2022-11-02 12:57:57.000000000 +0100 @@ -22,6 +22,7 @@ import java.io.StringWriter; import java.net.URI; import java.net.URL; +import java.nio.charset.Charset; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; @@ -66,7 +67,7 @@ private void testInputStream(InputStream stream) throws IOException { StringWriter writer = new StringWriter(); - IOUtils.copy(stream, writer); + IOUtils.copy(stream, writer, Charset.defaultCharset()); assertEquals("This is a text file used to test the CatalogResolver\n", writer.toString()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/io/XmlSourceUtilTestCase.java new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/io/XmlSourceUtilTestCase.java --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/io/XmlSourceUtilTestCase.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/io/XmlSourceUtilTestCase.java 2022-11-02 12:57:57.000000000 +0100 @@ -21,6 +21,7 @@ import java.io.InputStream; import java.io.Reader; import java.io.StringWriter; +import java.nio.charset.Charset; import javax.imageio.stream.ImageInputStream; import javax.xml.parsers.DocumentBuilder; @@ -91,7 +92,7 @@ domSource = new DOMSource(db.newDocument().createElement("test")); InputStream inStream = XmlSourceUtil.getInputStream(domSource); writer = new StringWriter(); - IOUtils.copy(inStream, writer); + IOUtils.copy(inStream, writer, Charset.defaultCharset()); } @Test @@ -145,7 +146,7 @@ public void testNeedInputStreamFailureCaseDOMSource() throws IOException { InputStream inStream = needInputStream(new DOMSource()); StringWriter writer = new StringWriter(); - IOUtils.copy(inStream, writer); + IOUtils.copy(inStream, writer, Charset.defaultCharset()); assertEquals("", writer.toString()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: PSGraphics2DTestCase.java 1845492 2018-11-01 15:54:06Z ssteiner $ */ +/* $Id: PSGraphics2DTestCase.java 1903802 2022-09-01 09:35:58Z ssteiner $ */ package org.apache.xmlgraphics.java2d.ps; @@ -176,4 +176,15 @@ p.fill(new Rectangle()); assertTrue(out.toString().contains("\nN\n")); } + + @Test + public void testMask() { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PSGenerator generator = new PSGenerator(out); + PSGraphics2D graphics = new PSGraphics2D(false, generator); + graphics.setGraphicContext(new GraphicContext()); + BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); + graphics.drawImage(image, 0, 0, null, null, image); + assertTrue(out.toString().contains("imagemask")); + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/ps/FormGeneratorTestCase.java new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/ps/FormGeneratorTestCase.java --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/ps/FormGeneratorTestCase.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/ps/FormGeneratorTestCase.java 2022-11-02 12:57:57.000000000 +0100 @@ -21,9 +21,9 @@ import java.awt.Color; import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.color.ColorSpace; - import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; @@ -100,4 +100,28 @@ //FlateDecode at DataSource so executed on page load rather than document load so viewer loads faster Assert.assertTrue(test.contains("/DataSource form:Data /FlateDecode filter\n")); } + + @Test + public void testAlphaImage() throws IOException { + Assert.assertEquals(buildPSImage(BufferedImage.TYPE_4BYTE_ABGR), buildPSImage(BufferedImage.TYPE_INT_RGB)); + } + + private String buildPSImage(int type) throws IOException { + Dimension2D dimension = new Dimension2DDouble(1, 1); + BufferedImage im = new BufferedImage(1, 1, type); + Graphics2D g = (Graphics2D) im.getGraphics(); + if (type == BufferedImage.TYPE_4BYTE_ABGR) { + g.setBackground(new Color(0, 0, 0, 0)); + } else { + g.setBackground(Color.white); + } + g.clearRect(0, 0, im.getWidth(), im.getHeight()); + g.drawImage(im, 0, 0, null); + g.dispose(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ImageFormGenerator formImageGen = new ImageFormGenerator("form", "title", dimension, im, false); + PSGenerator gen = new PSGenerator(out); + formImageGen.generate(gen); + return out.toString("utf-8"); + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/ps/ImageEncodingHelperTestCase.java new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/ps/ImageEncodingHelperTestCase.java --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/ps/ImageEncodingHelperTestCase.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/ps/ImageEncodingHelperTestCase.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: ImageEncodingHelperTestCase.java 1732019 2016-02-24 05:01:10Z gadams $ */ +/* $Id: ImageEncodingHelperTestCase.java 1896578 2021-12-31 12:22:29Z ssteiner $ */ package org.apache.xmlgraphics.ps; @@ -34,8 +34,8 @@ import org.mockito.stubbing.Answer; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -140,7 +140,7 @@ return null; } }; - when(raster.getDataElements(anyInt(), anyInt(), anyInt(), anyInt(), anyObject())) + when(raster.getDataElements(anyInt(), anyInt(), anyInt(), anyInt(), any())) .thenAnswer(ans); ByteArrayOutputStream optimized = new ByteArrayOutputStream(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/xmp/XMPParserTestCase.java new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/xmp/XMPParserTestCase.java --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/xmp/XMPParserTestCase.java 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/xmp/XMPParserTestCase.java 2022-11-02 12:57:57.000000000 +0100 @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: XMPParserTestCase.java 1878394 2020-06-02 13:18:41Z ssteiner $ */ +/* $Id: XMPParserTestCase.java 1902231 2022-06-24 12:44:08Z ssteiner $ */ package org.apache.xmlgraphics.xmp; @@ -30,6 +30,9 @@ import org.junit.Test; +import org.xml.sax.Attributes; +import org.xml.sax.helpers.DefaultHandler; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -195,6 +198,30 @@ } @Test + public void testSubproperty() throws Exception { + URL url = getClass().getResource("test-subproperty.xmp"); + Metadata meta = XMPParser.parseXMP(url); + final StringBuilder sb = new StringBuilder(); + meta.toSAX(new DefaultHandler() { + public void startElement(String uri, String localName, String qName, Attributes attributes) { + sb.append(qName).append("\n"); + } + }); + assertEquals("x:xmpmeta\n" + + "rdf:RDF\n" + + "rdf:Description\n" + + "pdfaExtension:schemas\n" + + "rdf:Bag\n" + + "rdf:li\n" + + "rdf:Description\n" + + "pdfaSchema:property\n" + + "rdf:Seq\n" + + "rdf:li\n" + + "rdf:Description\n" + + "pdfaProperty:name\n", sb.toString()); + } + + @Test public void testExternalDTD() { String payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<!DOCTYPE root [\n<!ENTITY % remote SYSTEM \"http://127.0.0.1:9999/eval.xml\">\n%remote;]>\n" @@ -206,6 +233,6 @@ } catch (TransformerException e) { msg = e.getMessage(); } - assertTrue(msg, msg.contains("access is not allowed")); + assertTrue(msg, msg.contains("accessExternalDTD")); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/xmp/test-subproperty.xmp new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/xmp/test-subproperty.xmp --- old/xmlgraphics-commons-2.6/src/test/java/org/apache/xmlgraphics/xmp/test-subproperty.xmp 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlgraphics-commons-2.8/src/test/java/org/apache/xmlgraphics/xmp/test-subproperty.xmp 2022-11-02 12:57:57.000000000 +0100 @@ -0,0 +1,21 @@ +<x:xmpmeta xmlns:x="adobe:ns:meta/"> + <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" + xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" + xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#" rdf:about=""> + <pdfaExtension:schemas> + <rdf:Bag> + <rdf:li rdf:parseType="Resource"> + <pdfaSchema:property> + <rdf:Seq> + <rdf:li rdf:parseType="Resource"> + <pdfaProperty:name>DocumentFileName</pdfaProperty:name> + </rdf:li> + </rdf:Seq> + </pdfaSchema:property> + </rdf:li> + </rdf:Bag> + </pdfaExtension:schemas> + </rdf:Description> + </rdf:RDF> +</x:xmpmeta> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlgraphics-commons-2.6/xmlgraphics-commons-pom-template.pom new/xmlgraphics-commons-2.8/xmlgraphics-commons-pom-template.pom --- old/xmlgraphics-commons-2.6/xmlgraphics-commons-pom-template.pom 2021-01-12 11:44:35.000000000 +0100 +++ new/xmlgraphics-commons-2.8/xmlgraphics-commons-pom-template.pom 2022-11-02 12:57:57.000000000 +0100 @@ -70,7 +70,7 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>1.3.1</version> + <version>2.11.0</version> </dependency> <dependency> <groupId>commons-logging</groupId>