From: Vincent Hennebert Date: Fri, 29 Jan 2010 11:33:10 +0000 (+0000) Subject: Made part of setupsRGBColorProfile method synchronized to avoid ConcurrentModificatio... X-Git-Tag: fop-1_0~71 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=56b6bee870af953e5e24b99e8e57f3378012b87c;p=xmlgraphics-fop.git Made part of setupsRGBColorProfile method synchronized to avoid ConcurrentModificationException when PDF documents are being produced in multiple threads git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@904467 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java b/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java index 66753f37f..7511bc20d 100644 --- a/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java +++ b/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java @@ -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;