Page 1 of 1

Adaptions to FormatUtil to import mails

PostPosted:Fri Sep 25, 2020 11:33 am
by easyflo
Hi guys

I am importing a bunch of mails into openkm. To do so I had to add null checks in
https://github.com/openkm/document-mana ... tUtil.java

Here the git diff:
Code: Select all
diff --git a/src/main/java/com/openkm/util/FormatUtil.java b/src/main/java/com/openkm/util/FormatUtil.java
index 1a3a5a7..2ec635b 100644
--- a/src/main/java/com/openkm/util/FormatUtil.java
+++ b/src/main/java/com/openkm/util/FormatUtil.java
@@ -304,6 +304,7 @@ public class FormatUtil {
         * Fix UTF-8 NULL
         */
        public static String fixUTF8(String input) {
+               if(input == null) return input;
                return input.replace('\u0000', '\u0020');
        }

@@ -313,6 +314,7 @@ public class FormatUtil {
         * http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Surrogates
         */
        public static String trimUnicodeSurrogates(String text) {
+               if(text == null) return text;
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < text.length(); i++) {
Cheers
Floriano

Re: Adaptions to FormatUtil to import mails

PostPosted:Fri Sep 25, 2020 6:48 pm
by jllort
I suppose you have cloned our repository in GitHub ( if not do it ), from your GitHub account you can do a pull request to our master branch ( and from there we will review it ). That's the usual process for patches. Thanks for your time and support.

Re: Adaptions to FormatUtil to import mails

PostPosted:Fri Sep 25, 2020 7:49 pm
by easyflo
Hi jllort

I have just cloned it. Now I have forked it and created a pull request in github.

Cheers
Florian