Author: tilman
Date: Mon Oct 27 13:15:43 2025
New Revision: 1929372

Log:
PDFBOX-5660: close input, as suggested by Valery Bokov; closes #294

Modified:
   
pdfbox/branches/3.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java

Modified: 
pdfbox/branches/3.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java
==============================================================================
--- 
pdfbox/branches/3.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java
       Mon Oct 27 13:15:39 2025        (r1929371)
+++ 
pdfbox/branches/3.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java
       Mon Oct 27 13:15:43 2025        (r1929372)
@@ -118,9 +118,12 @@ public final class CreatePDFA
             }
 
             // sRGB output intent
-            InputStream colorProfile = CreatePDFA.class.getResourceAsStream(
-                    "/org/apache/pdfbox/resources/pdfa/sRGB.icc");
-            PDOutputIntent intent = new PDOutputIntent(doc, colorProfile);
+            PDOutputIntent intent;
+            try (InputStream colorProfile = 
CreatePDFA.class.getResourceAsStream(
+                            "/org/apache/pdfbox/resources/pdfa/sRGB.icc"))
+            {
+                intent = new PDOutputIntent(doc, colorProfile);
+            }
             intent.setInfo("sRGB IEC61966-2.1");
             intent.setOutputCondition("sRGB IEC61966-2.1");
             intent.setOutputConditionIdentifier("sRGB IEC61966-2.1");

Reply via email to