• Adaptions to FormatUtil to import mails

  • He we will discuss about how to make customization and improvement to the OpenKM source code.
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.
 #50553  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
 #50564  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.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.