]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Made part of setupsRGBColorProfile method synchronized to avoid ConcurrentModificatio...
authorVincent Hennebert <vhennebert@apache.org>
Fri, 29 Jan 2010 11:33:10 +0000 (11:33 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Fri, 29 Jan 2010 11:33:10 +0000 (11:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@904467 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java

index 66753f37f52ebec4e8220eed59ea805276dfd770..7511bc20d1491b2455ed69a01767186cf952f7a1 100644 (file)
@@ -134,19 +134,21 @@ public class PDFICCBasedColorSpace extends PDFObject implements PDFColorSpace {
     public static PDFICCStream setupsRGBColorProfile(PDFDocument pdfDoc) {
         ICC_Profile profile;
         PDFICCStream sRGBProfile = pdfDoc.getFactory().makePDFICCStream();
-        InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm");
-        if (in != null) {
-            try {
-                profile = ICC_Profile.getInstance(in);
-            } catch (IOException ioe) {
-                throw new RuntimeException(
-                        "Unexpected IOException loading the sRGB profile: " + ioe.getMessage());
-            } finally {
-                IOUtils.closeQuietly(in);
+        synchronized (PDFICCBasedColorSpace.class) {
+            InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm");
+            if (in != null) {
+                try {
+                    profile = ICC_Profile.getInstance(in);
+                } catch (IOException ioe) {
+                    throw new RuntimeException(
+                            "Unexpected IOException loading the sRGB profile: " + ioe.getMessage());
+                } finally {
+                    IOUtils.closeQuietly(in);
+                }
+            } else {
+                // Fallback: Use the sRGB profile from the JRE (about 140KB)
+                profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
             }
-        } else {
-            // Fallback: Use the sRGB profile from the JRE (about 140KB)
-            profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
         }
         sRGBProfile.setColorSpace(profile, null);
         return sRGBProfile;