From 331c0cc11d72991ad31d9e5c3cfe6fe454a03009 Mon Sep 17 00:00:00 2001 From: "Matteo Franci a.k.a. Fugerit" Date: Sun, 8 Oct 2023 22:26:54 +0200 Subject: [PATCH] Fix sonar cloud issue --- .../openpdf/helpers/OpenPpfDocHandler.java | 2 +- .../doc/mod/itext/poc/TestDefaultDoc.java | 20 +++++++ src/test/resources/xml/default_doc_alt2.xml | 56 +++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/xml/default_doc_alt2.xml diff --git a/src/main/java/org/fugerit/java/doc/mod/openpdf/helpers/OpenPpfDocHandler.java b/src/main/java/org/fugerit/java/doc/mod/openpdf/helpers/OpenPpfDocHandler.java index 9c3846d..a7f279b 100644 --- a/src/main/java/org/fugerit/java/doc/mod/openpdf/helpers/OpenPpfDocHandler.java +++ b/src/main/java/org/fugerit/java/doc/mod/openpdf/helpers/OpenPpfDocHandler.java @@ -445,7 +445,7 @@ public static Element getElement( Document document, DocElement docElement, bool return result; } - private void handleHeaderFooterPara( DocElement docElement , Phrase phrase ) throws DocumentException, IOException { + private void handleHeaderFooterPara( DocElement docElement , Phrase phrase ) throws DocumentException { DocPara docPara = (DocPara) docElement; if ( !PageNumberHelper.isPageNumberContent( docPara.getText() ) ) { if ( docPara.getLeading() != null ) { diff --git a/src/test/java/test/org/fugerit/java/doc/mod/itext/poc/TestDefaultDoc.java b/src/test/java/test/org/fugerit/java/doc/mod/itext/poc/TestDefaultDoc.java index 61fa4b8..1d4077f 100644 --- a/src/test/java/test/org/fugerit/java/doc/mod/itext/poc/TestDefaultDoc.java +++ b/src/test/java/test/org/fugerit/java/doc/mod/itext/poc/TestDefaultDoc.java @@ -29,6 +29,8 @@ public static void init() { private static final String DEFAULT_DOC_ALT = "default_doc_alt"; private static final String DEFAULT_DOC_ALT1 = "default_doc_alt1"; + + private static final String DEFAULT_DOC_ALT2 = "default_doc_alt2"; @Test public void testOpenFailPDF() { @@ -96,4 +98,22 @@ public void testOpenAlt1RTF() { Assert.assertTrue(ok); } + @Test + public void testOpenAlt2PDF() { + boolean ok = this.testDocWorker( DEFAULT_DOC_ALT2 , PdfTypeHandler.HANDLER ); + Assert.assertTrue(ok); + } + + @Test + public void testOpenAlt2HTML() { + boolean ok = this.testDocWorker( DEFAULT_DOC_ALT2 , HtmlTypeHandler.HANDLER ); + Assert.assertTrue(ok); + } + + @Test + public void testOpenAlt2RTF() { + boolean ok = this.testDocWorker( DEFAULT_DOC_ALT2 , RtfTypeHandler.HANDLER ); + Assert.assertTrue(ok); + } + } diff --git a/src/test/resources/xml/default_doc_alt2.xml b/src/test/resources/xml/default_doc_alt2.xml new file mode 100644 index 0000000..c326f9b --- /dev/null +++ b/src/test/resources/xml/default_doc_alt2.xml @@ -0,0 +1,56 @@ + + + + + + 10;10;10;30 + excel-table=print + + Basic example + fj doc venus sample source xml + fugerit79 + en + + true + /css/test.css +
+ header +
+
+ footer +
+
+ + Test times roman + Courier + Symbol + Symbol + Test default font + + + Name + Surname + Title + + + + + + + + + + + + + + + + +
+ + +
\ No newline at end of file