diff --git a/xmlgraphics-commons-java-7-fix.patch b/xmlgraphics-commons-java-7-fix.patch
new file mode 100644
index 0000000..cc83a93
--- /dev/null
+++ b/xmlgraphics-commons-java-7-fix.patch
@@ -0,0 +1,1052 @@
+diff -r 5073426893de xmlgraphics-commons-1.4/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java
+--- src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java Tue Feb 21 12:29:55 2012 +0100
++++ src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java Tue Feb 21 12:50:48 2012 +0100
+@@ -15,7 +15,7 @@
+ * limitations under the License.
+ */
+
+-/* $Id: TIFFImage.java 750418 2009-03-05 11:03:54Z vhennebert $ */
++/* $Id$ */
+
+ package org.apache.xmlgraphics.image.codec.tiff;
+
+@@ -35,7 +35,6 @@
+ import java.awt.image.Raster;
+ import java.awt.image.SampleModel;
+ import java.awt.image.WritableRaster;
+-import java.io.ByteArrayInputStream;
+ import java.io.IOException;
+ import java.util.HashMap;
+ import java.util.Map;
+@@ -46,10 +45,6 @@
+ import org.apache.xmlgraphics.image.rendered.AbstractRed;
+ import org.apache.xmlgraphics.image.rendered.CachableRed;
+
+-import com.sun.image.codec.jpeg.JPEGCodec;
+-import com.sun.image.codec.jpeg.JPEGDecodeParam;
+-import com.sun.image.codec.jpeg.JPEGImageDecoder;
+-
+ public class TIFFImage extends AbstractRed {
+
+ // Compression types
+@@ -101,10 +96,6 @@
+ // LZW compression related variable
+ int predictor;
+
+- // TTN2 JPEG related variables
+- JPEGDecodeParam decodeParam = null;
+- boolean colorConvertJPEG = false;
+-
+ // DEFLATE variables
+ Inflater inflater = null;
+
+@@ -123,46 +114,6 @@
+ private TIFFLZWDecoder lzwDecoder = null;
+
+ /**
+- * Decode a buffer of data into a Raster with the specified location.
+- *
+- * @param data buffer contain an interchange or abbreviated datastream.
+- * @param decodeParam decoding parameters; may be null unless the
+- * data buffer contains an abbreviated datastream in which case
+- * it may not be null or an error will occur.
+- * @param colorConvert whether to perform color conversion; in this
+- * case that would be limited to YCbCr-to-RGB.
+- * @param minX the X position of the returned Raster.
+- * @param minY the Y position of the returned Raster.
+- */
+- private static final Raster decodeJPEG(byte[] data,
+- JPEGDecodeParam decodeParam,
+- boolean colorConvert,
+- int minX,
+- int minY) {
+- // Create an InputStream from the compressed data array.
+- ByteArrayInputStream jpegStream = new ByteArrayInputStream(data);
+-
+- // Create a decoder.
+- JPEGImageDecoder decoder = decodeParam == null ?
+- JPEGCodec.createJPEGDecoder(jpegStream) :
+- JPEGCodec.createJPEGDecoder(jpegStream,
+- decodeParam);
+-
+- // Decode the compressed data into a Raster.
+- Raster jpegRaster;
+- try {
+- jpegRaster = colorConvert ?
+- decoder.decodeAsBufferedImage().getWritableTile(0, 0) :
+- decoder.decodeAsRaster();
+- } catch (IOException ioe) {
+- throw new RuntimeException("TIFFImage13");
+- }
+-
+- // Translate the decoded Raster to the specified location and return.
+- return jpegRaster.createTranslatedChild(minX, minY);
+- }
+-
+- /**
+ * Inflates deflated
into inflated
using the
+ * Inflater
constructed during class instantiation.
+ */
+@@ -170,8 +121,8 @@
+ inflater.setInput(deflated);
+ try {
+ inflater.inflate(inflated);
+- } catch(DataFormatException dfe) {
+- throw new RuntimeException("TIFFImage17"+": "+
++ } catch (DataFormatException dfe) {
++ throw new RuntimeException("TIFFImage17" + ": " +
+ dfe.getMessage());
+ }
+ inflater.reset();
+@@ -180,26 +131,27 @@
+ private static SampleModel createPixelInterleavedSampleModel
+ (int dataType, int tileWidth, int tileHeight, int bands) {
+ int [] bandOffsets = new int[bands];
+- for (int i=0; i> 4);
+ data[dstCount++] =
+@@ -1278,15 +1167,15 @@
+ }
+ }
+
+- int len = colormap.length/3;
+- int len2 = len*2;
++ int len = colormap.length / 3;
++ int len2 = len * 2;
+ int cmapValue, lookup;
+ int count = 0;
+- for (int i=0; i= 0 && b <= 127) {
+
+ // literal run packet
+- for (int i=0; i<(b + 1); i++) {
++ for (int i = 0; i < (b + 1); i++) {
+ dst[dstCount++] = data[srcCount++];
+ }
+
+@@ -1750,7 +1635,7 @@
+
+ // 2 byte encoded run packet
+ repeat = data[srcCount++];
+- for (int i=0; i<(-b + 1); i++) {
++ for (int i = 0; i < (-b + 1); i++) {
+ dst[dstCount++] = repeat;
+ }
+
+@@ -1803,7 +1688,7 @@
+ }
+
+ RGBBits = new int[numBands];
+- for(int i = 0; i < numBands; i++) {
++ for (int i = 0; i < numBands; i++) {
+ RGBBits[i] = componentSize;
+ }
+
+diff -r 5073426893de xmlgraphics-commons-1.4/src/java/org/apache/xmlgraphics/java2d/ps/PSTilingPattern.java
+--- src/java/org/apache/xmlgraphics/java2d/ps/PSTilingPattern.java Tue Feb 21 12:29:55 2012 +0100
++++ src/java/org/apache/xmlgraphics/java2d/ps/PSTilingPattern.java Tue Feb 21 12:50:48 2012 +0100
+@@ -51,7 +51,7 @@
+ protected String patternName = null;
+
+ /**
+- * The XUID is an extended unique ID — an array of integers that provides for
++ * The XUID is an extended unique ID � an array of integers that provides for
+ * distributed, hierarchical management of the space of unique ID numbers
+ * (optional)
+ */
+@@ -65,7 +65,7 @@
+ /**
+ * An array of four numbers in the pattern coordinate system, giving
+ * the coordinates of the left, bottom, right, and top edges, respectively, of the
+- * pattern cell’s bounding box
++ * pattern cell's bounding box
+ */
+ protected Rectangle2D bBox = null;
+
+@@ -108,7 +108,7 @@
+ * the name is null, the pattern should be stored in PSPatternStorage, where the pattern
+ * gets a name (the pattern without name cannot be use in PS file)
+ * @param paintProc a postscript procedure for painting the pattern cell
+- * @param bBox a pattern cell’s bounding box
++ * @param bBox a pattern cell's bounding box
+ * @param xStep the desired horizontal spacing between pattern cells
+ * @param yStep the desired vertical spacing between pattern cells
+ * @param paintType 1 for colored pattern, 2 for uncolored pattern
+@@ -192,7 +192,7 @@
+ /**
+ * Returns the bounding box.
+ *
+- * @return a pattern cell’s bounding box
++ * @return a pattern cell's bounding box
+ */
+ public Rectangle2D getBoundingBox() {
+ return (this.bBox);
+@@ -201,7 +201,7 @@
+ /**
+ * Sets the bounding box.
+ *
+- * @param bBox a pattern cell’s bounding box
++ * @param bBox a pattern cell's bounding box
+ */
+ public void setBoundingBox(Rectangle2D bBox) {
+ if (bBox == null) {
+@@ -392,9 +392,9 @@
+ }
+
+ // define color image: width height bits/comp matrix
+- // datasrc0 … datasrcncomp-1 multi ncomp colorimage
++ // datasrc0 datasrcncomp-1 multi ncomp colorimage
+ sb.append(width + " " + height + " 8 " + "matrix\n"); // width height bits/comp matrix
+- int [] argb = new int[width * height]; // datasrc0 … datasrcncomp-1
++ int [] argb = new int[width * height]; // datasrc0 datasrcncomp-1
+ sb.append("{<");
+ texture.getImage().getRGB(0, 0, width, height, argb, 0, width);
+ int count = 0;
diff --git a/xmlgraphics-commons.spec b/xmlgraphics-commons.spec
index e6d02a9..df6d7ee 100644
--- a/xmlgraphics-commons.spec
+++ b/xmlgraphics-commons.spec
@@ -1,6 +1,6 @@
Name: xmlgraphics-commons
Version: 1.4
-Release: 4
+Release: 5
Epoch: 0
Summary: XML Graphics Commons
@@ -8,6 +8,7 @@ Group: Development/Libraries
License: ASL 2.0
URL: http://xmlgraphics.apache.org/
Source0: http://apache.skknet.net/xmlgraphics/commons/source/%{name}-%{version}-src.tar.gz
+Patch0: %{name}-java-7-fix.patch
BuildArch: noarch
BuildRequires: java-devel >= 1:1.6.0
@@ -43,6 +44,7 @@ Requires: jpackage-utils
%prep
%setup -q %{name}-%{version}
rm -f `find . -name "*.jar"`
+%patch0
# create pom from template
sed "s:@version@:%{version}:g" %{name}-pom-template.pom \
@@ -84,6 +86,10 @@ cp -pr build/javadocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%changelog
+* Thu Mar 01 2012 Jiri Vanek - 0:1.4-5
+- Resolves: rhbz#796341
+- Added xmlgraphics-commons-java-7-fix.patch to fix build with Java 7
+
* Sat Jan 14 2012 Fedora Release Engineering - 0:1.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild