aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2010-01-29 11:33:10 +0000
committerVincent Hennebert <vhennebert@apache.org>2010-01-29 11:33:10 +0000
commit56b6bee870af953e5e24b99e8e57f3378012b87c (patch)
tree350b20be67fd2bf7d399edc0c8e8a1847e6df1a0
parenta86f348c9e7a6589e8c71a60ef3f484c98f61d7c (diff)
downloadxmlgraphics-fop-56b6bee870af953e5e24b99e8e57f3378012b87c.tar.gz
xmlgraphics-fop-56b6bee870af953e5e24b99e8e57f3378012b87c.zip
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
-rw-r--r--src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java26
1 files changed, 14 insertions, 12 deletions
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;