Adaptions to FormatUtil to import mails

He we will discuss about how to make customization and improvement to the OpenKM source code.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
easyflo
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: Fri Sep 25, 2020 11:27 am

Adaptions to FormatUtil to import mails

Post 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

jllort
Moderator
Moderator
Posts: 11240
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Adaptions to FormatUtil to import mails

Post 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.

easyflo
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: Fri Sep 25, 2020 11:27 am

Re: Adaptions to FormatUtil to import mails

Post by easyflo »

Hi jllort

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

Cheers
Florian

Post Reply