diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2019-07-23 08:51:32 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2019-07-23 08:51:32 +0200 |
commit | 204e7dc0195b62a33f46aefb534cd59eb54b6c44 (patch) | |
tree | b353036f93a31256d55f357975909c2907d33851 /eaaf_core/src/main | |
parent | 7a6633b824f425efc32c1515f6ed75da0f65c57b (diff) | |
download | EAAF-Components-204e7dc0195b62a33f46aefb534cd59eb54b6c44.tar.gz EAAF-Components-204e7dc0195b62a33f46aefb534cd59eb54b6c44.tar.bz2 EAAF-Components-204e7dc0195b62a33f46aefb534cd59eb54b6c44.zip |
fix nullpointer in KeyValueUtils.java and add jUnit test
Diffstat (limited to 'eaaf_core/src/main')
-rw-r--r-- | eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtils.java | 4 |
1 files changed, 2 insertions, 2 deletions
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); |