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 2026/09/02 17:28:54 UTC

svn commit: r1937783 - pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf

Author: tilman
Date: Wed Sep  2 17:28:53 2026
New Revision: 1937783

Log:
PDFBOX-5660: avoid NPE

Modified:
   pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java	Wed Sep  2 15:53:34 2026	(r1937782)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java	Wed Sep  2 17:28:53 2026	(r1937783)
@@ -110,11 +110,17 @@ public class FDFField implements COSObje
      * @param output The stream to write the xml to.
      *
      * @throws IOException If there is an error writing the XML.
+     * @throws IllegalStateException If the field name is missing
      */
     public void writeXML(Writer output) throws IOException
     {
+        String partialFieldName = getPartialFieldName();
+        if (partialFieldName == null)
+        {
+            throw new IllegalStateException("Field name is missing");
+        }
         output.write("<field name=\"");
-        output.write(FDFUtils.escapeXML10(getPartialFieldName()));
+        output.write(FDFUtils.escapeXML10(partialFieldName));
         output.write("\">\n");
 
         Object value = getValue();