Author: tilman
Date: Wed Mar 25 09:44:13 2026
New Revision: 1932532

Log:
PDFBOX-5660: sonar fix

Modified:
   
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceStringTest.java
   
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/rendering/TestPDFToImage.java
   
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java
   
pdfbox/branches/3.0/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
   
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java

Modified: 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceStringTest.java
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceStringTest.java
      Wed Mar 25 09:24:33 2026        (r1932531)
+++ 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceStringTest.java
      Wed Mar 25 09:44:13 2026        (r1932532)
@@ -63,7 +63,7 @@ class PDDefaultAppearanceStringTest
     }
     
     @Test
-    void testFontResourceUnavailable() throws IOException
+    void testFontResourceUnavailable()
     {
         COSString sampleString = new COSString("/Helvetica 12 Tf 0.019 0.305 
0.627 rg");
         assertThrows(IOException.class, () -> {
@@ -72,7 +72,7 @@ class PDDefaultAppearanceStringTest
     }
     
     @Test
-    void testWrongNumberOfColorArguments() throws IOException
+    void testWrongNumberOfColorArguments()
     {
         COSString sampleString = new COSString("/Helvetica 12 Tf 0.305 0.627 
rg");
         assertThrows(IOException.class, () -> {

Modified: 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/rendering/TestPDFToImage.java
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/rendering/TestPDFToImage.java
    Wed Mar 25 09:24:33 2026        (r1932531)
+++ 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/rendering/TestPDFToImage.java
    Wed Mar 25 09:44:13 2026        (r1932532)
@@ -106,11 +106,8 @@ public class TestPDFToImage
      * @return If the images are different, the function returns a diff image. 
If the images are
      * identical, the function returns null. If the size is different, a black 
border on the bottom
      * at the right is created.
-     *
-     * @throws IOException
      */
     private static BufferedImage diffImages(BufferedImage bim1, BufferedImage 
bim2)
-            throws IOException
     {
         int minWidth = Math.min(bim1.getWidth(), bim2.getWidth());
         int minHeight = Math.min(bim1.getHeight(), bim2.getHeight());

Modified: 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java
       Wed Mar 25 09:24:33 2026        (r1932531)
+++ 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java
       Wed Mar 25 09:44:13 2026        (r1932532)
@@ -128,11 +128,9 @@ class TestTextStripper
 
     /**
      * Test class initialization.
-     *
-     * @throws IOException If there is an error initializing the test.
      */
     @BeforeAll
-    static void init() throws IOException
+    static void init()
     {
         stripper = new PDFTextStripper();
         stripper.setLineSeparator("\n");

Modified: 
pdfbox/branches/3.0/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
==============================================================================
--- 
pdfbox/branches/3.0/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
       Wed Mar 25 09:24:33 2026        (r1932531)
+++ 
pdfbox/branches/3.0/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
       Wed Mar 25 09:44:13 2026        (r1932532)
@@ -238,8 +238,7 @@ class TestImageIOUtils
         checkBufferedImageSize(filename, image, newImage);
     }
 
-    private void checkBufferedImageSize(String filename,
-            BufferedImage image, BufferedImage newImage) throws IOException
+    private void checkBufferedImageSize(String filename, BufferedImage image, 
BufferedImage newImage)
     {
         assertEquals(image.getHeight(), newImage.getHeight(), "File '" + 
filename + "' has different height after read");
         assertEquals(image.getWidth(), newImage.getWidth(), "File '" + 
filename + "' has different width after read");
@@ -376,7 +375,7 @@ class TestImageIOUtils
         // BMP format explained here:
         // 
http://www.javaworld.com/article/2077561/learn-java/java-tip-60--saving-bitmap-files-in-java.html
         // we skip 38 bytes and then read two 4 byte-integers and reverse the 
bytes
-        try (DataInputStream dis = new DataInputStream(new FileInputStream(new 
File(filename))))
+        try (DataInputStream dis = new DataInputStream(new 
FileInputStream(filename)))
         {
             int skipped = dis.skipBytes(38);
             assertEquals(38, skipped, "Can't skip 38 bytes in image file " + 
filename);

Modified: 
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java
==============================================================================
--- 
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java
 Wed Mar 25 09:24:33 2026        (r1932531)
+++ 
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java
 Wed Mar 25 09:44:13 2026        (r1932532)
@@ -73,25 +73,21 @@ class PDFAIdentificationOthersTest
     }
 
     @Test
-    void testBadPDFAConformanceId() throws BadFieldValueException
+    void testBadPDFAConformanceId()
     {
         XMPMetadata metadata = XMPMetadata.createXMPMetadata();
         PDFAIdentificationSchema pdfaid = 
metadata.createAndAddPDFAIdentificationSchema();
         String conformance = "kiohiohiohiohio";
-        assertThrows(BadFieldValueException.class, () -> {
-               pdfaid.setConformance(conformance);
-           });
+        assertThrows(BadFieldValueException.class, () -> 
pdfaid.setConformance(conformance));
     }
 
     @Test
-    void testBadVersionIdValueType() throws Exception
+    void testBadVersionIdValueType()
     {
         XMPMetadata metadata = XMPMetadata.createXMPMetadata();
         PDFAIdentificationSchema pdfaid = 
metadata.createAndAddPDFAIdentificationSchema();
         pdfaid.setPartValueWithString("1");
-        assertThrows(IllegalArgumentException.class, () -> {
-            pdfaid.setPartValueWithString("ojoj");
-           });
+        assertThrows(IllegalArgumentException.class, () -> 
pdfaid.setPartValueWithString("ojoj"));
     }
 
 }

Reply via email to