From 49f1464fb390f093451d28bdde4e87ff435d695d Mon Sep 17 00:00:00 2001 From: tomas-sexenian Date: Tue, 17 Oct 2023 10:53:25 -0300 Subject: [PATCH 1/3] Do not log as error exception that is probably always thrown intentionally Issue:105322 --- java/src/main/java/com/genexus/reports/GXReport.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/src/main/java/com/genexus/reports/GXReport.java b/java/src/main/java/com/genexus/reports/GXReport.java index ba93afebe..f409a6100 100644 --- a/java/src/main/java/com/genexus/reports/GXReport.java +++ b/java/src/main/java/com/genexus/reports/GXReport.java @@ -80,6 +80,8 @@ else if (implementation.equals("ITEXT8")) else reportHandler = new PDFReportPDFBox(context); ((GXReportPDFCommons) reportHandler).setOutputStream(getOutputStream()); + } catch (RuntimeException e) { + log.debug("getPrinter may have failed to set the output stream for the report: ", e); } catch (Exception e) { log.error("Failed to set output stream: ", e); } From 1826df4d51842a42ddf3ac62c27085edd16ba00b Mon Sep 17 00:00:00 2001 From: tomas-sexenian Date: Mon, 23 Oct 2023 17:59:44 -0300 Subject: [PATCH 2/3] GXReport output strem is always null --- java/src/main/java/com/genexus/reports/GXReport.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/src/main/java/com/genexus/reports/GXReport.java b/java/src/main/java/com/genexus/reports/GXReport.java index f409a6100..d42ed3cc4 100644 --- a/java/src/main/java/com/genexus/reports/GXReport.java +++ b/java/src/main/java/com/genexus/reports/GXReport.java @@ -80,8 +80,6 @@ else if (implementation.equals("ITEXT8")) else reportHandler = new PDFReportPDFBox(context); ((GXReportPDFCommons) reportHandler).setOutputStream(getOutputStream()); - } catch (RuntimeException e) { - log.debug("getPrinter may have failed to set the output stream for the report: ", e); } catch (Exception e) { log.error("Failed to set output stream: ", e); } @@ -141,7 +139,7 @@ protected int getOutputType() { } protected java.io.OutputStream getOutputStream() { - throw new RuntimeException("Output stream not set"); + return null; } //M�todos para la implementaci�n de reportes din�micos From c25b9c4680f88f168ef130c6767f05c195e00de8 Mon Sep 17 00:00:00 2001 From: tomas-sexenian Date: Mon, 23 Oct 2023 18:16:09 -0300 Subject: [PATCH 3/3] Remove try-catch block --- .../java/com/genexus/reports/GXReport.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/java/src/main/java/com/genexus/reports/GXReport.java b/java/src/main/java/com/genexus/reports/GXReport.java index d42ed3cc4..01d74646d 100644 --- a/java/src/main/java/com/genexus/reports/GXReport.java +++ b/java/src/main/java/com/genexus/reports/GXReport.java @@ -71,18 +71,14 @@ public IReportHandler getPrinter() } else if (getOutputType() == OUTPUT_PDF) { - try { - String implementation = com.genexus.Application.getClientContext().getClientPreferences().getPDF_RPT_LIBRARY(); - if (implementation.equals("ITEXT")) - reportHandler = new PDFReportItext2(context); - else if (implementation.equals("ITEXT8")) - reportHandler = new PDFReportItext8(context); - else - reportHandler = new PDFReportPDFBox(context); - ((GXReportPDFCommons) reportHandler).setOutputStream(getOutputStream()); - } catch (Exception e) { - log.error("Failed to set output stream: ", e); - } + String implementation = com.genexus.Application.getClientContext().getClientPreferences().getPDF_RPT_LIBRARY(); + if (implementation.equals("ITEXT")) + reportHandler = new PDFReportItext2(context); + else if (implementation.equals("ITEXT8")) + reportHandler = new PDFReportItext8(context); + else + reportHandler = new PDFReportPDFBox(context); + ((GXReportPDFCommons) reportHandler).setOutputStream(getOutputStream()); } else { throw new RuntimeException("Unrecognized report type: " + getOutputType());