You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/12/29 11:11:50 UTC

svn commit: r1884899 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java

Author: tilman
Date: Tue Dec 29 11:11:50 2020
New Revision: 1884899

URL: http://svn.apache.org/viewvc?rev=1884899&view=rev
Log:
PDFBOX-5056: remove JVM bug related workaround that is no longer needed, as suggested by Andreas Lehmkühler

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java?rev=1884899&r1=1884898&r2=1884899&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java Tue Dec 29 11:11:50 2020
@@ -36,41 +36,11 @@ public final class PDDeviceRGB extends P
     public static final PDDeviceRGB INSTANCE = new PDDeviceRGB();
     
     private final PDColor initialColor = new PDColor(new float[] { 0, 0, 0 }, this);
-    private volatile boolean initDone = false;
 
     private PDDeviceRGB()
     {
     }
 
-    /**
-     * Lazy setting of the AWT color space due to JDK race condition.
-     */
-    private void init()
-    {
-        // no need to synchronize this check as it is atomic
-        if (initDone)
-        {
-            return;
-        }
-
-        synchronized (this)
-        {
-            // we might have been waiting for another thread, so check again
-            if (initDone)
-            {
-                return;
-            }
-
-            // there is a JVM bug which results in a CMMException which appears to be a race
-            // condition caused by lazy initialization of the color transform, so we perform
-            // an initial color conversion while we're still synchronized, see PDFBOX-2184
-            ColorSpace.getInstance(ColorSpace.CS_sRGB).toRGB(new float[] { 0, 0, 0, 0 });
-
-            // This volatile write must be the LAST statement in the synchronized block!
-            initDone = true;
-        }
-    }
-    
     @Override
     public String getName()
     {
@@ -107,8 +77,6 @@ public final class PDDeviceRGB extends P
     @Override
     public BufferedImage toRGBImage(WritableRaster raster) throws IOException
     {
-        init();
-
         //
         // WARNING: this method is performance sensitive, modify with care!
         //