]> git.mxchange.org Git - jcore.git/commitdiff
Added convertNullToEmpty()
authorRoland Haeder <roland@mxchange.org>
Fri, 7 Aug 2015 12:07:54 +0000 (14:07 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 7 Aug 2015 12:07:54 +0000 (14:07 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jcore/BaseFrameworkSystem.java

index 7d96be82381006abe65d4df62bab3e66a226f681..8664591b157b37b27815a89bb752f0e6671ea7bf 100644 (file)
@@ -800,4 +800,27 @@ public class BaseFrameworkSystem implements FrameworkInterface {
                // Return list iterator
                return map.entrySet().iterator();
        }
+
+       /**
+        * Converts null to empty string or leaves original string.
+        *
+        * @param str Any string
+        * @return Empty string if null or original string
+        */
+       protected String convertNullToEmpty (final String str) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("str={0}", str));
+
+               // Is it null?
+               if (str == null) {
+                       // Return empty string
+                       return "";
+               }
+
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("str={0} - EXIT!", str));
+
+               // Return it
+               return str;
+       }
 }