From c5f1c5935ca59939a4d90962d432dd071cca41fc Mon Sep 17 00:00:00 2001 From: Anton Oellerer <13524304+AntonOellerer@users.noreply.github.com> Date: Thu, 3 Aug 2023 13:50:29 +0200 Subject: [PATCH] Catch if formatter is passed null --- build.gradle | 9 ++++++--- .../com/docutools/jocument/GenerationOptionsBuilder.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 80f7e052..810be801 100644 --- a/build.gradle +++ b/build.gradle @@ -8,10 +8,13 @@ plugins { } group 'com.docutools' -version = '1.6.0' +version = '1.6.1' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} repositories { mavenCentral() diff --git a/src/main/java/com/docutools/jocument/GenerationOptionsBuilder.java b/src/main/java/com/docutools/jocument/GenerationOptionsBuilder.java index 6a819ffb..3ca1a8ca 100644 --- a/src/main/java/com/docutools/jocument/GenerationOptionsBuilder.java +++ b/src/main/java/com/docutools/jocument/GenerationOptionsBuilder.java @@ -44,7 +44,7 @@ public GenerationOptionsBuilder format(Class filter, PlaceholderDataForma } public GenerationOptionsBuilder format(Class filter, LocalisedPlaceholderDataFormatter formatter) { - formattingOptions.add(new PlaceholderDataFormattingOption<>(obj -> obj.getClass().isAssignableFrom(filter), formatter)); + formattingOptions.add(new PlaceholderDataFormattingOption<>(obj -> obj != null && obj.getClass().isAssignableFrom(filter), formatter)); return this; }