From 204e7dc0195b62a33f46aefb534cd59eb54b6c44 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 23 Jul 2019 08:51:32 +0200 Subject: fix nullpointer in KeyValueUtils.java and add jUnit test --- .../src/main/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'eaaf_core/src/main/java') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtils.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtils.java index efc47337..e753f19f 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtils.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtils.java @@ -109,8 +109,8 @@ public class KeyValueUtils { * @param suffix Suffix of this key * @return Prefix {String} of the key or null if input key does not ends with postfix string */ - public static String getPrefixFromKey(String key, String suffix) { - if (key != null && key.endsWith(suffix)) { + public static String getPrefixFromKey(String key, String suffix) { + if (key != null && suffix != null && key.endsWith(suffix)) { final String idPreforeSuffix = key.substring(0, key.length()-suffix.length()); if (idPreforeSuffix.endsWith(KEY_DELIMITER)) return idPreforeSuffix.substring(0, idPreforeSuffix.length()-1); -- cgit v1.2.3