From b002b8e21fa309b14151778df828b9df8185258f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 23 Apr 2014 10:55:43 +0200 Subject: [PATCH 1/2] fix possible linkage error for Util.nonNull(java.lang.String) method --- .../src/main/java/sonia/scm/util/Util.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/util/Util.java b/scm-core/src/main/java/sonia/scm/util/Util.java index 5dd6ac4a6a..b4e377a2c3 100644 --- a/scm-core/src/main/java/sonia/scm/util/Util.java +++ b/scm-core/src/main/java/sonia/scm/util/Util.java @@ -33,6 +33,10 @@ package sonia.scm.util; +//~--- non-JDK imports -------------------------------------------------------- + +import com.google.common.base.Strings; + //~--- JDK imports ------------------------------------------------------------ import java.math.BigInteger; @@ -351,15 +355,14 @@ public final class Util } /** - * Method description - * - * - * @param value + * Returns an emtpy string, if the object is null. Otherwise the result of + * the toString method of the object is returned is returned. * + * @param value object * * @since 1.13 * - * @return + * @return string value or empty string */ public static String nonNull(Object value) { @@ -368,6 +371,23 @@ public final class Util : ""; } + /** + * Returns an emtpy string, if the string is null. Otherwise the string + * is returned. The method is available to fix a possible linkage error which + * was introduced with version 1.14. Please have a look at: + * https://bitbucket.org/sdorra/scm-manager/issue/569/active-directory-plugin-not-working-in + * + * @param value string value + * + * @return string value or empty string + * + * @since 1.38 + */ + public static String nonNull(String value) + { + return Strings.nullToEmpty(value); + } + /** * Method description * From f481d7d6b42746cb126b97fba2e3edfe9cc9bcf4 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 23 Apr 2014 20:30:15 +0200 Subject: [PATCH 2/2] close branch issue-569