Author: tilman
Date: Sun Jun 14 08:19:08 2026
New Revision: 1935273
Log:
PDFBOX-5660: Sonar fix
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSString.java
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java
Sun Jun 14 08:08:47 2026 (r1935272)
+++
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSInteger.java
Sun Jun 14 08:19:08 2026 (r1935273)
@@ -32,16 +32,9 @@ import org.junit.Assert;
*/
public class TestCOSInteger extends TestCOSNumber
{
- public void setUp()
+ public void setUp() throws IOException
{
- try
- {
- testCOSBase = COSNumber.get("0");
- }
- catch (IOException e)
- {
- fail("Failed to create a COSNumber in setUp()");
- }
+ testCOSBase = COSNumber.get("0");
}
/**
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSString.java
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSString.java
Sun Jun 14 08:08:47 2026 (r1935272)
+++
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSString.java
Sun Jun 14 08:19:08 2026 (r1935273)
@@ -67,9 +67,11 @@ public class TestCOSString extends TestC
/**
* Test setForceHexForm() and setForceLiteralForm() - tests these two
methods do enforce the
- * different String output forms within PDF.
+ * different String output forms within PDF.
+ *
+ * @throws IOException
*/
- public void testSetForceHexLiteralForm()
+ public void testSetForceHexLiteralForm() throws IOException
{
String inputString = "Test with a text and a few numbers 1, 2 and 3";
String pdfHex = "<" + createHex(inputString) + ">";
@@ -90,17 +92,10 @@ public class TestCOSString extends TestC
* @param expected the String expected when writePDF() is invoked
* @param testSubj the test subject
*/
- private void writePDFTests(String expected, COSString testSubj)
+ private void writePDFTests(String expected, COSString testSubj) throws
IOException
{
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- try
- {
- COSWriter.writeString(testSubj, outStream);
- }
- catch (IOException e)
- {
- fail("IOException: " + e.getMessage());
- }
+ COSWriter.writeString(testSubj, outStream);
Assert.assertEquals(expected, outStream.toString());
}
@@ -196,8 +191,10 @@ public class TestCOSString extends TestC
/**
* Tests writePDF() - tests that the string is in PDF format.
+ *
+ * @throws IOException
*/
- public void testWritePDF()
+ public void testWritePDF() throws IOException
{
// This has been tested quite thorougly above but do a couple tests
anyway
COSString testSubj = new COSString(ESC_CHAR_STRING);