File tree Expand file tree Collapse file tree 4 files changed +19
-11
lines changed
marketplace/release-notes Expand file tree Collapse file tree 4 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 1+ Added null check and close open streams.
2+
Original file line number Diff line number Diff line change @@ -674,18 +674,19 @@ public static boolean overlayPdf(IContext context, IMendixObject generatedDocume
674674 Logging .trace (LOGNODE , "Overlay PDF start, retrieve overlay PDF" );
675675
676676 Logging .trace (LOGNODE , "Perform overlay" );
677- Overlay overlay = new Overlay ();
678- overlay .setInputPDF (inputDoc );
679- overlay .setDefaultOverlayPDF (overlayDoc );
680- if (onTopOfContent == true ) {
681- overlay .setOverlayPosition (Overlay .Position .FOREGROUND );
682- } else {
683- overlay .setOverlayPosition (Overlay .Position .BACKGROUND );
684- }
677+ try ( Overlay overlay = new Overlay ()) {
678+ overlay .setInputPDF (inputDoc );
679+ overlay .setDefaultOverlayPDF (overlayDoc );
680+ if (onTopOfContent ) {
681+ overlay .setOverlayPosition (Overlay .Position .FOREGROUND );
682+ } else {
683+ overlay .setOverlayPosition (Overlay .Position .BACKGROUND );
684+ }
685685
686- Logging .trace (LOGNODE , "Save result in output stream" );
686+ Logging .trace (LOGNODE , "Save result in output stream" );
687687
688- overlay .overlay (new HashMap <>()).save (baos );
688+ overlay .overlay (new HashMap <>()).save (baos );
689+ }
689690
690691 Logging .trace (LOGNODE , "Duplicate result in input stream" );
691692 try (InputStream overlayedContent = new ByteArrayInputStream (baos .toByteArray ())) {
Original file line number Diff line number Diff line change @@ -493,7 +493,12 @@ public static String sanitizeHTML(String html, List<SanitizerPolicy> policyParam
493493 PolicyFactory policyFactory = null ;
494494
495495 for (SanitizerPolicy param : policyParams ) {
496- policyFactory = (policyFactory == null ) ? SANITIZER_POLICIES .get (param .name ()) : policyFactory .and (SANITIZER_POLICIES .get (param .name ()));
496+ PolicyFactory policyFactoryForParam = SANITIZER_POLICIES .get (param .name ());
497+ policyFactory = (policyFactory == null ) ? policyFactoryForParam : policyFactory .and (policyFactoryForParam );
498+ }
499+
500+ if (policyFactory == null ) {
501+ throw new IllegalArgumentException ("Sanitizer policy not found." );
497502 }
498503
499504 return sanitizeHTML (html , policyFactory );
You can’t perform that action at this time.
0 commit comments