pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1681643 - in /pdfbox/branches/1.8/pdfbox/src: main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java test/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBasedTest.java
Date Mon, 25 May 2015 19:34:06 GMT
Author: tilman
Date: Mon May 25 19:34:06 2015
New Revision: 1681643

URL: http://svn.apache.org/r1681643
Log:
PDFBOX-2812: avoid NPE in PDColorSpaceFactory.createColorSpace()

Added:
    pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBasedTest.java
  (with props)
Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java?rev=1681643&r1=1681642&r2=1681643&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
Mon May 25 19:34:06 2015
@@ -83,7 +83,8 @@ public class PDICCBased extends PDColorS
     {
         array = new COSArray();
         array.add( COSName.ICCBASED );
-        array.add( new PDStream( doc ) );
+        stream = new PDStream(doc);
+        array.add(stream);
     }
 
     /**

Added: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBasedTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBasedTest.java?rev=1681643&view=auto
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBasedTest.java
(added)
+++ pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBasedTest.java
Mon May 25 19:34:06 2015
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel.graphics.color;
+
+import java.awt.color.ColorSpace;
+import java.io.IOException;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import org.junit.Test;
+
+/**
+ *
+ * @author Tilman Hausherr
+ */
+public class PDICCBasedTest
+{
+
+    public PDICCBasedTest()
+    {
+    }
+
+    /**
+     * Test of Constructor for PDFBOX-2812.
+     */
+    @Test
+    public void testConstructor() throws IOException
+    {
+        PDDocument doc = new PDDocument();
+        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
+        assertFalse(cs.isCS_sRGB()); // this test doesn't work with CS_sRGB
+        PDICCBased iccBased = (PDICCBased) PDColorSpaceFactory.createColorSpace(doc, cs);
+        Assert.assertEquals("ICCBased", iccBased.getName());
+    }
+
+}

Propchange: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBasedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message