Author: vhennebert
Date: Fri Jan 29 11:33:10 2010
New Revision: 904467

URL: http://svn.apache.org/viewvc?rev=904467&view=rev
Log:
Made part of setupsRGBColorProfile method synchronized to avoid 
ConcurrentModificationException when PDF documents are being produced in 
multiple threads

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java?rev=904467&r1=904466&r2=904467&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java 
Fri Jan 29 11:33:10 2010
@@ -134,19 +134,21 @@
     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;



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to