[text] StrTokenizer#clone: add super.clone() call to fix findbug warning
Repository: commons-text Updated Branches: refs/heads/master 43b249b20 -> b0027e18d StrTokenizer#clone: add super.clone() call to fix findbug warning Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/b0027e18 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/b0027e18 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/b0027e18 Branch: refs/heads/master Commit: b0027e18d2e634e2a822962f6fbd3d296c82e722 Parents: 43b249b Author: Pascal Schumacher Authored: Sat Apr 22 15:23:16 2017 +0200 Committer: Pascal Schumacher Committed: Sat Apr 22 15:23:16 2017 +0200 -- src/main/java/org/apache/commons/text/StrTokenizer.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/b0027e18/src/main/java/org/apache/commons/text/StrTokenizer.java -- diff --git a/src/main/java/org/apache/commons/text/StrTokenizer.java b/src/main/java/org/apache/commons/text/StrTokenizer.java index 66126ec..b539268 100644 --- a/src/main/java/org/apache/commons/text/StrTokenizer.java +++ b/src/main/java/org/apache/commons/text/StrTokenizer.java @@ -1088,6 +1088,7 @@ public class StrTokenizer implements ListIterator, Cloneable { @Override public Object clone() { try { +super.clone(); return cloneReset(); } catch (final CloneNotSupportedException ex) { return null;
[text] AlphabetConverter#createConverterFromMap: remove unused local variable
Repository: commons-text Updated Branches: refs/heads/master c9fd6cc68 -> 43b249b20 AlphabetConverter#createConverterFromMap: remove unused local variable Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/43b249b2 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/43b249b2 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/43b249b2 Branch: refs/heads/master Commit: 43b249b200b5bd901094207461b22144e2c1b56d Parents: c9fd6cc Author: Pascal Schumacher Authored: Sat Apr 22 15:01:48 2017 +0200 Committer: Pascal Schumacher Committed: Sat Apr 22 15:01:48 2017 +0200 -- src/main/java/org/apache/commons/text/AlphabetConverter.java | 5 - 1 file changed, 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/43b249b2/src/main/java/org/apache/commons/text/AlphabetConverter.java -- diff --git a/src/main/java/org/apache/commons/text/AlphabetConverter.java b/src/main/java/org/apache/commons/text/AlphabetConverter.java index 27de69a..a216305 100644 --- a/src/main/java/org/apache/commons/text/AlphabetConverter.java +++ b/src/main/java/org/apache/commons/text/AlphabetConverter.java @@ -328,7 +328,6 @@ public final class AlphabetConverter { final Map unmodifiableOriginalToEncoded = Collections.unmodifiableMap(originalToEncoded); final Map encodedToOriginal = new LinkedHashMap<>(); -final Map doNotEncodeMap = new HashMap<>(); int encodedLetterLength = 1; @@ -337,10 +336,6 @@ public final class AlphabetConverter { final String originalAsString = codePointToString(e.getKey()); encodedToOriginal.put(e.getValue(), originalAsString); -if (e.getValue().equals(originalAsString)) { -doNotEncodeMap.put(e.getKey(), e.getValue()); -} - if (e.getValue().length() > encodedLetterLength) { encodedLetterLength = e.getValue().length(); }
[lang] LANG-1317: Add MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods
Repository: commons-lang Updated Branches: refs/heads/master 314b6b56b -> 8cafd87c8 LANG-1317: Add MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods fix bug introduced by last commit Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/8cafd87c Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/8cafd87c Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/8cafd87c Branch: refs/heads/master Commit: 8cafd87c83f4197f7e8d14de8cba453c844266c0 Parents: 314b6b5 Author: pascalschumacher Authored: Fri Apr 21 10:53:17 2017 +0200 Committer: pascalschumacher Committed: Fri Apr 21 10:53:17 2017 +0200 -- src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8cafd87c/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java index 107f317..2855410 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java @@ -904,7 +904,7 @@ public class MethodUtils { Validate.isTrue(annotationCls != null, "The annotation class must not be null"); List> classes = (searchSupers ? getAllSuperclassesAndInterfaces(cls) : new ArrayList>()); -classes.add(cls); +classes.add(0, cls); final List annotatedMethods = new ArrayList<>(); for (Class acls : classes) { final Method[] methods = (ignoreAccess ? acls.getDeclaredMethods() : acls.getMethods());
[2/2] [lang] LANG-1317: Add MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods
LANG-1317: Add MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods Add changes.xml entry and minimal clean-up. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/314b6b56 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/314b6b56 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/314b6b56 Branch: refs/heads/master Commit: 314b6b56bec4af56dba667d66a25c1613f4bc800 Parents: 46007c1 Author: pascalschumacher Authored: Fri Apr 21 10:45:03 2017 +0200 Committer: pascalschumacher Committed: Fri Apr 21 10:45:03 2017 +0200 -- src/changes/changes.xml | 1 + .../commons/lang3/reflect/MethodUtils.java | 60 ++-- 2 files changed, 31 insertions(+), 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/314b6b56/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index e50441b..f4df009 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -85,6 +85,7 @@ The type attribute can be add,update,fix,remove. MethodUtils.invokeMethod throws ArrayStoreException if using varargs arguments and smaller types than the method defines Add ArchUtils - An utility class for the "os.arch" system property Add shuffle methods to ArrayUtils +Add MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods http://git-wip-us.apache.org/repos/asf/commons-lang/blob/314b6b56/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java index 55b5cb1..107f317 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java @@ -866,9 +866,9 @@ public class MethodUtils { * @param annotationCls *the {@link java.lang.annotation.Annotation} that must be present on a method to be matched * @param searchSupers - *determines if also a lookup in the entire inheritance hierarchy of the given class should be performed + *determines if a lookup in the entire inheritance hierarchy of the given class should be performed * @param ignoreAccess - *determines if also non public methods should be considered + *determines if non public methods should be considered * @return an array of Methods (possibly empty). * @throws IllegalArgumentException *if the class or annotation are {@code null} @@ -888,9 +888,9 @@ public class MethodUtils { * @param annotationCls *the {@link Annotation} that must be present on a method to be matched * @param searchSupers - *determines if also a lookup in the entire inheritance hierarchy of the given class should be performed + *determines if a lookup in the entire inheritance hierarchy of the given class should be performed * @param ignoreAccess - *determines if also non public methods should be considered + *determines if non public methods should be considered * @return a list of Methods (possibly empty). * @throws IllegalArgumentException *if the class or annotation are {@code null} @@ -904,7 +904,7 @@ public class MethodUtils { Validate.isTrue(annotationCls != null, "The annotation class must not be null"); List> classes = (searchSupers ? getAllSuperclassesAndInterfaces(cls) : new ArrayList>()); -classes.add(0, cls); +classes.add(cls); final List annotatedMethods = new ArrayList<>(); for (Class acls : classes) { final Method[] methods = (ignoreAccess ? acls.getDeclaredMethods() : acls.getMethods()); @@ -918,12 +918,12 @@ public class MethodUtils { } /** - * Gets the annotation object that is present on the given method or any equivalent method in - * super classes and interfaces, with the given annotation type. Returns null if the annotation - * type was not present on any of them. + * Gets the annotation object with the given annotation type that is present on the given method + * or optionally on any equivalent method in super classes and interfaces. Returns null if the annotation + * type was not present.
[1/2] [lang] LANG-1317: Adds MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods (closes #261)
Repository: commons-lang Updated Branches: refs/heads/master 859224ffa -> 314b6b56b LANG-1317: Adds MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods (closes #261) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/46007c15 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/46007c15 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/46007c15 Branch: refs/heads/master Commit: 46007c151e4cd79891eed4d289ff372ba39d5b8c Parents: 859224f Author: Yasser Zamani Authored: Sun Mar 26 01:49:46 2017 +0430 Committer: pascalschumacher Committed: Fri Apr 21 10:44:41 2017 +0200 -- .../commons/lang3/reflect/MethodUtils.java | 158 ++- .../commons/lang3/reflect/MethodUtilsTest.java | 136 .../commons/lang3/reflect/testbed/Foo.java | 1 + .../commons/lang3/reflect/testbed/Parent.java | 7 + .../lang3/reflect/testbed/PublicChild.java | 16 ++ 5 files changed, 310 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/46007c15/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java index c6f9795..55b5cb1 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java @@ -830,7 +830,7 @@ public class MethodUtils { } /** - * Gets all methods of the given class that are annotated with the given annotation. + * Gets all class level public methods of the given class that are annotated with the given annotation. * @param cls *the {@link Class} to query * @param annotationCls @@ -841,12 +841,11 @@ public class MethodUtils { * @since 3.4 */ public static Method[] getMethodsWithAnnotation(final Class cls, final Class annotationCls) { -final List annotatedMethodsList = getMethodsListWithAnnotation(cls, annotationCls); -return annotatedMethodsList.toArray(new Method[annotatedMethodsList.size()]); +return getMethodsWithAnnotation(cls, annotationCls, false, false); } /** - * Gets all methods of the given class that are annotated with the given annotation. + * Gets all class level public methods of the given class that are annotated with the given annotation. * @param cls *the {@link Class} to query * @param annotationCls @@ -857,16 +856,159 @@ public class MethodUtils { * @since 3.4 */ public static List getMethodsListWithAnnotation(final Class cls, final Class annotationCls) { +return getMethodsListWithAnnotation(cls, annotationCls, false, false); +} + +/** + * Gets all methods of the given class that are annotated with the given annotation. + * @param cls + *the {@link Class} to query + * @param annotationCls + *the {@link java.lang.annotation.Annotation} that must be present on a method to be matched + * @param searchSupers + *determines if also a lookup in the entire inheritance hierarchy of the given class should be performed + * @param ignoreAccess + *determines if also non public methods should be considered + * @return an array of Methods (possibly empty). + * @throws IllegalArgumentException + *if the class or annotation are {@code null} + * @since 3.6 + */ +public static Method[] getMethodsWithAnnotation(final Class cls, final Class annotationCls, +boolean searchSupers, boolean ignoreAccess) { +final List annotatedMethodsList = getMethodsListWithAnnotation(cls, annotationCls, searchSupers, +ignoreAccess); +return annotatedMethodsList.toArray(new Method[annotatedMethodsList.size()]); +} + +/** + * Gets all methods of the given class that are annotated with the given annotation. + * @param cls + *the {@link Class} to query + * @param annotationCls + *the {@link Annotation} that must be present on a method to be matched + * @param searchSupers + *determines if also a lookup in the entire inheritance hierarchy of the given class should be performed + * @param ignoreAccess + *determines if also non public methods should be considered + * @return a list of Methods (possibly empty). + * @throws IllegalArgumentExcept
[lang] LANG-1167: Add null filter to ReflectionToStringBuilder
Repository: commons-lang Updated Branches: refs/heads/master 0446364ff -> 859224ffa LANG-1167: Add null filter to ReflectionToStringBuilder Fix/add since javadoc tags, fix checkstyle violations and do other small clean-ups. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/859224ff Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/859224ff Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/859224ff Branch: refs/heads/master Commit: 859224ffadb79147088840732236c1fad341d842 Parents: 0446364 Author: pascalschumacher Authored: Thu Apr 20 19:15:31 2017 +0200 Committer: pascalschumacher Committed: Thu Apr 20 19:15:31 2017 +0200 -- .../lang3/builder/ReflectionToStringBuilder.java | 14 -- ...eflectionToStringBuilderExcludeNullValuesTest.java | 11 +++ 2 files changed, 15 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/859224ff/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java -- diff --git a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java index e315ed2..5e512d3 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java @@ -342,7 +342,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder { *whether to include transient fields * @param outputStatics *whether to include static fields - * @param excludeNulls + * @param excludeNullValues *whether to exclude fields whose values are null * @param reflectUpToClass *the superclass to reflect up to (inclusive), may be null @@ -351,12 +351,12 @@ public class ReflectionToStringBuilder extends ToStringBuilder { * if the Object is null * * @see ToStringExclude - * @since 2.1 + * @since 3.6 */ public static String toString( final T object, final ToStringStyle style, final boolean outputTransients, -final boolean outputStatics, boolean excludeNulls, final Class reflectUpToClass) { -return new ReflectionToStringBuilder(object, style, null, reflectUpToClass, outputTransients, outputStatics, excludeNulls) +final boolean outputStatics, boolean excludeNullValues, final Class reflectUpToClass) { +return new ReflectionToStringBuilder(object, style, null, reflectUpToClass, outputTransients, outputStatics, excludeNullValues) .toString(); } @@ -565,7 +565,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder { *whether to include static fields * @param excludeNullValues *whether to exclude fields who value is null - * @since 2.1 + * @since 3.6 */ public ReflectionToStringBuilder( final T object, final ToStringStyle style, final StringBuffer buffer, @@ -641,7 +641,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder { // Warning: Field.get(Object) creates wrappers objects // for primitive types. final Object fieldValue = this.getValue(field); -if(!excludeNullValues || fieldValue != null){ +if (!excludeNullValues || fieldValue != null) { this.append(fieldName, fieldValue); } } catch (final IllegalAccessException ex) { @@ -722,6 +722,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder { * * * @return Whether or not to append fields whose values are null. + * @since 3.6 */ public boolean isExcludeNullValues() { return this.excludeNullValues; @@ -773,6 +774,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder { * * @param excludeNullValues *Whether or not to append fields whose values are null. + * @since 3.6 */ public void setExcludeNullValues(final boolean excludeNullValues) { this.excludeNullValues = excludeNullValues; http://git-wip-us.apache.org/repos/asf/commons-lang/blob/859224ff/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java b/src/test/java/org/apache/commons/lang3/buil
[lang] use Validate#isTrue to validate arguments
Repository: commons-lang Updated Branches: refs/heads/master 52d6e24d1 -> ff6b0ada7 use Validate#isTrue to validate arguments Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/ff6b0ada Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/ff6b0ada Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/ff6b0ada Branch: refs/heads/master Commit: ff6b0ada72106d67aef1ee21d51bacac2f3af7ac Parents: 52d6e24 Author: pascalschumacher Authored: Wed Apr 19 21:07:05 2017 +0200 Committer: pascalschumacher Committed: Wed Apr 19 21:07:05 2017 +0200 -- .../org/apache/commons/lang3/CharRange.java | 4 +- .../org/apache/commons/lang3/CharUtils.java | 12 +-- .../commons/lang3/SerializationUtils.java | 12 +-- .../org/apache/commons/lang3/ThreadUtils.java | 36 ++-- .../commons/lang3/builder/DiffBuilder.java | 93 ++-- .../commons/lang3/builder/DiffResult.java | 17 ++-- .../commons/lang3/builder/HashCodeBuilder.java | 5 +- .../builder/ReflectionToStringBuilder.java | 5 +- .../commons/lang3/builder/ToStringBuilder.java | 5 +- .../CallableBackgroundInitializer.java | 6 +- .../concurrent/MultiBackgroundInitializer.java | 12 +-- .../commons/lang3/exception/ExceptionUtils.java | 9 +- .../org/apache/commons/lang3/math/Fraction.java | 18 ++-- .../commons/lang3/math/IEEE754rUtils.java | 21 + .../apache/commons/lang3/math/NumberUtils.java | 4 +- .../apache/commons/lang3/time/DateUtils.java| 33 +++ 16 files changed, 86 insertions(+), 206 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ff6b0ada/src/main/java/org/apache/commons/lang3/CharRange.java -- diff --git a/src/main/java/org/apache/commons/lang3/CharRange.java b/src/main/java/org/apache/commons/lang3/CharRange.java index 2ccda7c..bf82805 100644 --- a/src/main/java/org/apache/commons/lang3/CharRange.java +++ b/src/main/java/org/apache/commons/lang3/CharRange.java @@ -179,9 +179,7 @@ final class CharRange implements Iterable, Serializable { * @throws IllegalArgumentException if {@code null} input */ public boolean contains(final CharRange range) { -if (range == null) { -throw new IllegalArgumentException("The Range must not be null"); -} +Validate.isTrue(range != null, "The Range must not be null"); if (negated) { if (range.negated) { return start >= range.start && end <= range.end; http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ff6b0ada/src/main/java/org/apache/commons/lang3/CharUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/CharUtils.java b/src/main/java/org/apache/commons/lang3/CharUtils.java index 92a8d44..bb45e5f 100644 --- a/src/main/java/org/apache/commons/lang3/CharUtils.java +++ b/src/main/java/org/apache/commons/lang3/CharUtils.java @@ -128,9 +128,7 @@ public class CharUtils { * @throws IllegalArgumentException if the Character is null */ public static char toChar(final Character ch) { -if (ch == null) { -throw new IllegalArgumentException("The Character must not be null"); -} +Validate.isTrue(ch != null, "The Character must not be null"); return ch.charValue(); } @@ -171,9 +169,7 @@ public class CharUtils { * @throws IllegalArgumentException if the String is empty */ public static char toChar(final String str) { -if (StringUtils.isEmpty(str)) { -throw new IllegalArgumentException("The String must not be empty"); -} +Validate.isTrue(StringUtils.isNotEmpty(str), "The String must not be empty"); return str.charAt(0); } @@ -261,9 +257,7 @@ public class CharUtils { * @throws IllegalArgumentException if the Character is not ASCII numeric or is null */ public static int toIntValue(final Character ch) { -if (ch == null) { -throw new IllegalArgumentException("The character must not be null"); -} +Validate.isTrue(ch != null, "The character must not be null"); return toIntValue(ch.charValue()); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ff6b0ada/src/main/java/org/apache/commons/lang3/SerializationUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/SerializationUtils.java b/src/main/java/org/apache/commons/lang3/SerializationUtils.java index f
[lang] use Validate#notNull instead of "throw new NullPointerException"
Repository: commons-lang Updated Branches: refs/heads/master 82cc24437 -> 52d6e24d1 use Validate#notNull instead of "throw new NullPointerException" Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/52d6e24d Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/52d6e24d Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/52d6e24d Branch: refs/heads/master Commit: 52d6e24d19465e6f468839650c969d5931f66d65 Parents: 82cc244 Author: pascalschumacher Authored: Wed Apr 19 20:17:58 2017 +0200 Committer: pascalschumacher Committed: Wed Apr 19 20:17:58 2017 +0200 -- .../java/org/apache/commons/lang3/ClassUtils.java | 5 ++--- .../java/org/apache/commons/lang3/ObjectUtils.java | 16 src/main/java/org/apache/commons/lang3/Range.java | 6 ++ .../lang3/concurrent/BasicThreadFactory.java | 17 + .../org/apache/commons/lang3/time/FormatCache.java | 6 +++--- 5 files changed, 16 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/52d6e24d/src/main/java/org/apache/commons/lang3/ClassUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java index 012d2a6..60395ef 100644 --- a/src/main/java/org/apache/commons/lang3/ClassUtils.java +++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java @@ -1053,9 +1053,8 @@ public class ClassUtils { */ private static String toCanonicalName(String className) { className = StringUtils.deleteWhitespace(className); -if (className == null) { -throw new NullPointerException("className must not be null."); -} else if (className.endsWith("[]")) { +Validate.notNull(className, "className must not be null."); +if (className.endsWith("[]")) { final StringBuilder classNameBuffer = new StringBuilder(); while (className.endsWith("[]")) { className = className.substring(0, className.length() - 2); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/52d6e24d/src/main/java/org/apache/commons/lang3/ObjectUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java index 2edd81f..13d1256 100644 --- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java +++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java @@ -353,9 +353,7 @@ public class ObjectUtils { * @since 3.2 */ public static void identityToString(final Appendable appendable, final Object object) throws IOException { -if (object == null) { -throw new NullPointerException("Cannot get the toString of a null identity"); -} +Validate.notNull(object, "Cannot get the toString of a null identity"); appendable.append(object.getClass().getName()) .append('@') .append(Integer.toHexString(System.identityHashCode(object))); @@ -379,9 +377,7 @@ public class ObjectUtils { */ @Deprecated public static void identityToString(final StrBuilder builder, final Object object) { -if (object == null) { -throw new NullPointerException("Cannot get the toString of a null identity"); -} +Validate.notNull(object, "Cannot get the toString of a null identity"); builder.append(object.getClass().getName()) .append('@') .append(Integer.toHexString(System.identityHashCode(object))); @@ -403,9 +399,7 @@ public class ObjectUtils { * @since 2.4 */ public static void identityToString(final StringBuffer buffer, final Object object) { -if (object == null) { -throw new NullPointerException("Cannot get the toString of a null identity"); -} +Validate.notNull(object, "Cannot get the toString of a null identity"); buffer.append(object.getClass().getName()) .append('@') .append(Integer.toHexString(System.identityHashCode(object))); @@ -427,9 +421,7 @@ public class ObjectUtils { * @since 3.2 */ public static void identityToString(final StringBuilder builder, final Object object) { -if (object == null) { -throw new NullPointerException("Cannot get the toString of a null identity"); -} +Validate.notNull(object, "Cannot get the toString of a null identity
[3/6] [lang] Exclude SF_SWITCH_FALLTHROUGH on FastDatePrinter
Exclude SF_SWITCH_FALLTHROUGH on FastDatePrinter FastDatePrinter#appendFullDigits uses a switch statement that intentionally falls through the cases. This patch adds a FindBugs suppression for it. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/4d343ccc Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/4d343ccc Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/4d343ccc Branch: refs/heads/master Commit: 4d343ccc1181e306f8bb9431087ebb5e58b0c3c9 Parents: c40dcf6 Author: Allon Mureinik Authored: Sat Apr 1 12:38:54 2017 +0300 Committer: pascalschumacher Committed: Wed Apr 19 18:24:57 2017 +0200 -- findbugs-exclude-filter.xml | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4d343ccc/findbugs-exclude-filter.xml -- diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml index 772052a..edc6ead 100644 --- a/findbugs-exclude-filter.xml +++ b/findbugs-exclude-filter.xml @@ -150,6 +150,13 @@ + + + + + + +
[6/6] [lang] Add FindBugs to Travis CI (closes #262)
Add FindBugs to Travis CI (closes #262) This patch copies the FindBugs configuration in pom.xml from the reporting section to the build section so findbugs can be used as part of the build process (by using the maven goal findbugs:check). It then adds this goal to the Travis CI build so that FindBugs becomes part of the CI, and new patches would be prevented from introducing new FindBugs errors. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/9ceaaeb6 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/9ceaaeb6 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/9ceaaeb6 Branch: refs/heads/master Commit: 9ceaaeb6566c78b25da0ae8181964b13f09204a8 Parents: 9f7d03f Author: Allon Mureinik Authored: Sat Apr 1 12:49:24 2017 +0300 Committer: pascalschumacher Committed: Wed Apr 19 18:25:04 2017 +0200 -- .travis.yml | 2 +- pom.xml | 9 + 2 files changed, 10 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/9ceaaeb6/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index e81e8cd..f0a6c49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ jdk: - oraclejdk8 script: - - mvn test apache-rat:check clirr:check checkstyle:check javadoc:javadoc -B + - mvn test apache-rat:check clirr:check checkstyle:check findbugs:check javadoc:javadoc -B after_success: - mvn clean cobertura:cobertura coveralls:report http://git-wip-us.apache.org/repos/asf/commons-lang/blob/9ceaaeb6/pom.xml -- diff --git a/pom.xml b/pom.xml index 8bea60c..bca6df4 100644 --- a/pom.xml +++ b/pom.xml @@ -660,6 +660,15 @@ false + +org.codehaus.mojo +findbugs-maven-plugin + +${commons.findbugs.version} + + ${basedir}/findbugs-exclude-filter.xml + +
[4/6] [lang] Exclude SF_SWITCH_NO_DEFAULT on FastDateParser
Exclude SF_SWITCH_NO_DEFAULT on FastDateParser FastDateParser#simpleQuote uses a switch case that actually has a default branch in it, but doesn't use break statements. SF_SWITCH_NO_DEFAULT unfortunately cannot recognize this pattern, and leave us with no choice but to suppress it. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c40dcf65 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c40dcf65 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c40dcf65 Branch: refs/heads/master Commit: c40dcf659897edb26affa408c3fa62e80f906550 Parents: 3304965 Author: Allon Mureinik Authored: Sat Apr 1 12:18:53 2017 +0300 Committer: pascalschumacher Committed: Wed Apr 19 18:24:57 2017 +0200 -- findbugs-exclude-filter.xml | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c40dcf65/findbugs-exclude-filter.xml -- diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml index f7623df..772052a 100644 --- a/findbugs-exclude-filter.xml +++ b/findbugs-exclude-filter.xml @@ -139,9 +139,14 @@ + - + + + +
[2/6] [lang] FindBugs exclude filter for StringUtils
FindBugs exclude filter for StringUtils Exclude ES_COMPARING_PARAMETER_STRING_WITH_EQ FindBugs warnings from StringUtils methods compare(String, String, boolean) and compareIgnoreCase(String, String, boolean). The usages of the == operator seem to be intentional optimizations similar to the usage in indexOfDifference. If this reasoning is ever overruled, this suppression should be removed. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/33049658 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/33049658 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/33049658 Branch: refs/heads/master Commit: 3304965840c139dae7b8c01e1779a806641a0159 Parents: 5a52446 Author: Allon Mureinik Authored: Sat Apr 1 11:44:39 2017 +0300 Committer: pascalschumacher Committed: Wed Apr 19 18:24:57 2017 +0200 -- findbugs-exclude-filter.xml | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/33049658/findbugs-exclude-filter.xml -- diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml index def3ec8..f7623df 100644 --- a/findbugs-exclude-filter.xml +++ b/findbugs-exclude-filter.xml @@ -58,7 +58,11 @@ - + + + + +
[5/6] [lang] Add a default case to switch to appease FindBugs
Add a default case to switch to appease FindBugs Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/9f7d03f0 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/9f7d03f0 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/9f7d03f0 Branch: refs/heads/master Commit: 9f7d03f09172afcf0a7be40e3262d151ef053b3c Parents: 8069e1c Author: Allon Mureinik Authored: Sat Apr 1 12:16:52 2017 +0300 Committer: pascalschumacher Committed: Wed Apr 19 18:24:58 2017 +0200 -- src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/9f7d03f0/src/main/java/org/apache/commons/lang3/time/FastDateParser.java -- diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java index e27acf4..9cf1a1c 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java @@ -863,6 +863,8 @@ public class FastDateParser implements DateParser, Serializable { case 5: // offset 5 starts additional names, probably standard time tzInfo = standard; break; +default: +break; } if (zoneNames[i] != null) { final String key = zoneNames[i].toLowerCase(locale);
[1/6] [lang] Exclude SF_SWITCH_NO_DEFAULT on FastDatePrinter
Repository: commons-lang Updated Branches: refs/heads/master 5a5244609 -> 9ceaaeb65 Exclude SF_SWITCH_NO_DEFAULT on FastDatePrinter FastDatePrinter#appendFullDigits uses a switch case without break statements. SF_SWITCH_NO_DEFAULT unfortunately cannot recognize this pattern, and leave us with no choice but to suppress it. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/8069e1c1 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/8069e1c1 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/8069e1c1 Branch: refs/heads/master Commit: 8069e1c1ce7ec864c7bab2eae880742fac02376b Parents: 4d343cc Author: Allon Mureinik Authored: Sat Apr 1 12:18:53 2017 +0300 Committer: pascalschumacher Committed: Wed Apr 19 18:24:57 2017 +0200 -- findbugs-exclude-filter.xml | 8 1 file changed, 8 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8069e1c1/findbugs-exclude-filter.xml -- diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml index edc6ead..23dddbd 100644 --- a/findbugs-exclude-filter.xml +++ b/findbugs-exclude-filter.xml @@ -150,6 +150,14 @@ + + + + + + +
[text] index.xml: fix typo in apache license header
Repository: commons-text Updated Branches: refs/heads/master a6a2732ff -> c9fd6cc68 index.xml: fix typo in apache license header Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/c9fd6cc6 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/c9fd6cc6 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/c9fd6cc6 Branch: refs/heads/master Commit: c9fd6cc68d790890bb29a5d7e270751f78fe6ff1 Parents: a6a2732 Author: Pascal Schumacher Authored: Tue Apr 18 23:32:56 2017 +0200 Committer: Pascal Schumacher Committed: Tue Apr 18 23:32:56 2017 +0200 -- src/site/xdoc/index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/c9fd6cc6/src/site/xdoc/index.xml -- diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index 0edbf88..ef34a5a 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -12,7 +12,7 @@ the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific uage governing permissions and +See the License for the specific language governing permissions and limitations under the License. -->
[lang] LANG-1313: Add ArchUtils
Repository: commons-lang Updated Branches: refs/heads/master 30d4070af -> 5d3a2081c LANG-1313: Add ArchUtils add missing since javadoc tags Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/5d3a2081 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/5d3a2081 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/5d3a2081 Branch: refs/heads/master Commit: 5d3a2081c5a791f05811889e2b35e99c3b604731 Parents: 30d4070 Author: pascalschumacher Authored: Mon Mar 27 21:59:42 2017 +0200 Committer: pascalschumacher Committed: Mon Mar 27 21:59:42 2017 +0200 -- src/main/java/org/apache/commons/lang3/ArchUtils.java | 1 + src/main/java/org/apache/commons/lang3/arch/Processor.java| 1 + src/main/java/org/apache/commons/lang3/arch/package-info.java | 1 + 3 files changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5d3a2081/src/main/java/org/apache/commons/lang3/ArchUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ArchUtils.java b/src/main/java/org/apache/commons/lang3/ArchUtils.java index 41b770b..c7e28d9 100644 --- a/src/main/java/org/apache/commons/lang3/ArchUtils.java +++ b/src/main/java/org/apache/commons/lang3/ArchUtils.java @@ -28,6 +28,7 @@ import java.util.Map; * Important: The os.arch System Property returns the architecture used by the JVM * not of the operating system. * + * @since 3.6 */ public class ArchUtils { http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5d3a2081/src/main/java/org/apache/commons/lang3/arch/Processor.java -- diff --git a/src/main/java/org/apache/commons/lang3/arch/Processor.java b/src/main/java/org/apache/commons/lang3/arch/Processor.java index e37b3f6..1d03a83 100644 --- a/src/main/java/org/apache/commons/lang3/arch/Processor.java +++ b/src/main/java/org/apache/commons/lang3/arch/Processor.java @@ -19,6 +19,7 @@ package org.apache.commons.lang3.arch; /** * The {@link Processor} represents a microprocessor and defines * some properties like architecture and type of the microprocessor. + * @since 3.6 */ public class Processor { http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5d3a2081/src/main/java/org/apache/commons/lang3/arch/package-info.java -- diff --git a/src/main/java/org/apache/commons/lang3/arch/package-info.java b/src/main/java/org/apache/commons/lang3/arch/package-info.java index 9b832e3..0a60a81 100644 --- a/src/main/java/org/apache/commons/lang3/arch/package-info.java +++ b/src/main/java/org/apache/commons/lang3/arch/package-info.java @@ -16,5 +16,6 @@ */ /** * Provides classes to work with the values of the os.arch system property. + * @since 3.6 */ package org.apache.commons.lang3.arch; \ No newline at end of file
[2/3] [lang] add changes.xml entry for LANG-1313
add changes.xml entry for LANG-1313 Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/46edb45d Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/46edb45d Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/46edb45d Branch: refs/heads/master Commit: 46edb45d3e7c3c0a3bf3e4e862f701f1a49ba73d Parents: 90f0a68 Author: pascalschumacher Authored: Mon Mar 27 20:39:47 2017 +0200 Committer: pascalschumacher Committed: Mon Mar 27 20:41:07 2017 +0200 -- src/changes/changes.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/46edb45d/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 78c3514..14f3ca4 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -81,6 +81,7 @@ The type attribute can be add,update,fix,remove. javadoc creation broken with Java 8 Deprecate classes/methods moved to commons-text MethodUtils.invokeMethod throws ArrayStoreException if using varargs arguments and smaller types than the method defines +Add ArchUtils - An utility class for the "os.arch" system property
[3/3] [lang] Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-lang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-lang Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/30d4070a Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/30d4070a Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/30d4070a Branch: refs/heads/master Commit: 30d4070af9fc623cf9723510bb46d1a19fcb5930 Parents: 46edb45 b06f13f Author: pascalschumacher Authored: Mon Mar 27 20:42:48 2017 +0200 Committer: pascalschumacher Committed: Mon Mar 27 20:42:48 2017 +0200 -- .../org/apache/commons/lang3/ArrayUtils.java| 144 +-- .../org/apache/commons/lang3/StringUtils.java | 13 +- 2 files changed, 75 insertions(+), 82 deletions(-) --
[1/3] [lang] LANG-1313: Add ArchUtils - an utility class for the "os.arch" system property (closes #231)
Repository: commons-lang Updated Branches: refs/heads/master b06f13ff0 -> 30d4070af LANG-1313: Add ArchUtils - an utility class for the "os.arch" system property (closes #231) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/90f0a680 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/90f0a680 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/90f0a680 Branch: refs/heads/master Commit: 90f0a680adf3eaa95e46e96d28ecd6848c74bfdd Parents: 1674c95 Author: Tomschi Authored: Tue Mar 7 21:11:09 2017 +0100 Committer: pascalschumacher Committed: Mon Mar 27 20:40:28 2017 +0200 -- .../org/apache/commons/lang3/ArchUtils.java | 134 .../apache/commons/lang3/arch/Processor.java| 136 .../apache/commons/lang3/arch/package-info.java | 20 +++ .../org/apache/commons/lang3/ArchUtilsTest.java | 160 +++ 4 files changed, 450 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/90f0a680/src/main/java/org/apache/commons/lang3/ArchUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ArchUtils.java b/src/main/java/org/apache/commons/lang3/ArchUtils.java new file mode 100644 index 000..41b770b --- /dev/null +++ b/src/main/java/org/apache/commons/lang3/ArchUtils.java @@ -0,0 +1,134 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.lang3; + +import org.apache.commons.lang3.arch.Processor; + +import java.util.HashMap; +import java.util.Map; + +/** + * An utility class for the os.arch System Property. The class defines methods for + * identifying the architecture of the current JVM. + * + * Important: The os.arch System Property returns the architecture used by the JVM + * not of the operating system. + * + */ +public class ArchUtils { + +private static final Map ARCH_TO_PROCESSOR; + +static { +ARCH_TO_PROCESSOR = new HashMap<>(); +init(); +} + +private static final void init() { +init_X86_32Bit(); +init_X86_64Bit(); +init_IA64_32Bit(); +init_IA64_64Bit(); +init_PPC_32Bit(); +init_PPC_64Bit(); +} + +private static final void init_X86_32Bit() { +Processor processor = new Processor(Processor.Arch.BIT_32, Processor.Type.X86); +addProcessors(processor, "x86", "i386", "i486", "i586", "i686", "pentium"); +} + +private static final void init_X86_64Bit() { +Processor processor = new Processor(Processor.Arch.BIT_64, Processor.Type.X86); +addProcessors(processor, "x86_64", "amd64", "em64t", "universal"); +} + +private static final void init_IA64_32Bit() { +Processor processor = new Processor(Processor.Arch.BIT_32, Processor.Type.IA_64); +addProcessors(processor, "ia64_32", "ia64n"); +} + +private static final void init_IA64_64Bit() { +Processor processor = new Processor(Processor.Arch.BIT_64, Processor.Type.IA_64); +addProcessors(processor, "ia64", "ia64w"); +} + +private static final void init_PPC_32Bit() { +Processor processor = new Processor(Processor.Arch.BIT_32, Processor.Type.PPC); +addProcessors(processor, "ppc", "power", "powerpc", "power_pc", "power_rs"); +} + +private static final void init_PPC_64Bit() { +Processor processor = new Processor(Processor.Arch.BIT_64, Processor.Type.PPC); +addProcessors(processor, "ppc64", "power64", "powerpc64", "power_pc64", "power_rs64"); +} + +/** + * Adds the given {@link Processor} with the given key {@link String} to the map. + * + * @param key The key as {@link String}. +
[lang] Restore clirr report generation
Repository: commons-lang Updated Branches: refs/heads/master 4a300fee2 -> 1674c953f Restore clirr report generation Since commons-parent version 41, generation of the clirr report for the site has to be explicitly enabled by adding a "src\site\resources\profile.clirr" file. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/1674c953 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/1674c953 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/1674c953 Branch: refs/heads/master Commit: 1674c953fafe6438952d6290f30143aab22f33dd Parents: 4a300fe Author: pascalschumacher Authored: Sun Mar 26 14:06:23 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 26 14:06:23 2017 +0200 -- src/site/resources/profile.clirr | 0 1 file changed, 0 insertions(+), 0 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1674c953/src/site/resources/profile.clirr -- diff --git a/src/site/resources/profile.clirr b/src/site/resources/profile.clirr new file mode 100644 index 000..e69de29
[lang] Fixed javadoc of MutableBoolean setTrue / setFalse (closes #260)
Repository: commons-lang Updated Branches: refs/heads/master 5d6c17638 -> 4a300fee2 Fixed javadoc of MutableBoolean setTrue / setFalse (closes #260) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/4a300fee Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/4a300fee Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/4a300fee Branch: refs/heads/master Commit: 4a300fee2ef1c03902d0fb25ceb02aa01d0fab46 Parents: 5d6c176 Author: Tobias Soloschenko Authored: Wed Mar 22 15:23:45 2017 +0100 Committer: pascalschumacher Committed: Wed Mar 22 17:32:14 2017 +0100 -- .../java/org/apache/commons/lang3/mutable/MutableBoolean.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4a300fee/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java -- diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java b/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java index 085df40..97781bf 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java @@ -90,7 +90,7 @@ public class MutableBoolean implements Mutable, Serializable, Comparabl } /** - * Sets the value to true. + * Sets the value to false. * * @since 3.3 */ @@ -99,7 +99,7 @@ public class MutableBoolean implements Mutable, Serializable, Comparabl } /** - * Sets the value to false. + * Sets the value to true. * * @since 3.3 */
[text] pom.xml: make site build use use clirr version defined in properties
Repository: commons-text Updated Branches: refs/heads/master 440d83bf1 -> b11451b26 pom.xml: make site build use use clirr version defined in properties Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/b11451b2 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/b11451b2 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/b11451b2 Branch: refs/heads/master Commit: b11451b26f5145000c71c2191aa306e911e6f12c Parents: 440d83b Author: Pascal Schumacher Authored: Sun Mar 19 19:40:10 2017 +0100 Committer: Pascal Schumacher Committed: Sun Mar 19 19:40:10 2017 +0100 -- pom.xml | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/b11451b2/pom.xml -- diff --git a/pom.xml b/pom.xml index 8d54735..c4d8e2c 100644 --- a/pom.xml +++ b/pom.xml @@ -243,7 +243,6 @@ org.codehaus.mojo clirr-maven-plugin -2.8 info
[text] update clirr version to 2.8, which is java 8 compatible
Repository: commons-text Updated Branches: refs/heads/master 899edeb3b -> 440d83bf1 update clirr version to 2.8, which is java 8 compatible Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/440d83bf Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/440d83bf Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/440d83bf Branch: refs/heads/master Commit: 440d83bf15c07ed9cc7f815bbb1f4ec0165a4beb Parents: 899edeb Author: Pascal Schumacher Authored: Sun Mar 19 19:36:14 2017 +0100 Committer: Pascal Schumacher Committed: Sun Mar 19 19:36:14 2017 +0100 -- pom.xml | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/440d83bf/pom.xml -- diff --git a/pom.xml b/pom.xml index c339a6e..8d54735 100644 --- a/pom.xml +++ b/pom.xml @@ -139,6 +139,9 @@ 0.7.8 + +2.8 + 2.13
[3/3] [text] travis: run apache-rat, clirr, checkstyle and javadoc during the build
travis: run apache-rat, clirr, checkstyle and javadoc during the build Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/899edeb3 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/899edeb3 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/899edeb3 Branch: refs/heads/master Commit: 899edeb3b6b1ed2745f22677a80b61b7b03ca812 Parents: 2bd24ca Author: Pascal Schumacher Authored: Sun Mar 19 19:28:21 2017 +0100 Committer: Pascal Schumacher Committed: Sun Mar 19 19:28:21 2017 +0100 -- .travis.yml | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/899edeb3/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index d51d8d8..8f4c08f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,5 +21,8 @@ jdk: - oraclejdk7 - oraclejdk8 +script: + - mvn test apache-rat:check clirr:check checkstyle:check javadoc:javadoc + after_success: - - mvn clean apache-rat:check test jacoco:report coveralls:report + - mvn clean test jacoco:report coveralls:report
[1/3] [text] pox.xml: remove outdated comment about shading of commons-lang
Repository: commons-text Updated Branches: refs/heads/master 94ca2ca01 -> 899edeb3b pox.xml: remove outdated comment about shading of commons-lang Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/cc9dc64a Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/cc9dc64a Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/cc9dc64a Branch: refs/heads/master Commit: cc9dc64ac8d7b3dc629557187d0a9fcec44f03ee Parents: 94ca2ca Author: Pascal Schumacher Authored: Sun Mar 19 17:57:55 2017 +0100 Committer: Pascal Schumacher Committed: Sun Mar 19 17:57:55 2017 +0100 -- pom.xml | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/cc9dc64a/pom.xml -- diff --git a/pom.xml b/pom.xml index cf03e86..58ec51a 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,6 @@ org.apache.commons commons-lang3 - 3.5
[2/3] [text] pom.xml: make checkstyle plugin run-able outside of the site phase
pom.xml: make checkstyle plugin run-able outside of the site phase Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/2bd24caa Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/2bd24caa Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/2bd24caa Branch: refs/heads/master Commit: 2bd24caaf8629f94e7adb5c23f7477139828f385 Parents: cc9dc64 Author: Pascal Schumacher Authored: Sun Mar 19 19:23:39 2017 +0100 Committer: Pascal Schumacher Committed: Sun Mar 19 19:23:39 2017 +0100 -- pom.xml | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/2bd24caa/pom.xml -- diff --git a/pom.xml b/pom.xml index 58ec51a..c339a6e 100644 --- a/pom.xml +++ b/pom.xml @@ -138,6 +138,8 @@ 0.7.8 + +2.13 @@ -160,6 +162,17 @@ +maven-checkstyle-plugin +${checkstyle.plugin.version} + + false + ${basedir}/checkstyle.xml + ${basedir}/license-header.txt + ${basedir}/checkstyle-suppressions.xml + ${basedir}/checkstyle-suppressions.xml + + + maven-assembly-plugin @@ -197,7 +210,7 @@ maven-checkstyle-plugin -2.13 +${checkstyle.plugin.version} false ${basedir}/checkstyle.xml
[1/2] [lang] LANG-1310: MethodUtils.invokeMethod throws ArrayStoreException if using varargs arguments and smaller types than the method defines (closes #256)
Repository: commons-lang Updated Branches: refs/heads/master 7ac12154b -> 5d6c17638 LANG-1310: MethodUtils.invokeMethod throws ArrayStoreException if using varargs arguments and smaller types than the method defines (closes #256) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/1a20867d Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/1a20867d Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/1a20867d Branch: refs/heads/master Commit: 1a20867d01ef8ee5b32b0620125b7c38a10b80c5 Parents: 7ac1215 Author: drajakumar Authored: Mon Mar 13 22:21:12 2017 +0530 Committer: pascalschumacher Committed: Sun Mar 19 17:12:16 2017 +0100 -- .../commons/lang3/reflect/MethodUtils.java | 14 + .../commons/lang3/reflect/MethodUtilsTest.java | 32 2 files changed, 40 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1a20867d/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java index 0f94d93..4602378 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java @@ -700,6 +700,20 @@ public class MethodUtils { if (bestMatch != null) { MemberUtils.setAccessibleWorkaround(bestMatch); } + +if (bestMatch != null && bestMatch.isVarArgs() && bestMatch.getParameterTypes().length > 0 && parameterTypes.length > 0) { +final Class[] methodParameterTypes = bestMatch.getParameterTypes(); +final Class methodParameterComponentType = methodParameterTypes[methodParameterTypes.length - 1].getComponentType(); +final String methodParameterComponentTypeName = ClassUtils.primitiveToWrapper(methodParameterComponentType).getName(); +final String parameterTypeName = parameterTypes[parameterTypes.length - 1].getName(); +final String parameterTypeSuperClassName = parameterTypes[parameterTypes.length - 1].getSuperclass().getName(); + +if (!methodParameterComponentTypeName.equals(parameterTypeName) +&& !methodParameterComponentTypeName.equals(parameterTypeSuperClassName)) { +return null; +} +} + return bestMatch; } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1a20867d/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java index 351bed1..df57a13 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java @@ -96,6 +96,10 @@ public class MethodUtilsTest { return "bar(String...)"; } +public static String bar(final long... s) { +return "bar(long...)"; +} + public static String bar(final Integer i, final String... s) { return "bar(int, String...)"; } @@ -138,7 +142,6 @@ public class MethodUtilsTest { return "privateStringStuff(Object)"; } - public String foo() { return "foo()"; } @@ -155,6 +158,10 @@ public class MethodUtilsTest { return "foo(double)"; } +public String foo(final long l) { +return "foo(long)"; +} + public String foo(final String s) { return "foo(String)"; } @@ -167,6 +174,10 @@ public class MethodUtilsTest { return "foo(String...)"; } +public String foo(final long... l) { +return "foo(long...)"; +} + public String foo(final Integer i, final String... s) { return "foo(int, String...)"; } @@ -356,7 +367,7 @@ public class MethodUtilsTest { NumberUtils.INTEGER_ONE)); assertEquals("foo(int)", MethodUtils.invokeMethod(testBean, "foo", NumberUtils.BYTE_ONE)); -assertEquals("foo(double)", MethodUtils.invokeMethod(testBean, "foo", +assertEquals("foo(long)", MethodUtils.invokeMethod(testBean, "foo", NumberUtils.LONG
[2/2] [lang] changes.xml: add entry for LANG-1310
changes.xml: add entry for LANG-1310 Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/5d6c1763 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/5d6c1763 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/5d6c1763 Branch: refs/heads/master Commit: 5d6c176388e417869421adf2eb21ac5c291f0884 Parents: 1a20867 Author: pascalschumacher Authored: Sun Mar 19 17:14:42 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 19 17:14:42 2017 +0100 -- src/changes/changes.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5d6c1763/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3edd5e6..78c3514 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -80,6 +80,7 @@ The type attribute can be add,update,fix,remove. Build failures when building with Java 9 EA javadoc creation broken with Java 8 Deprecate classes/methods moved to commons-text +MethodUtils.invokeMethod throws ArrayStoreException if using varargs arguments and smaller types than the method defines
[lang] README.md: remove license badge, because github now displays the license at the top of the page
Repository: commons-lang Updated Branches: refs/heads/master 811dbe722 -> 7ac12154b README.md: remove license badge, because github now displays the license at the top of the page Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/7ac12154 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/7ac12154 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/7ac12154 Branch: refs/heads/master Commit: 7ac12154b0c3854bda27a1a427eb9a25b1813a5d Parents: 811dbe7 Author: pascalschumacher Authored: Sun Mar 19 14:42:31 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 19 14:42:31 2017 +0100 -- README.md | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7ac12154/README.md -- diff --git a/README.md b/README.md index 45a0dca..dd44aab 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ Apache Commons Lang [![Build Status](https://travis-ci.org/apache/commons-lang.svg?branch=master)](https://travis-ci.org/apache/commons-lang) [![Coverage Status](https://coveralls.io/repos/apache/commons-lang/badge.svg?branch=master)](https://coveralls.io/r/apache/commons-lang) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-lang3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-lang3/) -[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) Apache Commons Lang, a package of Java utility classes for the classes that are in java.lang's hierarchy, or are considered to be so
[lang] restore deprecated annotation of StringUtils#getJaroWinklerDistance
Repository: commons-lang Updated Branches: refs/heads/master f4ee399e3 -> 811dbe722 restore deprecated annotation of StringUtils#getJaroWinklerDistance This annotation was with "LANG-1316: Deprecate classes/methods moved to commons-text" and removed by mistake while reverting "LANG-1269: Wrong name or result of StringUtils#getJaroWinklerDistance". Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/811dbe72 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/811dbe72 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/811dbe72 Branch: refs/heads/master Commit: 811dbe7226ba0ede04c2062c2dba8f72a1c03e58 Parents: f4ee399 Author: pascalschumacher Authored: Sun Mar 19 14:37:19 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 19 14:37:19 2017 +0100 -- src/main/java/org/apache/commons/lang3/StringUtils.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/811dbe72/src/main/java/org/apache/commons/lang3/StringUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 26aea76..98a2d0c 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -8213,6 +8213,7 @@ public class StringUtils { * https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/similarity/JaroWinklerDistance.html";> * JaroWinklerDistance instead */ +@Deprecated public static double getJaroWinklerDistance(final CharSequence first, final CharSequence second) { final double DEFAULT_SCALING_FACTOR = 0.1;
[lang] Revert "LANG-1269: Wrong name or result of StringUtils#getJaroWinklerDistance (closes #198)"
Repository: commons-lang Updated Branches: refs/heads/master 844cd4298 -> f4ee399e3 Revert "LANG-1269: Wrong name or result of StringUtils#getJaroWinklerDistance (closes #198)" This reverts commit a40b2a907a69e51675d7d0502b2608833c4da343, because adding a new method StringUtils#getJaroWinklerSimilarity and immediately deprecating it makes not sense. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/f4ee399e Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/f4ee399e Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/f4ee399e Branch: refs/heads/master Commit: f4ee399e31eb61741f5f2167d6af8f49c0e991b6 Parents: 844cd42 Author: pascalschumacher Authored: Sun Mar 19 14:25:20 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 19 14:25:20 2017 +0100 -- src/changes/changes.xml | 1 - .../org/apache/commons/lang3/StringUtils.java | 54 .../apache/commons/lang3/StringUtilsTest.java | 28 -- 3 files changed, 83 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/f4ee399e/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index ee3097d..3edd5e6 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -54,7 +54,6 @@ The type attribute can be add,update,fix,remove. RandomStringUtils#random can enter infinite loop if end parameter is to small NullPointerException in FastDateParser$TimeZoneStrategy Javadoc of StringUtils.ordinalIndexOf is contradictory. -Wrong name or result of StringUtils#getJaroWinklerDistance StringUtils#join(T...): warning: [unchecked] Possible heap pollution from parameterized vararg type T Multiple calls of org.apache.commons.lang3.concurrent.LazyInitializer.initialize() are possible. StrBuilder#replaceAll ArrayIndexOutOfBoundsException http://git-wip-us.apache.org/repos/asf/commons-lang/blob/f4ee399e/src/main/java/org/apache/commons/lang3/StringUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 6e32a5c..26aea76 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -8213,7 +8213,6 @@ public class StringUtils { * https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/similarity/JaroWinklerDistance.html";> * JaroWinklerDistance instead */ -@Deprecated public static double getJaroWinklerDistance(final CharSequence first, final CharSequence second) { final double DEFAULT_SCALING_FACTOR = 0.1; @@ -8231,59 +8230,6 @@ public class StringUtils { return Math.round(jw * 100.0D) / 100.0D; } -/** - * Find the Jaro Winkler Similarity which indicates the similarity score between two Strings. - * - * The Jaro measure is the weighted sum of percentage of matched characters from each file and transposed characters. - * Winkler increased this measure for matching initial characters. - * - * This implementation is based on the Jaro Winkler similarity algorithm - * from http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance";>http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance. - * - * - * StringUtils.getJaroWinklerSimilarity(null, null) = IllegalArgumentException - * StringUtils.getJaroWinklerSimilarity("","") = 0.0 - * StringUtils.getJaroWinklerSimilarity("","a") = 0.0 - * StringUtils.getJaroWinklerSimilarity("aaa", "") = 0.0 - * StringUtils.getJaroWinklerSimilarity("frog", "fog") = 0.93 - * StringUtils.getJaroWinklerSimilarity("fly", "ant")= 0.0 - * StringUtils.getJaroWinklerSimilarity("elephant", "hippo") = 0.44 - * StringUtils.getJaroWinklerSimilarity("hippo", "elephant") = 0.44 - * StringUtils.getJaroWinklerSimilarity("hippo", "") = 0.0 - * StringUtils.getJaroWinklerSimilarity("hello", "hallo")= 0.88 - * StringUtils.getJaroWinklerSimilarity("ABC Corporation", "ABC Corp") = 0.93 - * StringUtils.getJaroWinklerSimilarity("D N H Enterprises Inc", "D & H Enterprises, Inc.") = 0.95 - * StringUtils.getJaroWinklerSimilarity("My Gym Children's Fitness
[lang] LANG-1316: Deprecate classes/methods moved to commons-text (closes #255)
Repository: commons-lang Updated Branches: refs/heads/master 9aea44ace -> 844cd4298 LANG-1316: Deprecate classes/methods moved to commons-text (closes #255) * org.apache.commons.lang3.text.translate - every class * org.apache.commons.lang3.text - every class other than WordUtils * StringEscapeUtils - whole class * StringUtils: getLevenshteinDistance, getFuzzyDistance and getJaroWinklerSimilarity methods * ObjectUtils: identityToString(final StrBuilder builder, final Object object) method (StrBuilder was moved to commons-text) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/844cd429 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/844cd429 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/844cd429 Branch: refs/heads/master Commit: 844cd4298e46027ba1201df4eceb2dcaa5c1bb26 Parents: 9aea44a Author: pascalschumacher Authored: Sun Mar 12 14:53:40 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 19 14:12:44 2017 +0100 -- src/changes/changes.xml | 1 + .../org/apache/commons/lang3/ObjectUtils.java | 4 .../apache/commons/lang3/StringEscapeUtils.java | 4 .../org/apache/commons/lang3/StringUtils.java | 20 +++- .../commons/lang3/text/CompositeFormat.java | 4 .../lang3/text/ExtendedMessageFormat.java | 4 .../commons/lang3/text/FormatFactory.java | 4 .../commons/lang3/text/FormattableUtils.java| 4 .../apache/commons/lang3/text/StrBuilder.java | 4 .../apache/commons/lang3/text/StrLookup.java| 4 .../apache/commons/lang3/text/StrMatcher.java | 4 .../commons/lang3/text/StrSubstitutor.java | 4 .../apache/commons/lang3/text/StrTokenizer.java | 4 .../text/translate/AggregateTranslator.java | 4 .../text/translate/CharSequenceTranslator.java | 4 .../text/translate/CodePointTranslator.java | 4 .../lang3/text/translate/EntityArrays.java | 4 .../text/translate/JavaUnicodeEscaper.java | 4 .../lang3/text/translate/LookupTranslator.java | 4 .../text/translate/NumericEntityEscaper.java| 4 .../text/translate/NumericEntityUnescaper.java | 4 .../lang3/text/translate/OctalUnescaper.java| 4 .../lang3/text/translate/UnicodeEscaper.java| 4 .../lang3/text/translate/UnicodeUnescaper.java | 4 .../UnicodeUnpairedSurrogateRemover.java| 5 + .../lang3/text/translate/package-info.java | 3 +++ .../commons/lang3/StringEscapeUtilsTest.java| 5 + .../lang3/StringUtilsStartsEndsWithTest.java| 5 ++--- .../commons/lang3/reflect/TypeUtilsTest.java| 9 - .../commons/lang3/text/CompositeFormatTest.java | 1 + .../lang3/text/ExtendedMessageFormatTest.java | 1 + .../lang3/text/FormattableUtilsTest.java| 1 + .../lang3/text/StrBuilderAppendInsertTest.java | 1 + .../commons/lang3/text/StrBuilderTest.java | 1 + .../commons/lang3/text/StrLookupTest.java | 1 + .../commons/lang3/text/StrMatcherTest.java | 1 + .../commons/lang3/text/StrSubstitutorTest.java | 1 + .../commons/lang3/text/StrTokenizerTest.java| 1 + .../lang3/text/translate/EntityArraysTest.java | 1 + .../text/translate/LookupTranslatorTest.java| 1 + .../translate/NumericEntityEscaperTest.java | 1 + .../translate/NumericEntityUnescaperTest.java | 1 + .../text/translate/OctalUnescaperTest.java | 1 + .../text/translate/UnicodeEscaperTest.java | 1 + .../text/translate/UnicodeUnescaperTest.java| 1 + .../UnicodeUnpairedSurrogateRemoverTest.java| 1 + 46 files changed, 140 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/844cd429/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index c770c90..ee3097d 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -80,6 +80,7 @@ The type attribute can be add,update,fix,remove. LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code Build failures when building with Java 9 EA javadoc creation broken with Java 8 +Deprecate classes/methods moved to commons-text http://git-wip-us.apache.org/repos/asf/commons-lang/blob/844cd429/src/main/java/org/apache/commons/lang3/ObjectUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java index ec4eb61..2edd81f 100644 --- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java +++ b/src/m
[lang] travis: add clirr check
Repository: commons-lang Updated Branches: refs/heads/master e702828e7 -> 9aea44ace travis: add clirr check Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/9aea44ac Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/9aea44ac Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/9aea44ac Branch: refs/heads/master Commit: 9aea44aceaada5ac9fb1b1c774e8f56a6f815f2c Parents: e702828 Author: pascalschumacher Authored: Sun Mar 19 10:41:33 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 19 10:41:33 2017 +0100 -- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/9aea44ac/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index 5684ab6..e81e8cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ jdk: - oraclejdk8 script: - - mvn test checkstyle:check javadoc:javadoc apache-rat:check -B + - mvn test apache-rat:check clirr:check checkstyle:check javadoc:javadoc -B after_success: - mvn clean cobertura:cobertura coveralls:report
[2/2] [lang] checkstyle-suppressions.xml: make paths work on windows
checkstyle-suppressions.xml: make paths work on windows Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/e702828e Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/e702828e Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/e702828e Branch: refs/heads/master Commit: e702828e7b34c6a9f1ae4eb6bbf07e60445ec8aa Parents: 99900ae Author: pascalschumacher Authored: Sun Mar 19 10:32:33 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 19 10:32:33 2017 +0100 -- checkstyle-suppressions.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/e702828e/checkstyle-suppressions.xml -- diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml index f609d3d..3c02362 100644 --- a/checkstyle-suppressions.xml +++ b/checkstyle-suppressions.xml @@ -15,9 +15,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - http://www.puppycrawl.com/dtds/suppressions_1_1.dtd";> - - + +
[1/2] [lang] StringUtilsEqualsIndexOfTest: fix checkstyle violations
Repository: commons-lang Updated Branches: refs/heads/master 27d3d40f7 -> e702828e7 StringUtilsEqualsIndexOfTest: fix checkstyle violations Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/99900ae0 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/99900ae0 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/99900ae0 Branch: refs/heads/master Commit: 99900ae089cf996bc969f0673349c06c2e6fbf1d Parents: 27d3d40 Author: pascalschumacher Authored: Sun Mar 19 10:31:21 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 19 10:31:21 2017 +0100 -- .../lang3/StringUtilsEqualsIndexOfTest.java | 73 +--- 1 file changed, 33 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/99900ae0/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java index 4635a54..91c0451 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java @@ -297,25 +297,24 @@ public class StringUtilsEqualsIndexOfTest { //LANG-1300 tests go here final int CODE_POINT = 0x2070E; - StringBuilder builder = new StringBuilder(); - builder.appendCodePoint(CODE_POINT); - assertEquals(0, StringUtils.indexOf(builder, CODE_POINT, 0)); - assertEquals(0, StringUtils.indexOf(builder.toString(), CODE_POINT, 0)); - builder.appendCodePoint(CODE_POINT); - assertEquals(2, StringUtils.indexOf(builder, CODE_POINT, 1)); - assertEquals(2, StringUtils.indexOf(builder.toString(), CODE_POINT, 1)); - //inner branch on the supplementary character block - char[] tmp = {(char) 55361}; - builder = new StringBuilder(); - builder.append(tmp); - assertEquals(-1, StringUtils.indexOf(builder, CODE_POINT, 0)); - assertEquals(-1, StringUtils.indexOf(builder.toString(), CODE_POINT, 0)); - builder.appendCodePoint(CODE_POINT); - assertEquals(1, StringUtils.indexOf(builder, CODE_POINT, 0)); - assertEquals(1, StringUtils.indexOf(builder.toString(), CODE_POINT, 0)); - assertEquals(-1, StringUtils.indexOf(builder, CODE_POINT, 2)); +StringBuilder builder = new StringBuilder(); +builder.appendCodePoint(CODE_POINT); +assertEquals(0, StringUtils.indexOf(builder, CODE_POINT, 0)); +assertEquals(0, StringUtils.indexOf(builder.toString(), CODE_POINT, 0)); +builder.appendCodePoint(CODE_POINT); +assertEquals(2, StringUtils.indexOf(builder, CODE_POINT, 1)); +assertEquals(2, StringUtils.indexOf(builder.toString(), CODE_POINT, 1)); +// inner branch on the supplementary character block +char[] tmp = { (char) 55361 }; +builder = new StringBuilder(); +builder.append(tmp); +assertEquals(-1, StringUtils.indexOf(builder, CODE_POINT, 0)); +assertEquals(-1, StringUtils.indexOf(builder.toString(), CODE_POINT, 0)); +builder.appendCodePoint(CODE_POINT); +assertEquals(1, StringUtils.indexOf(builder, CODE_POINT, 0)); +assertEquals(1, StringUtils.indexOf(builder.toString(), CODE_POINT, 0)); +assertEquals(-1, StringUtils.indexOf(builder, CODE_POINT, 2)); assertEquals(-1, StringUtils.indexOf(builder.toString(), CODE_POINT, 2)); - } @Test @@ -453,7 +452,6 @@ public class StringUtilsEqualsIndexOfTest { assertEquals(0, StringUtils.indexOfAnyBut("zzabyycdxx", 'b','y')); assertEquals(-1, StringUtils.indexOfAnyBut("aba", 'a', 'b')); assertEquals(0, StringUtils.indexOfAnyBut("aba", 'z')); - } @Test @@ -550,30 +548,26 @@ public class StringUtilsEqualsIndexOfTest { //LANG-1300 addition test final int CODE_POINT = 0x2070E; - StringBuilder builder = new StringBuilder(); - builder.appendCodePoint(CODE_POINT); - assertEquals(0, StringUtils.lastIndexOf(builder, CODE_POINT, 0)); - builder.appendCodePoint(CODE_POINT); - assertEquals(0, StringUtils.lastIndexOf(builder, CODE_POINT, 0)); - assertEquals(0, StringUtils.lastIndexOf(builder, CODE_POINT, 1)); +StringBuilder builder = new StringBuilder(); +builder.appendCodePoint(CODE_POINT); +assertEquals(0, StringUtils.lastIndexOf(builder, CODE_POINT, 0)); +builder.appendCodePoint(CODE_POINT); +assert
[1/3] [lang] MethodUtilsTest whitespaces
Repository: commons-lang Updated Branches: refs/heads/master bf80b9e28 -> 27d3d40f7 MethodUtilsTest whitespaces Clean up MethodUtilsTest whitespaces as per the project's standards - no trailing whitespaces are allowed and spaces are used for indentation. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/17319491 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/17319491 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/17319491 Branch: refs/heads/master Commit: 1731949116a7278f2b729cbb9e505580c8f56980 Parents: 6bc8650 Author: Allon Mureinik Authored: Tue Mar 14 11:55:08 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 19 10:10:45 2017 +0100 -- .../commons/lang3/reflect/MethodUtilsTest.java | 34 ++-- 1 file changed, 17 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/17319491/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java index 5b49c85..351bed1 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java @@ -103,39 +103,39 @@ public class MethodUtilsTest { public static void oneParameterStatic(final String s) { // empty } - + @SuppressWarnings("unused") private void privateStuff() { } @SuppressWarnings("unused") private String privateStringStuff() { - return "privateStringStuff()"; +return "privateStringStuff()"; } - + @SuppressWarnings("unused") private String privateStringStuff(final int i) { - return "privateStringStuff(int)"; +return "privateStringStuff(int)"; } - + @SuppressWarnings("unused") private String privateStringStuff(final Integer i) { - return "privateStringStuff(Integer)"; +return "privateStringStuff(Integer)"; } - + @SuppressWarnings("unused") private String privateStringStuff(final double d) { - return "privateStringStuff(double)"; +return "privateStringStuff(double)"; } - + @SuppressWarnings("unused") private String privateStringStuff(final String s) { - return "privateStringStuff(String)"; +return "privateStringStuff(String)"; } - + @SuppressWarnings("unused") private String privateStringStuff(final Object s) { - return "privateStringStuff(Object)"; +return "privateStringStuff(Object)"; } @@ -760,12 +760,12 @@ public class MethodUtilsTest { final int[] actual = (int[])MethodUtils.invokeMethod(testBean, "unboxing", Integer.valueOf(1), Integer.valueOf(2)); Assert.assertArrayEquals(new int[]{1, 2}, actual); } - + @Test public void testInvokeMethodForceAccessNoArgs() throws Exception { Assert.assertEquals("privateStringStuff()", MethodUtils.invokeMethod(testBean, true, "privateStringStuff")); } - + @Test public void testInvokeMethodForceAccessWithArgs() throws Exception { Assert.assertEquals("privateStringStuff(Integer)", MethodUtils.invokeMethod(testBean, true, "privateStringStuff", 5)); @@ -773,17 +773,17 @@ public class MethodUtilsTest { Assert.assertEquals("privateStringStuff(String)", MethodUtils.invokeMethod(testBean, true, "privateStringStuff", "Hi There")); Assert.assertEquals("privateStringStuff(Object)", MethodUtils.invokeMethod(testBean, true, "privateStringStuff", new Date())); } - + @Test public void testDistance() throws Exception { final Method distanceMethod = MethodUtils.getMatchingMethod(MethodUtils.class, "distance", Class[].class, Class[].class); distanceMethod.setAccessible(true); - + Assert.assertEquals(-1, distanceMethod.invoke(null, new Class[]{String.class}, new Class[]{Date.class})); Assert.assertEquals(0, distanceMethod.invoke(null, new Class[]{Date.class}, new Class[]{Date.class})); Assert.assertEquals(1, distanceMethod.invoke(null, new Class[]{Integer.class}, new Class[]{ClassUtils.wrapperToPrimitive(Integer.class)})); Assert.assertEquals(2, distanceMethod.invoke(null, new Class[]{Integer.class}, new Class[]{Object.class})); - + distanceMethod.setAccessible(false); } }
[3/3] [lang] Apply checkstyle checks to test files (closes #257)
Apply checkstyle checks to test files (closes #257) This patch enforces the code style defined by the checkstyle checks to the test files too. In the cases where it would just add robustness and not improve the code's readability and maintainability (specifically - the javadoc checks), those checks are explicitly suppressed. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/27d3d40f Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/27d3d40f Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/27d3d40f Branch: refs/heads/master Commit: 27d3d40f7c6e97979d08517b0c04c1bb1774a9b2 Parents: 1731949 Author: Allon Mureinik Authored: Tue Mar 14 12:06:57 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 19 10:10:50 2017 +0100 -- checkstyle-suppressions.xml | 23 +++ pom.xml | 4 2 files changed, 27 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/27d3d40f/checkstyle-suppressions.xml -- diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml new file mode 100644 index 000..f609d3d --- /dev/null +++ b/checkstyle-suppressions.xml @@ -0,0 +1,23 @@ + + + +http://www.puppycrawl.com/dtds/suppressions_1_1.dtd";> + + + + http://git-wip-us.apache.org/repos/asf/commons-lang/blob/27d3d40f/pom.xml -- diff --git a/pom.xml b/pom.xml index e606eca..90e73c5 100644 --- a/pom.xml +++ b/pom.xml @@ -655,6 +655,8 @@ ${checkstyle.plugin.version} ${basedir}/checkstyle.xml + ${basedir}/checkstyle-suppressions.xml + true false @@ -669,6 +671,8 @@ ${checkstyle.plugin.version} ${basedir}/checkstyle.xml + ${basedir}/checkstyle-suppressions.xml + true false
[2/3] [lang] Remove test wildcard imports
Remove test wildcard imports This patch applies the de-facto project's coding standard on the test files and replaces wildcard static imports with series of single method imports. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6bc8650e Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6bc8650e Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6bc8650e Branch: refs/heads/master Commit: 6bc8650ed456810d600feea4b80a665fb5895832 Parents: bf80b9e Author: Allon Mureinik Authored: Tue Mar 14 11:45:03 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 19 10:10:45 2017 +0100 -- .../commons/lang3/ArrayUtilsInsertTest.java | 5 ++- .../commons/lang3/CharSequenceUtilsTest.java| 35 +++- .../apache/commons/lang3/JavaVersionTest.java | 4 ++- .../lang3/StringUtilsStartsEndsWithTest.java| 5 ++- .../apache/commons/lang3/StringUtilsTest.java | 9 - .../MultilineRecursiveToStringStyleTest.java| 2 +- .../concurrent/BackgroundInitializerTest.java | 8 - .../exception/AbstractExceptionContextTest.java | 3 +- .../lang3/mutable/MutableBooleanTest.java | 5 ++- .../commons/lang3/mutable/MutableByteTest.java | 5 ++- .../lang3/mutable/MutableDoubleTest.java| 5 ++- .../commons/lang3/mutable/MutableFloatTest.java | 5 ++- .../commons/lang3/mutable/MutableIntTest.java | 5 ++- .../commons/lang3/mutable/MutableLongTest.java | 5 ++- .../lang3/mutable/MutableObjectTest.java| 7 +++- .../commons/lang3/mutable/MutableShortTest.java | 6 +++- .../commons/lang3/reflect/FieldUtilsTest.java | 18 -- .../commons/lang3/text/CompositeFormatTest.java | 4 ++- .../lang3/text/ExtendedMessageFormatTest.java | 5 ++- .../lang3/text/StrBuilderAppendInsertTest.java | 4 ++- .../commons/lang3/text/StrBuilderTest.java | 9 - .../commons/lang3/text/StrTokenizerTest.java| 6 +++- .../commons/lang3/text/WordUtilsTest.java | 5 ++- .../text/translate/OctalUnescaperTest.java | 2 +- .../UnicodeUnpairedSurrogateRemoverTest.java| 2 +- .../lang3/time/DateUtilsFragmentTest.java | 4 ++- .../lang3/time/DateUtilsRoundingTest.java | 5 ++- 27 files changed, 135 insertions(+), 43 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6bc8650e/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java index 02895c8..86b0916 100644 --- a/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java +++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java @@ -17,7 +17,10 @@ package org.apache.commons.lang3; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6bc8650e/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java index 6ab9aae..591bf38 100644 --- a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java @@ -16,13 +16,16 @@ */ package org.apache.commons.lang3; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; -import org.junit.Assert; - import org.junit.Test; /** @@ -47,27 +50,27 @@ public class CharSequenceUtilsTest { // // null input // -Assert.assertEquals(null, CharSequenceUtils.subSequence(null, -1)); -Assert.assertEquals(null, CharSequenceUtils.subSequence(null, 0)); -Assert.assertEquals(null, CharSequenceUtils.subSequence(null, 1)); +assertEquals(null, CharSequenceUtils.subSequence(null, -1)); +assertEquals(null, CharSequenceUtils.subSequence(null, 0)); +assertEquals(null, CharSequenceUtils.subSequence(null, 1)); // // non-null input // -Assert.assertEquals(StringUtils.
[lang] update commons-parent to version 42
Repository: commons-lang Updated Branches: refs/heads/master 39a2a6fa3 -> 6700d58fd update commons-parent to version 42 Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6700d58f Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6700d58f Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6700d58f Branch: refs/heads/master Commit: 6700d58fd6538f531d282b98e4d31fadd35e87da Parents: 39a2a6f Author: pascalschumacher Authored: Tue Mar 14 22:05:53 2017 +0100 Committer: pascalschumacher Committed: Tue Mar 14 22:05:53 2017 +0100 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6700d58f/pom.xml -- diff --git a/pom.xml b/pom.xml index fc75181..3e6ebaa 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ org.apache.commons commons-parent -41 +42 4.0.0 commons-lang3
[lang] correct LANG-1314 changes.xml entry description
Repository: commons-lang Updated Branches: refs/heads/master 15dcb423c -> 39a2a6fa3 correct LANG-1314 changes.xml entry description Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/39a2a6fa Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/39a2a6fa Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/39a2a6fa Branch: refs/heads/master Commit: 39a2a6fa38c5e4d1293e00f98a89698a962d6775 Parents: 15dcb42 Author: pascalschumacher Authored: Mon Mar 13 09:06:29 2017 +0100 Committer: pascalschumacher Committed: Mon Mar 13 09:06:29 2017 +0100 -- src/changes/changes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/39a2a6fa/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 595fcc8..5d22f00 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -78,7 +78,7 @@ The type attribute can be add,update,fix,remove. TypeUtils.toString() doesn't handle primitive and Object arrays correctly LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code Build failures when building with Java 9 EA -Fix javadoc creation on with Java 8 +javadoc creation broken with Java 8
[lang] .travis.yml: include apache rat license check in the main script, so that the build fails if there are violations
Repository: commons-lang Updated Branches: refs/heads/master 4fb393be2 -> 15dcb423c .travis.yml: include apache rat license check in the main script, so that the build fails if there are violations Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/15dcb423 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/15dcb423 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/15dcb423 Branch: refs/heads/master Commit: 15dcb423cf0af2b52c0b5cc60d5f0bce85dcacdd Parents: 4fb393b Author: pascalschumacher Authored: Sun Mar 12 18:07:19 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 12 18:07:19 2017 +0100 -- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/15dcb423/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index 44a34a8..5684ab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ jdk: - oraclejdk8 script: - - mvn test checkstyle:check javadoc:javadoc -B + - mvn test checkstyle:check javadoc:javadoc apache-rat:check -B after_success: - - mvn clean apache-rat:check cobertura:cobertura coveralls:report + - mvn clean cobertura:cobertura coveralls:report
[4/6] [lang] Replace tabs with spaces in DateUtils
Replace tabs with spaces in DateUtils Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/4259a706 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/4259a706 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/4259a706 Branch: refs/heads/master Commit: 4259a706ab8641f408afc3ce224b1c0ba5a43d17 Parents: ba7c788 Author: Allon Mureinik Authored: Sat Mar 11 09:54:27 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 12 17:41:50 2017 +0100 -- src/main/java/org/apache/commons/lang3/time/DateUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4259a706/src/main/java/org/apache/commons/lang3/time/DateUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/time/DateUtils.java b/src/main/java/org/apache/commons/lang3/time/DateUtils.java index fc9f577..859011a 100644 --- a/src/main/java/org/apache/commons/lang3/time/DateUtils.java +++ b/src/main/java/org/apache/commons/lang3/time/DateUtils.java @@ -675,9 +675,9 @@ public class DateUtils { * @throws NullPointerException if {@code date} or {@code tz} is null */ public static Calendar toCalendar(final Date date, final TimeZone tz) { - final Calendar c = Calendar.getInstance(tz); - c.setTime(date); - return c; +final Calendar c = Calendar.getInstance(tz); +c.setTime(date); +return c; } //---
[1/6] [lang] Remove unused SystemUtils import from ExceptionUtils
Repository: commons-lang Updated Branches: refs/heads/master 4282efae5 -> 4fb393be2 Remove unused SystemUtils import from ExceptionUtils Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/ba7c7880 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/ba7c7880 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/ba7c7880 Branch: refs/heads/master Commit: ba7c788042ce0f4e156b6900d3d698e47aef5a4d Parents: 1f8479a Author: Allon Mureinik Authored: Sat Mar 11 09:52:41 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 12 17:41:49 2017 +0100 -- .../java/org/apache/commons/lang3/exception/ExceptionUtils.java | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ba7c7880/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java index 7b5b4d4..39e270b 100644 --- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java +++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java @@ -29,7 +29,6 @@ import java.util.StringTokenizer; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ClassUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.SystemUtils; /** * Provides utilities for manipulating and examining
[6/6] [lang] Add checkstyle to Travis CI (closes #254)
Add checkstyle to Travis CI (closes #254) Currently, checkstyle is only run as part of the reporting phase, and it's up to the developer to check the report manually. This patch adds the checkstyle configuration to the build plugins so it can be used to check the code (as opposed to just generate a report of the failures) and adds it to Travis CI's configuration so every new patch will be automatically checked against it. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/4fb393be Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/4fb393be Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/4fb393be Branch: refs/heads/master Commit: 4fb393be2c847d77b371a246e22704855a42201a Parents: 754e669 Author: Allon Mureinik Authored: Sat Mar 11 11:14:16 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 12 17:57:23 2017 +0100 -- .travis.yml | 2 +- pom.xml | 11 ++- 2 files changed, 11 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4fb393be/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index 4e3fd53..44a34a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ jdk: - oraclejdk8 script: - - mvn test javadoc:javadoc -B + - mvn test checkstyle:check javadoc:javadoc -B after_success: - mvn clean apache-rat:check cobertura:cobertura coveralls:report http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4fb393be/pom.xml -- diff --git a/pom.xml b/pom.xml index c4049c9..fc75181 100644 --- a/pom.xml +++ b/pom.xml @@ -576,6 +576,7 @@ 2.8 +2.17 @@ -646,6 +647,14 @@ + +maven-checkstyle-plugin +${checkstyle.plugin.version} + + ${basedir}/checkstyle.xml + false + + @@ -654,7 +663,7 @@ maven-checkstyle-plugin -2.17 +${checkstyle.plugin.version} ${basedir}/checkstyle.xml false
[3/6] [lang] Upgrade maven-checkstyle-plugin to 2.17
Upgrade maven-checkstyle-plugin to 2.17 This patch upgrades maven-checkstyle-plugin to the latest available version, 2.17. This is done in order to consume a fix for checkstyle wrongfully reporting an error if the @return javadoc tag was used in an annotation type, as it is in Guarded (line 36). Note that checkstyle has removed the RedundantThrows check (see discussion at https://github.com/checkstyle/checkstyle/issues/473), so it was removed from the project's checkstyle.xml configuration. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c121f03d Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c121f03d Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c121f03d Branch: refs/heads/master Commit: c121f03d5c6dae98b0c735cec0a5126520293f08 Parents: 4259a70 Author: Allon Mureinik Authored: Sat Mar 11 10:13:44 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 12 17:41:50 2017 +0100 -- checkstyle.xml | 3 --- pom.xml| 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c121f03d/checkstyle.xml -- diff --git a/checkstyle.xml b/checkstyle.xml index bbec654..6f03c44 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -36,9 +36,6 @@ limitations under the License. - - - http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c121f03d/pom.xml -- diff --git a/pom.xml b/pom.xml index d467ecd..c4049c9 100644 --- a/pom.xml +++ b/pom.xml @@ -654,7 +654,7 @@ maven-checkstyle-plugin -2.15 +2.17 ${basedir}/checkstyle.xml false
[2/6] [lang] Apply JavaDoc checkstyle only to public methods
Apply JavaDoc checkstyle only to public methods The defacto style of the project requires Javadoc for public methods only, but the checkstyle Javadoc check defaults to requiring them even for private methods, generating 46 errors. This patch sets the checkstyle Javadoc check's scope to public to clean up the checkstyle report so it can be enabled in the CI. If we wish to reset the check to a laxer scope, the aforementioned errors should be fixed first. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/1f8479a8 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/1f8479a8 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/1f8479a8 Branch: refs/heads/master Commit: 1f8479a84b52bb8c755c84501ba98f0d511adfd0 Parents: 4282efa Author: Allon Mureinik Authored: Sun Mar 5 12:05:23 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 12 17:41:49 2017 +0100 -- checkstyle.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1f8479a8/checkstyle.xml -- diff --git a/checkstyle.xml b/checkstyle.xml index d4df9da..bbec654 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -41,6 +41,7 @@ limitations under the License. +
[5/6] [lang] org.apache.commons.lang3.concurrent.annotation package-info
org.apache.commons.lang3.concurrent.annotation package-info Added package-info.java to the org.apache.commons.lang3.concurrent.annotation package to solve a checkstyle violation. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/754e669f Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/754e669f Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/754e669f Branch: refs/heads/master Commit: 754e669f76c5587b163cea7fc5c68f274a267ef1 Parents: c121f03 Author: Allon Mureinik Authored: Sat Mar 11 10:49:22 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 12 17:41:50 2017 +0100 -- .../concurrent/annotation/package-info.java | 22 1 file changed, 22 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/754e669f/src/main/java/org/apache/commons/lang3/concurrent/annotation/package-info.java -- diff --git a/src/main/java/org/apache/commons/lang3/concurrent/annotation/package-info.java b/src/main/java/org/apache/commons/lang3/concurrent/annotation/package-info.java new file mode 100644 index 000..3f29ebf --- /dev/null +++ b/src/main/java/org/apache/commons/lang3/concurrent/annotation/package-info.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Provides annotations to document classes' thread safety + * + * @since 3.6 + */ +package org.apache.commons.lang3.concurrent.annotation;
[lang] LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods
Repository: commons-lang Updated Branches: refs/heads/master 3ce7f9eec -> 4282efae5 LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods fix error in javadoc (side effects: close #221, close #197) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/4282efae Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/4282efae Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/4282efae Branch: refs/heads/master Commit: 4282efae5f4ab456cef3acac5574f13f4f450b9e Parents: 3ce7f9e Author: pascalschumacher Authored: Sun Mar 12 17:33:53 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 12 17:33:53 2017 +0100 -- src/main/java/org/apache/commons/lang3/StringUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4282efae/src/main/java/org/apache/commons/lang3/StringUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 56a1c47..2250595 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -426,7 +426,7 @@ public class StringUtils { /** * Checks if all of the CharSequences are empty (""), null or whitespace only. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * * StringUtils.isAllBlank(null) = true
[1/2] [lang] LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods
Repository: commons-lang Updated Branches: refs/heads/master 31a9fa0cc -> 3ce7f9eec LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6b9c3315 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6b9c3315 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6b9c3315 Branch: refs/heads/master Commit: 6b9c3315885f8f9e4be19db9ef05257035b97bca Parents: 31a9fa0 Author: Martin Authored: Sun Dec 4 22:13:20 2016 +0100 Committer: pascalschumacher Committed: Sun Mar 12 17:07:31 2017 +0100 -- .../org/apache/commons/lang3/StringUtils.java | 48 .../lang3/StringUtilsEmptyBlankTest.java| 29 2 files changed, 77 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6b9c3315/src/main/java/org/apache/commons/lang3/StringUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 63caeac..d91ad55 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -311,6 +311,29 @@ public class StringUtils { } /** + * Checks if all of the CharSequences are empty ("") or null. + * + * + * StringUtils.isAllEmpty(null) = true + * StringUtils.isAllEmpty(null, "") = true + * StringUtils.isAllEmpty(new String[] {}) = true + * StringUtils.isAllEmpty(null, "foo") = false + * StringUtils.isAllEmpty("", "bar")= false + * StringUtils.isAllEmpty("bob", "")= false + * StringUtils.isAllEmpty(" bob ", null) = false + * StringUtils.isAllEmpty(" ", "bar") = false + * StringUtils.isAllEmpty("foo", "bar") = false + * + * + * @param css the CharSequences to check, may be null or empty + * @return {@code true} if all of the CharSequences are empty or null + * @since 3.6 + */ +public static boolean isAllEmpty(final CharSequence... css) { + return !isAnyNotEmpty(css); +} + +/** * Checks if a CharSequence is empty (""), null or whitespace only. * * Whitespace is defined by {@link Character#isWhitespace(char)}. @@ -455,6 +478,31 @@ public class StringUtils { return !isAnyBlank(css); } +/** + * Checks if all of the CharSequences are empty (""), null or whitespace only. + * + * Whitespace is defined by {@link Character#isWhitespace(char)}. + * + * + * StringUtils.isAllBlank(null) = true + * StringUtils.isAllBlank(null, "foo") = false + * StringUtils.isAllBlank(null, null) = true + * StringUtils.isAllBlank("", "bar")= false + * StringUtils.isAllBlank("bob", "")= false + * StringUtils.isAllBlank(" bob ", null) = false + * StringUtils.isAllBlank(" ", "bar") = false + * StringUtils.isAllBlank("foo", "bar") = false + * StringUtils.isAllBlank(new String[] {}) = true + * + * + * @param css the CharSequences to check, may be null or empty + * @return {@code true} if all of the CharSequences are empty or null or whitespace only + * @since 3.6 + */ +public static boolean isAllBlank(final CharSequence... css) { + return !isAnyNotBlank(css); +} + // Trim //--- /** http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6b9c3315/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java index 769a138..b04d0da 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java @@ -82,6 +82,21 @@ public class StringUtilsEmptyBlankTest { } @Test +public void testIsAllEmpty() { +assertTrue(StringUtils.isAllEmpty()); +assertTrue(StringUtils.isAllEmpty(new String[]{})); +assertTrue(StringUtils.isAllEmpty((String) null)); +assertTrue(StringUtils.isAllEmpty((String[]) null)); +assertFalse(StringUtils.isAllEmpty(null, "foo")); +
[2/2] [lang] revert "LANG-1270: Add StringUtils#isAnyNotEmpty and #isAnyNotBlank" and add "LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods" instead
revert "LANG-1270: Add StringUtils#isAnyNotEmpty and #isAnyNotBlank" and add "LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods" instead Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/3ce7f9ee Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/3ce7f9ee Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/3ce7f9ee Branch: refs/heads/master Commit: 3ce7f9eecfacbf3de716a8338ad4929371a66ca2 Parents: 6b9c331 Author: pascalschumacher Authored: Sun Mar 12 17:21:27 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 12 17:21:27 2017 +0100 -- src/changes/changes.xml | 2 +- .../org/apache/commons/lang3/StringUtils.java | 83 +--- .../lang3/StringUtilsEmptyBlankTest.java| 26 -- 3 files changed, 19 insertions(+), 92 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3ce7f9ee/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 5b2cb64..595fcc8 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -66,7 +66,7 @@ The type attribute can be add,update,fix,remove. Implementation of a Memomizer Add ArrayUtils#toStringArray method StringUtils#abbreviate should support 'custom ellipses' parameter -Add StringUtils#isAnyNotEmpty and #isAnyNotBlank +Add StringUtils#isAllEmpty and #isAllBlank methods Provide annotations to document thread safety Increase test coverage of org.apache.commons.lang3.ArrayUtils StrSubstitutor should state its thread safety http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3ce7f9ee/src/main/java/org/apache/commons/lang3/StringUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index d91ad55..56a1c47 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -259,36 +259,6 @@ public class StringUtils { } /** - * Checks if any of the CharSequences are not empty ("") and not null. - * - * - * StringUtils.isAnyNotEmpty(null) = false - * StringUtils.isAnyNotEmpty(new String[] {}) = false - * StringUtils.isAnyNotEmpty(null, "foo") = true - * StringUtils.isAnyNotEmpty("", "bar")= true - * StringUtils.isAnyNotEmpty("bob", "")= true - * StringUtils.isAnyNotEmpty(" bob ", null) = true - * StringUtils.isAnyNotEmpty(" ", "bar") = true - * StringUtils.isAnyNotEmpty("foo", "bar") = true - * - * - * @param css the CharSequences to check, may be null or empty - * @return {@code true} if any of the CharSequences are not empty and not null - * @since 3.6 - */ -public static boolean isAnyNotEmpty(final CharSequence... css) { - if (ArrayUtils.isEmpty(css)) { -return false; - } - for (final CharSequence cs : css) { -if (isNotEmpty(cs)) { - return true; -} - } - return false; -} - -/** * Checks if none of the CharSequences are empty ("") or null. * * @@ -330,7 +300,15 @@ public class StringUtils { * @since 3.6 */ public static boolean isAllEmpty(final CharSequence... css) { - return !isAnyNotEmpty(css); +if (ArrayUtils.isEmpty(css)) { +return true; +} +for (final CharSequence cs : css) { +if (isNotEmpty(cs)) { +return false; +} +} +return true; } /** @@ -421,39 +399,6 @@ public class StringUtils { } /** - * Checks if any of the CharSequences are not empty (""), not null and not whitespace only. - * - * Whitespace is defined by {@link Character#isWhitespace(char)}. - * - * - * StringUtils.isAnyNotBlank(null) = false - * StringUtils.isAnyNotBlank(null, "foo") = true - * StringUtils.isAnyNotBlank(null, null) = false - * StringUtils.isAnyNotBlank("", "bar")= true - * StringUtils.isAnyNotBlank("bob", "")= true - * StringUtils.isAnyNotBlank(" bob ", null) = true - * StringUtils.isAnyNotBlank(" ", "bar") = true - * StringUtils.isAnyNotBlank("foo", "bar") = true - * S
[commons-text] Git Push Summary
Repository: commons-text Updated Branches: refs/heads/deprecated_classes_methods_move_to_commons_text [created] 94ca2ca01
[lang] ClassUtilsTest: some tests can simplified because lang does not support java versions without autoboxing anymore
Repository: commons-lang Updated Branches: refs/heads/master 5482ce61b -> 31a9fa0cc ClassUtilsTest: some tests can simplified because lang does not support java versions without autoboxing anymore Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/31a9fa0c Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/31a9fa0c Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/31a9fa0c Branch: refs/heads/master Commit: 31a9fa0cce769c976d74cdcb6e6ce8831793db7b Parents: 5482ce6 Author: pascalschumacher Authored: Sun Mar 12 13:44:03 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 12 13:44:03 2017 +0100 -- .../apache/commons/lang3/ClassUtilsTest.java| 83 +--- 1 file changed, 38 insertions(+), 45 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/31a9fa0c/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java index b0a23cd..744aaa8 100644 --- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java @@ -16,7 +16,6 @@ */ package org.apache.commons.lang3; -import static org.apache.commons.lang3.JavaVersion.JAVA_1_5; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -385,13 +384,11 @@ public class ClassUtilsTest { assertTrue(ClassUtils.isAssignable(array1s, array1s)); assertTrue(ClassUtils.isAssignable(array1s, array1)); -final boolean autoboxing = SystemUtils.isJavaVersionAtLeast(JAVA_1_5); - -assertEquals(autoboxing, ClassUtils.isAssignable(arrayPrimitives, arrayWrappers)); -assertEquals(autoboxing, ClassUtils.isAssignable(arrayWrappers, arrayPrimitives)); +assertTrue(ClassUtils.isAssignable(arrayPrimitives, arrayWrappers)); +assertTrue(ClassUtils.isAssignable(arrayWrappers, arrayPrimitives)); assertFalse(ClassUtils.isAssignable(arrayPrimitives, array1)); assertFalse(ClassUtils.isAssignable(arrayWrappers, array1)); -assertEquals(autoboxing, ClassUtils.isAssignable(arrayPrimitives, array2)); +assertTrue(ClassUtils.isAssignable(arrayPrimitives, array2)); assertTrue(ClassUtils.isAssignable(arrayWrappers, array2)); } @@ -463,18 +460,16 @@ public class ClassUtilsTest { assertTrue(ClassUtils.isAssignable(String.class, String.class)); assertFalse(ClassUtils.isAssignable(Object.class, String.class)); -final boolean autoboxing = SystemUtils.isJavaVersionAtLeast(JAVA_1_5); - -assertEquals(autoboxing, ClassUtils.isAssignable(Integer.TYPE, Integer.class)); -assertEquals(autoboxing, ClassUtils.isAssignable(Integer.TYPE, Object.class)); -assertEquals(autoboxing, ClassUtils.isAssignable(Integer.class, Integer.TYPE)); -assertEquals(autoboxing, ClassUtils.isAssignable(Integer.class, Object.class)); +assertTrue(ClassUtils.isAssignable(Integer.TYPE, Integer.class)); +assertTrue(ClassUtils.isAssignable(Integer.TYPE, Object.class)); +assertTrue(ClassUtils.isAssignable(Integer.class, Integer.TYPE)); +assertTrue(ClassUtils.isAssignable(Integer.class, Object.class)); assertTrue(ClassUtils.isAssignable(Integer.TYPE, Integer.TYPE)); assertTrue(ClassUtils.isAssignable(Integer.class, Integer.class)); -assertEquals(autoboxing, ClassUtils.isAssignable(Boolean.TYPE, Boolean.class)); -assertEquals(autoboxing, ClassUtils.isAssignable(Boolean.TYPE, Object.class)); -assertEquals(autoboxing, ClassUtils.isAssignable(Boolean.class, Boolean.TYPE)); -assertEquals(autoboxing, ClassUtils.isAssignable(Boolean.class, Object.class)); +assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.class)); +assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Object.class)); +assertTrue(ClassUtils.isAssignable(Boolean.class, Boolean.TYPE)); +assertTrue(ClassUtils.isAssignable(Boolean.class, Object.class)); assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE)); assertTrue(ClassUtils.isAssignable(Boolean.class, Boolean.class)); } @@ -612,46 +607,44 @@ public class ClassUtilsTest { @Test public void test_isAssignable_DefaultUnboxing_Widening() throws Exception { -final boolean autoboxing = SystemUtils.isJavaVersionAtLeast(JAVA_1_5); - // test byte conversions assertFalse("byte -> char", ClassUtils.isAssignable(Byte.class,
[lang] ClassUtilsTest#test_isAssignable_ClassArray_ClassArray: add explicit cast to avoid compiler warning and remove commented out code
Repository: commons-lang Updated Branches: refs/heads/master f0f896ee6 -> 5482ce61b ClassUtilsTest#test_isAssignable_ClassArray_ClassArray: add explicit cast to avoid compiler warning and remove commented out code Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/5482ce61 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/5482ce61 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/5482ce61 Branch: refs/heads/master Commit: 5482ce61b003726a9476c76a4337e043af4318c0 Parents: f0f896e Author: pascalschumacher Authored: Sun Mar 12 13:13:35 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 12 13:13:35 2017 +0100 -- src/test/java/org/apache/commons/lang3/ClassUtilsTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5482ce61/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java index d9c1e6f..b0a23cd 100644 --- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java @@ -378,9 +378,8 @@ public class ClassUtilsTest { assertFalse(ClassUtils.isAssignable(null, array2)); assertTrue(ClassUtils.isAssignable(null, array0)); assertTrue(ClassUtils.isAssignable(array0, array0)); -//assertTrue(ClassUtils.isAssignable(array0, null)); assertTrue(ClassUtils.isAssignable(array0, (Class[]) null)); // explicit cast to avoid warning -assertTrue(ClassUtils.isAssignable((Class[]) null, null)); +assertTrue(ClassUtils.isAssignable((Class[]) null, (Class[]) null)); // explicit cast to avoid warning assertFalse(ClassUtils.isAssignable(array1, array1s)); assertTrue(ClassUtils.isAssignable(array1s, array1s));
[lang] AbstractExceptionContextTest#testJavaSerialization: remove unnecessary SuppressWarnings annotation
Repository: commons-lang Updated Branches: refs/heads/master 05bf337fc -> f0f896ee6 AbstractExceptionContextTest#testJavaSerialization: remove unnecessary SuppressWarnings annotation Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/f0f896ee Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/f0f896ee Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/f0f896ee Branch: refs/heads/master Commit: f0f896ee600ea7ff66c083747f370453b914be48 Parents: 05bf337 Author: pascalschumacher Authored: Sun Mar 12 13:10:34 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 12 13:10:34 2017 +0100 -- .../commons/lang3/exception/AbstractExceptionContextTest.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/f0f896ee/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java b/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java index 462c4cc..e569ade 100644 --- a/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java +++ b/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java @@ -179,9 +179,9 @@ public abstract class AbstractExceptionContextTest
[lang] StringUtils#indexOfAny, #lastIndexOfAny: remove unused local variable
Repository: commons-lang Updated Branches: refs/heads/master ee19f8247 -> 05bf337fc StringUtils#indexOfAny, #lastIndexOfAny: remove unused local variable Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/05bf337f Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/05bf337f Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/05bf337f Branch: refs/heads/master Commit: 05bf337fc0095d2557368b481f332245f5754b03 Parents: ee19f82 Author: pascalschumacher Authored: Sun Mar 12 13:06:53 2017 +0100 Committer: pascalschumacher Committed: Sun Mar 12 13:06:53 2017 +0100 -- src/main/java/org/apache/commons/lang3/StringUtils.java | 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/05bf337f/src/main/java/org/apache/commons/lang3/StringUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index a92c4df..63caeac 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -2461,7 +2461,6 @@ public class StringUtils { if (str == null || searchStrs == null) { return INDEX_NOT_FOUND; } -final int sz = searchStrs.length; // String's can't have a MAX_VALUEth index. int ret = Integer.MAX_VALUE; @@ -2514,7 +2513,6 @@ public class StringUtils { if (str == null || searchStrs == null) { return INDEX_NOT_FOUND; } -final int sz = searchStrs.length; int ret = INDEX_NOT_FOUND; int tmp = 0; for (final CharSequence search : searchStrs) {
[2/5] [lang] LANG-1314: Fix javadoc creation on with Java 8
LANG-1314: Fix javadoc creation on with Java 8 Remove tag from Computable's javadoc The standard javadoc doclet does not allow self closing tags (such as ). This patch removes such a tag from Computable's javadoc, as it's redundant anyway, as it's only used to create spaces between two existing paragraphs. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/7337507a Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/7337507a Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/7337507a Branch: refs/heads/master Commit: 7337507a796ed6717feb87f4e9829467872c1741 Parents: 0f5c769 Author: pascalschumacher Authored: Mon Mar 6 19:23:00 2017 +0100 Committer: pascalschumacher Committed: Mon Mar 6 19:27:36 2017 +0100 -- src/main/java/org/apache/commons/lang3/concurrent/Computable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7337507a/src/main/java/org/apache/commons/lang3/concurrent/Computable.java -- diff --git a/src/main/java/org/apache/commons/lang3/concurrent/Computable.java b/src/main/java/org/apache/commons/lang3/concurrent/Computable.java index d9e5468..6cb37aa 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/Computable.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/Computable.java @@ -18,7 +18,7 @@ package org.apache.commons.lang3.concurrent; /** * Definition of an interface for a wrapper around a calculation that takes a single parameter and returns a result. - * + * * This interface allows for wrapping a calculation into a class so that it maybe passed around an application. * * @param the type of the input to the calculation
[3/5] [lang] LANG-1314: Fix javadoc creation on with Java 8
LANG-1314: Fix javadoc creation on with Java 8 Add @param for in ArrayUtils#insert Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/a0f9db28 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/a0f9db28 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/a0f9db28 Branch: refs/heads/master Commit: a0f9db28319f45feb56982d21239fed451b6c3ef Parents: e5ed4ff Author: pascalschumacher Authored: Mon Mar 6 19:22:14 2017 +0100 Committer: pascalschumacher Committed: Mon Mar 6 19:27:36 2017 +0100 -- src/main/java/org/apache/commons/lang3/ArrayUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a0f9db28/src/main/java/org/apache/commons/lang3/ArrayUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java index b09e891..4ced70c 100644 --- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java +++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java @@ -8408,12 +8408,13 @@ public class ArrayUtils { * ArrayUtils.insert(index, array, null) = cloned copy of 'array' * ArrayUtils.insert(index, null, values)= null * - * + * + * @param The type of elements in {@code array} and {@code values} * @param index the position within {@code array} to insert the new values * @param array the array to insert the values into, may be {@code null} * @param values the new values to insert, may be {@code null} * @return The new array. - * @throws IndexOutOfBoundsException if {@code array} is provided + * @throws IndexOutOfBoundsException if {@code array} is provided * and either {@code index < 0} or {@code index > array.length} * @since 3.6 */
[1/5] [lang] add changes.xml entry for LANG-1314
Repository: commons-lang Updated Branches: refs/heads/master e5ed4ffe5 -> d43e1d019 add changes.xml entry for LANG-1314 Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/d43e1d01 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/d43e1d01 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/d43e1d01 Branch: refs/heads/master Commit: d43e1d01981d321b85a8ccae788da4d818548dbe Parents: 0ba25aa Author: pascalschumacher Authored: Mon Mar 6 19:27:02 2017 +0100 Committer: pascalschumacher Committed: Mon Mar 6 19:27:36 2017 +0100 -- src/changes/changes.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d43e1d01/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 4419d95..5b2cb64 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -78,6 +78,7 @@ The type attribute can be add,update,fix,remove. TypeUtils.toString() doesn't handle primitive and Object arrays correctly LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code Build failures when building with Java 9 EA +Fix javadoc creation on with Java 8
[4/5] [lang] Add javadoc creation to Travis CI (closes #252)
Add javadoc creation to Travis CI (closes #252) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/0ba25aa9 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/0ba25aa9 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/0ba25aa9 Branch: refs/heads/master Commit: 0ba25aa97bf80e001645bcb1fb597c7f704b0f29 Parents: 7337507 Author: Allon Mureinik Authored: Sun Mar 5 18:03:01 2017 +0200 Committer: pascalschumacher Committed: Mon Mar 6 19:27:36 2017 +0100 -- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/0ba25aa9/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index a969aba..4e3fd53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,5 +21,8 @@ jdk: - oraclejdk7 - oraclejdk8 +script: + - mvn test javadoc:javadoc -B + after_success: - mvn clean apache-rat:check cobertura:cobertura coveralls:report
[5/5] [lang] LANG-1314: Fix javadoc creation on with Java 8
LANG-1314: Fix javadoc creation on with Java 8 Fix StirngUtils tags in javadoc The paragraph Whitespace is defined by {@link Character#isWhitespace(char)}. appears in several places in the javadoc (presumably, copy-pasted from the original one to the others). This is obviously a mistake, as a paragraph should start with , not with . This patch fixes all the occurrences of this paragraph to the proper form: Whitespace is defined by {@link Character#isWhitespace(char)}. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/0f5c769e Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/0f5c769e Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/0f5c769e Branch: refs/heads/master Commit: 0f5c769e0c27a5f31a3451aa7372048bed08e9f7 Parents: a0f9db2 Author: pascalschumacher Authored: Mon Mar 6 19:22:49 2017 +0100 Committer: pascalschumacher Committed: Mon Mar 6 19:27:36 2017 +0100 -- .../java/org/apache/commons/lang3/StringUtils.java | 16 1 file changed, 8 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/0f5c769e/src/main/java/org/apache/commons/lang3/StringUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 8049850..a92c4df 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -313,7 +313,7 @@ public class StringUtils { /** * Checks if a CharSequence is empty (""), null or whitespace only. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * * StringUtils.isBlank(null) = true @@ -344,7 +344,7 @@ public class StringUtils { /** * Checks if a CharSequence is not empty (""), not null and not whitespace only. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * * StringUtils.isNotBlank(null) = false @@ -367,7 +367,7 @@ public class StringUtils { /** * Checks if any of the CharSequences are empty ("") or null or whitespace only. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * * StringUtils.isAnyBlank(null) = true @@ -400,7 +400,7 @@ public class StringUtils { /** * Checks if any of the CharSequences are not empty (""), not null and not whitespace only. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * * StringUtils.isAnyNotBlank(null) = false @@ -433,7 +433,7 @@ public class StringUtils { /** * Checks if none of the CharSequences are empty (""), null or whitespace only. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * * StringUtils.isNoneBlank(null) = false @@ -1943,7 +1943,7 @@ public class StringUtils { /** * Check whether the given CharSequence contains any whitespace characters. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * @param seq the CharSequence to check (may be {@code null}) * @return {@code true} if the CharSequence is not empty and @@ -7089,7 +7089,7 @@ public class StringUtils { /** * Checks if the CharSequence contains only whitespace. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * {@code null} will return {@code false}. * An empty CharSequence (length()=0) will return {@code true}. @@ -7238,7 +7238,7 @@ public class StringUtils { * Returns either the passed in CharSequence, or if the CharSequence is * whitespace, empty ("") or {@code null}, the value of {@code defaultStr}. * - * Whitespace is defined by {@link Character#isWhitespace(char)}. + * Whitespace is defined by {@link Character#isWhitespace(char)}. * * * StringUtils.defaultIfBlank(null, "NULL") = "NULL"
[lang] Checkstyle for long literals (closes #249)
Repository: commons-lang Updated Branches: refs/heads/master 6597c1965 -> e5ed4ffe5 Checkstyle for long literals (closes #249) PR #248 corrected all the long literals to use the upper case L notation. This patch finishes the job as per the discussion there, and adds a checktysle check to ensure no code that introduces long literals with lowercase l are introduced. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/e5ed4ffe Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/e5ed4ffe Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/e5ed4ffe Branch: refs/heads/master Commit: e5ed4ffe5df9bd5fe796e95acf0b35f4c858e1a2 Parents: 6597c19 Author: Allon Mureinik Authored: Sat Mar 4 18:38:19 2017 +0200 Committer: pascalschumacher Committed: Sun Mar 5 13:05:47 2017 +0100 -- checkstyle.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/e5ed4ffe/checkstyle.xml -- diff --git a/checkstyle.xml b/checkstyle.xml index 79943fb..9b6625e 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -42,5 +42,6 @@ limitations under the License. +
[1/2] [lang] Use uppercase L for long literals
Repository: commons-lang Updated Branches: refs/heads/master 42cf67402 -> 6597c1965 Use uppercase L for long literals Long literals can be specified by a lower case l (e.g., 1l) or by an uppercase one (e.g., 1L). This patch converts all existing long literals to use the uppercase L, as in some terminals, the lowercase l and the 1 characters are graphically similar, leading to possible confusions. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/4670a941 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/4670a941 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/4670a941 Branch: refs/heads/master Commit: 4670a941be92a55fbaaa3b4055d444e07ffcadb0 Parents: 42cf674 Author: Allon Mureinik Authored: Sat Mar 4 05:59:58 2017 +0200 Committer: pascalschumacher Committed: Sat Mar 4 10:06:53 2017 +0100 -- .../org/apache/commons/lang3/ObjectUtilsTest.java | 2 +- .../apache/commons/lang3/math/NumberUtilsTest.java | 16 2 files changed, 9 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4670a941/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java index b57ae2d..a5f7e1a 100644 --- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java @@ -533,7 +533,7 @@ public class ObjectUtilsTest { assertEquals("CONST(char)", (char) 3, ObjectUtils.CONST((char) 3)); assertEquals("CONST(short)", (short) 3, ObjectUtils.CONST((short) 3)); assertEquals("CONST(int)", 3, ObjectUtils.CONST(3)); -assertEquals("CONST(long)", 3l, ObjectUtils.CONST(3l)); +assertEquals("CONST(long)", 3L, ObjectUtils.CONST(3L)); assertEquals("CONST(float)", 3f, ObjectUtils.CONST(3f), 0); assertEquals("CONST(double)", 3.0, ObjectUtils.CONST(3.0), 0); assertEquals("CONST(Object)", "abc", ObjectUtils.CONST("abc")); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4670a941/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java index 97f9012..e504239 100644 --- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java @@ -73,14 +73,14 @@ public class NumberUtilsTest { */ @Test public void testToLongString() { -assertTrue("toLong(String) 1 failed", NumberUtils.toLong("12345") == 12345l); -assertTrue("toLong(String) 2 failed", NumberUtils.toLong("abc") == 0l); -assertTrue("toLong(String) 3 failed", NumberUtils.toLong("1L") == 0l); -assertTrue("toLong(String) 4 failed", NumberUtils.toLong("1l") == 0l); +assertTrue("toLong(String) 1 failed", NumberUtils.toLong("12345") == 12345L); +assertTrue("toLong(String) 2 failed", NumberUtils.toLong("abc") == 0L); +assertTrue("toLong(String) 3 failed", NumberUtils.toLong("1L") == 0L); +assertTrue("toLong(String) 4 failed", NumberUtils.toLong("1l") == 0L); assertTrue("toLong(Long.MAX_VALUE) failed", NumberUtils.toLong(Long.MAX_VALUE+"") == Long.MAX_VALUE); assertTrue("toLong(Long.MIN_VALUE) failed", NumberUtils.toLong(Long.MIN_VALUE+"") == Long.MIN_VALUE); -assertTrue("toLong(empty) failed", NumberUtils.toLong("") == 0l); -assertTrue("toLong(null) failed", NumberUtils.toLong(null) == 0l); +assertTrue("toLong(empty) failed", NumberUtils.toLong("") == 0L); +assertTrue("toLong(null) failed", NumberUtils.toLong(null) == 0L); } /** @@ -88,8 +88,8 @@ public class NumberUtilsTest { */ @Test public void testToLongStringL() { -assertTrue("toLong(String,long) 1 failed", NumberUtils.toLong("12345", 5l) == 12345l); -assertTrue("toLong(String,long) 2 failed", NumberUtils.toLong("1234.5", 5l) == 5l); +assertTrue("toLong(String,long) 1 failed", NumberUtils.toLong("12345", 5L) == 12345L); +assertTrue("toLong(String,long) 2 failed", NumberUtils.toLong("1234.5", 5L) == 5L); } /**
[2/2] [lang] Use long literals (closes #248)
Use long literals (closes #248) This patch replaces int literals that were cast to longs (e.g., "(long) 1)" with long literals (e.g., "1L"), making the code cleaner and easier to maintain. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6597c196 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6597c196 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6597c196 Branch: refs/heads/master Commit: 6597c196521af500feef7a02610727eafa7ec1dc Parents: 4670a94 Author: Allon Mureinik Authored: Sat Mar 4 05:55:03 2017 +0200 Committer: pascalschumacher Committed: Sat Mar 4 10:07:11 2017 +0100 -- .../lang3/ArrayUtilsRemoveMultipleTest.java | 26 ++--- .../commons/lang3/ArrayUtilsRemoveTest.java | 10 ++--- .../org/apache/commons/lang3/RangeTest.java | 2 +- .../commons/lang3/mutable/MutableLongTest.java | 40 ++-- 4 files changed, 39 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6597c196/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java index b6f22d5..3414027 100644 --- a/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java +++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java @@ -1158,53 +1158,53 @@ public class ArrayUtilsRemoveMultipleTest { public void testRemoveElementLongArray() { long[] array; -array = ArrayUtils.removeElements((long[]) null, (long) 1); +array = ArrayUtils.removeElements((long[]) null, 1L); assertNull(array); -array = ArrayUtils.removeElements(ArrayUtils.EMPTY_LONG_ARRAY, (long) 1); +array = ArrayUtils.removeElements(ArrayUtils.EMPTY_LONG_ARRAY, 1L); assertTrue(Arrays.equals(ArrayUtils.EMPTY_LONG_ARRAY, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements(new long[] { 1 }, (long) 1); +array = ArrayUtils.removeElements(new long[] { 1 }, 1L); assertTrue(Arrays.equals(ArrayUtils.EMPTY_LONG_ARRAY, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements(new long[] { 1, 2 }, (long) 1); +array = ArrayUtils.removeElements(new long[] { 1, 2 }, 1L); assertTrue(Arrays.equals(new long[] { 2 }, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements(new long[] { 1, 2, 1 }, (long) 1); +array = ArrayUtils.removeElements(new long[] { 1, 2, 1 }, 1L); assertTrue(Arrays.equals(new long[] { 2, 1 }, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements((long[]) null, (long) 1, (long) 1); +array = ArrayUtils.removeElements((long[]) null, 1L, 1L); assertNull(array); -array = ArrayUtils.removeElements(ArrayUtils.EMPTY_LONG_ARRAY, (long) 1, (long) 1); +array = ArrayUtils.removeElements(ArrayUtils.EMPTY_LONG_ARRAY, 1L, 1L); assertTrue(Arrays.equals(ArrayUtils.EMPTY_LONG_ARRAY, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements(new long[] { 1 }, (long) 1, (long) 1); +array = ArrayUtils.removeElements(new long[] { 1 }, 1L, 1L); assertTrue(Arrays.equals(ArrayUtils.EMPTY_LONG_ARRAY, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements(new long[] { 1, 2 }, (long) 1, (long) 2); +array = ArrayUtils.removeElements(new long[] { 1, 2 }, 1L, 2L); assertTrue(Arrays.equals(ArrayUtils.EMPTY_LONG_ARRAY, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements(new long[] { 1, 2 }, (long) 1, (long) 1); +array = ArrayUtils.removeElements(new long[] { 1, 2 }, 1L, 1L); assertTrue(Arrays.equals(new long[] { 2 }, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements(new long[] { 1, 2, 1 }, (long) 1, (long) 1); +array = ArrayUtils.removeElements(new long[] { 1, 2, 1 }, 1L, 1L); assertTrue(Arrays.equals(new long[] { 2 }, array)); assertEquals(Long.TYPE, array.getClass().getComponentType()); -array = ArrayUtils.removeElements(new long[] { 1, 2, 1 }, (long) 1, (long
[lang] add changes.xml entry for LANG-1265
Repository: commons-lang Updated Branches: refs/heads/master 72476ff46 -> 42cf67402 add changes.xml entry for LANG-1265 Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/42cf6740 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/42cf6740 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/42cf6740 Branch: refs/heads/master Commit: 42cf6740264f1cff5180b3d79199bcae692f1066 Parents: 72476ff Author: pascalschumacher Authored: Tue Feb 28 23:41:58 2017 +0100 Committer: pascalschumacher Committed: Tue Feb 28 23:41:58 2017 +0100 -- src/changes/changes.xml | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/42cf6740/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 13e83b4..4419d95 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -77,6 +77,7 @@ The type attribute can be add,update,fix,remove. Moving apache-rat-plugin configuration into pluginManagement TypeUtils.toString() doesn't handle primitive and Object arrays correctly LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code +Build failures when building with Java 9 EA
[lang] LANG-1265: Build failures when building with Java 9 EA (closes #244)
Repository: commons-lang Updated Branches: refs/heads/master c79e6fb8f -> 72476ff46 LANG-1265: Build failures when building with Java 9 EA (closes #244) Fix build on Java 9 Build 157 by adding a java-9 maven profile. This is activated by default on Java 9 and opens up java.base classes for reflection, which makes all unit tests pass. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/72476ff4 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/72476ff4 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/72476ff4 Branch: refs/heads/master Commit: 72476ff4620559b33a23aabba9eaec3b4330208e Parents: c79e6fb Author: pascalschumacher Authored: Fri Feb 24 18:51:03 2017 +0100 Committer: pascalschumacher Committed: Tue Feb 28 23:37:26 2017 +0100 -- pom.xml | 11 +++ 1 file changed, 11 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/72476ff4/pom.xml -- diff --git a/pom.xml b/pom.xml index 0d06563..d467ecd 100644 --- a/pom.xml +++ b/pom.xml @@ -810,6 +810,17 @@ + + + java9 + +9 + + + +-Xmx512m --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED + +
[lang] JUnit imports (closes #247)
Repository: commons-lang Updated Branches: refs/heads/master 98fa164cd -> c79e6fb8f JUnit imports (closes #247) The junit.framework package has been deprecated, and should no longer be used. This patch fixes the one remaining import from it to statically import org.junit.Assert.assertNull instead. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c79e6fb8 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c79e6fb8 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c79e6fb8 Branch: refs/heads/master Commit: c79e6fb8f95bb07d2394221b29b75fcc016f4900 Parents: 98fa164 Author: Allon Mureinik Authored: Tue Feb 28 23:17:51 2017 +0200 Committer: pascalschumacher Committed: Tue Feb 28 23:33:26 2017 +0100 -- src/test/java/org/apache/commons/lang3/RandomUtilsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c79e6fb8/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java index ed032e7..ddbaab1 100644 --- a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java @@ -16,10 +16,10 @@ */ package org.apache.commons.lang3; -import static junit.framework.TestCase.assertNotNull; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import org.junit.Test;
[lang] DateUtilsTest asserts (closes #246)
Repository: commons-lang Updated Branches: refs/heads/master 44516f77e -> 98fa164cd DateUtilsTest asserts (closes #246) Use JUnit's assertFalse for assertions with conditions instead of re-implementing the logic here by testing the condition and throwing an AssertionFailureException if the condition is met. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/98fa164c Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/98fa164c Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/98fa164c Branch: refs/heads/master Commit: 98fa164cd88d126d0f137f5bcb4a1d180e0c2fc4 Parents: 44516f7 Author: Allon Mureinik Authored: Mon Feb 27 21:35:03 2017 +0200 Committer: pascalschumacher Committed: Mon Feb 27 23:31:35 2017 +0100 -- .../org/apache/commons/lang3/time/DateUtilsTest.java | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/98fa164c/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java index c0e0a80..964c40b 100644 --- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java @@ -43,8 +43,6 @@ import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; -import junit.framework.AssertionFailedError; - /** * Unit tests {@link org.apache.commons.lang3.time.DateUtils}. */ @@ -1722,9 +1720,8 @@ public class DateUtilsTest { last.add(Calendar.DATE, 1); assertCalendarsEquals("", last, cal, 0); } -if (count % 7 != 0) { -throw new AssertionFailedError("There were " + count + " days in this iterator"); -} + +assertFalse("There were " + count + " days in this iterator", count % 7 != 0); assertCalendarsEquals("", end, cal, 0); } @@ -1733,10 +1730,8 @@ public class DateUtilsTest { * delta is in milliseconds */ private static void assertCalendarsEquals(final String message, final Calendar cal1, final Calendar cal2, final long delta) { -if (Math.abs(cal1.getTime().getTime() - cal2.getTime().getTime()) > delta) { -throw new AssertionFailedError( -message + " expected " + cal1.getTime() + " but got " + cal2.getTime()); -} +assertFalse(message + " expected " + cal1.getTime() + " but got " + cal2.getTime(), +Math.abs(cal1.getTime().getTime() - cal2.getTime().getTime()) > delta); } @Test
[lang] Use foreach loop for arrays (closes #245)
Repository: commons-lang Updated Branches: refs/heads/master 36b00f803 -> 44516f77e Use foreach loop for arrays (closes #245) Since the project no longer supports Java versions older than 6, it's safe to use the enhanced for loop syntax introduced in Java 5. This patch employs this syntax where possible to clean up the code. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/44516f77 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/44516f77 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/44516f77 Branch: refs/heads/master Commit: 44516f77ecd06aa818263ec31e150bab3edd956b Parents: 36b00f8 Author: Allon Mureinik Authored: Fri Feb 24 20:50:10 2017 +0200 Committer: pascalschumacher Committed: Fri Feb 24 22:52:13 2017 +0100 -- src/main/java/org/apache/commons/lang3/CharSet.java | 5 ++--- .../java/org/apache/commons/lang3/CharSetUtils.java | 7 +++ .../java/org/apache/commons/lang3/StringUtils.java| 14 ++ .../org/apache/commons/lang3/reflect/MethodUtils.java | 8 4 files changed, 15 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/44516f77/src/main/java/org/apache/commons/lang3/CharSet.java -- diff --git a/src/main/java/org/apache/commons/lang3/CharSet.java b/src/main/java/org/apache/commons/lang3/CharSet.java index cf3244c..150f850 100644 --- a/src/main/java/org/apache/commons/lang3/CharSet.java +++ b/src/main/java/org/apache/commons/lang3/CharSet.java @@ -175,9 +175,8 @@ public class CharSet implements Serializable { */ protected CharSet(final String... set) { super(); -final int sz = set.length; -for (int i = 0; i < sz; i++) { -add(set[i]); +for (String s : set) { +add(s); } } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/44516f77/src/main/java/org/apache/commons/lang3/CharSetUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/CharSetUtils.java b/src/main/java/org/apache/commons/lang3/CharSetUtils.java index 6284e38..84c1d09 100644 --- a/src/main/java/org/apache/commons/lang3/CharSetUtils.java +++ b/src/main/java/org/apache/commons/lang3/CharSetUtils.java @@ -234,10 +234,9 @@ public class CharSetUtils { final CharSet chars = CharSet.getInstance(set); final StringBuilder buffer = new StringBuilder(str.length()); final char[] chrs = str.toCharArray(); -final int sz = chrs.length; -for(int i=0; ihttp://git-wip-us.apache.org/repos/asf/commons-lang/blob/44516f77/src/main/java/org/apache/commons/lang3/StringUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 1a0325e..8049850 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -2467,8 +2467,7 @@ public class StringUtils { int ret = Integer.MAX_VALUE; int tmp = 0; -for (int i = 0; i < sz; i++) { -final CharSequence search = searchStrs[i]; +for (final CharSequence search : searchStrs) { if (search == null) { continue; } @@ -2518,8 +2517,7 @@ public class StringUtils { final int sz = searchStrs.length; int ret = INDEX_NOT_FOUND; int tmp = 0; -for (int i = 0; i < sz; i++) { -final CharSequence search = searchStrs[i]; +for (final CharSequence search : searchStrs) { if (search == null) { continue; } @@ -7751,14 +7749,14 @@ public class StringUtils { // find the min and max string lengths; this avoids checking to make // sure we are not exceeding the length of the string each time through // the bottom loop. -for (int i = 0; i < arrayLen; i++) { -if (css[i] == null) { +for (CharSequence cs : css) { +if (cs == null) { anyStringNull = true; shortestStrLen = 0; } else { allStringsNull = false; -shortestStrLen = Math.min(css[i].length(), shortestStrLen); -longestStrLen = Math.max(css[i].length(), longestStrLen); +shortestStrLen = Math.min(cs.length(), shortestStrLen); +longestStrLen = Math.max(cs.length(), longestStrLen); } } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/44516f
[lang] Fix JsonToStringStyleTest.NestingPerson javadoc (closes #243)
Repository: commons-lang Updated Branches: refs/heads/master 914844e1b -> 36b00f803 Fix JsonToStringStyleTest.NestingPerson javadoc (closes #243) A {@link} javadoc can only reference a resolvable class name. The {@link} tag in NestingPerson's javadoc is thus broken, as it directly references JsonToStringStyle without qualifying it with the enclosing ToStringStyle class. This patch adds the enclosing class to the javadoc, thus "unbreaking" the reference. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/36b00f80 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/36b00f80 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/36b00f80 Branch: refs/heads/master Commit: 36b00f803a0b307c30f79378cd758323c242cc65 Parents: 914844e Author: Allon Mureinik Authored: Thu Feb 23 01:20:47 2017 +0200 Committer: pascalschumacher Committed: Fri Feb 24 17:20:50 2017 +0100 -- .../org/apache/commons/lang3/builder/JsonToStringStyleTest.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/36b00f80/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java index 580a254..c60dc05 100644 --- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java @@ -359,7 +359,7 @@ public class JsonToStringStyleTest { } /** - * An object with nested object structures used to test {@link JsonToStringStyle}. + * An object with nested object structures used to test {@link ToStringStyle.JsonToStringStyle}. * */ static class NestingPerson {
[lang] EnumUtilsTest: fix spaces between enum constants (closes #241)
Repository: commons-lang Updated Branches: refs/heads/master 8767cd4f1 -> 914844e1b EnumUtilsTest: fix spaces between enum constants (closes #241) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/914844e1 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/914844e1 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/914844e1 Branch: refs/heads/master Commit: 914844e1b226a1ac7ba45626ecfdfb56e7b2e263 Parents: 8767cd4 Author: Andrii Authored: Tue Feb 21 23:08:38 2017 +0200 Committer: pascalschumacher Committed: Wed Feb 22 23:22:31 2017 +0100 -- src/test/java/org/apache/commons/lang3/EnumUtilsTest.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/914844e1/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java index d496cbb..5845ef6 100644 --- a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java @@ -420,8 +420,9 @@ enum Enum64 { A32, A33, A34, A35, A36, A37, A38, A39, A40, A41, A42, A43, A44, A45, A46, A47, A48, A49, A50, A51, A52, A53, A54, A55, A56, A57, A58, A59, A60, A61, A62, A63 } + enum TooMany { -A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z, - A1,B1,C1,D1,E1,F1,G1,H1,I1,J1,K1,L1,M1,N1,O1,P1,Q1,R1,S1,T1,U1,V1,W1,X1,Y1,Z1, -A2,B2,C2,D2,E2,F2,G2,H2,I2,J2,K2,L2,M2 +A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, +A1, B1, C1, D1, E1, F1, G1, H1, I1, J1, K1, L1, M1, N1, O1, P1, Q1, R1, S1, T1, +U1, V1, W1, X1, Y1, Z1, A2, B2, C2, D2, E2, F2, G2, H2, I2, J2, K2, L2, M2 }
[lang] Fix FastDateParser#getStrategy(char, int, Calendar) javadoc (closes #242)
Repository: commons-lang Updated Branches: refs/heads/master 4bd982d1a -> 8767cd4f1 Fix FastDateParser#getStrategy(char, int, Calendar) javadoc (closes #242) The javadoc refers to a formatField parameter, which the method doesn't have. Reading the description and the method's code, this documentation clearly refers to the f parameter. This patch fixes the javadoc and aligns it with the method's parameters. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/8767cd4f Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/8767cd4f Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/8767cd4f Branch: refs/heads/master Commit: 8767cd4f1a6af07093c1e6c422dae8e574be7e5e Parents: 4bd982d Author: Allon Mureinik Authored: Wed Feb 22 10:35:57 2017 +0200 Committer: pascalschumacher Committed: Wed Feb 22 23:16:03 2017 +0100 -- src/main/java/org/apache/commons/lang3/time/FastDateParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8767cd4f/src/main/java/org/apache/commons/lang3/time/FastDateParser.java -- diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java index 7b394c6..e27acf4 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java @@ -548,7 +548,7 @@ public class FastDateParser implements DateParser, Serializable { /** * Obtain a Strategy given a field from a SimpleDateFormat pattern - * @param formatField A sub-sequence of the SimpleDateFormat pattern + * @param f A sub-sequence of the SimpleDateFormat pattern * @param definingCalendar The calendar to obtain the short and long values * @return The Strategy that will handle parsing for the field */
[lang] LANG-1312: LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code (closes #239)
Repository: commons-lang Updated Branches: refs/heads/master a6443e146 -> 4bd982d1a LANG-1312: LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code (closes #239) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/4bd982d1 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/4bd982d1 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/4bd982d1 Branch: refs/heads/master Commit: 4bd982d1a1df87724682c17c39bf27b5cbe389be Parents: a6443e1 Author: pascalschumacher Authored: Sun Feb 19 20:39:05 2017 +0100 Committer: pascalschumacher Committed: Tue Feb 21 21:13:45 2017 +0100 -- src/changes/changes.xml | 1 + src/main/java/org/apache/commons/lang3/LocaleUtils.java | 4 +++- src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java | 7 +++ 3 files changed, 11 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4bd982d1/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b023f95..13e83b4 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -76,6 +76,7 @@ The type attribute can be add,update,fix,remove. Add SystemUtils.getHostName() API. Moving apache-rat-plugin configuration into pluginManagement TypeUtils.toString() doesn't handle primitive and Object arrays correctly +LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4bd982d1/src/main/java/org/apache/commons/lang3/LocaleUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java index a3126eb..f13b52f 100644 --- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java +++ b/src/main/java/org/apache/commons/lang3/LocaleUtils.java @@ -67,6 +67,7 @@ public class LocaleUtils { * LocaleUtils.toLocale("") = new Locale("", "") * LocaleUtils.toLocale("en") = new Locale("en", "") * LocaleUtils.toLocale("en_GB") = new Locale("en", "GB") + * LocaleUtils.toLocale("en_001") = new Locale("en", "001") * LocaleUtils.toLocale("en_GB_xxx") = new Locale("en", "GB", "xxx") (#) * * @@ -134,7 +135,8 @@ public class LocaleUtils { case 1: if (StringUtils.isAllLowerCase(split[0]) && (split[0].length() == 2 || split[0].length() == 3) && - split[1].length() == 2 && StringUtils.isAllUpperCase(split[1])) { + (split[1].length() == 2 && StringUtils.isAllUpperCase(split[1])) || + (split[1].length() == 3 && StringUtils.isNumeric(split[1]))) { return new Locale(split[0], split[1]); } throw new IllegalArgumentException("Invalid locale format: " + str); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/4bd982d1/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java index 4a867ba..79198af 100644 --- a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java @@ -505,6 +505,13 @@ public class LocaleUtilsTest { assertValidToLocale("fr__POSIX", "fr", "", "POSIX"); } +@Test +public void testLanguageAndUNM49Numeric3AreaCodeLang1312() { +assertValidToLocale("en_001", "en", "001"); +assertValidToLocale("en_150", "en", "150"); +assertValidToLocale("ar_001", "ar", "001"); +} + /** * Tests #LANG-865, strings starting with an underscore. */
[lang] Remove redundant semicolons from enums (closes #240)
Repository: commons-lang Updated Branches: refs/heads/master a64153a37 -> a6443e146 Remove redundant semicolons from enums (closes #240) While enums allow ending the member list in a semicolon(;), it's redundant. Some enums in the codebase use a semicolon in the end, and some do not. This patch standardizes the codebase's enum and cleans up the code by removing these semicolons. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/a6443e14 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/a6443e14 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/a6443e14 Branch: refs/heads/master Commit: a6443e146f825291308319c6a0f2eb82aa34f8c3 Parents: a64153a Author: Allon Mureinik Authored: Tue Feb 21 11:18:54 2017 +0200 Committer: pascalschumacher Committed: Tue Feb 21 19:58:49 2017 +0100 -- src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java | 2 +- src/test/java/org/apache/commons/lang3/EnumUtilsTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a6443e14/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java b/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java index cd0eda2..ee4a361 100644 --- a/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java @@ -378,7 +378,7 @@ public class AnnotationUtilsTest { } public static enum Stooge { -MOE, LARRY, CURLY, JOE, SHEMP; +MOE, LARRY, CURLY, JOE, SHEMP } private Field field1; http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a6443e14/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java index 757cb16..d496cbb 100644 --- a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java @@ -418,10 +418,10 @@ enum Enum64 { A00, A01, A02, A03, A04, A05, A06, A07, A08, A09, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29, A30, A31, A32, A33, A34, A35, A36, A37, A38, A39, A40, A41, A42, A43, A44, A45, A46, A47, -A48, A49, A50, A51, A52, A53, A54, A55, A56, A57, A58, A59, A60, A61, A62, A63; +A48, A49, A50, A51, A52, A53, A54, A55, A56, A57, A58, A59, A60, A61, A62, A63 } enum TooMany { A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z, A1,B1,C1,D1,E1,F1,G1,H1,I1,J1,K1,L1,M1,N1,O1,P1,Q1,R1,S1,T1,U1,V1,W1,X1,Y1,Z1, -A2,B2,C2,D2,E2,F2,G2,H2,I2,J2,K2,L2,M2; +A2,B2,C2,D2,E2,F2,G2,H2,I2,J2,K2,L2,M2 }
[lang] Validate's String.format without arguments (closes #238)
Repository: commons-lang Updated Branches: refs/heads/master 954ade4c1 -> a64153a37 Validate's String.format without arguments (closes #238) While calling String.format("some string") without any additional arguments is not technically wrong, it's redundant, as it just returns the same string. Removing these calls and just using the string instead both cleans up the code and offers a (very slight) performance gain. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/a64153a3 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/a64153a3 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/a64153a3 Branch: refs/heads/master Commit: a64153a3710c5035988690f0acf57dd61b711cf4 Parents: 954ade4 Author: Allon Mureinik Authored: Sat Feb 18 11:56:09 2017 +0200 Committer: pascalschumacher Committed: Mon Feb 20 23:18:50 2017 +0100 -- src/main/java/org/apache/commons/lang3/Validate.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a64153a3/src/main/java/org/apache/commons/lang3/Validate.java -- diff --git a/src/main/java/org/apache/commons/lang3/Validate.java b/src/main/java/org/apache/commons/lang3/Validate.java index 508845a..fc52cb4 100644 --- a/src/main/java/org/apache/commons/lang3/Validate.java +++ b/src/main/java/org/apache/commons/lang3/Validate.java @@ -1052,7 +1052,7 @@ public class Validate { public static void inclusiveBetween(final long start, final long end, final long value, final String message) { // TODO when breaking BC, consider returning value if (value < start || value > end) { -throw new IllegalArgumentException(String.format(message)); +throw new IllegalArgumentException(message); } } @@ -1096,7 +1096,7 @@ public class Validate { public static void inclusiveBetween(final double start, final double end, final double value, final String message) { // TODO when breaking BC, consider returning value if (value < start || value > end) { -throw new IllegalArgumentException(String.format(message)); +throw new IllegalArgumentException(message); } } @@ -1190,7 +1190,7 @@ public class Validate { public static void exclusiveBetween(final long start, final long end, final long value, final String message) { // TODO when breaking BC, consider returning value if (value <= start || value >= end) { -throw new IllegalArgumentException(String.format(message)); +throw new IllegalArgumentException(message); } } @@ -1234,7 +1234,7 @@ public class Validate { public static void exclusiveBetween(final double start, final double end, final double value, final String message) { // TODO when breaking BC, consider returning value if (value <= start || value >= end) { -throw new IllegalArgumentException(String.format(message)); +throw new IllegalArgumentException(message); } }
[lang] LANG-1311: TypeUtils.toString() doesn't handle primitive and Object arrays correctly
Repository: commons-lang Updated Branches: refs/heads/master 30c85ad05 -> 1661e5519 LANG-1311: TypeUtils.toString() doesn't handle primitive and Object arrays correctly apply patch by Aaron Digulla Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/1661e551 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/1661e551 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/1661e551 Branch: refs/heads/master Commit: 1661e5519c4836a5a940b13b7797263443156fc9 Parents: 30c85ad Author: pascalschumacher Authored: Fri Feb 17 18:32:32 2017 +0100 Committer: pascalschumacher Committed: Fri Feb 17 18:32:32 2017 +0100 -- src/changes/changes.xml | 3 ++- .../java/org/apache/commons/lang3/reflect/TypeUtils.java | 4 .../org/apache/commons/lang3/reflect/TypeUtilsTest.java | 10 ++ 3 files changed, 16 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1661e551/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 330a0b7..b023f95 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -45,7 +45,7 @@ The type attribute can be add,update,fix,remove. - + Add method for converting string to an array of code points RandomStringUtils random method can overflow and return characters outside of specified range Add methods to insert arrays into arrays at an index @@ -75,6 +75,7 @@ The type attribute can be add,update,fix,remove. StringUtils should use toXxxxCase(int) rather than toXxxxCase(char) Add SystemUtils.getHostName() API. Moving apache-rat-plugin configuration into pluginManagement +TypeUtils.toString() doesn't handle primitive and Object arrays correctly http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1661e551/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java index da448c9..8db6ca4 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java @@ -1742,6 +1742,10 @@ public class TypeUtils { * @since 3.2 */ private static String classToString(final Class c) { +if (c.isArray()) { +return toString(c.getComponentType()) + "[]"; +} + final StringBuilder buf = new StringBuilder(); if (c.getEnclosingClass() != null) { http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1661e551/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java index b01bd0f..afc5b74 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java @@ -101,6 +101,8 @@ public class TypeUtilsTest { public static URI uri; +public static List[] stringListArray; + public void dummyMethod(final List list0, final List list1, final List list2, final List list3, final List list4, final List list5, final List list6, final List[] list7, final List[] list8, final List[] list9, @@ -744,6 +746,14 @@ public class TypeUtilsTest { } @Test +public void testToStringLang1311() { +Assert.assertEquals("int[]", TypeUtils.toString(int[].class)); +Assert.assertEquals("java.lang.Integer[]", TypeUtils.toString(Integer[].class)); +Field stringListField = FieldUtils.getDeclaredField(getClass(), "stringListArray"); +Assert.assertEquals("java.util.List[]", TypeUtils.toString(stringListField.getGenericType())); +} + +@Test public void testToLongString() { Assert.assertEquals(getClass().getName() + ":B", TypeUtils.toLongString(getClass().getTypeParameters()[0])); }
commons-io git commit: Fix Javadoc typos (closes #30)
Repository: commons-io Updated Branches: refs/heads/master 546316432 -> 8b9fe1b01 Fix Javadoc typos (closes #30) Project: http://git-wip-us.apache.org/repos/asf/commons-io/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-io/commit/8b9fe1b0 Tree: http://git-wip-us.apache.org/repos/asf/commons-io/tree/8b9fe1b0 Diff: http://git-wip-us.apache.org/repos/asf/commons-io/diff/8b9fe1b0 Branch: refs/heads/master Commit: 8b9fe1b01ce21003f6a6ff8391ad2a64f4d21030 Parents: 5463164 Author: Sebastian Kürten Authored: Wed Feb 15 17:19:34 2017 +0100 Committer: pascalschumacher Committed: Wed Feb 15 19:37:53 2017 +0100 -- .../java/org/apache/commons/io/DirectoryWalker.java | 4 ++-- src/main/java/org/apache/commons/io/FileCleaner.java| 6 +++--- .../java/org/apache/commons/io/FileCleaningTracker.java | 6 +++--- .../java/org/apache/commons/io/FileDeleteStrategy.java | 2 +- src/main/java/org/apache/commons/io/FileUtils.java | 4 ++-- src/main/java/org/apache/commons/io/FilenameUtils.java | 8 src/main/java/org/apache/commons/io/IOCase.java | 2 +- src/main/java/org/apache/commons/io/ThreadMonitor.java | 2 +- .../apache/commons/io/comparator/ReverseComparator.java | 2 +- .../commons/io/comparator/SizeFileComparator.java | 2 +- .../commons/io/filefilter/AbstractFileFilter.java | 4 ++-- .../org/apache/commons/io/filefilter/AgeFileFilter.java | 8 .../org/apache/commons/io/filefilter/AndFileFilter.java | 4 ++-- .../apache/commons/io/filefilter/CanReadFileFilter.java | 2 +- .../commons/io/filefilter/CanWriteFileFilter.java | 2 +- .../commons/io/filefilter/DelegateFileFilter.java | 4 ++-- .../commons/io/filefilter/DirectoryFileFilter.java | 2 +- .../apache/commons/io/filefilter/EmptyFileFilter.java | 2 +- .../apache/commons/io/filefilter/FalseFileFilter.java | 2 +- .../apache/commons/io/filefilter/FileFileFilter.java| 2 +- .../apache/commons/io/filefilter/FileFilterUtils.java | 4 ++-- .../apache/commons/io/filefilter/HiddenFileFilter.java | 2 +- .../apache/commons/io/filefilter/NameFileFilter.java| 4 ++-- .../org/apache/commons/io/filefilter/NotFileFilter.java | 4 ++-- .../org/apache/commons/io/filefilter/OrFileFilter.java | 4 ++-- .../apache/commons/io/filefilter/PrefixFileFilter.java | 4 ++-- .../apache/commons/io/filefilter/SizeFileFilter.java| 4 ++-- .../apache/commons/io/filefilter/SuffixFileFilter.java | 8 .../apache/commons/io/filefilter/WildcardFilter.java| 4 ++-- .../org/apache/commons/io/input/BOMInputStream.java | 2 +- .../org/apache/commons/io/input/BoundedInputStream.java | 2 +- .../java/org/apache/commons/io/input/BoundedReader.java | 12 .../org/apache/commons/io/input/CharSequenceReader.java | 2 +- .../apache/commons/io/input/ObservableInputStream.java | 2 +- src/main/java/org/apache/commons/io/input/Tailer.java | 2 +- .../org/apache/commons/io/input/XmlStreamReader.java| 2 +- .../commons/io/monitor/FileAlterationMonitor.java | 4 ++-- .../commons/io/monitor/FileAlterationObserver.java | 6 +++--- .../apache/commons/io/output/ByteArrayOutputStream.java | 8 .../commons/io/output/DeferredFileOutputStream.java | 2 +- .../commons/io/output/ThresholdingOutputStream.java | 4 ++-- .../org/apache/commons/io/output/XmlStreamWriter.java | 2 +- .../org/apache/commons/io/ByteOrderMarkTestCase.java| 2 +- .../apache/commons/io/FileUtilsFileNewerTestCase.java | 10 +- .../commons/io/input/compatibility/XmlStreamReader.java | 2 +- .../commons/io/monitor/AbstractMonitorTestCase.java | 2 +- .../commons/io/output/DeferredFileOutputStreamTest.java | 4 ++-- .../java/org/apache/commons/io/testtools/TestUtils.java | 2 +- 48 files changed, 92 insertions(+), 88 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-io/blob/8b9fe1b0/src/main/java/org/apache/commons/io/DirectoryWalker.java -- diff --git a/src/main/java/org/apache/commons/io/DirectoryWalker.java b/src/main/java/org/apache/commons/io/DirectoryWalker.java index 1a8725b..439dc48 100644 --- a/src/main/java/org/apache/commons/io/DirectoryWalker.java +++ b/src/main/java/org/apache/commons/io/DirectoryWalker.java @@ -30,7 +30,7 @@ import org.apache.commons.io.filefilter.TrueFileFilter; * subclasses with convenient hooks to add specific behaviour. * * This class operates with a {@link FileFilter} and maximum depth to - * limit the files and direcories visited. + * limit the files and directories visited. * Commons IO supplies many common filter implementations in the * filefilter package. * @@ -172,7 +172,7 @@ import org.apache.commons.io.filefilter.TrueFileFilter; * *
[lang] Remove redundant casts (closes #235)
Repository: commons-lang Updated Branches: refs/heads/master 5bdf0a938 -> ce1bd5785 Remove redundant casts (closes #235) Remove redundant casts throughout the codebase to make it cleaner and easier to read. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/ce1bd578 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/ce1bd578 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/ce1bd578 Branch: refs/heads/master Commit: ce1bd5785d05d3df324e1169aab4abd45f4281f7 Parents: 5bdf0a9 Author: Allon Mureinik Authored: Sun Feb 12 20:35:48 2017 +0200 Committer: pascalschumacher Committed: Tue Feb 14 23:10:56 2017 +0100 -- .../commons/lang3/exception/ExceptionUtils.java | 2 +- .../apache/commons/lang3/reflect/TypeUtils.java | 2 +- .../commons/lang3/text/StrSubstitutor.java | 2 +- .../apache/commons/lang3/ArrayUtilsAddTest.java | 8 +-- .../commons/lang3/ArrayUtilsInsertTest.java | 2 +- .../commons/lang3/ArrayUtilsRemoveTest.java | 6 +- .../apache/commons/lang3/ArrayUtilsTest.java| 62 ++-- .../apache/commons/lang3/BooleanUtilsTest.java | 48 +++ .../apache/commons/lang3/ClassUtilsTest.java| 8 +-- .../org/apache/commons/lang3/EnumUtilsTest.java | 2 +- .../apache/commons/lang3/LocaleUtilsTest.java | 2 +- .../apache/commons/lang3/ObjectUtilsTest.java | 10 ++-- .../org/apache/commons/lang3/RangeTest.java | 2 +- .../lang3/StringUtilsStartsEndsWithTest.java| 16 ++--- .../lang3/builder/CompareToBuilderTest.java | 26 .../commons/lang3/builder/DiffBuilderTest.java | 18 +++--- .../lang3/builder/EqualsBuilderTest.java| 8 +-- .../lang3/builder/HashCodeBuilderTest.java | 12 ++-- .../lang3/builder/ToStringBuilderTest.java | 12 ++-- .../exception/AbstractExceptionContextTest.java | 2 +- .../lang3/exception/ExceptionUtilsTest.java | 10 ++-- .../commons/lang3/mutable/MutableIntTest.java | 40 ++--- .../commons/lang3/reflect/MethodUtilsTest.java | 8 +-- .../lang3/text/StrBuilderAppendInsertTest.java | 4 +- .../commons/lang3/text/StrBuilderTest.java | 10 ++-- .../commons/lang3/text/StrMatcherTest.java | 2 +- .../commons/lang3/text/StrSubstitutorTest.java | 12 ++-- .../commons/lang3/time/DateUtilsTest.java | 30 +- 28 files changed, 183 insertions(+), 183 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ce1bd578/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java index b9cfc49..7b5b4d4 100644 --- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java +++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java @@ -183,7 +183,7 @@ public class ExceptionUtils { */ public static Throwable getRootCause(final Throwable throwable) { final List list = getThrowableList(throwable); -return list.size() < 2 ? null : (Throwable)list.get(list.size() - 1); +return list.size() < 2 ? null : list.get(list.size() - 1); } /** http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ce1bd578/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java index 685e4cb..da448c9 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java @@ -1687,7 +1687,7 @@ public class TypeUtils { public static String toLongString(final TypeVariable var) { Validate.notNull(var, "var is null"); final StringBuilder buf = new StringBuilder(); -final GenericDeclaration d = ((TypeVariable) var).getGenericDeclaration(); +final GenericDeclaration d = var.getGenericDeclaration(); if (d instanceof Class) { Class c = (Class) d; while (true) { http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ce1bd578/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java -- diff --git a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java b/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java index 0af4d14..1a56620 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java +++ b/src/main/java/org/apache/commons/lang3/text/StrSubstit
[lang] ObjectUtilsTest#testIdentityToStringAppendable: fail test if IOException is thrown
Repository: commons-lang Updated Branches: refs/heads/master aaeb4c621 -> 5bdf0a938 ObjectUtilsTest#testIdentityToStringAppendable: fail test if IOException is thrown Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/5bdf0a93 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/5bdf0a93 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/5bdf0a93 Branch: refs/heads/master Commit: 5bdf0a938adb384bfdb6cc494a2781e2ac33b0ea Parents: aaeb4c6 Author: pascalschumacher Authored: Tue Feb 14 22:59:12 2017 +0100 Committer: pascalschumacher Committed: Tue Feb 14 22:59:12 2017 +0100 -- src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5bdf0a93/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java index 5d3f0a2..803e4d8 100644 --- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java @@ -257,13 +257,17 @@ public class ObjectUtilsTest { try { ObjectUtils.identityToString((Appendable)null, "tmp"); fail("NullPointerException expected"); -} catch(final NullPointerException | IOException npe) { +} catch(final NullPointerException expectedException) { +} catch(final IOException ex) { + fail("IOException unexpected"); } try { ObjectUtils.identityToString((Appendable)(new StringBuilder()), null); fail("NullPointerException expected"); -} catch(final NullPointerException | IOException npe) { +} catch(final NullPointerException expectedException) { +} catch(final IOException ex) { + fail("IOException unexpected"); } }
[lang] ObjectUtilsTest: remove commented-out code
Repository: commons-lang Updated Branches: refs/heads/master b715d18f0 -> aaeb4c621 ObjectUtilsTest: remove commented-out code Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/aaeb4c62 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/aaeb4c62 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/aaeb4c62 Branch: refs/heads/master Commit: aaeb4c621a88facc673949003713d259ac67f0dd Parents: b715d18 Author: pascalschumacher Authored: Tue Feb 14 22:51:45 2017 +0100 Committer: pascalschumacher Committed: Tue Feb 14 22:51:45 2017 +0100 -- .../apache/commons/lang3/ObjectUtilsTest.java | 44 1 file changed, 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/aaeb4c62/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java index 1f3ae54..5d3f0a2 100644 --- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java @@ -82,9 +82,6 @@ public class ObjectUtilsTest { // Cast to Object in line below ensures compiler doesn't complain of unchecked generic array creation assertNull(ObjectUtils.firstNonNull((Object) null, (Object) null)); -//assertSame("123", ObjectUtils.firstNonNull(null, ObjectUtils.NULL, "123", "456")); -//assertSame("456", ObjectUtils.firstNonNull(ObjectUtils.NULL, "456", "123", null)); -//assertNull(ObjectUtils.firstNonNull(null, null, ObjectUtils.NULL)); assertNull(ObjectUtils.firstNonNull((Object) null)); assertNull(ObjectUtils.firstNonNull((Object[]) null)); } @@ -173,47 +170,6 @@ public class ObjectUtilsTest { assertEquals(list3.hashCode(), ObjectUtils.hashCodeMulti("a", "b", "c")); } -///** -// * Show that java.util.Date and java.sql.Timestamp are apples and oranges. -// * Prompted by an email discussion. -// * -// * The behavior is different b/w Sun Java 1.3.1_10 and 1.4.2_03. -// */ -//public void testDateEqualsJava() { -//long now = 1076957313284L; // Feb 16, 2004 10:49... PST -//java.util.Date date = new java.util.Date(now); -//java.sql.Timestamp realTimestamp = new java.sql.Timestamp(now); -//java.util.Date timestamp = realTimestamp; -//// sanity check 1: -//assertEquals(28400, realTimestamp.getNanos()); -//assertEquals(1076957313284L, date.getTime()); -//// -//// On Sun 1.3.1_10: -////junit.framework.AssertionFailedError: expected:<1076957313284> but was:<1076957313000> -//// -////assertEquals(1076957313284L, timestamp.getTime()); -//// -////junit.framework.AssertionFailedError: expected:<1076957313284> but was:<1076957313000> -//// -////assertEquals(1076957313284L, realTimestamp.getTime()); -//// sanity check 2: -//assertEquals(date.getDay(), realTimestamp.getDay()); -//assertEquals(date.getHours(), realTimestamp.getHours()); -//assertEquals(date.getMinutes(), realTimestamp.getMinutes()); -//assertEquals(date.getMonth(), realTimestamp.getMonth()); -//assertEquals(date.getSeconds(), realTimestamp.getSeconds()); -//assertEquals(date.getTimezoneOffset(), realTimestamp.getTimezoneOffset()); -//assertEquals(date.getYear(), realTimestamp.getYear()); -//// -//// Time values are == and equals() on Sun 1.4.2_03 but NOT on Sun 1.3.1_10: -//// -////assertFalse("Sanity check failed: date.getTime() == timestamp.getTime()", date.getTime() == timestamp.getTime()); -////assertFalse("Sanity check failed: timestamp.equals(date)", timestamp.equals(date)); -////assertFalse("Sanity check failed: date.equals(timestamp)", date.equals(timestamp)); -//// real test: -////assertFalse("java.util.Date and java.sql.Timestamp should be equal", ObjectUtils.equals(date, timestamp)); -//} - @Test public void testIdentityToStringStringBuffer() { final Integer i = Integer.valueOf(45);
[lang] Fix a few broken @literal tags (closes #233)
Repository: commons-lang Updated Branches: refs/heads/master ebcef2d16 -> 04a2a4b45 Fix a few broken @literal tags (closes #233) The Javadoc of SystemDefaultsSwitch contains some broken @literal tags. Instead of {@literal @} to insert a '@' into the HTML, {@literal@} without the space is used, which does not work. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/04a2a4b4 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/04a2a4b4 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/04a2a4b4 Branch: refs/heads/master Commit: 04a2a4b456c8448b9e63edbf5479d1fe745917ab Parents: ebcef2d Author: Sebastian Kürten Authored: Sat Feb 4 18:57:53 2017 +0100 Committer: pascalschumacher Committed: Sun Feb 5 12:46:43 2017 +0100 -- .../apache/commons/lang3/test/SystemDefaultsSwitch.java | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/04a2a4b4/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java -- diff --git a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java index 6a8429f..398341c 100644 --- a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java +++ b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java @@ -35,22 +35,22 @@ import org.junit.runners.model.Statement; * * public class SystemDefaultsDependentTest { * - * {@literal@}Rule + * {@literal @}Rule * public SystemDefaultsSwitch locale = new SystemDefaultsSwitch(); * - * {@literal@}Test + * {@literal @}Test * public void testThatWillExecuteWithTheDefaultLocaleAndTimeZone() { * // nothing to do, just implement the test * } * - * {@literal@}Test - * {@literal@}SystemDefaults(local="zh_CN") + * {@literal @}Test + * {@literal @}SystemDefaults(local="zh_CN") * public void testWithSimplifiedChinaDefaultLocale() { * // Locale.getDefault() will return Locale.CHINA until the end of this test method * } * - * {@literal@}Test - * {@literal@}SystemDefaults(timezone="America/New_York") + * {@literal @}Test + * {@literal @}SystemDefaults(timezone="America/New_York") * public void testWithNorthAmericaEasternTimeZone() { * // TimeZone.getDefault() will equal TimeZone.getTimeZone("America/New_York") until the end of this method * }
[lang] Fix a number of Javadoc typos (closes #232)
Repository: commons-lang Updated Branches: refs/heads/master ab25f6734 -> ebcef2d16 Fix a number of Javadoc typos (closes #232) Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/ebcef2d1 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/ebcef2d1 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/ebcef2d1 Branch: refs/heads/master Commit: ebcef2d16a81bfe1a818a362fd03cb5063640003 Parents: ab25f67 Author: Sebastian Kürten Authored: Fri Feb 3 19:03:04 2017 +0100 Committer: pascalschumacher Committed: Fri Feb 3 20:00:04 2017 +0100 -- .../org/apache/commons/lang3/ArrayUtils.java| 54 ++-- .../commons/lang3/SerializationUtils.java | 2 +- .../apache/commons/lang3/reflect/TypeUtils.java | 8 +-- .../apache/commons/lang3/text/StrBuilder.java | 2 +- .../commons/lang3/text/StrSubstitutor.java | 20 .../apache/commons/lang3/time/DateUtils.java| 2 +- 6 files changed, 44 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ebcef2d1/src/main/java/org/apache/commons/lang3/ArrayUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java index 624731e..b09e891 100644 --- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java +++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java @@ -2651,7 +2651,7 @@ public class ArrayUtils { *the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no *change. * @param endIndexExclusive - *elements up to endIndex-1 are shiftd in the array. Undervalue (< start index) results in no + *elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no *change. Overvalue (>array.length) is demoted to array length. * @param offset * The number of positions to rotate the elements. If the offset is larger than the number of elements to @@ -2711,7 +2711,7 @@ public class ArrayUtils { *the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no *change. * @param endIndexExclusive - *elements up to endIndex-1 are shiftd in the array. Undervalue (< start index) results in no + *elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no *change. Overvalue (>array.length) is demoted to array length. * @param offset * The number of positions to rotate the elements. If the offset is larger than the number of elements to @@ -2771,7 +2771,7 @@ public class ArrayUtils { *the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no *change. * @param endIndexExclusive - *elements up to endIndex-1 are shiftd in the array. Undervalue (< start index) results in no + *elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no *change. Overvalue (>array.length) is demoted to array length. * @param offset * The number of positions to rotate the elements. If the offset is larger than the number of elements to @@ -2831,7 +2831,7 @@ public class ArrayUtils { *the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no *change. * @param endIndexExclusive - *elements up to endIndex-1 are shiftd in the array. Undervalue (< start index) results in no + *elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no *change. Overvalue (>array.length) is demoted to array length. * @param offset * The number of positions to rotate the elements. If the offset is larger than the number of elements to @@ -2891,7 +2891,7 @@ public class ArrayUtils { *the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no *change. * @param endIndexExclusive - *elements up to endIndex-1 are shiftd in the array. Undervalue (< start index) results in no + *elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no *change. Overvalue (>array.length) is demoted to array length. * @par
[lang] Fix copy-paste error in CharUtilsTest#testIsAsciiPrintable_char (closes #230)
Repository: commons-lang Updated Branches: refs/heads/master 857e0de49 -> ab25f6734 Fix copy-paste error in CharUtilsTest#testIsAsciiPrintable_char (closes #230) Line 238 has copy paste error from testIsAscii_char Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/ab25f673 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/ab25f673 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/ab25f673 Branch: refs/heads/master Commit: ab25f67348d4885620df86497889c1826f013a73 Parents: 857e0de Author: peleghila Authored: Wed Feb 1 14:01:18 2017 +0200 Committer: pascalschumacher Committed: Wed Feb 1 20:03:48 2017 +0100 -- src/test/java/org/apache/commons/lang3/CharUtilsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ab25f673/src/test/java/org/apache/commons/lang3/CharUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/CharUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharUtilsTest.java index 988c380..ea68ada 100644 --- a/src/test/java/org/apache/commons/lang3/CharUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/CharUtilsTest.java @@ -235,7 +235,7 @@ public class CharUtilsTest { assertTrue(CharUtils.isAsciiPrintable('3')); assertTrue(CharUtils.isAsciiPrintable('-')); assertFalse(CharUtils.isAsciiPrintable('\n')); -assertFalse(CharUtils.isAscii(CHAR_COPY)); +assertFalse(CharUtils.isAsciiPrintable(CHAR_COPY)); for (int i = 0; i < 196; i++) { if (i >= 32 && i <= 126) {
[lang] Update RELEASE-NOTES.txt fix typo "vom" (closes #229)
Repository: commons-lang Updated Branches: refs/heads/master 86a082e8b -> 857e0de49 Update RELEASE-NOTES.txt fix typo "vom" (closes #229) Replace `vom` by `from`. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/857e0de4 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/857e0de4 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/857e0de4 Branch: refs/heads/master Commit: 857e0de49293083aae6d3e6c6b76ec0755b1d0fa Parents: 86a082e Author: stonio Authored: Thu Jan 26 15:30:28 2017 +0100 Committer: pascalschumacher Committed: Thu Jan 26 18:56:51 2017 +0100 -- RELEASE-NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/857e0de4/RELEASE-NOTES.txt -- diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 9eba1b5..141203a 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -41,7 +41,7 @@ COMPATIBILITY = Apache Commons Lang 3.5 is binary compatible with the 3.4 release. Users -should not experience any problems when upgrading vom 3.4 to 3.5. +should not experience any problems when upgrading from 3.4 to 3.5. There has been an addition to the org.apache.commons.lang3.time.DatePrinter interface:
[3/3] [lang] MultilineRecursiveToStringStyle: made private field indent static
MultilineRecursiveToStringStyle: made private field indent static Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/86a082e8 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/86a082e8 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/86a082e8 Branch: refs/heads/master Commit: 86a082e8be8c51f07079ded82d6d125c9efc1791 Parents: bd7788b Author: pascalschumacher Authored: Fri Jan 20 18:48:13 2017 +0100 Committer: pascalschumacher Committed: Fri Jan 20 18:48:13 2017 +0100 -- .../MultilineRecursiveToStringStyle.java| 50 ++-- 1 file changed, 25 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/86a082e8/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java -- diff --git a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java index 311a698..df82787 100644 --- a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java +++ b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java @@ -70,7 +70,7 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle { private static final long serialVersionUID = 1L; /** Indenting of inner lines. */ -private final int indent = 2; +private static final int INDENT = 2; /** Current indenting. */ private int spaces = 2; @@ -90,11 +90,11 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle { private void resetIndent() { setArrayStart("{" + System.lineSeparator() + spacer(spaces)); setArraySeparator("," + System.lineSeparator() + spacer(spaces)); -setArrayEnd(System.lineSeparator() + spacer(spaces - indent) + "}"); +setArrayEnd(System.lineSeparator() + spacer(spaces - INDENT) + "}"); setContentStart("[" + System.lineSeparator() + spacer(spaces)); setFieldSeparator("," + System.lineSeparator() + spacer(spaces)); -setContentEnd(System.lineSeparator() + spacer(spaces - indent) + "]"); +setContentEnd(System.lineSeparator() + spacer(spaces - INDENT) + "]"); } /** @@ -115,10 +115,10 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle { public void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) { if (!ClassUtils.isPrimitiveWrapper(value.getClass()) && !String.class.equals(value.getClass()) && accept(value.getClass())) { -spaces += indent; +spaces += INDENT; resetIndent(); buffer.append(ReflectionToStringBuilder.toString(value, this)); -spaces -= indent; +spaces -= INDENT; resetIndent(); } else { super.appendDetail(buffer, fieldName, value); @@ -127,91 +127,91 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle { @Override protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object[] array) { -spaces += indent; +spaces += INDENT; resetIndent(); super.appendDetail(buffer, fieldName, array); -spaces -= indent; +spaces -= INDENT; resetIndent(); } @Override protected void reflectionAppendArrayDetail(final StringBuffer buffer, final String fieldName, final Object array) { -spaces += indent; +spaces += INDENT; resetIndent(); super.appendDetail(buffer, fieldName, array); -spaces -= indent; +spaces -= INDENT; resetIndent(); } @Override protected void appendDetail(final StringBuffer buffer, final String fieldName, final long[] array) { -spaces += indent; +spaces += INDENT; resetIndent(); super.appendDetail(buffer, fieldName, array); -spaces -= indent; +spaces -= INDENT; resetIndent(); } @Override protected void appendDetail(final StringBuffer buffer, final String fieldName, final int[] array) { -spaces += indent; +spaces += INDENT; resetIndent(); super.appendDetail(buffer, fieldName, array); -spaces -= indent; +spaces -= INDENT; resetIndent(); } @Override protected void appendDetail(final StringBuffer buffer, final String fieldName, final short[] array) { -spaces += indent;
[1/3] [lang] JsonToStringStyle: private field FIELD_NAME_PREFIX can be static
Repository: commons-lang Updated Branches: refs/heads/master 928e74f73 -> 86a082e8b JsonToStringStyle: private field FIELD_NAME_PREFIX can be static Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/04436741 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/04436741 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/04436741 Branch: refs/heads/master Commit: 044367419dd317eb9f9935d8360280b8b8695462 Parents: 928e74f Author: pascalschumacher Authored: Fri Jan 20 18:39:16 2017 +0100 Committer: pascalschumacher Committed: Fri Jan 20 18:39:16 2017 +0100 -- src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/04436741/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java -- diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java index f4eb64e..1658198 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java +++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java @@ -2366,7 +2366,7 @@ public abstract class ToStringStyle implements Serializable { /** * The summary size text start '>'. */ -private final String FIELD_NAME_PREFIX = "\""; +private static final String FIELD_NAME_PREFIX = "\""; /** *
[2/3] [lang] JsonToStringStyle: improve private constant name and remove wrong comment
JsonToStringStyle: improve private constant name and remove wrong comment Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/bd7788b3 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/bd7788b3 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/bd7788b3 Branch: refs/heads/master Commit: bd7788b384a87024ddd6bbe6a9bd9a167cf2ec12 Parents: 0443674 Author: pascalschumacher Authored: Fri Jan 20 18:46:34 2017 +0100 Committer: pascalschumacher Committed: Fri Jan 20 18:46:34 2017 +0100 -- .../org/apache/commons/lang3/builder/ToStringStyle.java | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/bd7788b3/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java -- diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java index 1658198..645525e 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java +++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java @@ -2363,10 +2363,7 @@ public abstract class ToStringStyle implements Serializable { private static final long serialVersionUID = 1L; -/** - * The summary size text start '>'. - */ -private static final String FIELD_NAME_PREFIX = "\""; +private static final String FIELD_NAME_QUOTE = "\""; /** * @@ -2621,8 +2618,8 @@ public abstract class ToStringStyle implements Serializable { "Field names are mandatory when using JsonToStringStyle"); } -super.appendFieldStart(buffer, FIELD_NAME_PREFIX + fieldName -+ FIELD_NAME_PREFIX); +super.appendFieldStart(buffer, FIELD_NAME_QUOTE + fieldName ++ FIELD_NAME_QUOTE); } /**
[2/2] [lang] LANG-1295: ArrayUtils.toArray(T... items) has unsafe use of varargs
LANG-1295: ArrayUtils.toArray(T... items) has unsafe use of varargs remove SafeVarargs annotation Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/928e74f7 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/928e74f7 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/928e74f7 Branch: refs/heads/master Commit: 928e74f73f62f241c986f6ff609575e1d833413d Parents: 7e60537 Author: pascalschumacher Authored: Fri Jan 20 17:49:11 2017 +0100 Committer: pascalschumacher Committed: Fri Jan 20 17:49:11 2017 +0100 -- src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/928e74f7/src/main/java/org/apache/commons/lang3/ArrayUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java index 3331b5b..624731e 100644 --- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java +++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java @@ -301,7 +301,6 @@ public class ArrayUtils { * @return the array, not null unless a null array is passed in * @since 3.0 */ -@SafeVarargs public static T[] toArray(final T... items) { return items; }
[1/2] [lang] LANG-1296: ArrayUtils.addAll() has unsafe use of varargs
Repository: commons-lang Updated Branches: refs/heads/master d0e2bfc46 -> 928e74f73 LANG-1296: ArrayUtils.addAll() has unsafe use of varargs remove SafeVarargs annotation Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/7e605378 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/7e605378 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/7e605378 Branch: refs/heads/master Commit: 7e605378202fe4e6c9f4aa6a10201b4205238710 Parents: d0e2bfc Author: pascalschumacher Authored: Fri Jan 20 17:47:20 2017 +0100 Committer: pascalschumacher Committed: Fri Jan 20 17:47:20 2017 +0100 -- src/main/java/org/apache/commons/lang3/ArrayUtils.java | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7e605378/src/main/java/org/apache/commons/lang3/ArrayUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java index 1e1217b..3331b5b 100644 --- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java +++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java @@ -5059,7 +5059,6 @@ public class ArrayUtils { * @since 2.1 * @throws IllegalArgumentException if the array types are incompatible */ -@SafeVarargs public static T[] addAll(final T[] array1, final T... array2) { if (array1 == null) { return clone(array2);
[lang] deprecate SystemUtils#LINE_SEPARATOR in favor of java.lang.System#lineSeparator
Repository: commons-lang Updated Branches: refs/heads/master aab4018d8 -> d0e2bfc46 deprecate SystemUtils#LINE_SEPARATOR in favor of java.lang.System#lineSeparator Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/d0e2bfc4 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/d0e2bfc4 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/d0e2bfc4 Branch: refs/heads/master Commit: d0e2bfc46659025e6262b2e5de984a8359c9dada Parents: aab4018 Author: pascalschumacher Authored: Fri Jan 20 17:40:38 2017 +0100 Committer: pascalschumacher Committed: Fri Jan 20 17:41:03 2017 +0100 -- .../org/apache/commons/lang3/SystemUtils.java | 2 + .../MultilineRecursiveToStringStyle.java| 13 ++-- .../commons/lang3/builder/ToStringStyle.java| 5 +- .../commons/lang3/exception/ExceptionUtils.java | 4 +- .../apache/commons/lang3/text/StrBuilder.java | 3 +- .../apache/commons/lang3/text/WordUtils.java| 3 +- .../lang3/builder/JsonToStringStyleTest.java| 13 ++-- .../builder/MultiLineToStringStyleTest.java | 69 ++-- .../MultilineRecursiveToStringStyleTest.java| 3 +- .../lang3/text/StrBuilderAppendInsertTest.java | 4 +- .../commons/lang3/text/WordUtilsTest.java | 5 +- 11 files changed, 58 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/SystemUtils.java -- diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java index 8425c5c..f553618 100644 --- a/src/main/java/org/apache/commons/lang3/SystemUtils.java +++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java @@ -664,8 +664,10 @@ public class SystemUtils { * sync with that System property. * * + * @deprecated Use {@link System#lineSeparator} instead, since it does not require a privilege check. * @since Java 1.1 */ +@Deprecated public static final String LINE_SEPARATOR = getSystemProperty("line.separator"); /** http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java -- diff --git a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java index d1a2ad2..311a698 100644 --- a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java +++ b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java @@ -18,7 +18,6 @@ package org.apache.commons.lang3.builder; import org.apache.commons.lang3.ClassUtils; -import org.apache.commons.lang3.SystemUtils; /** * Works with {@link ToStringBuilder} to create a "deep" toString. @@ -89,13 +88,13 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle { * Must be invoked after changing the {@link #spaces} value. */ private void resetIndent() { -setArrayStart("{" + SystemUtils.LINE_SEPARATOR + spacer(spaces)); -setArraySeparator("," + SystemUtils.LINE_SEPARATOR + spacer(spaces)); -setArrayEnd(SystemUtils.LINE_SEPARATOR + spacer(spaces - indent) + "}"); +setArrayStart("{" + System.lineSeparator() + spacer(spaces)); +setArraySeparator("," + System.lineSeparator() + spacer(spaces)); +setArrayEnd(System.lineSeparator() + spacer(spaces - indent) + "}"); -setContentStart("[" + SystemUtils.LINE_SEPARATOR + spacer(spaces)); -setFieldSeparator("," + SystemUtils.LINE_SEPARATOR + spacer(spaces)); -setContentEnd(SystemUtils.LINE_SEPARATOR + spacer(spaces - indent) + "]"); +setContentStart("[" + System.lineSeparator() + spacer(spaces)); +setFieldSeparator("," + System.lineSeparator() + spacer(spaces)); +setContentEnd(System.lineSeparator() + spacer(spaces - indent) + "]"); } /** http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java -- diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java index 4b3cc53..f4eb64e 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java +++ b/src/main/java/
[lang] remove commons-io test dependency
Repository: commons-lang Updated Branches: refs/heads/master c63653983 -> 7cf5e01c2 remove commons-io test dependency Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/7cf5e01c Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/7cf5e01c Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/7cf5e01c Branch: refs/heads/master Commit: 7cf5e01c2a152a0b612cb19e02213879a57c14d2 Parents: c636539 Author: pascalschumacher Authored: Tue Dec 20 10:01:04 2016 +0100 Committer: pascalschumacher Committed: Tue Dec 20 10:01:04 2016 +0100 -- pom.xml | 7 --- .../org/apache/commons/lang3/StringEscapeUtilsTest.java | 10 +- 2 files changed, 5 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7cf5e01c/pom.xml -- diff --git a/pom.xml b/pom.xml index 12354b0..0d06563 100644 --- a/pom.xml +++ b/pom.xml @@ -520,13 +520,6 @@ - commons-io - commons-io - 2.5 - test - - - org.apache.bcel bcel 6.0 http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7cf5e01c/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java index 28be437..815dc96 100644 --- a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java @@ -22,14 +22,15 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.FileInputStream; import java.io.IOException; import java.io.StringWriter; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; -import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.text.translate.CharSequenceTranslator; import org.apache.commons.lang3.text.translate.NumericEntityEscaper; import org.junit.Test; @@ -555,14 +556,13 @@ public class StringEscapeUtilsTest { */ @Test public void testLang708() throws IOException { -final FileInputStream fis = new FileInputStream("src/test/resources/lang-708-input.txt"); -final String input = IOUtils.toString(fis, "UTF-8"); +final byte[] inputBytes = Files.readAllBytes(Paths.get("src/test/resources/lang-708-input.txt")); +final String input = new String(inputBytes, StandardCharsets.UTF_8); final String escaped = StringEscapeUtils.escapeEcmaScript(input); // just the end: assertTrue(escaped, escaped.endsWith("}]")); // a little more: assertTrue(escaped, escaped.endsWith("\"valueCode\\\":\\\"\\\"}]")); -fis.close(); } /**
[2/3] [text] StrTokenizerTest: replace lang3.ArrayUtils#toString with Arrays#toString
StrTokenizerTest: replace lang3.ArrayUtils#toString with Arrays#toString Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/2166def7 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/2166def7 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/2166def7 Branch: refs/heads/master Commit: 2166def7473b98bf40522f48b84a80e962174b70 Parents: 0306d48 Author: Pascal Schumacher Authored: Sun Dec 18 18:03:48 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 18:03:48 2016 +0100 -- .../org/apache/commons/text/StrTokenizerTest.java | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/2166def7/src/test/java/org/apache/commons/text/StrTokenizerTest.java -- diff --git a/src/test/java/org/apache/commons/text/StrTokenizerTest.java b/src/test/java/org/apache/commons/text/StrTokenizerTest.java index 4b39f55..9feb170 100644 --- a/src/test/java/org/apache/commons/text/StrTokenizerTest.java +++ b/src/test/java/org/apache/commons/text/StrTokenizerTest.java @@ -26,8 +26,6 @@ import java.util.Collections; import java.util.List; import java.util.NoSuchElementException; -import org.apache.commons.lang3.ArrayUtils; - /** * Unit test for {@link StrTokenizer}. */ @@ -56,7 +54,7 @@ public class StrTokenizerTest { final String expected[] = new String[]{"a", "b", "c", "d;\"e", "f", "", "", "",}; -assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length); +assertEquals(Arrays.toString(tokens), expected.length, tokens.length); for (int i = 0; i < expected.length; i++) { assertEquals("token[" + i + "] was '" + tokens[i] + "' but was expected to be '" + expected[i] + "'", expected[i], tokens[i]); @@ -77,7 +75,7 @@ public class StrTokenizerTest { final String expected[] = new String[]{"a", "b", "c ", "d;\"e", "f", " ", " ", "",}; -assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length); +assertEquals(Arrays.toString(tokens), expected.length, tokens.length); for (int i = 0; i < expected.length; i++) { assertEquals("token[" + i + "] was '" + tokens[i] + "' but was expected to be '" + expected[i] + "'", expected[i], tokens[i]); @@ -98,7 +96,7 @@ public class StrTokenizerTest { final String expected[] = new String[]{"a", "b", " c", "d;\"e", "f", " ", " ", "",}; -assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length); +assertEquals(Arrays.toString(tokens), expected.length, tokens.length); for (int i = 0; i < expected.length; i++) { assertEquals("token[" + i + "] was '" + tokens[i] + "' but was expected to be '" + expected[i] + "'", expected[i], tokens[i]); @@ -119,7 +117,7 @@ public class StrTokenizerTest { final String expected[] = new String[]{"a", "b", "c", "d;\"e", "f",}; -assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length); +assertEquals(Arrays.toString(tokens), expected.length, tokens.length); for (int i = 0; i < expected.length; i++) { assertEquals("token[" + i + "] was '" + tokens[i] + "' but was expected to be '" + expected[i] + "'", expected[i], tokens[i]); @@ -141,7 +139,7 @@ public class StrTokenizerTest { final String expected[] = new String[]{"a", "b", "c", "d;\"e", "f", null, null, null,}; -assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length); +assertEquals(Arrays.toString(tokens), expected.length, tokens.length); for (int i = 0; i < expected.length; i++) { assertEquals("token[" + i + "] was '" + tokens[i] + "' but was expected to be '" + expected[i] + "'", expected[i], tokens[i]); @@ -175,7 +173,7 @@ public class StrTokenizerTest { prevCount++; } -assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length); +assertEquals(Arrays.toString(tokens), expected.length, tokens.length); assertTrue("could not cycle through entire token list" + " using the 'hasNext' and 'next' methods", nextCount == expected.length); @@ -198,7 +196,7 @@ public class StrTokenizerTest { final String expected[] = new String[]{"a", "", "", "b", "c", "d e", "f", "",}; -assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length); +assertEquals(Arrays.toString(tokens), expected.length, tokens.length); for (int i = 0; i < expected.length; i++) { a
[3/3] [text] ExtendedMessageFormat: replace ObjectUtils#notEqual with !Objects#equals
ExtendedMessageFormat: replace ObjectUtils#notEqual with !Objects#equals Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/0e09bb82 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/0e09bb82 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/0e09bb82 Branch: refs/heads/master Commit: 0e09bb82a9edc9553530f4755d4b69b282cb910c Parents: 2166def Author: Pascal Schumacher Authored: Sun Dec 18 18:06:44 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 18:06:44 2016 +0100 -- .../java/org/apache/commons/text/ExtendedMessageFormat.java | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/0e09bb82/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java -- diff --git a/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java b/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java index 617018f..949a820 100644 --- a/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java +++ b/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java @@ -16,8 +16,6 @@ */ package org.apache.commons.text; -import org.apache.commons.lang3.ObjectUtils; - import java.text.Format; import java.text.MessageFormat; import java.text.ParsePosition; @@ -272,14 +270,14 @@ public class ExtendedMessageFormat extends MessageFormat { if (!super.equals(obj)) { return false; } -if (ObjectUtils.notEqual(getClass(), obj.getClass())) { +if (!Objects.equals(getClass(), obj.getClass())) { return false; } final ExtendedMessageFormat rhs = (ExtendedMessageFormat)obj; -if (ObjectUtils.notEqual(toPattern, rhs.toPattern)) { +if (!Objects.equals(toPattern, rhs.toPattern)) { return false; } -if (ObjectUtils.notEqual(registry, rhs.registry)) { +if (!Objects.equals(registry, rhs.registry)) { return false; } return true;
[1/3] [text] StrBuilderTest: simplify two assertions by directly testing for 0 instead of ArrayUtils.EMPTY_CHAR_ARRAY.length
Repository: commons-text Updated Branches: refs/heads/master 8d3711162 -> 0e09bb82a StrBuilderTest: simplify two assertions by directly testing for 0 instead of ArrayUtils.EMPTY_CHAR_ARRAY.length Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/0306d48d Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/0306d48d Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/0306d48d Branch: refs/heads/master Commit: 0306d48d3c38a12563a850ed83adf0f9209670c2 Parents: 8d37111 Author: Pascal Schumacher Authored: Sun Dec 18 18:01:37 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 18:01:37 2016 +0100 -- src/test/java/org/apache/commons/text/StrBuilderTest.java | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/0306d48d/src/test/java/org/apache/commons/text/StrBuilderTest.java -- diff --git a/src/test/java/org/apache/commons/text/StrBuilderTest.java b/src/test/java/org/apache/commons/text/StrBuilderTest.java index e44c767..a0c923b 100644 --- a/src/test/java/org/apache/commons/text/StrBuilderTest.java +++ b/src/test/java/org/apache/commons/text/StrBuilderTest.java @@ -28,8 +28,6 @@ import java.io.Writer; import java.nio.CharBuffer; import java.util.Arrays; -import org.apache.commons.lang3.ArrayUtils; - /** * Unit tests for {@link StrBuilder}. */ @@ -467,7 +465,7 @@ public class StrBuilderTest { @Test public void testToCharArray() { final StrBuilder sb = new StrBuilder(); -assertEquals(ArrayUtils.EMPTY_CHAR_ARRAY.length, sb.toCharArray().length); +assertEquals(0, sb.toCharArray().length); char[] a = sb.toCharArray(); assertNotNull("toCharArray() result is null", a); @@ -482,7 +480,7 @@ public class StrBuilderTest { @Test public void testToCharArrayIntInt() { final StrBuilder sb = new StrBuilder(); -assertEquals(ArrayUtils.EMPTY_CHAR_ARRAY.length, sb.toCharArray(0, 0).length); +assertEquals(0, sb.toCharArray(0, 0).length); sb.append("junit"); char[] a = sb.toCharArray(0, 20); // too large test
[2/2] [text] StrBuilderAppendInsertTest and WordUtilsTest: replace lang3.SystemUtils#LINE_SEPARATOR with System#lineSeparator
StrBuilderAppendInsertTest and WordUtilsTest: replace lang3.SystemUtils#LINE_SEPARATOR with System#lineSeparator Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/8d371116 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/8d371116 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/8d371116 Branch: refs/heads/master Commit: 8d37111622aaa576198d081db7613eff8ba46724 Parents: 144ee0e Author: Pascal Schumacher Authored: Sun Dec 18 17:58:00 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 17:58:00 2016 +0100 -- .../org/apache/commons/text/StrBuilderAppendInsertTest.java | 4 +--- src/test/java/org/apache/commons/text/WordUtilsTest.java| 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/8d371116/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java -- diff --git a/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java b/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java index 228c8df..95a4adf 100644 --- a/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java +++ b/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java @@ -26,15 +26,13 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; -import org.apache.commons.lang3.SystemUtils; - /** * Unit tests for {@link StrBuilder}. */ public class StrBuilderAppendInsertTest { /** The system line separator. */ -private static final String SEP = SystemUtils.LINE_SEPARATOR; +private static final String SEP = System.lineSeparator(); /** Test subclass of Object, with a toString method. */ private static final Object FOO = new Object() { http://git-wip-us.apache.org/repos/asf/commons-text/blob/8d371116/src/test/java/org/apache/commons/text/WordUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/text/WordUtilsTest.java b/src/test/java/org/apache/commons/text/WordUtilsTest.java index 6b57072..0ab8b09 100644 --- a/src/test/java/org/apache/commons/text/WordUtilsTest.java +++ b/src/test/java/org/apache/commons/text/WordUtilsTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertTrue; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; -import org.apache.commons.lang3.SystemUtils; import org.junit.Test; /** @@ -53,7 +52,7 @@ public class WordUtilsTest { assertEquals("", WordUtils.wrap("", -1)); // normal -final String systemNewLine = SystemUtils.LINE_SEPARATOR; +final String systemNewLine = System.lineSeparator(); String input = "Here is one line of text that is going to be wrapped after 20 columns."; String expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine + "to be wrapped after" + systemNewLine + "20 columns."; @@ -115,7 +114,7 @@ public class WordUtilsTest { assertEquals(expected, WordUtils.wrap(input, -1, "\n", false)); // system newline char -final String systemNewLine = SystemUtils.LINE_SEPARATOR; +final String systemNewLine = System.lineSeparator(); input = "Here is one line of text that is going to be wrapped after 20 columns."; expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine + "to be wrapped after" + systemNewLine + "20 columns.";
[1/2] [text] ExtendedMessageFormatTest: remove code for java versions below 1.4
Repository: commons-text Updated Branches: refs/heads/master 98d62f36f -> 8d3711162 ExtendedMessageFormatTest: remove code for java versions below 1.4 Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/144ee0ec Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/144ee0ec Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/144ee0ec Branch: refs/heads/master Commit: 144ee0ecfcfa32e4a2618997f05eeb96b85d9cda Parents: 98d62f3 Author: Pascal Schumacher Authored: Sun Dec 18 17:51:16 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 17:51:16 2016 +0100 -- .../commons/text/ExtendedMessageFormatTest.java | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/144ee0ec/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java -- diff --git a/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java index 36c6faa..fe9281a 100644 --- a/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java +++ b/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java @@ -19,7 +19,6 @@ package org.apache.commons.text; import org.junit.Test; import org.junit.Before; import static org.junit.Assert.*; -import static org.apache.commons.lang3.JavaVersion.JAVA_1_4; import java.text.DateFormat; import java.text.FieldPosition; @@ -35,12 +34,8 @@ import java.util.HashSet; import java.util.Locale; import java.util.Map; -import org.apache.commons.lang3.SystemUtils; - /** * Test case for {@link ExtendedMessageFormat}. - * - * @since 2.4 */ public class ExtendedMessageFormatTest { @@ -59,7 +54,7 @@ public class ExtendedMessageFormatTest { public void testExtendedFormats() { final String pattern = "Lower: {0,lower} Upper: {1,upper}"; final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, registry); -assertPatternsEqual("TOPATTERN", pattern, emf.toPattern()); +assertEquals("TOPATTERN", pattern, emf.toPattern()); assertEquals("Lower: foo Upper: BAR", emf.format(new Object[] {"foo", "bar"})); assertEquals("Lower: foo Upper: BAR", emf.format(new Object[] {"Foo", "Bar"})); assertEquals("Lower: foo Upper: BAR", emf.format(new Object[] {"FOO", "BAR"})); @@ -142,7 +137,7 @@ public class ExtendedMessageFormatTest { expected.append(df.format(args[1])); expected.append(" Salary: "); expected.append(nf.format(args[2])); -assertPatternsEqual("pattern comparison for locale " + locale, expectedPattern, emf.toPattern()); +assertEquals("pattern comparison for locale " + locale, expectedPattern, emf.toPattern()); assertEquals(String.valueOf(locale), expected.toString(), emf.format(args)); } } @@ -377,14 +372,7 @@ public class ExtendedMessageFormatTest { emf = new ExtendedMessageFormat(pattern, locale); } assertEquals("format "+ buffer.toString(), mf.format(args), emf.format(args)); -assertPatternsEqual("toPattern " + buffer.toString(), mf.toPattern(), emf.toPattern()); -} - -//can't trust what MessageFormat does with toPattern() pre 1.4: -private void assertPatternsEqual(final String message, final String expected, final String actual) { -if (SystemUtils.isJavaVersionAtLeast(JAVA_1_4)) { -assertEquals(message, expected, actual); -} +assertEquals("toPattern " + buffer.toString(), mf.toPattern(), emf.toPattern()); } /**
[lang] ExtendedMessageFormatTest: remove code for java versions below 1.4
Repository: commons-lang Updated Branches: refs/heads/master cc2d70e2e -> c63653983 ExtendedMessageFormatTest: remove code for java versions below 1.4 Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c6365398 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c6365398 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c6365398 Branch: refs/heads/master Commit: c636539836ecb541d9ef71f2d347772cf9f6bc52 Parents: cc2d70e Author: pascalschumacher Authored: Sun Dec 18 17:49:27 2016 +0100 Committer: pascalschumacher Committed: Sun Dec 18 17:49:27 2016 +0100 -- .../lang3/text/ExtendedMessageFormatTest.java | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c6365398/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java -- diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java index 13a7e79..6a717a3 100644 --- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java @@ -19,7 +19,6 @@ package org.apache.commons.lang3.text; import org.junit.Test; import org.junit.Before; import static org.junit.Assert.*; -import static org.apache.commons.lang3.JavaVersion.JAVA_1_4; import java.text.DateFormat; import java.text.FieldPosition; @@ -35,8 +34,6 @@ import java.util.HashSet; import java.util.Locale; import java.util.Map; -import org.apache.commons.lang3.SystemUtils; - /** * Test case for {@link ExtendedMessageFormat}. * @@ -59,7 +56,7 @@ public class ExtendedMessageFormatTest { public void testExtendedFormats() { final String pattern = "Lower: {0,lower} Upper: {1,upper}"; final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, registry); -assertPatternsEqual("TOPATTERN", pattern, emf.toPattern()); +assertEquals("TOPATTERN", pattern, emf.toPattern()); assertEquals("Lower: foo Upper: BAR", emf.format(new Object[] {"foo", "bar"})); assertEquals("Lower: foo Upper: BAR", emf.format(new Object[] {"Foo", "Bar"})); assertEquals("Lower: foo Upper: BAR", emf.format(new Object[] {"FOO", "BAR"})); @@ -142,7 +139,7 @@ public class ExtendedMessageFormatTest { expected.append(df.format(args[1])); expected.append(" Salary: "); expected.append(nf.format(args[2])); -assertPatternsEqual("pattern comparison for locale " + locale, expectedPattern, emf.toPattern()); +assertEquals("pattern comparison for locale " + locale, expectedPattern, emf.toPattern()); assertEquals(String.valueOf(locale), expected.toString(), emf.format(args)); } } @@ -377,14 +374,7 @@ public class ExtendedMessageFormatTest { emf = new ExtendedMessageFormat(pattern, locale); } assertEquals("format "+ buffer.toString(), mf.format(args), emf.format(args)); -assertPatternsEqual("toPattern " + buffer.toString(), mf.toPattern(), emf.toPattern()); -} - -//can't trust what MessageFormat does with toPattern() pre 1.4: -private void assertPatternsEqual(final String message, final String expected, final String actual) { -if (SystemUtils.isJavaVersionAtLeast(JAVA_1_4)) { -assertEquals(message, expected, actual); -} +assertEquals("toPattern " + buffer.toString(), mf.toPattern(), emf.toPattern()); } /**
[2/3] [text] remove unused commons-csv test dependency
remove unused commons-csv test dependency Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/a659f622 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/a659f622 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/a659f622 Branch: refs/heads/master Commit: a659f622f577c08bee9f63cf34cf2028b01b1447 Parents: ff511e1 Author: Pascal Schumacher Authored: Sun Dec 18 17:30:02 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 17:30:02 2016 +0100 -- pom.xml | 7 --- 1 file changed, 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/a659f622/pom.xml -- diff --git a/pom.xml b/pom.xml index 63670db..366f424 100644 --- a/pom.xml +++ b/pom.xml @@ -97,13 +97,6 @@ 1.3 test - - - org.apache.commons - commons-csv - 1.4 - test - commons-io commons-io
[1/3] [text] pom.xml: removed comment which was copied from commons-lang and made no sense for commons-text
Repository: commons-text Updated Branches: refs/heads/master c0b4869e6 -> 98d62f36f pom.xml: removed comment which was copied from commons-lang and made no sense for commons-text Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/ff511e17 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/ff511e17 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/ff511e17 Branch: refs/heads/master Commit: ff511e175bd3542164f725835ebfe02b34fc5fa5 Parents: c0b4869 Author: Pascal Schumacher Authored: Sun Dec 18 17:28:49 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 17:28:49 2016 +0100 -- pom.xml | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/ff511e17/pom.xml -- diff --git a/pom.xml b/pom.xml index bda5418..63670db 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,6 @@ - org.apache.commons
[3/3] [text] remove commons-io test dependency which was used only in one test
remove commons-io test dependency which was used only in one test Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/98d62f36 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/98d62f36 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/98d62f36 Branch: refs/heads/master Commit: 98d62f36fc3dfba2693ddf5c301de15fe40320ee Parents: a659f62 Author: Pascal Schumacher Authored: Sun Dec 18 17:36:18 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 17:36:18 2016 +0100 -- pom.xml | 6 -- .../org/apache/commons/text/StringEscapeUtilsTest.java| 10 +- 2 files changed, 5 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/98d62f36/pom.xml -- diff --git a/pom.xml b/pom.xml index 366f424..72621f1 100644 --- a/pom.xml +++ b/pom.xml @@ -97,12 +97,6 @@ 1.3 test - - commons-io - commons-io - 2.5 - test - http://git-wip-us.apache.org/repos/asf/commons-text/blob/98d62f36/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java -- diff --git a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java index e732b6c..c0f7d05 100644 --- a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java +++ b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java @@ -25,14 +25,15 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.FileInputStream; import java.io.IOException; import java.io.StringWriter; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; -import org.apache.commons.io.IOUtils; import org.junit.Test; /** @@ -478,14 +479,13 @@ public class StringEscapeUtilsTest { */ @Test public void testLang708() throws IOException { -final FileInputStream fis = new FileInputStream("src/test/resources/stringEscapeUtilsTestData.txt"); -final String input = IOUtils.toString(fis, "UTF-8"); +byte[] inputBytes = Files.readAllBytes(Paths.get("src/test/resources/stringEscapeUtilsTestData.txt")); +final String input = new String(inputBytes, StandardCharsets.UTF_8); final String escaped = StringEscapeUtils.escapeEcmaScript(input); // just the end: assertTrue(escaped, escaped.endsWith("}]")); // a little more: assertTrue(escaped, escaped.endsWith("\"valueCode\\\":\\\"\\\"}]")); -fis.close(); } /**
[text] run rat check on travis
Repository: commons-text Updated Branches: refs/heads/master df543ca9c -> c0b4869e6 run rat check on travis Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/c0b4869e Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/c0b4869e Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/c0b4869e Branch: refs/heads/master Commit: c0b4869e6b8543849d3b4e65ad9ade3fe9e9251f Parents: df543ca Author: Pascal Schumacher Authored: Sun Dec 18 17:22:37 2016 +0100 Committer: Pascal Schumacher Committed: Sun Dec 18 17:22:37 2016 +0100 -- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/c0b4869e/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index 9e3529b..d51d8d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,4 +22,4 @@ jdk: - oraclejdk8 after_success: - - mvn clean test jacoco:report coveralls:report + - mvn clean apache-rat:check test jacoco:report coveralls:report