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 2021/05/06 18:09:28 UTC

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

Author: tilman
Date: Thu May  6 18:09:28 2021
New Revision: 1889574

URL: http://svn.apache.org/viewvc?rev=1889574&view=rev
Log:
PDFBOX-4892: correct javadoc and check parameter, as suggested by valerybokov

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java?rev=1889574&r1=1889573&r2=1889574&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java Thu May  6 18:09:28 2021
@@ -147,35 +147,30 @@ public abstract class PDCIEDictionaryBas
     }
 
     /**
-     * This will set the whitepoint tristimulus. As this is a required field
-     * this null should not be passed into this function.
+     * This will set the whitepoint tristimulus. As this is a required field, null should not be
+     * passed into this function.
      *
-     * @param whitepoint the whitepoint tristimulus
+     * @param whitepoint the whitepoint tristimulus.
+     * @throws IllegalArgumentException if null is passed as argument.
      */
     public void setWhitePoint(PDTristimulus whitepoint)
     {
-        COSBase wpArray = whitepoint.getCOSObject();
-        if (wpArray != null)
+        if (whitepoint == null)
         {
-            dictionary.setItem(COSName.WHITE_POINT, wpArray);
+            throw new IllegalArgumentException("Whitepoint may not be null");
         }
+        dictionary.setItem(COSName.WHITE_POINT, whitepoint);
         fillWhitepointCache(whitepoint);
     }
 
     /**
-     * This will set the BlackPoint tristimulus. As this is a required field
-     * this null should not be passed into this function.
+     * This will set the BlackPoint tristimulus.
      *
      * @param blackpoint the BlackPoint tristimulus
      */
     public void setBlackPoint(PDTristimulus blackpoint)
     {
-        COSBase bpArray = null;
-        if (blackpoint != null)
-        {
-            bpArray = blackpoint.getCOSObject();
-        }
-        dictionary.setItem(COSName.BLACK_POINT, bpArray);
+        dictionary.setItem(COSName.BLACK_POINT, blackpoint);
     }
 
 }