Author: ssteiner
Date: Wed Jun 10 11:55:35 2020
New Revision: 1878709

URL: http://svn.apache.org/viewvc?rev=1878709&view=rev
Log:
FOP-2942: COSNull not supported error

Modified:
    
xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PDFWriter.java
    
xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java

Modified: 
xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PDFWriter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PDFWriter.java?rev=1878709&r1=1878708&r2=1878709&view=diff
==============================================================================
--- 
xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PDFWriter.java
 (original)
+++ 
xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PDFWriter.java
 Wed Jun 10 11:55:35 2020
@@ -34,6 +34,7 @@ import org.apache.pdfbox.cos.COSDictiona
 import org.apache.pdfbox.cos.COSFloat;
 import org.apache.pdfbox.cos.COSInteger;
 import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.cos.COSNull;
 import org.apache.pdfbox.cos.COSString;
 import org.apache.pdfbox.pdfparser.PDFStreamParser;
 import org.apache.pdfbox.pdmodel.common.PDStream;
@@ -131,6 +132,8 @@ public class PDFWriter {
             s.append(">>");
         } else if (c instanceof COSBoolean) {
             s.append(((COSBoolean) c).getValue()).append(" ");
+        } else if (c instanceof COSNull) {
+            s.append("null ");
         } else {
             throw new IOException(c + " not supported");
         }

Modified: 
xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java?rev=1878709&r1=1878708&r2=1878709&view=diff
==============================================================================
--- 
xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java
 (original)
+++ 
xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java
 Wed Jun 10 11:55:35 2020
@@ -70,4 +70,13 @@ public class PDFWriterTestCase {
         String out = pdfWriter.writeText(pdStream);
         Assert.assertEquals(out, text);
     }
+
+    @Test
+    public void testNull() throws IOException {
+        String text = "[null ] a\n";
+        PDStream pdStream = new PDStream(new PDDocument(), new 
ByteArrayInputStream(text.getBytes("UTF-8")));
+        PDFWriter pdfWriter = new MyPDFWriter();
+        String out = pdfWriter.writeText(pdStream);
+        Assert.assertEquals(out, text);
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-h...@xmlgraphics.apache.org

Reply via email to