LANG-1279: Update Java requirement from Java 6 to 7

replace usage of deprecated ObjectUtils#toString with Objects#toString
This commit is contained in:
pascalschumacher 2016-10-28 18:27:55 +02:00
parent 61bc7f27b4
commit 9b481a9701
2 changed files with 8 additions and 14 deletions

View File

@ -24,6 +24,7 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.regex.Pattern;
/**
@ -4520,9 +4521,7 @@ public class StringUtils {
}
final Object first = iterator.next();
if (!iterator.hasNext()) {
@SuppressWarnings( "deprecation" ) // ObjectUtils.toString(Object) has been deprecated in 3.2
final
String result = ObjectUtils.toString(first);
final String result = Objects.toString(first, "");
return result;
}
@ -4567,8 +4566,7 @@ public class StringUtils {
}
final Object first = iterator.next();
if (!iterator.hasNext()) {
@SuppressWarnings( "deprecation" ) // ObjectUtils.toString(Object) has been deprecated in 3.2
final String result = ObjectUtils.toString(first);
final String result = Objects.toString(first, "");
return result;
}
@ -4663,8 +4661,7 @@ public class StringUtils {
final Iterator<Object> iterator = Arrays.asList(objects).iterator();
while (iterator.hasNext()) {
@SuppressWarnings("deprecation") // o.k. to use as long as we do not require java 7 or greater
final String value = ObjectUtils.toString(iterator.next());
final String value = Objects.toString(iterator.next(), "");
result.append(value);
if (iterator.hasNext()) {

View File

@ -23,9 +23,9 @@ import java.io.Writer;
import java.nio.CharBuffer;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.lang3.builder.Builder;
@ -1245,8 +1245,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
*/
public StrBuilder appendWithSeparators(final Object[] array, final String separator) {
if (array != null && array.length > 0) {
@SuppressWarnings( "deprecation" ) // ObjectUtils.toString(Object) has been deprecated in 3.2
final String sep = ObjectUtils.toString(separator);
final String sep = Objects.toString(separator, "");
append(array[0]);
for (int i = 1; i < array.length; i++) {
append(sep);
@ -1268,8 +1267,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
*/
public StrBuilder appendWithSeparators(final Iterable<?> iterable, final String separator) {
if (iterable != null) {
@SuppressWarnings( "deprecation" ) // ObjectUtils.toString(Object) has been deprecated in 3.2
final String sep = ObjectUtils.toString(separator);
final String sep = Objects.toString(separator, "");
final Iterator<?> it = iterable.iterator();
while (it.hasNext()) {
append(it.next());
@ -1293,8 +1291,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
*/
public StrBuilder appendWithSeparators(final Iterator<?> it, final String separator) {
if (it != null) {
@SuppressWarnings( "deprecation" ) // ObjectUtils.toString(Object) has been deprecated in 3.2
final String sep = ObjectUtils.toString(separator);
final String sep = Objects.toString(separator, "");
while (it.hasNext()) {
append(it.next());
if (it.hasNext()) {