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 2018/08/22 16:09:08 UTC

svn commit: r1838653 - in /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox: Overlay.java util/Overlay.java

Author: tilman
Date: Wed Aug 22 16:09:08 2018
New Revision: 1838653

URL: http://svn.apache.org/viewvc?rev=1838653&view=rev
Log:
PDFBOX-4298: avoid NPE; use similar text

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/Overlay.java
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/Overlay.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/Overlay.java?rev=1838653&r1=1838652&r2=1838653&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/Overlay.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/Overlay.java Wed Aug 22 16:09:08 2018
@@ -271,7 +271,8 @@ public class Overlay
             }
             else
             {
-                throw new IOException( "Contents are unknown type:" + contents.getClass().getName() );
+                throw new IOException( "Unknown content type: " +
+                        (contents == null ? "(null)" : contents.getClass().getName()));
             }
         }
     }
@@ -391,7 +392,8 @@ public class Overlay
             }
             else
             {
-                throw new IOException( "Contents are unknown type:" + contents.getClass().getName() );
+                throw new IOException( "Unknown content type: " +
+                        (contents == null ? "(null)" : contents.getClass().getName()));
             }
             pageCount++;
         }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java?rev=1838653&r1=1838652&r2=1838653&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/Overlay.java Wed Aug 22 16:09:08 2018
@@ -333,7 +333,8 @@ public class Overlay
         }
         else
         {
-            throw new IOException("Contents are unknown type:" + contents.getClass().getName());
+            throw new IOException("Unknown content type: " + 
+                    (contents == null ? "(null)" : contents.getClass().getName()));
         }
         return contentStreams;
     }
@@ -362,7 +363,8 @@ public class Overlay
                 }
                 else
                 {
-                    throw new IOException("Unknown content type:" + contents.getClass().getName());
+                    throw new IOException("Unknown content type: " +
+                            (contents == null ? "(null)" : contents.getClass().getName()));
                 }
                 // restore state
                 contentArray.add(createStream("Q\n"));
@@ -383,7 +385,8 @@ public class Overlay
                 }
                 else
                 {
-                    throw new IOException("Unknown content type:" + contents.getClass().getName());
+                    throw new IOException("Unknown content type: " +
+                            (contents == null ? "(null)" : contents.getClass().getName()));
                 }
                 break;
             default: