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:46 UTC
svn commit: r1884898 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java
Author: tilman
Date: Tue Dec 29 11:11:46 2020
New Revision: 1884898
URL: http://svn.apache.org/viewvc?rev=1884898&view=rev
Log:
PDFBOX-5056: remove JVM bug related workaround that is no longer needed, as suggested by Andreas Lehmkühler
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java?rev=1884898&r1=1884897&r2=1884898&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java Tue Dec 29 11:11:46 2020
@@ -36,40 +36,10 @@ 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!
//