diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 1ec0956f7e8..16a6b93123e 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -1033,4 +1033,36 @@ public static T CONST(final T v) {
return v;
}
+ /**
+ * Gets the class name of the given object.
+ *
+ * @param object the object to query, may be null
+ * @return the given object's class name or null if the object is null
+ * @since 3.7
+ */
+ public static String getClassName(final Object object) {
+ return object == null ? null : object.getClass().getName();
+ }
+
+ /**
+ * Gets the class simple name of the given object.
+ *
+ * @param object the object to query, may be null
+ * @return the given object's class simple name or null if the object is null
+ * @since 3.7
+ */
+ public static String getClassSimpleName(final Object object) {
+ return object == null ? null : object.getClass().getSimpleName();
+ }
+
+ /**
+ * Gets the class canonical name of the given object.
+ *
+ * @param object the object to query, may be null
+ * @return the given object's class canonical name or null if the object is null
+ * @since 3.7
+ */
+ public static String getClassCanonicalName(final Object object) {
+ return object == null ? null : object.getClass().getCanonicalName();
+ }
}
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index 3da844300b5..2bf036c8c1b 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -38,6 +38,7 @@
import org.apache.commons.lang3.exception.CloneFailedException;
import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.lang3.text.StrBuilder;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -666,4 +667,36 @@ public int compare(final CharSequence o1, final CharSequence o2) {
}
}
+
+ /**
+ * @since 3.7
+ */
+ @Test
+ public void testGetClassName() {
+ Assert.assertNull(ObjectUtils.getClassName(null));
+ Assert.assertEquals("java.lang.String", ObjectUtils.getClassName(new String()));
+ Assert.assertEquals("org.apache.commons.lang3.ObjectUtilsTest$CloneableString",
+ ObjectUtils.getClassName(new CloneableString("test")));
+ }
+
+ /**
+ * @since 3.7
+ */
+ @Test
+ public void testGetSimpleName() {
+ Assert.assertNull(ObjectUtils.getClassSimpleName(null));
+ Assert.assertEquals("String", ObjectUtils.getClassSimpleName(new String()));
+ Assert.assertEquals("CloneableString", ObjectUtils.getClassSimpleName(new CloneableString("test")));
+ }
+
+ /**
+ * @since 3.7
+ */
+ @Test
+ public void testGetCanonicalName() {
+ Assert.assertNull(ObjectUtils.getClassCanonicalName(null));
+ Assert.assertEquals("java.lang.String", ObjectUtils.getClassCanonicalName(new String()));
+ Assert.assertEquals("org.apache.commons.lang3.ObjectUtilsTest.CloneableString",
+ ObjectUtils.getClassCanonicalName(new CloneableString("test")));
+ }
}
From f0930aa1512a408635d2286c01d49523b1234db7 Mon Sep 17 00:00:00 2001
From: Allon Mureinik
Date: Sat, 21 Oct 2017 14:38:53 +0300
Subject: [PATCH 0052/3439] Remove ObjectUtils' trailing white spaces
Commit 6ea2fc8 inadvertently introduced trailing white spaces in
ObjectUtils' code, thus breaking the Checkstyle validation.
This patch removes these redundant TWS in order to allow the build to
pass.
---
src/main/java/org/apache/commons/lang3/ObjectUtils.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 16a6b93123e..8bebba9daef 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -1035,7 +1035,7 @@ public static T CONST(final T v) {
/**
* Gets the class name of the given object.
- *
+ *
* @param object the object to query, may be null
* @return the given object's class name or null if the object is null
* @since 3.7
@@ -1046,7 +1046,7 @@ public static String getClassName(final Object object) {
/**
* Gets the class simple name of the given object.
- *
+ *
* @param object the object to query, may be null
* @return the given object's class simple name or null if the object is null
* @since 3.7
@@ -1057,7 +1057,7 @@ public static String getClassSimpleName(final Object object) {
/**
* Gets the class canonical name of the given object.
- *
+ *
* @param object the object to query, may be null
* @return the given object's class canonical name or null if the object is null
* @since 3.7
From be3638eb477a8635f647c9a4fefdce7ca2e2408a Mon Sep 17 00:00:00 2001
From: "Bruno P. Kinoshita"
Date: Sun, 22 Oct 2017 01:12:41 +1300
Subject: [PATCH 0053/3439] Fix javadoc typos
---
.../java/org/apache/commons/lang3/CharUtils.java | 8 ++++----
.../java/org/apache/commons/lang3/StringUtils.java | 14 +++++++-------
.../java/org/apache/commons/lang3/ThreadUtils.java | 4 ++--
.../commons/lang3/builder/EqualsExclude.java | 2 +-
.../commons/lang3/builder/HashCodeExclude.java | 2 +-
.../commons/lang3/builder/ToStringBuilder.java | 2 +-
.../commons/lang3/builder/ToStringExclude.java | 2 +-
.../apache/commons/lang3/text/StrTokenizer.java | 2 +-
8 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/CharUtils.java b/src/main/java/org/apache/commons/lang3/CharUtils.java
index 219dea2a054..c22896838de 100644
--- a/src/main/java/org/apache/commons/lang3/CharUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharUtils.java
@@ -206,7 +206,7 @@ public static char toChar(final String str, final char defaultValue) {
*
Converts the character to the Integer it represents, throwing an
* exception if the character is not numeric.
*
- *
This method coverts the char '1' to the int 1 and so on.
+ *
This method converts the char '1' to the int 1 and so on.
*
*
* CharUtils.toIntValue('3') = 3
@@ -228,7 +228,7 @@ public static int toIntValue(final char ch) {
*
Converts the character to the Integer it represents, throwing an
* exception if the character is not numeric.
*
- *
This method coverts the char '1' to the int 1 and so on.
+ *
This method converts the char '1' to the int 1 and so on.
*
*
* CharUtils.toIntValue('3', -1) = 3
@@ -250,7 +250,7 @@ public static int toIntValue(final char ch, final int defaultValue) {
*
Converts the character to the Integer it represents, throwing an
* exception if the character is not numeric.
*
- *
This method coverts the char '1' to the int 1 and so on.
+ *
This method converts the char '1' to the int 1 and so on.
*
*
* CharUtils.toIntValue('3') = 3
@@ -271,7 +271,7 @@ public static int toIntValue(final Character ch) {
*
Converts the character to the Integer it represents, throwing an
* exception if the character is not numeric.
*
- *
This method coverts the char '1' to the int 1 and so on.
+ *
This method converts the char '1' to the int 1 and so on.
Unlike in the {@link #removePattern(String, String)} method, the {@link Pattern#DOTALL} option
* is NOT automatically added.
* To use the DOTALL option prepend "(?s)" to the regex.
- * DOTALL is also know as single-line mode in Perl.
+ * DOTALL is also known as single-line mode in Perl.
The {@link Pattern#DOTALL} option is NOT automatically added.
* To use the DOTALL option prepend "(?s)" to the regex.
- * DOTALL is also know as single-line mode in Perl.
+ * DOTALL is also known as single-line mode in Perl.
*
*
* StringUtils.removeFirst(null, *) = null
@@ -5191,7 +5191,7 @@ public static String replaceOnceIgnoreCase(final String text, final String searc
/**
*
Replaces each substring of the source String that matches the given regular expression with the given
- * replacement using the {@link Pattern#DOTALL} option. DOTALL is also know as single-line mode in Perl.
+ * replacement using the {@link Pattern#DOTALL} option. DOTALL is also known as single-line mode in Perl.
*
* This call is a {@code null} safe equivalent to:
*
@@ -5284,7 +5284,7 @@ public static String removePattern(final String source, final String regex) {
*
Unlike in the {@link #replacePattern(String, String, String)} method, the {@link Pattern#DOTALL} option
* is NOT automatically added.
* To use the DOTALL option prepend "(?s)" to the regex.
- * DOTALL is also know as single-line mode in Perl.
+ * DOTALL is also known as single-line mode in Perl.
*
*
* StringUtils.replaceAll(null, *, *) = null
@@ -5338,7 +5338,7 @@ public static String replaceAll(final String text, final String regex, final Str
*
*
The {@link Pattern#DOTALL} option is NOT automatically added.
* To use the DOTALL option prepend "(?s)" to the regex.
- * DOTALL is also know as single-line mode in Perl.
+ * DOTALL is also known as single-line mode in Perl.
*
*
* StringUtils.replaceFirst(null, *, *) = null
@@ -6212,7 +6212,7 @@ public static String repeat(final String str, final String separator, final int
* StringUtils.repeat('e', -2) = ""
*
*
- *
Note: this method doesn't not support padding with
+ *
Note: this method does not support padding with
* Unicode Supplementary Characters
* as they require a pair of {@code char}s to be represented.
* If you are needing to support full I18N of your applications
@@ -9218,7 +9218,7 @@ public static String unwrap(final String str, final char wrapChar) {
*
*
Valid pairs of surrogate code units will be converted into a single supplementary
* code point. Isolated surrogate code units (i.e. a high surrogate not followed by a low surrogate or
- * a low surrogate not preceeded by a high surrogate) will be returned as-is.
+ * a low surrogate not preceded by a high surrogate) will be returned as-is.
*
*
* StringUtils.toCodePoints(null) = null
diff --git a/src/main/java/org/apache/commons/lang3/ThreadUtils.java b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
index 0091cb071d9..55a7b22e8e6 100644
--- a/src/main/java/org/apache/commons/lang3/ThreadUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
@@ -36,7 +36,7 @@
public class ThreadUtils {
/**
- * Return the active thread with the specified id if it belong's to the specified thread group.
+ * Return the active thread with the specified id if it belongs to the specified thread group.
*
* @param threadId The thread id
* @param threadGroup The thread group
@@ -59,7 +59,7 @@ public static Thread findThreadById(final long threadId, final ThreadGroup threa
}
/**
- * Return the active thread with the specified id if it belong's to a thread group with the specified group name.
+ * Return the active thread with the specified id if it belongs to a thread group with the specified group name.
*
* @param threadId The thread id
* @param threadGroupName The thread group name
diff --git a/src/main/java/org/apache/commons/lang3/builder/EqualsExclude.java b/src/main/java/org/apache/commons/lang3/builder/EqualsExclude.java
index fe09f815eaf..21ec4bb504d 100755
--- a/src/main/java/org/apache/commons/lang3/builder/EqualsExclude.java
+++ b/src/main/java/org/apache/commons/lang3/builder/EqualsExclude.java
@@ -23,7 +23,7 @@
import java.lang.annotation.Target;
/**
- * Use this annotation to exclude a field from being being used by
+ * Use this annotation to exclude a field from being used by
* the various reflectionEquals methods defined on
* {@link EqualsBuilder}.
*
diff --git a/src/main/java/org/apache/commons/lang3/builder/HashCodeExclude.java b/src/main/java/org/apache/commons/lang3/builder/HashCodeExclude.java
index 65d9bef422b..c55291960d0 100755
--- a/src/main/java/org/apache/commons/lang3/builder/HashCodeExclude.java
+++ b/src/main/java/org/apache/commons/lang3/builder/HashCodeExclude.java
@@ -23,7 +23,7 @@
import java.lang.annotation.Target;
/**
- * Use this annotation to exclude a field from being being used by
+ * Use this annotation to exclude a field from being used by
* the various reflectionHashcode methods defined on
* {@link HashCodeBuilder}.
*
diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java b/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java
index 20dd748eb33..63117b00d99 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java
@@ -225,7 +225,7 @@ public ToStringBuilder(final Object object) {
}
/**
- *
Constructs a builder for the specified object using the a defined output style.
+ *
Constructs a builder for the specified object using the defined output style.
*
*
If the style is null, the default style is used.
*
diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringExclude.java b/src/main/java/org/apache/commons/lang3/builder/ToStringExclude.java
index 4cd31cc1f35..e36acce6470 100755
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringExclude.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringExclude.java
@@ -23,7 +23,7 @@
import java.lang.annotation.RetentionPolicy;
/**
- * Use this annotation to exclude a field from being being used by
+ * Use this annotation to exclude a field from being used by
* the {@link ReflectionToStringBuilder}.
*
* @since 3.5
diff --git a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
index 06bc2b87495..25db7c974bd 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
@@ -27,7 +27,7 @@
import org.apache.commons.lang3.StringUtils;
/**
- * Tokenizes a string based based on delimiters (separators)
+ * Tokenizes a string based on delimiters (separators)
* and supporting quoting and ignored character concepts.
*
* This class can split a String into many smaller strings. It aims
From 95fce758b0e12837869cae450d8029d7237b0dbb Mon Sep 17 00:00:00 2001
From: Allon Mureinik
Date: Sat, 21 Oct 2017 13:29:06 +0300
Subject: [PATCH 0054/3439] EventUtilsTest ExpectedException usage
Use the ExpectedException @Rule to verify thrown exception instead of
boiler-plate implementing its logic, in order to clean up the code
and make it easier to read and maintain.
---
.../commons/lang3/event/EventUtilsTest.java | 42 ++++++++-----------
1 file changed, 18 insertions(+), 24 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
index 9c4265a456c..1b3f525cac0 100644
--- a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
@@ -20,7 +20,6 @@
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.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -36,13 +35,18 @@
import javax.naming.event.ObjectChangeListener;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
/**
* @since 3.0
*/
public class EventUtilsTest {
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
@Test
public void testConstructor() {
assertNotNull(new EventUtils());
@@ -70,28 +74,21 @@ public void testAddEventListenerWithNoAddMethod() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class);
- try {
- EventUtils.addEventListener(src, ObjectChangeListener.class, listener);
- fail("Should not be allowed to add a listener to an object that doesn't support it.");
- } catch (final IllegalArgumentException e) {
- assertEquals("Class " + src.getClass().getName() + " does not have a public add" + ObjectChangeListener.class.getSimpleName() + " method which takes a parameter of type " + ObjectChangeListener.class.getName() + ".", e.getMessage());
- }
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Class " + src.getClass().getName() + " does not have a public add" + ObjectChangeListener.class.getSimpleName() + " method which takes a parameter of type " + ObjectChangeListener.class.getName() + ".");
+ EventUtils.addEventListener(src, ObjectChangeListener.class, listener);
}
@Test
public void testAddEventListenerThrowsException() {
final ExceptionEventSource src = new ExceptionEventSource();
- try {
- EventUtils.addEventListener(src, PropertyChangeListener.class, new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent e) {
- // Do nothing!
- }
- });
- fail("Add method should have thrown an exception, so method should fail.");
- } catch (final RuntimeException e) {
-
- }
+ expectedException.expect(RuntimeException.class);
+ EventUtils.addEventListener(src, PropertyChangeListener.class, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent e) {
+ // Do nothing!
+ }
+ });
}
@Test
@@ -99,12 +96,9 @@ public void testAddEventListenerWithPrivateAddMethod() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final VetoableChangeListener listener = handler.createListener(VetoableChangeListener.class);
- try {
- EventUtils.addEventListener(src, VetoableChangeListener.class, listener);
- fail("Should not be allowed to add a listener to an object that doesn't support it.");
- } catch (final IllegalArgumentException e) {
- assertEquals("Class " + src.getClass().getName() + " does not have a public add" + VetoableChangeListener.class.getSimpleName() + " method which takes a parameter of type " + VetoableChangeListener.class.getName() + ".", e.getMessage());
- }
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Class " + src.getClass().getName() + " does not have a public add" + VetoableChangeListener.class.getSimpleName() + " method which takes a parameter of type " + VetoableChangeListener.class.getName() + ".");
+ EventUtils.addEventListener(src, VetoableChangeListener.class, listener);
}
@Test
From 6ce88517b3af6d48c979b6e984889b69c044561c Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 23 Oct 2017 10:35:43 -0600
Subject: [PATCH 0055/3439] Sort members.
---
.../apache/commons/lang3/CharUtilsTest.java | 342 +++++++++---------
1 file changed, 171 insertions(+), 171 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/CharUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
index 2d10ade88e4..3b3128bebe9 100644
--- a/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
@@ -34,9 +34,16 @@
*/
public class CharUtilsTest {
+ private static final char CHAR_COPY = '\u00a9';
private static final Character CHARACTER_A = new Character('A');
private static final Character CHARACTER_B = new Character('B');
- private static final char CHAR_COPY = '\u00a9';
+
+ @Test
+ public void testCompare() {
+ assertTrue(CharUtils.compare('a', 'b') < 0);
+ assertTrue(CharUtils.compare('c', 'c') == 0);
+ assertTrue(CharUtils.compare('c', 'a') > 0);
+ }
@Test
public void testConstructor() {
@@ -48,36 +55,144 @@ public void testConstructor() {
assertFalse(Modifier.isFinal(BooleanUtils.class.getModifiers()));
}
- @SuppressWarnings("deprecation") // intentional test of deprecated method
@Test
- public void testToCharacterObject_char() {
- assertEquals(new Character('a'), CharUtils.toCharacterObject('a'));
- assertSame(CharUtils.toCharacterObject('a'), CharUtils.toCharacterObject('a'));
+ public void testIsAscii_char() {
+ assertTrue(CharUtils.isAscii('a'));
+ assertTrue(CharUtils.isAscii('A'));
+ assertTrue(CharUtils.isAscii('3'));
+ assertTrue(CharUtils.isAscii('-'));
+ assertTrue(CharUtils.isAscii('\n'));
+ assertFalse(CharUtils.isAscii(CHAR_COPY));
- for (int i = 0; i < 128; i++) {
- final Character ch = CharUtils.toCharacterObject((char) i);
- final Character ch2 = CharUtils.toCharacterObject((char) i);
- assertSame(ch, ch2);
- assertEquals(i, ch.charValue());
+ for (int i = 0; i < 255; i++) {
+ assertEquals(i < 128, CharUtils.isAscii((char) i));
}
- for (int i = 128; i < 196; i++) {
- final Character ch = CharUtils.toCharacterObject((char) i);
- final Character ch2 = CharUtils.toCharacterObject((char) i);
- assertEquals(ch, ch2);
- assertTrue(ch != ch2);
- assertEquals(i, ch.charValue());
- assertEquals(i, ch2.charValue());
+ }
+
+ @Test
+ public void testIsAsciiAlpha_char() {
+ assertTrue(CharUtils.isAsciiAlpha('a'));
+ assertTrue(CharUtils.isAsciiAlpha('A'));
+ assertFalse(CharUtils.isAsciiAlpha('3'));
+ assertFalse(CharUtils.isAsciiAlpha('-'));
+ assertFalse(CharUtils.isAsciiAlpha('\n'));
+ assertFalse(CharUtils.isAsciiAlpha(CHAR_COPY));
+
+ for (int i = 0; i < 196; i++) {
+ if ((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z')) {
+ assertTrue(CharUtils.isAsciiAlpha((char) i));
+ } else {
+ assertFalse(CharUtils.isAsciiAlpha((char) i));
+ }
}
- assertSame(CharUtils.toCharacterObject("a"), CharUtils.toCharacterObject('a'));
}
@Test
- public void testToCharacterObject_String() {
- assertNull(CharUtils.toCharacterObject(null));
- assertNull(CharUtils.toCharacterObject(""));
- assertEquals(new Character('a'), CharUtils.toCharacterObject("a"));
- assertEquals(new Character('a'), CharUtils.toCharacterObject("abc"));
- assertSame(CharUtils.toCharacterObject("a"), CharUtils.toCharacterObject("a"));
+ public void testIsAsciiAlphaLower_char() {
+ assertTrue(CharUtils.isAsciiAlphaLower('a'));
+ assertFalse(CharUtils.isAsciiAlphaLower('A'));
+ assertFalse(CharUtils.isAsciiAlphaLower('3'));
+ assertFalse(CharUtils.isAsciiAlphaLower('-'));
+ assertFalse(CharUtils.isAsciiAlphaLower('\n'));
+ assertFalse(CharUtils.isAsciiAlphaLower(CHAR_COPY));
+
+ for (int i = 0; i < 196; i++) {
+ if (i >= 'a' && i <= 'z') {
+ assertTrue(CharUtils.isAsciiAlphaLower((char) i));
+ } else {
+ assertFalse(CharUtils.isAsciiAlphaLower((char) i));
+ }
+ }
+ }
+
+ @Test
+ public void testIsAsciiAlphanumeric_char() {
+ assertTrue(CharUtils.isAsciiAlphanumeric('a'));
+ assertTrue(CharUtils.isAsciiAlphanumeric('A'));
+ assertTrue(CharUtils.isAsciiAlphanumeric('3'));
+ assertFalse(CharUtils.isAsciiAlphanumeric('-'));
+ assertFalse(CharUtils.isAsciiAlphanumeric('\n'));
+ assertFalse(CharUtils.isAsciiAlphanumeric(CHAR_COPY));
+
+ for (int i = 0; i < 196; i++) {
+ if ((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z') || (i >= '0' && i <= '9')) {
+ assertTrue(CharUtils.isAsciiAlphanumeric((char) i));
+ } else {
+ assertFalse(CharUtils.isAsciiAlphanumeric((char) i));
+ }
+ }
+ }
+
+ @Test
+ public void testIsAsciiAlphaUpper_char() {
+ assertFalse(CharUtils.isAsciiAlphaUpper('a'));
+ assertTrue(CharUtils.isAsciiAlphaUpper('A'));
+ assertFalse(CharUtils.isAsciiAlphaUpper('3'));
+ assertFalse(CharUtils.isAsciiAlphaUpper('-'));
+ assertFalse(CharUtils.isAsciiAlphaUpper('\n'));
+ assertFalse(CharUtils.isAsciiAlphaUpper(CHAR_COPY));
+
+ for (int i = 0; i < 196; i++) {
+ if (i >= 'A' && i <= 'Z') {
+ assertTrue(CharUtils.isAsciiAlphaUpper((char) i));
+ } else {
+ assertFalse(CharUtils.isAsciiAlphaUpper((char) i));
+ }
+ }
+ }
+
+ @Test
+ public void testIsAsciiControl_char() {
+ assertFalse(CharUtils.isAsciiControl('a'));
+ assertFalse(CharUtils.isAsciiControl('A'));
+ assertFalse(CharUtils.isAsciiControl('3'));
+ assertFalse(CharUtils.isAsciiControl('-'));
+ assertTrue(CharUtils.isAsciiControl('\n'));
+ assertFalse(CharUtils.isAsciiControl(CHAR_COPY));
+
+ for (int i = 0; i < 196; i++) {
+ if (i < 32 || i == 127) {
+ assertTrue(CharUtils.isAsciiControl((char) i));
+ } else {
+ assertFalse(CharUtils.isAsciiControl((char) i));
+ }
+ }
+ }
+
+ @Test
+ public void testIsAsciiNumeric_char() {
+ assertFalse(CharUtils.isAsciiNumeric('a'));
+ assertFalse(CharUtils.isAsciiNumeric('A'));
+ assertTrue(CharUtils.isAsciiNumeric('3'));
+ assertFalse(CharUtils.isAsciiNumeric('-'));
+ assertFalse(CharUtils.isAsciiNumeric('\n'));
+ assertFalse(CharUtils.isAsciiNumeric(CHAR_COPY));
+
+ for (int i = 0; i < 196; i++) {
+ if (i >= '0' && i <= '9') {
+ assertTrue(CharUtils.isAsciiNumeric((char) i));
+ } else {
+ assertFalse(CharUtils.isAsciiNumeric((char) i));
+ }
+ }
+ }
+
+ @Test
+ public void testIsAsciiPrintable_char() {
+ assertTrue(CharUtils.isAsciiPrintable('a'));
+ assertTrue(CharUtils.isAsciiPrintable('A'));
+ assertTrue(CharUtils.isAsciiPrintable('3'));
+ assertTrue(CharUtils.isAsciiPrintable('-'));
+ assertFalse(CharUtils.isAsciiPrintable('\n'));
+ assertFalse(CharUtils.isAsciiPrintable(CHAR_COPY));
+
+ for (int i = 0; i < 196; i++) {
+ if (i >= 32 && i <= 126) {
+ assertTrue(CharUtils.isAsciiPrintable((char) i));
+ } else {
+ assertFalse(CharUtils.isAsciiPrintable((char) i));
+ }
+ }
}
@Test
@@ -119,6 +234,38 @@ public void testToChar_String_char() {
assertEquals('X', CharUtils.toChar((String) null, 'X'));
}
+ @SuppressWarnings("deprecation") // intentional test of deprecated method
+ @Test
+ public void testToCharacterObject_char() {
+ assertEquals(new Character('a'), CharUtils.toCharacterObject('a'));
+ assertSame(CharUtils.toCharacterObject('a'), CharUtils.toCharacterObject('a'));
+
+ for (int i = 0; i < 128; i++) {
+ final Character ch = CharUtils.toCharacterObject((char) i);
+ final Character ch2 = CharUtils.toCharacterObject((char) i);
+ assertSame(ch, ch2);
+ assertEquals(i, ch.charValue());
+ }
+ for (int i = 128; i < 196; i++) {
+ final Character ch = CharUtils.toCharacterObject((char) i);
+ final Character ch2 = CharUtils.toCharacterObject((char) i);
+ assertEquals(ch, ch2);
+ assertTrue(ch != ch2);
+ assertEquals(i, ch.charValue());
+ assertEquals(i, ch2.charValue());
+ }
+ assertSame(CharUtils.toCharacterObject("a"), CharUtils.toCharacterObject('a'));
+ }
+
+ @Test
+ public void testToCharacterObject_String() {
+ assertNull(CharUtils.toCharacterObject(null));
+ assertNull(CharUtils.toCharacterObject(""));
+ assertEquals(new Character('a'), CharUtils.toCharacterObject("a"));
+ assertEquals(new Character('a'), CharUtils.toCharacterObject("abc"));
+ assertSame(CharUtils.toCharacterObject("a"), CharUtils.toCharacterObject("a"));
+ }
+
@Test
public void testToIntValue_char() {
assertEquals(0, CharUtils.toIntValue('0'));
@@ -217,151 +364,4 @@ public void testToUnicodeEscaped_Character() {
assertNull(CharUtils.unicodeEscaped(null));
assertEquals("\\u0041", CharUtils.unicodeEscaped(CHARACTER_A));
}
-
- @Test
- public void testIsAscii_char() {
- assertTrue(CharUtils.isAscii('a'));
- assertTrue(CharUtils.isAscii('A'));
- assertTrue(CharUtils.isAscii('3'));
- assertTrue(CharUtils.isAscii('-'));
- assertTrue(CharUtils.isAscii('\n'));
- assertFalse(CharUtils.isAscii(CHAR_COPY));
-
- for (int i = 0; i < 255; i++) {
- assertEquals(i < 128, CharUtils.isAscii((char) i));
- }
- }
-
- @Test
- public void testIsAsciiPrintable_char() {
- assertTrue(CharUtils.isAsciiPrintable('a'));
- assertTrue(CharUtils.isAsciiPrintable('A'));
- assertTrue(CharUtils.isAsciiPrintable('3'));
- assertTrue(CharUtils.isAsciiPrintable('-'));
- assertFalse(CharUtils.isAsciiPrintable('\n'));
- assertFalse(CharUtils.isAsciiPrintable(CHAR_COPY));
-
- for (int i = 0; i < 196; i++) {
- if (i >= 32 && i <= 126) {
- assertTrue(CharUtils.isAsciiPrintable((char) i));
- } else {
- assertFalse(CharUtils.isAsciiPrintable((char) i));
- }
- }
- }
-
- @Test
- public void testIsAsciiControl_char() {
- assertFalse(CharUtils.isAsciiControl('a'));
- assertFalse(CharUtils.isAsciiControl('A'));
- assertFalse(CharUtils.isAsciiControl('3'));
- assertFalse(CharUtils.isAsciiControl('-'));
- assertTrue(CharUtils.isAsciiControl('\n'));
- assertFalse(CharUtils.isAsciiControl(CHAR_COPY));
-
- for (int i = 0; i < 196; i++) {
- if (i < 32 || i == 127) {
- assertTrue(CharUtils.isAsciiControl((char) i));
- } else {
- assertFalse(CharUtils.isAsciiControl((char) i));
- }
- }
- }
-
- @Test
- public void testIsAsciiAlpha_char() {
- assertTrue(CharUtils.isAsciiAlpha('a'));
- assertTrue(CharUtils.isAsciiAlpha('A'));
- assertFalse(CharUtils.isAsciiAlpha('3'));
- assertFalse(CharUtils.isAsciiAlpha('-'));
- assertFalse(CharUtils.isAsciiAlpha('\n'));
- assertFalse(CharUtils.isAsciiAlpha(CHAR_COPY));
-
- for (int i = 0; i < 196; i++) {
- if ((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z')) {
- assertTrue(CharUtils.isAsciiAlpha((char) i));
- } else {
- assertFalse(CharUtils.isAsciiAlpha((char) i));
- }
- }
- }
-
- @Test
- public void testIsAsciiAlphaUpper_char() {
- assertFalse(CharUtils.isAsciiAlphaUpper('a'));
- assertTrue(CharUtils.isAsciiAlphaUpper('A'));
- assertFalse(CharUtils.isAsciiAlphaUpper('3'));
- assertFalse(CharUtils.isAsciiAlphaUpper('-'));
- assertFalse(CharUtils.isAsciiAlphaUpper('\n'));
- assertFalse(CharUtils.isAsciiAlphaUpper(CHAR_COPY));
-
- for (int i = 0; i < 196; i++) {
- if (i >= 'A' && i <= 'Z') {
- assertTrue(CharUtils.isAsciiAlphaUpper((char) i));
- } else {
- assertFalse(CharUtils.isAsciiAlphaUpper((char) i));
- }
- }
- }
-
- @Test
- public void testIsAsciiAlphaLower_char() {
- assertTrue(CharUtils.isAsciiAlphaLower('a'));
- assertFalse(CharUtils.isAsciiAlphaLower('A'));
- assertFalse(CharUtils.isAsciiAlphaLower('3'));
- assertFalse(CharUtils.isAsciiAlphaLower('-'));
- assertFalse(CharUtils.isAsciiAlphaLower('\n'));
- assertFalse(CharUtils.isAsciiAlphaLower(CHAR_COPY));
-
- for (int i = 0; i < 196; i++) {
- if (i >= 'a' && i <= 'z') {
- assertTrue(CharUtils.isAsciiAlphaLower((char) i));
- } else {
- assertFalse(CharUtils.isAsciiAlphaLower((char) i));
- }
- }
- }
-
- @Test
- public void testIsAsciiNumeric_char() {
- assertFalse(CharUtils.isAsciiNumeric('a'));
- assertFalse(CharUtils.isAsciiNumeric('A'));
- assertTrue(CharUtils.isAsciiNumeric('3'));
- assertFalse(CharUtils.isAsciiNumeric('-'));
- assertFalse(CharUtils.isAsciiNumeric('\n'));
- assertFalse(CharUtils.isAsciiNumeric(CHAR_COPY));
-
- for (int i = 0; i < 196; i++) {
- if (i >= '0' && i <= '9') {
- assertTrue(CharUtils.isAsciiNumeric((char) i));
- } else {
- assertFalse(CharUtils.isAsciiNumeric((char) i));
- }
- }
- }
-
- @Test
- public void testIsAsciiAlphanumeric_char() {
- assertTrue(CharUtils.isAsciiAlphanumeric('a'));
- assertTrue(CharUtils.isAsciiAlphanumeric('A'));
- assertTrue(CharUtils.isAsciiAlphanumeric('3'));
- assertFalse(CharUtils.isAsciiAlphanumeric('-'));
- assertFalse(CharUtils.isAsciiAlphanumeric('\n'));
- assertFalse(CharUtils.isAsciiAlphanumeric(CHAR_COPY));
-
- for (int i = 0; i < 196; i++) {
- if ((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z') || (i >= '0' && i <= '9')) {
- assertTrue(CharUtils.isAsciiAlphanumeric((char) i));
- } else {
- assertFalse(CharUtils.isAsciiAlphanumeric((char) i));
- }
- }
- }
-
- @Test
- public void testCompare() {
- assertTrue(CharUtils.compare('a', 'b') < 0);
- assertTrue(CharUtils.compare('c', 'c') == 0);
- assertTrue(CharUtils.compare('c', 'a') > 0);
- }
}
From b52c69b1b0ba1c542b917247f1f76deb4ce2a42d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 23 Oct 2017 10:40:17 -0600
Subject: [PATCH 0056/3439] Sort members.
---
.../apache/commons/lang3/ClassUtilsTest.java | 1534 ++++++++---------
1 file changed, 767 insertions(+), 767 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
index 6b97fb5ed7c..5aa2baff223 100644
--- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
@@ -50,182 +50,108 @@
@SuppressWarnings("boxing") // JUnit4 does not support primitive equality testing apart from long
public class ClassUtilsTest {
- private static class Inner {
- private class DeeplyNested{}
+ private static class CX implements IB, IA, IE {
}
- //-----------------------------------------------------------------------
- @Test
- public void testConstructor() {
- assertNotNull(new ClassUtils());
- final Constructor>[] cons = ClassUtils.class.getDeclaredConstructors();
- assertEquals(1, cons.length);
- assertTrue(Modifier.isPublic(cons[0].getModifiers()));
- assertTrue(Modifier.isPublic(ClassUtils.class.getModifiers()));
- assertFalse(Modifier.isFinal(ClassUtils.class.getModifiers()));
+ private static class CY extends CX implements IB, IC {
}
- // -------------------------------------------------------------------------
- @Test
- public void test_getShortClassName_Object() {
- assertEquals("ClassUtils", ClassUtils.getShortClassName(new ClassUtils(), ""));
- assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(new Inner(), ""));
- assertEquals("String", ClassUtils.getShortClassName("hello", ""));
- assertEquals("", ClassUtils.getShortClassName(null, ""));
-
- // Inner types
- class Named {}
- assertEquals("ClassUtilsTest.1", ClassUtils.getShortClassName(new Object(){}, ""));
- assertEquals("ClassUtilsTest.1Named", ClassUtils.getShortClassName(new Named(), ""));
- assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(new Inner(), ""));
+ private interface IA {
}
- @Test
- public void test_getShortClassName_Class() {
- assertEquals("ClassUtils", ClassUtils.getShortClassName(ClassUtils.class));
- assertEquals("Map.Entry", ClassUtils.getShortClassName(Map.Entry.class));
- assertEquals("", ClassUtils.getShortClassName((Class>) null));
-
- // LANG-535
- assertEquals("String[]", ClassUtils.getShortClassName(String[].class));
- assertEquals("Map.Entry[]", ClassUtils.getShortClassName(Map.Entry[].class));
-
- // Primitives
- assertEquals("boolean", ClassUtils.getShortClassName(boolean.class));
- assertEquals("byte", ClassUtils.getShortClassName(byte.class));
- assertEquals("char", ClassUtils.getShortClassName(char.class));
- assertEquals("short", ClassUtils.getShortClassName(short.class));
- assertEquals("int", ClassUtils.getShortClassName(int.class));
- assertEquals("long", ClassUtils.getShortClassName(long.class));
- assertEquals("float", ClassUtils.getShortClassName(float.class));
- assertEquals("double", ClassUtils.getShortClassName(double.class));
-
- // Primitive Arrays
- assertEquals("boolean[]", ClassUtils.getShortClassName(boolean[].class));
- assertEquals("byte[]", ClassUtils.getShortClassName(byte[].class));
- assertEquals("char[]", ClassUtils.getShortClassName(char[].class));
- assertEquals("short[]", ClassUtils.getShortClassName(short[].class));
- assertEquals("int[]", ClassUtils.getShortClassName(int[].class));
- assertEquals("long[]", ClassUtils.getShortClassName(long[].class));
- assertEquals("float[]", ClassUtils.getShortClassName(float[].class));
- assertEquals("double[]", ClassUtils.getShortClassName(double[].class));
-
- // Arrays of arrays of ...
- assertEquals("String[][]", ClassUtils.getShortClassName(String[][].class));
- assertEquals("String[][][]", ClassUtils.getShortClassName(String[][][].class));
- assertEquals("String[][][][]", ClassUtils.getShortClassName(String[][][][].class));
-
- // Inner types
- class Named {}
- assertEquals("ClassUtilsTest.2", ClassUtils.getShortClassName(new Object(){}.getClass()));
- assertEquals("ClassUtilsTest.2Named", ClassUtils.getShortClassName(Named.class));
- assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(Inner.class));
+ private interface IB {
}
- @Test
- public void test_getShortClassName_String() {
- assertEquals("ClassUtils", ClassUtils.getShortClassName(ClassUtils.class.getName()));
- assertEquals("Map.Entry", ClassUtils.getShortClassName(Map.Entry.class.getName()));
- assertEquals("", ClassUtils.getShortClassName((String) null));
- assertEquals("", ClassUtils.getShortClassName(""));
+ private interface IC extends ID, IE {
}
- @Test
- public void test_getSimpleName_Class() {
- assertEquals("ClassUtils", ClassUtils.getSimpleName(ClassUtils.class));
- assertEquals("Entry", ClassUtils.getSimpleName(Map.Entry.class));
- assertEquals("", ClassUtils.getSimpleName(null));
+ private interface ID {
+ }
- // LANG-535
- assertEquals("String[]", ClassUtils.getSimpleName(String[].class));
- assertEquals("Entry[]", ClassUtils.getSimpleName(Map.Entry[].class));
+ private interface IE extends IF {
+ }
- // Primitives
- assertEquals("boolean", ClassUtils.getSimpleName(boolean.class));
- assertEquals("byte", ClassUtils.getSimpleName(byte.class));
- assertEquals("char", ClassUtils.getSimpleName(char.class));
- assertEquals("short", ClassUtils.getSimpleName(short.class));
- assertEquals("int", ClassUtils.getSimpleName(int.class));
- assertEquals("long", ClassUtils.getSimpleName(long.class));
- assertEquals("float", ClassUtils.getSimpleName(float.class));
- assertEquals("double", ClassUtils.getSimpleName(double.class));
+ private interface IF {
+ }
- // Primitive Arrays
- assertEquals("boolean[]", ClassUtils.getSimpleName(boolean[].class));
- assertEquals("byte[]", ClassUtils.getSimpleName(byte[].class));
- assertEquals("char[]", ClassUtils.getSimpleName(char[].class));
- assertEquals("short[]", ClassUtils.getSimpleName(short[].class));
- assertEquals("int[]", ClassUtils.getSimpleName(int[].class));
- assertEquals("long[]", ClassUtils.getSimpleName(long[].class));
- assertEquals("float[]", ClassUtils.getSimpleName(float[].class));
- assertEquals("double[]", ClassUtils.getSimpleName(double[].class));
+ private static class Inner {
+ private class DeeplyNested{}
+ }
- // Arrays of arrays of ...
- assertEquals("String[][]", ClassUtils.getSimpleName(String[][].class));
- assertEquals("String[][][]", ClassUtils.getSimpleName(String[][][].class));
- assertEquals("String[][][][]", ClassUtils.getSimpleName(String[][][][].class));
+ private void assertGetClassReturnsClass( final Class> c ) throws Exception {
+ assertEquals( c, ClassUtils.getClass( c.getName() ) );
+ }
- // On-the-fly types
- class Named {}
- assertEquals("", ClassUtils.getSimpleName(new Object(){}.getClass()));
- assertEquals("Named", ClassUtils.getSimpleName(Named.class));
+ private void assertGetClassThrowsClassNotFound( final String className ) throws Exception {
+ assertGetClassThrowsException( className, ClassNotFoundException.class );
}
- @Test
- public void test_getSimpleName_Object() {
- assertEquals("ClassUtils", ClassUtils.getSimpleName(new ClassUtils(), ""));
- assertEquals("Inner", ClassUtils.getSimpleName(new Inner(), ""));
- assertEquals("String", ClassUtils.getSimpleName("hello", ""));
- assertEquals("", ClassUtils.getSimpleName(null, ""));
+ private void assertGetClassThrowsException( final String className, final Class> exceptionType ) throws Exception {
+ try {
+ ClassUtils.getClass( className );
+ fail( "ClassUtils.getClass() should fail with an exception of type " + exceptionType.getName() + " when given class name \"" + className + "\"." );
+ } catch( final Exception e ) {
+ assertTrue( exceptionType.isAssignableFrom( e.getClass() ) );
+ }
}
- // -------------------------------------------------------------------------
- @Test
- public void test_getPackageName_Object() {
- assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new ClassUtils(), ""));
- assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new Inner(), ""));
- assertEquals("", ClassUtils.getPackageName(null, ""));
+ private void assertGetClassThrowsNullPointerException( final String className ) throws Exception {
+ assertGetClassThrowsException( className, NullPointerException.class );
}
@Test
- public void test_getPackageName_Class() {
- assertEquals("java.lang", ClassUtils.getPackageName(String.class));
- assertEquals("java.util", ClassUtils.getPackageName(Map.Entry.class));
- assertEquals("", ClassUtils.getPackageName((Class>) null));
-
- // LANG-535
- assertEquals("java.lang", ClassUtils.getPackageName(String[].class));
-
- // Primitive Arrays
- assertEquals("", ClassUtils.getPackageName(boolean[].class));
- assertEquals("", ClassUtils.getPackageName(byte[].class));
- assertEquals("", ClassUtils.getPackageName(char[].class));
- assertEquals("", ClassUtils.getPackageName(short[].class));
- assertEquals("", ClassUtils.getPackageName(int[].class));
- assertEquals("", ClassUtils.getPackageName(long[].class));
- assertEquals("", ClassUtils.getPackageName(float[].class));
- assertEquals("", ClassUtils.getPackageName(double[].class));
+ public void test_convertClassesToClassNames_List() {
+ final List> list = new ArrayList<>();
+ List result = ClassUtils.convertClassesToClassNames(list);
+ assertEquals(0, result.size());
- // Arrays of arrays of ...
- assertEquals("java.lang", ClassUtils.getPackageName(String[][].class));
- assertEquals("java.lang", ClassUtils.getPackageName(String[][][].class));
- assertEquals("java.lang", ClassUtils.getPackageName(String[][][][].class));
+ list.add(String.class);
+ list.add(null);
+ list.add(Object.class);
+ result = ClassUtils.convertClassesToClassNames(list);
+ assertEquals(3, result.size());
+ assertEquals("java.lang.String", result.get(0));
+ assertNull(result.get(1));
+ assertEquals("java.lang.Object", result.get(2));
- // On-the-fly types
- class Named {}
- assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new Object() {
- }.getClass()));
- assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(Named.class));
+ @SuppressWarnings("unchecked") // test what happens when non-generic code adds wrong type of element
+ final
+ List
*
*
These are ideal classes to start using if you're looking to get into Lang.
- * StringUtils' {@link org.apache.commons.lang3.StringUtils#capitalize(String)}, {@link org.apache.commons.lang3.StringUtils#substringBetween(String, String)}/{@link org.apache.commons.lang3.StringUtils#substringBefore(String, String) Before}/{@link org.apache.commons.lang3.StringUtils#substringAfter(String, String) After}, {@link org.apache.commons.lang3.StringUtils#split(String)} and {@link org.apache.commons.lang3.StringUtils#join(Object[])} are good methods to begin with.
- * If you use java.sql.Statements a lot, StringEscapeUtils.escapeSql might be of interest.
+ * StringUtils' {@link org.apache.commons.lang3.StringUtils#capitalize(String)}, {@link org.apache.commons.lang3.StringUtils#substringBetween(String, String)}/{@link org.apache.commons.lang3.StringUtils#substringBefore(String, String) Before}/{@link org.apache.commons.lang3.StringUtils#substringAfter(String, String) After}, {@link org.apache.commons.lang3.StringUtils#split(String)} and {@link org.apache.commons.lang3.StringUtils#join(Object[])} are good methods to begin with.
*
*
Character handling - CharSetUtils, CharSet, CharRange, CharUtils
*
From 758228f691b34c97f421ed92336772531495e0cc Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Fri, 27 Oct 2017 14:57:41 +0200
Subject: [PATCH 0066/3439] EventCountCircuitBreakerTest#testNow: improve
assertion failure message
(side-effects: close #298, close #297, close #279, close #184, close #75)
---
.../commons/lang3/concurrent/EventCountCircuitBreakerTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
index 5a92fd53af2..1c9e7941147 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
@@ -100,7 +100,7 @@ public void testNow() {
TimeUnit.SECONDS);
final long now = breaker.now();
final long delta = Math.abs(System.nanoTime() - now);
- assertTrue("Delta to current time too large", delta < 100000);
+ assertTrue(String.format("Delta %d ns to current time too large", delta), delta < 100000);
}
/**
From a26c66a8edcf029ca5f94354cee0db267e9ccc20 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 3 Nov 2017 11:14:26 -0600
Subject: [PATCH 0067/3439] Pft! Fix typo.
---
src/test/java/org/apache/commons/lang3/SystemUtilsTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index 755b4e46175..05ae457fd2f 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -379,7 +379,7 @@ public void testJavaVersionMatches() {
}
@Test
- public void testIsJavaVersionAtLeat() throws Exception {
+ public void testIsJavaVersionAtLeast() throws Exception {
if (SystemUtils.IS_JAVA_1_7) {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
From a618b844c5a261ced37385ab3947de6e215d46f7 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 3 Nov 2017 11:33:34 -0600
Subject: [PATCH 0068/3439] [LANG-1365] Fix NullPointerException in
isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add
JavaVersion.JAVA_10.
---
src/changes/changes.xml | 3 +-
.../org/apache/commons/lang3/JavaVersion.java | 11 +++++++
.../org/apache/commons/lang3/SystemUtils.java | 12 +++++++
.../apache/commons/lang3/JavaVersionTest.java | 2 ++
.../apache/commons/lang3/SystemUtilsTest.java | 33 ++++++++++++++++++-
5 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bea599d09ee..cbc17a03df9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,7 +45,8 @@ The type attribute can be add,update,fix,remove.
-
+
+ Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10Improve StringUtils#replace throughputTimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.)StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf
diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java
index e464043e7ed..666624d5587 100644
--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java
+++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java
@@ -82,9 +82,18 @@ public enum JavaVersion {
/**
* Java 9
+ *
+ * @since 3.5
*/
JAVA_9(9.0f, "9"),
+ /**
+ * Java 10
+ *
+ * @since 3.7
+ */
+ JAVA_10(10.0f, "10"),
+
/**
* The most recent java version. Mainly introduced to avoid to break when a new version of Java is used.
*/
@@ -168,6 +177,8 @@ static JavaVersion get(final String nom) {
return JAVA_1_8;
} else if ("9".equals(nom)) {
return JAVA_9;
+ } else if ("10".equals(nom)) {
+ return JAVA_10;
}
if (nom == null) {
return null;
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 50d260ba0ae..74a90fca5e0 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -973,6 +973,18 @@ public class SystemUtils {
*/
public static final boolean IS_JAVA_9 = getJavaVersionMatches("9");
+ /**
+ *
+ * Is {@code true} if this is Java version 10 (also 10.x versions).
+ *
+ *
+ * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
+ *
+ *
+ * @since 3.7
+ */
+ public static final boolean IS_JAVA_10 = getJavaVersionMatches("10");
+
// Operating system checks
// -----------------------------------------------------------------------
// These MUST be declared after those above as they depend on the
diff --git a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
index 2e8c2d5f125..4d4202c49bc 100644
--- a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
+++ b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
@@ -34,6 +34,7 @@
import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
import static org.apache.commons.lang3.JavaVersion.JAVA_9;
+import static org.apache.commons.lang3.JavaVersion.JAVA_10;
import static org.apache.commons.lang3.JavaVersion.get;
import static org.apache.commons.lang3.JavaVersion.getJavaVersion;
@@ -54,6 +55,7 @@ public void testGetJavaVersion() {
assertEquals("1.7 failed", JAVA_1_7, get("1.7"));
assertEquals("1.8 failed", JAVA_1_8, get("1.8"));
assertEquals("9 failed", JAVA_9, get("9"));
+ assertEquals("10 failed", JAVA_10, get("10"));
assertEquals("1.10 failed", JAVA_RECENT, get("1.10"));
// assertNull("2.10 unexpectedly worked", get("2.10"));
assertEquals("Wrapper method failed", get("1.5"), getJavaVersion("1.5"));
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index 05ae457fd2f..b97cb811331 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -28,6 +28,7 @@
import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
import static org.apache.commons.lang3.JavaVersion.JAVA_9;
+import static org.apache.commons.lang3.JavaVersion.JAVA_10;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -119,6 +120,7 @@ public void testIS_JAVA() {
assertFalse(SystemUtils.IS_JAVA_1_8);
assertFalse(SystemUtils.IS_JAVA_1_9);
assertFalse(SystemUtils.IS_JAVA_9);
+ assertFalse(SystemUtils.IS_JAVA_10);
} else if (javaVersion.startsWith("1.7")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -130,6 +132,7 @@ public void testIS_JAVA() {
assertFalse(SystemUtils.IS_JAVA_1_8);
assertFalse(SystemUtils.IS_JAVA_1_9);
assertFalse(SystemUtils.IS_JAVA_9);
+ assertFalse(SystemUtils.IS_JAVA_10);
} else if (javaVersion.startsWith("1.8")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -141,6 +144,7 @@ public void testIS_JAVA() {
assertTrue(SystemUtils.IS_JAVA_1_8);
assertFalse(SystemUtils.IS_JAVA_1_9);
assertFalse(SystemUtils.IS_JAVA_9);
+ assertFalse(SystemUtils.IS_JAVA_10);
} else if (javaVersion.startsWith("9")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -152,8 +156,21 @@ public void testIS_JAVA() {
assertFalse(SystemUtils.IS_JAVA_1_8);
assertTrue(SystemUtils.IS_JAVA_1_9);
assertTrue(SystemUtils.IS_JAVA_9);
+ assertFalse(SystemUtils.IS_JAVA_10);
+ } else if (javaVersion.startsWith("10")) {
+ assertFalse(SystemUtils.IS_JAVA_1_1);
+ assertFalse(SystemUtils.IS_JAVA_1_2);
+ assertFalse(SystemUtils.IS_JAVA_1_3);
+ assertFalse(SystemUtils.IS_JAVA_1_4);
+ assertFalse(SystemUtils.IS_JAVA_1_5);
+ assertFalse(SystemUtils.IS_JAVA_1_6);
+ assertFalse(SystemUtils.IS_JAVA_1_7);
+ assertFalse(SystemUtils.IS_JAVA_1_8);
+ assertFalse(SystemUtils.IS_JAVA_1_9);
+ assertFalse(SystemUtils.IS_JAVA_9);
+ assertTrue(SystemUtils.IS_JAVA_10);
} else {
- System.out.println("Can't test IS_JAVA value: "+javaVersion);
+ System.out.println("Can't test IS_JAVA value: " + javaVersion);
}
}
@@ -390,6 +407,7 @@ public void testIsJavaVersionAtLeast() throws Exception {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_9));
+ assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
} else if (SystemUtils.IS_JAVA_1_8) {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
@@ -400,6 +418,7 @@ public void testIsJavaVersionAtLeast() throws Exception {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_9));
+ assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
} else if (SystemUtils.IS_JAVA_9) {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
@@ -410,6 +429,18 @@ public void testIsJavaVersionAtLeast() throws Exception {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_9));
+ assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+ } else if (SystemUtils.IS_JAVA_10) {
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_3));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_4));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_5));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_6));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_9));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_10));
}
}
From 63f6be088d790fd597a3dc5d8e981a0872bf112b Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 3 Nov 2017 11:38:09 -0600
Subject: [PATCH 0069/3439] Sort entries by type.
---
src/changes/changes.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cbc17a03df9..f0e3bc8f50a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,15 +47,15 @@ The type attribute can be add,update,fix,remove.
Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10
- Improve StringUtils#replace throughput
- TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.)StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf
- Remove deprecation from RandomStringUtilsConstructorUtils.invokeConstructor(Class, Object...) regressionEqualsBuilder#isRegistered: swappedPair construction bugorg.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale)
- Add methods to ObjectUtils to get various forms of class names in a null-safe manner
+ Improve StringUtils#replace throughput
+ Remove deprecation from RandomStringUtilsExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause()
+ TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.)
+ Add methods to ObjectUtils to get various forms of class names in a null-safe manner
From f746c508d197c3662509037e8975a2a58b847689 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sat, 4 Nov 2017 14:05:48 +0100
Subject: [PATCH 0070/3439] [LANG-1365] Fix NullPointerException in
isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add
JavaVersion.JAVA_10.
Fix check-style violations.
---
src/main/java/org/apache/commons/lang3/JavaVersion.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java
index 666624d5587..a0744536355 100644
--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java
+++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java
@@ -82,14 +82,14 @@ public enum JavaVersion {
/**
* Java 9
- *
+ *
* @since 3.5
*/
JAVA_9(9.0f, "9"),
/**
* Java 10
- *
+ *
* @since 3.7
*/
JAVA_10(10.0f, "10"),
@@ -103,6 +103,7 @@ public enum JavaVersion {
* The float value.
*/
private final float value;
+
/**
* The standard name.
*/
From fc409b5791ef8145a791cf7bd9b35d68a4ad3305 Mon Sep 17 00:00:00 2001
From: Stephen Colebourne
Date: Sat, 4 Nov 2017 08:41:28 -0600
Subject: [PATCH 0071/3439] Fix DateUtilsTest to work reliably on Java 9. This
closes #304.
---
.../commons/lang3/time/DateUtilsTest.java | 415 +++++++++---------
1 file changed, 215 insertions(+), 200 deletions(-)
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 686c1a62284..671c385d181 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
@@ -104,16 +104,19 @@ public void setUp() throws Exception {
date2 = dateTimeParser.parse("November 18, 2001 1:23:11.321");
defaultZone = TimeZone.getDefault();
zone = TimeZone.getTimeZone("MET");
- TimeZone.setDefault(zone);
- dateTimeParser.setTimeZone(zone);
- date3 = dateTimeParser.parse("March 30, 2003 05:30:45.000");
- date4 = dateTimeParser.parse("March 30, 2003 01:10:00.000");
- date5 = dateTimeParser.parse("March 30, 2003 01:40:00.000");
- date6 = dateTimeParser.parse("March 30, 2003 02:10:00.000");
- date7 = dateTimeParser.parse("March 30, 2003 02:40:00.000");
- date8 = dateTimeParser.parse("October 26, 2003 05:30:45.000");
- dateTimeParser.setTimeZone(defaultZone);
- TimeZone.setDefault(defaultZone);
+ try {
+ TimeZone.setDefault(zone);
+ dateTimeParser.setTimeZone(zone);
+ date3 = dateTimeParser.parse("March 30, 2003 05:30:45.000");
+ date4 = dateTimeParser.parse("March 30, 2003 01:10:00.000");
+ date5 = dateTimeParser.parse("March 30, 2003 01:40:00.000");
+ date6 = dateTimeParser.parse("March 30, 2003 02:10:00.000");
+ date7 = dateTimeParser.parse("March 30, 2003 02:40:00.000");
+ date8 = dateTimeParser.parse("October 26, 2003 05:30:45.000");
+ } finally {
+ dateTimeParser.setTimeZone(defaultZone);
+ TimeZone.setDefault(defaultZone);
+ }
calAmPm1 = Calendar.getInstance();
calAmPm1.setTime(dateAmPm1);
calAmPm2 = Calendar.getInstance();
@@ -126,20 +129,23 @@ public void setUp() throws Exception {
cal1.setTime(date1);
cal2 = Calendar.getInstance();
cal2.setTime(date2);
- TimeZone.setDefault(zone);
- cal3 = Calendar.getInstance();
- cal3.setTime(date3);
- cal4 = Calendar.getInstance();
- cal4.setTime(date4);
- cal5 = Calendar.getInstance();
- cal5.setTime(date5);
- cal6 = Calendar.getInstance();
- cal6.setTime(date6);
- cal7 = Calendar.getInstance();
- cal7.setTime(date7);
- cal8 = Calendar.getInstance();
- cal8.setTime(date8);
- TimeZone.setDefault(defaultZone);
+ try {
+ TimeZone.setDefault(zone);
+ cal3 = Calendar.getInstance();
+ cal3.setTime(date3);
+ cal4 = Calendar.getInstance();
+ cal4.setTime(date4);
+ cal5 = Calendar.getInstance();
+ cal5.setTime(date5);
+ cal6 = Calendar.getInstance();
+ cal6.setTime(date6);
+ cal7 = Calendar.getInstance();
+ cal7.setTime(date7);
+ cal8 = Calendar.getInstance();
+ cal8.setTime(date8);
+ } finally {
+ TimeZone.setDefault(defaultZone);
+ }
}
//-----------------------------------------------------------------------
@@ -885,59 +891,62 @@ public void testRound() throws Exception {
// Fix for http://issues.apache.org/bugzilla/show_bug.cgi?id=25560 / LANG-13
// Test rounding across the beginning of daylight saving time
- TimeZone.setDefault(zone);
- dateTimeParser.setTimeZone(zone);
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.round(date4, Calendar.DATE));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.round((Object) cal4, Calendar.DATE));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.round(date5, Calendar.DATE));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.round((Object) cal5, Calendar.DATE));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.round(date6, Calendar.DATE));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.round((Object) cal6, Calendar.DATE));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.round(date7, Calendar.DATE));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.round((Object) cal7, Calendar.DATE));
-
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 01:00:00.000"),
- DateUtils.round(date4, Calendar.HOUR_OF_DAY));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 01:00:00.000"),
- DateUtils.round((Object) cal4, Calendar.HOUR_OF_DAY));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 03:00:00.000"),
- DateUtils.round(date5, Calendar.HOUR_OF_DAY));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 03:00:00.000"),
- DateUtils.round((Object) cal5, Calendar.HOUR_OF_DAY));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 03:00:00.000"),
- DateUtils.round(date6, Calendar.HOUR_OF_DAY));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 03:00:00.000"),
- DateUtils.round((Object) cal6, Calendar.HOUR_OF_DAY));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 04:00:00.000"),
- DateUtils.round(date7, Calendar.HOUR_OF_DAY));
- assertEquals("round MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 04:00:00.000"),
- DateUtils.round((Object) cal7, Calendar.HOUR_OF_DAY));
- TimeZone.setDefault(defaultZone);
- dateTimeParser.setTimeZone(defaultZone);
+ try {
+ TimeZone.setDefault(zone);
+ dateTimeParser.setTimeZone(zone);
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.round(date4, Calendar.DATE));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.round((Object) cal4, Calendar.DATE));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.round(date5, Calendar.DATE));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.round((Object) cal5, Calendar.DATE));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.round(date6, Calendar.DATE));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.round((Object) cal6, Calendar.DATE));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.round(date7, Calendar.DATE));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.round((Object) cal7, Calendar.DATE));
+
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 01:00:00.000"),
+ DateUtils.round(date4, Calendar.HOUR_OF_DAY));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 01:00:00.000"),
+ DateUtils.round((Object) cal4, Calendar.HOUR_OF_DAY));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 03:00:00.000"),
+ DateUtils.round(date5, Calendar.HOUR_OF_DAY));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 03:00:00.000"),
+ DateUtils.round((Object) cal5, Calendar.HOUR_OF_DAY));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 03:00:00.000"),
+ DateUtils.round(date6, Calendar.HOUR_OF_DAY));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 03:00:00.000"),
+ DateUtils.round((Object) cal6, Calendar.HOUR_OF_DAY));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 04:00:00.000"),
+ DateUtils.round(date7, Calendar.HOUR_OF_DAY));
+ assertEquals("round MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 04:00:00.000"),
+ DateUtils.round((Object) cal7, Calendar.HOUR_OF_DAY));
+ } finally {
+ TimeZone.setDefault(defaultZone);
+ dateTimeParser.setTimeZone(defaultZone);
+ }
}
/**
@@ -948,8 +957,6 @@ public void testRound() throws Exception {
*/
@Test
public void testRoundLang346() throws Exception {
- TimeZone.setDefault(defaultZone);
- dateTimeParser.setTimeZone(defaultZone);
final Calendar testCalendar = Calendar.getInstance();
testCalendar.set(2007, Calendar.JULY, 2, 8, 8, 50);
Date date = testCalendar.getTime();
@@ -1163,23 +1170,26 @@ public void testTruncate() throws Exception {
// Fix for http://issues.apache.org/bugzilla/show_bug.cgi?id=25560
// Test truncate across beginning of daylight saving time
- TimeZone.setDefault(zone);
- dateTimeParser.setTimeZone(zone);
- assertEquals("truncate MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.truncate(date3, Calendar.DATE));
- assertEquals("truncate MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 00:00:00.000"),
- DateUtils.truncate((Object) cal3, Calendar.DATE));
- // Test truncate across end of daylight saving time
- assertEquals("truncate MET date across DST change-over",
- dateTimeParser.parse("October 26, 2003 00:00:00.000"),
- DateUtils.truncate(date8, Calendar.DATE));
- assertEquals("truncate MET date across DST change-over",
- dateTimeParser.parse("October 26, 2003 00:00:00.000"),
- DateUtils.truncate((Object) cal8, Calendar.DATE));
- TimeZone.setDefault(defaultZone);
- dateTimeParser.setTimeZone(defaultZone);
+ try {
+ TimeZone.setDefault(zone);
+ dateTimeParser.setTimeZone(zone);
+ assertEquals("truncate MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.truncate(date3, Calendar.DATE));
+ assertEquals("truncate MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 00:00:00.000"),
+ DateUtils.truncate((Object) cal3, Calendar.DATE));
+ // Test truncate across end of daylight saving time
+ assertEquals("truncate MET date across DST change-over",
+ dateTimeParser.parse("October 26, 2003 00:00:00.000"),
+ DateUtils.truncate(date8, Calendar.DATE));
+ assertEquals("truncate MET date across DST change-over",
+ dateTimeParser.parse("October 26, 2003 00:00:00.000"),
+ DateUtils.truncate((Object) cal8, Calendar.DATE));
+ } finally {
+ TimeZone.setDefault(defaultZone);
+ dateTimeParser.setTimeZone(defaultZone);
+ }
// Bug 31395, large dates
final Date endOfTime = new Date(Long.MAX_VALUE); // fyi: Sun Aug 17 07:12:55 CET 292278994 -- 807 millis
@@ -1208,72 +1218,73 @@ public void testTruncate() throws Exception {
*/
@Test
public void testTruncateLang59() throws Exception {
- // Set TimeZone to Mountain Time
- final TimeZone MST_MDT = TimeZone.getTimeZone("MST7MDT");
- TimeZone.setDefault(MST_MDT);
- final DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z");
- format.setTimeZone(MST_MDT);
-
- final Date oct31_01MDT = new Date(1099206000000L);
-
- final Date oct31MDT = new Date(oct31_01MDT.getTime() - 3600000L); // - 1 hour
- final Date oct31_01_02MDT = new Date(oct31_01MDT.getTime() + 120000L); // + 2 minutes
- final Date oct31_01_02_03MDT = new Date(oct31_01_02MDT.getTime() + 3000L); // + 3 seconds
- final Date oct31_01_02_03_04MDT = new Date(oct31_01_02_03MDT.getTime() + 4L); // + 4 milliseconds
+ try {
+ // Set TimeZone to Mountain Time
+ final TimeZone denverZone = TimeZone.getTimeZone("America/Denver");
+ TimeZone.setDefault(denverZone);
+ final DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS XXX");
+ format.setTimeZone(denverZone);
- assertEquals("Check 00:00:00.000", "2004-10-31 00:00:00.000 MDT", format.format(oct31MDT));
- assertEquals("Check 01:00:00.000", "2004-10-31 01:00:00.000 MDT", format.format(oct31_01MDT));
- assertEquals("Check 01:02:00.000", "2004-10-31 01:02:00.000 MDT", format.format(oct31_01_02MDT));
- assertEquals("Check 01:02:03.000", "2004-10-31 01:02:03.000 MDT", format.format(oct31_01_02_03MDT));
- assertEquals("Check 01:02:03.004", "2004-10-31 01:02:03.004 MDT", format.format(oct31_01_02_03_04MDT));
+ final Date oct31_01MDT = new Date(1099206000000L);
- // ------- Demonstrate Problem -------
- final Calendar gval = Calendar.getInstance();
- gval.setTime(new Date(oct31_01MDT.getTime()));
- gval.set(Calendar.MINUTE, gval.get(Calendar.MINUTE)); // set minutes to the same value
- assertEquals("Demonstrate Problem", gval.getTime().getTime(), oct31_01MDT.getTime() + 3600000L);
+ final Date oct31MDT = new Date(oct31_01MDT.getTime() - 3600000L); // - 1 hour
+ final Date oct31_01_02MDT = new Date(oct31_01MDT.getTime() + 120000L); // + 2 minutes
+ final Date oct31_01_02_03MDT = new Date(oct31_01_02MDT.getTime() + 3000L); // + 3 seconds
+ final Date oct31_01_02_03_04MDT = new Date(oct31_01_02_03MDT.getTime() + 4L); // + 4 milliseconds
- // ---------- Test Truncate ----------
- assertEquals("Truncate Calendar.MILLISECOND",
- oct31_01_02_03_04MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.MILLISECOND));
+ assertEquals("Check 00:00:00.000", "2004-10-31 00:00:00.000 -06:00", format.format(oct31MDT));
+ assertEquals("Check 01:00:00.000", "2004-10-31 01:00:00.000 -06:00", format.format(oct31_01MDT));
+ assertEquals("Check 01:02:00.000", "2004-10-31 01:02:00.000 -06:00", format.format(oct31_01_02MDT));
+ assertEquals("Check 01:02:03.000", "2004-10-31 01:02:03.000 -06:00", format.format(oct31_01_02_03MDT));
+ assertEquals("Check 01:02:03.004", "2004-10-31 01:02:03.004 -06:00", format.format(oct31_01_02_03_04MDT));
- assertEquals("Truncate Calendar.SECOND",
- oct31_01_02_03MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.SECOND));
+ // ------- Demonstrate Problem -------
+ final Calendar gval = Calendar.getInstance();
+ gval.setTime(new Date(oct31_01MDT.getTime()));
+ gval.set(Calendar.MINUTE, gval.get(Calendar.MINUTE)); // set minutes to the same value
+ assertEquals("Demonstrate Problem", gval.getTime().getTime(), oct31_01MDT.getTime() + 3600000L);
- assertEquals("Truncate Calendar.MINUTE",
- oct31_01_02MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.MINUTE));
+ // ---------- Test Truncate ----------
+ assertEquals("Truncate Calendar.MILLISECOND",
+ oct31_01_02_03_04MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.MILLISECOND));
- assertEquals("Truncate Calendar.HOUR_OF_DAY",
- oct31_01MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.HOUR_OF_DAY));
+ assertEquals("Truncate Calendar.SECOND",
+ oct31_01_02_03MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.SECOND));
- assertEquals("Truncate Calendar.HOUR",
- oct31_01MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.HOUR));
+ assertEquals("Truncate Calendar.MINUTE",
+ oct31_01_02MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.MINUTE));
- assertEquals("Truncate Calendar.DATE",
- oct31MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.DATE));
+ assertEquals("Truncate Calendar.HOUR_OF_DAY",
+ oct31_01MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.HOUR_OF_DAY));
+ assertEquals("Truncate Calendar.HOUR",
+ oct31_01MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.HOUR));
- // ---------- Test Round (down) ----------
- assertEquals("Round Calendar.MILLISECOND",
- oct31_01_02_03_04MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.MILLISECOND));
+ assertEquals("Truncate Calendar.DATE",
+ oct31MDT, DateUtils.truncate(oct31_01_02_03_04MDT, Calendar.DATE));
- assertEquals("Round Calendar.SECOND",
- oct31_01_02_03MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.SECOND));
+ // ---------- Test Round (down) ----------
+ assertEquals("Round Calendar.MILLISECOND",
+ oct31_01_02_03_04MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.MILLISECOND));
- assertEquals("Round Calendar.MINUTE",
- oct31_01_02MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.MINUTE));
+ assertEquals("Round Calendar.SECOND",
+ oct31_01_02_03MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.SECOND));
- assertEquals("Round Calendar.HOUR_OF_DAY",
- oct31_01MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.HOUR_OF_DAY));
+ assertEquals("Round Calendar.MINUTE",
+ oct31_01_02MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.MINUTE));
- assertEquals("Round Calendar.HOUR",
- oct31_01MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.HOUR));
+ assertEquals("Round Calendar.HOUR_OF_DAY",
+ oct31_01MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.HOUR_OF_DAY));
- assertEquals("Round Calendar.DATE",
- oct31MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.DATE));
+ assertEquals("Round Calendar.HOUR",
+ oct31_01MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.HOUR));
- // restore default time zone
- TimeZone.setDefault(defaultZone);
+ assertEquals("Round Calendar.DATE",
+ oct31MDT, DateUtils.round(oct31_01_02_03_04MDT, Calendar.DATE));
+ } finally {
+ // restore default time zone
+ TimeZone.setDefault(defaultZone);
+ }
}
// http://issues.apache.org/jira/browse/LANG-530
@@ -1462,60 +1473,64 @@ public void testCeil() throws Exception {
// Fix for http://issues.apache.org/bugzilla/show_bug.cgi?id=25560
// Test ceiling across the beginning of daylight saving time
- TimeZone.setDefault(zone);
- dateTimeParser.setTimeZone(zone);
-
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 31, 2003 00:00:00.000"),
- DateUtils.ceiling(date4, Calendar.DATE));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 31, 2003 00:00:00.000"),
- DateUtils.ceiling((Object) cal4, Calendar.DATE));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 31, 2003 00:00:00.000"),
- DateUtils.ceiling(date5, Calendar.DATE));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 31, 2003 00:00:00.000"),
- DateUtils.ceiling((Object) cal5, Calendar.DATE));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 31, 2003 00:00:00.000"),
- DateUtils.ceiling(date6, Calendar.DATE));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 31, 2003 00:00:00.000"),
- DateUtils.ceiling((Object) cal6, Calendar.DATE));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 31, 2003 00:00:00.000"),
- DateUtils.ceiling(date7, Calendar.DATE));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 31, 2003 00:00:00.000"),
- DateUtils.ceiling((Object) cal7, Calendar.DATE));
-
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 03:00:00.000"),
- DateUtils.ceiling(date4, Calendar.HOUR_OF_DAY));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 03:00:00.000"),
- DateUtils.ceiling((Object) cal4, Calendar.HOUR_OF_DAY));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 03:00:00.000"),
- DateUtils.ceiling(date5, Calendar.HOUR_OF_DAY));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 03:00:00.000"),
- DateUtils.ceiling((Object) cal5, Calendar.HOUR_OF_DAY));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 04:00:00.000"),
- DateUtils.ceiling(date6, Calendar.HOUR_OF_DAY));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 04:00:00.000"),
- DateUtils.ceiling((Object) cal6, Calendar.HOUR_OF_DAY));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 04:00:00.000"),
- DateUtils.ceiling(date7, Calendar.HOUR_OF_DAY));
- assertEquals("ceiling MET date across DST change-over",
- dateTimeParser.parse("March 30, 2003 04:00:00.000"),
- DateUtils.ceiling((Object) cal7, Calendar.HOUR_OF_DAY));
- TimeZone.setDefault(defaultZone);
- dateTimeParser.setTimeZone(defaultZone);
+ try {
+ TimeZone.setDefault(zone);
+ dateTimeParser.setTimeZone(zone);
+
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 31, 2003 00:00:00.000"),
+ DateUtils.ceiling(date4, Calendar.DATE));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 31, 2003 00:00:00.000"),
+ DateUtils.ceiling((Object) cal4, Calendar.DATE));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 31, 2003 00:00:00.000"),
+ DateUtils.ceiling(date5, Calendar.DATE));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 31, 2003 00:00:00.000"),
+ DateUtils.ceiling((Object) cal5, Calendar.DATE));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 31, 2003 00:00:00.000"),
+ DateUtils.ceiling(date6, Calendar.DATE));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 31, 2003 00:00:00.000"),
+ DateUtils.ceiling((Object) cal6, Calendar.DATE));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 31, 2003 00:00:00.000"),
+ DateUtils.ceiling(date7, Calendar.DATE));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 31, 2003 00:00:00.000"),
+ DateUtils.ceiling((Object) cal7, Calendar.DATE));
+
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 03:00:00.000"),
+ DateUtils.ceiling(date4, Calendar.HOUR_OF_DAY));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 03:00:00.000"),
+ DateUtils.ceiling((Object) cal4, Calendar.HOUR_OF_DAY));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 03:00:00.000"),
+ DateUtils.ceiling(date5, Calendar.HOUR_OF_DAY));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 03:00:00.000"),
+ DateUtils.ceiling((Object) cal5, Calendar.HOUR_OF_DAY));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 04:00:00.000"),
+ DateUtils.ceiling(date6, Calendar.HOUR_OF_DAY));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 04:00:00.000"),
+ DateUtils.ceiling((Object) cal6, Calendar.HOUR_OF_DAY));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 04:00:00.000"),
+ DateUtils.ceiling(date7, Calendar.HOUR_OF_DAY));
+ assertEquals("ceiling MET date across DST change-over",
+ dateTimeParser.parse("March 30, 2003 04:00:00.000"),
+ DateUtils.ceiling((Object) cal7, Calendar.HOUR_OF_DAY));
+
+ } finally {
+ TimeZone.setDefault(defaultZone);
+ dateTimeParser.setTimeZone(defaultZone);
+ }
// Bug 31395, large dates
final Date endOfTime = new Date(Long.MAX_VALUE); // fyi: Sun Aug 17 07:12:55 CET 292278994 -- 807 millis
From 98581d3c41da2e92a505f47376a35f4329ac23eb Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sat, 4 Nov 2017 16:49:59 +0100
Subject: [PATCH 0072/3439] LANG-1362: Fix tests DateUtilsTest for Java 9 with
en_GB locale
Add changes.xml entry.
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f0e3bc8f50a..bfe0b09128d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ Fix tests DateUtilsTest for Java 9 with en_GB localeFix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOfConstructorUtils.invokeConstructor(Class, Object...) regression
From 49e185294e8dad356db6fc706468f805253a0c4d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 4 Nov 2017 11:29:40 -0600
Subject: [PATCH 0073/3439] maven-pmd-plugin 3.7 -> 3.8.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 6db828ae5bc..971d4574fbf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -724,7 +724,7 @@
maven-pmd-plugin
- 3.7
+ 3.8${maven.compiler.target}
From 95286e641b591c6d4bcaeac07188627d6cccf382 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 4 Nov 2017 11:54:47 -0600
Subject: [PATCH 0074/3439] Update benchmark tests from JMH 1.17.4 to 1.19.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 971d4574fbf..43440182c26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -591,7 +591,7 @@
2.17
- 1.17.4
+ 1.19benchmarks
From 641367d98c8c43cb5fb687fa2e0c9c1cb5a1f038 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 4 Nov 2017 11:55:23 -0600
Subject: [PATCH 0075/3439] Prepare for releasing 3.7.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 43440182c26..2a411c66083 100644
--- a/pom.xml
+++ b/pom.xml
@@ -571,7 +571,7 @@
lang3org.apache.commons.lang3
- 3.6
+ 3.7(Java 7.0+)2.6
From 77d75526cda89d89cf9911031e2a5995db37a0a5 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 4 Nov 2017 11:57:43 -0600
Subject: [PATCH 0076/3439] Prepare for releasing 3.7.
---
src/site/xdoc/download_lang.xml | 54 ++++++++++++++++-----------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/site/xdoc/download_lang.xml b/src/site/xdoc/download_lang.xml
index 55e00ddb7af..e4d0c7bb9bc 100644
--- a/src/site/xdoc/download_lang.xml
+++ b/src/site/xdoc/download_lang.xml
@@ -111,32 +111,32 @@ limitations under the License.
-
+
From 5f4b07d9b4c63a3337743cda2fe303ae267fad2d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 4 Nov 2017 12:00:27 -0600
Subject: [PATCH 0077/3439] Prepare for releasing 3.7.
---
RELEASE-NOTES.txt | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 163944704fa..4dfef1d3b54 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -180,6 +180,8 @@ o LANG-1301: Moving apache-rat-plugin configuration into pluginManagement.
Thanks to Karl Heinz Marbaise.
o LANG-1316: Deprecate classes/methods moved to commons-text.
+=============================================================================
+
Release Notes for version 3.5
@@ -477,6 +479,8 @@ o LANG-1107: Fix parsing edge cases in FastDateParser.
o LANG-1273: Added new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils. Thanks
to Jake Wang.
+=============================================================================
+
Release Notes for version 3.4
@@ -611,6 +615,8 @@ o LANG-1003: DurationFormatUtils are not able to handle negative
o LANG-998: Javadoc is not clear on preferred pattern to instantiate
FastDateParser / FastDatePrinter
+=============================================================================
+
Release Notes for version 3.3.2
NEW FEATURES
@@ -623,6 +629,8 @@ FIXED BUGS
o LANG-992: NumberUtils#isNumber() returns false for "0.0", "0.4790", et al
+=============================================================================
+
Release Notes for version 3.3.1
FIXED BUGS
@@ -637,6 +645,8 @@ o LANG-982: DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field
size should be 4 digits
o LANG-978: Failing tests with Java 8 b128
+=============================================================================
+
Release Notes for version 3.3
NEW FEATURES
@@ -702,6 +712,8 @@ o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
o LANG-819: EnumUtils.generateBitVector needs a "? extends"
+=============================================================================
+
Release Notes for version 3.2.1
BUG FIXES
@@ -714,6 +726,8 @@ o LANG-942: Test failure in FastDateParserTest and FastDateFormat_ParserTest
Henri Yandell.
o LANG-938: Build fails with test failures when building with JDK 8
+=============================================================================
+
Release Notes for version 3.2
COMPATIBILITY WITH 3.1
@@ -874,6 +888,7 @@ CHANGES WITHOUT TICKET
o Fixed URLs in javadoc to point to new oracle.com pages
+=============================================================================
Release Notes for version 3.1
@@ -908,6 +923,7 @@ o LANG-748: Deprecating chomp(String, String)
o LANG-736: CharUtils static final array CHAR_STRING is not needed to compute
CHAR_STRING_ARRAY
+=============================================================================
Release Notes for version 3.0
From 6aeb71b0d61d27b453f8819dc90b66dd72b25eb4 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 4 Nov 2017 12:01:45 -0600
Subject: [PATCH 0078/3439] Prepare for releasing 3.7.
---
RELEASE-NOTES.txt | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 4dfef1d3b54..33ec1635acc 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,3 +1,34 @@
+The Apache Commons Lang team is pleased to announce the commons-lang3-3.7 release!
+
+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
+ standard as to justify existence in java.lang.
+
+Changes in this version include:
+
+New features:
+o TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.) Issue: LANG-1355. Thanks to Chas Honton.
+o Add methods to ObjectUtils to get various forms of class names in a null-safe manner Issue: LANG-1360. Thanks to Gary Gregory.
+
+Fixed Bugs:
+o Fix tests DateUtilsTest for Java 9 with en_GB locale Issue: LANG-1362. Thanks to Stephen Colebourne.
+o Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10 Issue: LANG-1365. Thanks to Gary Gregory.
+o StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf Issue: LANG-1348. Thanks to mbusso.
+o ConstructorUtils.invokeConstructor(Class, Object...) regression Issue: LANG-1350. Thanks to Brett Kail.
+o EqualsBuilder#isRegistered: swappedPair construction bug Issue: LANG-1349. Thanks to Naman Nigam.
+o org.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale) Issue: LANG-1357. Thanks to BruceKuiLiu.
+
+Changes:
+o Improve StringUtils#replace throughput Issue: LANG-1358. Thanks to Stephane Landelle.
+o Remove deprecation from RandomStringUtils Issue: LANG-1346.
+o ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Issue: LANG-1361. Thanks to Ana.
+
+
+Have fun!
+-Apache Commons Lang team
+
+=============================================================================
+
Apache Commons Lang
Version 3.6
Release Notes
From 8635d807fb6b6d7535f93a908e4f6d33cd08a3ba Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 4 Nov 2017 12:03:44 -0600
Subject: [PATCH 0079/3439] Prepare for releasing 3.7.
---
RELEASE-NOTES.txt | 71 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 55 insertions(+), 16 deletions(-)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 33ec1635acc..b77a9b45267 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,31 +1,70 @@
-The Apache Commons Lang team is pleased to announce the commons-lang3-3.7 release!
+
+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.
+
+
+ Apache Commons Lang
+ Version 3.7
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 3.7 version of Apache Commons Lang.
+Commons Lang is a set of utility functions and reusable components that should be of use in any
+Java environment.
+
+Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
+variable arguments, autoboxing, concurrency and formatted output.
+
+For the advice on upgrading from 2.x to 3.x, see the following page:
+
+ http://commons.apache.org/lang/article3_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
- standard as to justify existence in java.lang.
+classes that are in java.lang's hierarchy, or are considered to be so
+standard as to justify existence in java.lang.
+
+New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
Changes in this version include:
New features:
-o TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.) Issue: LANG-1355. Thanks to Chas Honton.
-o Add methods to ObjectUtils to get various forms of class names in a null-safe manner Issue: LANG-1360. Thanks to Gary Gregory.
+o LANG-1355: TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.) Thanks to Chas Honton.
+o LANG-1360: Add methods to ObjectUtils to get various forms of class names in a null-safe manner Thanks to Gary Gregory.
Fixed Bugs:
-o Fix tests DateUtilsTest for Java 9 with en_GB locale Issue: LANG-1362. Thanks to Stephen Colebourne.
-o Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10 Issue: LANG-1365. Thanks to Gary Gregory.
-o StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf Issue: LANG-1348. Thanks to mbusso.
-o ConstructorUtils.invokeConstructor(Class, Object...) regression Issue: LANG-1350. Thanks to Brett Kail.
-o EqualsBuilder#isRegistered: swappedPair construction bug Issue: LANG-1349. Thanks to Naman Nigam.
-o org.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale) Issue: LANG-1357. Thanks to BruceKuiLiu.
+o LANG-1362: Fix tests DateUtilsTest for Java 9 with en_GB locale Thanks to Stephen Colebourne.
+o LANG-1365: Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10 Thanks to Gary Gregory.
+o LANG-1348: StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf Thanks to mbusso.
+o LANG-1350: ConstructorUtils.invokeConstructor(Class, Object...) regression Thanks to Brett Kail.
+o LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug Thanks to Naman Nigam.
+o LANG-1357: org.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale) Thanks to BruceKuiLiu.
Changes:
-o Improve StringUtils#replace throughput Issue: LANG-1358. Thanks to Stephane Landelle.
-o Remove deprecation from RandomStringUtils Issue: LANG-1346.
-o ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Issue: LANG-1361. Thanks to Ana.
+o LANG-1358: Improve StringUtils#replace throughput Thanks to Stephane Landelle.
+o LANG-1346: Remove deprecation from RandomStringUtils
+o LANG-1361: ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Thanks to Ana.
-Have fun!
--Apache Commons Lang team
+Historical list of changes: http://commons.apache.org/proper/commons-lang/changes-report.html
+
+For complete information on Apache Commons Lang, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Apache Commons Lang website:
+
+http://commons.apache.org/proper/commons-lang/
=============================================================================
From 425d8085cfcaab5a78bf0632f9ae77b7e9127cf8 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 4 Nov 2017 12:09:44 -0600
Subject: [PATCH 0080/3439] Prepare for releasing 3.7.
---
pom.xml | 2 +-
src/changes/changes.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2a411c66083..142ec97779e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
4.0.0commons-lang3
- 3.7-SNAPSHOT
+ 3.7Apache Commons Lang2001
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bfe0b09128d..7d102003a75 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,7 +45,7 @@ The type attribute can be add,update,fix,remove.
-
+ Fix tests DateUtilsTest for Java 9 with en_GB localeFix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf
From 20de433aa24957e40d974b87aba54ae0688500ed Mon Sep 17 00:00:00 2001
From: Haoliang Quan
Date: Sat, 4 Nov 2017 22:04:24 -0700
Subject: [PATCH 0081/3439] Remove unnecessary testing comments (closes #305)
---
.../apache/commons/lang3/math/Fraction.java | 3 --
.../commons/lang3/CharUtilsPerfRun.java | 6 ----
.../apache/commons/lang3/StringUtilsTest.java | 1 -
.../lang3/text/ExtendedMessageFormatTest.java | 1 -
.../lang3/time/DateFormatUtilsTest.java | 28 -------------------
5 files changed, 39 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/math/Fraction.java b/src/main/java/org/apache/commons/lang3/math/Fraction.java
index 0ce5bedbff5..0924ac91327 100644
--- a/src/main/java/org/apache/commons/lang3/math/Fraction.java
+++ b/src/main/java/org/apache/commons/lang3/math/Fraction.java
@@ -269,7 +269,6 @@ public static Fraction getFraction(double value) {
double delta1, delta2 = Double.MAX_VALUE;
double fraction;
int i = 1;
- // System.out.println("---");
do {
delta1 = delta2;
a2 = (int) (x1 / y1);
@@ -279,7 +278,6 @@ public static Fraction getFraction(double value) {
denom2 = a1 * denom1 + denom0;
fraction = (double) numer2 / (double) denom2;
delta2 = Math.abs(value - fraction);
- // System.out.println(numer2 + " " + denom2 + " " + fraction + " " + delta2 + " " + y1);
a1 = a2;
x1 = x2;
y1 = y2;
@@ -288,7 +286,6 @@ public static Fraction getFraction(double value) {
numer1 = numer2;
denom1 = denom2;
i++;
- // System.out.println(">>" + delta1 +" "+ delta2+" "+(delta1 > delta2)+" "+i+" "+denom2);
} while (delta1 > delta2 && denom2 <= 10000 && denom2 > 0 && i < 25);
if (i == 25) {
throw new ArithmeticException("Unable to convert double to fraction");
diff --git a/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java b/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
index 1886d0bd3be..925d05bccc1 100644
--- a/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
+++ b/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
@@ -102,21 +102,15 @@ private void run() {
long start;
start = System.currentTimeMillis();
this.printlnTotal("Do nothing", start);
- //System.out.println("Warming up...");
run_CharUtils_isAsciiNumeric(WARM_UP);
- //System.out.println("Measuring...");
start = System.currentTimeMillis();
run_CharUtils_isAsciiNumeric(COUNT);
this.printlnTotal("run_CharUtils_isAsciiNumeric", start);
- //System.out.println("Warming up...");
run_inlined_CharUtils_isAsciiNumeric(WARM_UP);
- //System.out.println("Measuring...");
start = System.currentTimeMillis();
run_inlined_CharUtils_isAsciiNumeric(COUNT);
this.printlnTotal("run_inlined_CharUtils_isAsciiNumeric", start);
- //System.out.println("Warming up...");
run_CharSet(WARM_UP);
- //System.out.println("Measuring...");
start = System.currentTimeMillis();
run_CharSet(COUNT);
this.printlnTotal("run_CharSet", start);
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 451202ef654..36f8964f9b3 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -2371,7 +2371,6 @@ public void testDifferenceAt_StringString() {
assertEquals(7, StringUtils.indexOfDifference("i am a machine", "i am a robot"));
assertEquals(-1, StringUtils.indexOfDifference("foo", "foo"));
assertEquals(0, StringUtils.indexOfDifference("i am a robot", "you are a robot"));
- //System.out.println("indexOfDiff: " + StringUtils.indexOfDifference("i am a robot", "not machine"));
}
//-----------------------------------------------------------------------
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 6b0f725c11a..823c3473054 100644
--- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
@@ -370,7 +370,6 @@ private void checkBuiltInFormat(final String pattern, final Map regis
buffer.append(locale);
buffer.append("]");
final MessageFormat mf = createMessageFormat(pattern, locale);
- // System.out.println(buffer + ", result=[" + mf.format(args) +"]");
ExtendedMessageFormat emf = null;
if (locale == null) {
emf = new ExtendedMessageFormat(pattern);
diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
index 603e7def93f..1a2f4e986a3 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
@@ -186,34 +186,6 @@ public void testSMTP() {
timeZone, june);
}
- /*
- public void testLang312() {
- String pattern = "dd/MM/yyyy";
- String expected = "19/04/1948";
- TimeZone timeZone = TimeZone.getTimeZone("CET");
- Locale locale = Locale.GERMANY;
-
- // show Calendar is good
- Calendar cal = Calendar.getInstance(timeZone, locale);
- cal.set(1948, 3, 19);
- assertEquals(expected, DateFormatUtils.format( cal.getTime(), pattern, timeZone, locale ) );
-
- Date date = new Date(48, 3, 19);
-
- // test JDK
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern, locale);
- sdf.setTimeZone(timeZone);
-// There's nothing we can do if the JDK fails, so just going to print a warning in this case
-// assertEquals(expected, sdf.format( date ) );
- if( ! expected.equals( sdf.format( date ) ) ) {
- System.out.println("WARNING: JDK test failed - testLang312()");
- }
-
- // test Commons
- assertEquals(expected, DateFormatUtils.format( date, pattern, timeZone, locale ) );
- }
- */
-
@Test
public void testLANG1000() throws Exception {
final String date = "2013-11-18T12:48:05Z";
From fdb91d4fd5f932f5670773ae1c1e16d287b93363 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 8 Nov 2017 08:49:34 -0700
Subject: [PATCH 0082/3439] Update version to 3.8-SNAPSHOT.
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 142ec97779e..b2d1e9060b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
4.0.0commons-lang3
- 3.7
+ 3.8-SNAPSHOTApache Commons Lang2001
@@ -571,7 +571,7 @@
lang3org.apache.commons.lang3
- 3.7
+ 3.8(Java 7.0+)2.6
From 4025834872e72cf667c4be243ac84c28fc95043d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 8 Nov 2017 08:54:13 -0700
Subject: [PATCH 0083/3439] Updates for 3.7 site.
---
src/site/xdoc/index.xml | 10 +++++-----
src/site/xdoc/release-history.xml | 3 +++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 2d8b15efeda..55c9d5635db 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -50,7 +50,7 @@ and various project reports are provided.
The JavaDoc API documents are available online:
@@ -74,7 +74,7 @@ Alternatively you can pull it from the central Maven repositories:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.6</version>
+ <version>3.7</version>
</dependency>
diff --git a/src/site/xdoc/release-history.xml b/src/site/xdoc/release-history.xml
index 57ba62d4cb9..6e79ac804bb 100644
--- a/src/site/xdoc/release-history.xml
+++ b/src/site/xdoc/release-history.xml
@@ -31,6 +31,9 @@ limitations under the License.
From 6fea9cd301e3b131aa29f290fd707c3289c898fa Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 8 Nov 2017 10:50:11 -0700
Subject: [PATCH 0085/3439] Use the same license header for all files.
---
.../release-notes/RELEASE-NOTES-1.0.1.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-1.0.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-2.0.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-2.1.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-2.2.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-2.3.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-2.4.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-2.5.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-2.6.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-3.0.1.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-3.1.txt | 17 +++++++++-
.../release-notes/RELEASE-NOTES-3.2.1.txt | 33 +++++++++----------
.../release-notes/RELEASE-NOTES-3.2.txt | 33 +++++++++----------
.../release-notes/RELEASE-NOTES-3.3.1.txt | 17 ++++++++++
.../release-notes/RELEASE-NOTES-3.3.2.txt | 17 ++++++++++
.../release-notes/RELEASE-NOTES-3.3.txt | 33 +++++++++----------
.../release-notes/RELEASE-NOTES-3.4.txt | 17 ++++++++++
17 files changed, 275 insertions(+), 62 deletions(-)
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-1.0.1.txt b/src/site/resources/release-notes/RELEASE-NOTES-1.0.1.txt
index ac2f776d38a..97584922511 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-1.0.1.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-1.0.1.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt,v 1.4.2.1 2002/11/23 02:52:02 bayard Exp $
+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.
+
+=============================================================================
Commons Lang Package
Version 1.0.1
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-1.0.txt b/src/site/resources/release-notes/RELEASE-NOTES-1.0.txt
index 3164f74d9be..10ee7e89c46 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-1.0.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-1.0.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt,v 1.4 2002/09/25 10:29:56 scolebourne Exp $
+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.
+
+=============================================================================
Commons Lang Package
Version 1.0
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.0.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.0.txt
index ce6d25e4d57..9ee37521ac8 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.0.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.0.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 137634 2003-08-19 02:39:59Z bayard $
+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.
+
+=============================================================================
Commons Lang Package
Version 2.0
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.1.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.1.txt
index fac5a90ed90..609bccd18ad 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.1.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.1.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 179435 2005-06-01 22:19:20Z stevencaswell $
+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.
+
+=============================================================================
Commons Lang Package
Version 2.1
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.2.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.2.txt
index 82fd31a7ecb..b47e0744dea 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.2.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.2.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 447139 2006-09-17 20:36:53Z bayard $
+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.
+
+=============================================================================
Commons Lang Package
Version 2.2
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.3.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.3.txt
index d2589cd17de..eed2ceb2c65 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.3.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.3.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 504353 2007-02-06 22:52:29Z bayard $
+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.
+
+=============================================================================
Commons Lang Package
Version 2.3
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.4.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.4.txt
index 0313d2528dd..c3dc5b2d9bf 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.4.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.4.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 637522 2008-03-16 03:41:46Z bayard $
+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.
+
+=============================================================================
Commons Lang Package
Version 2.4
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.5.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.5.txt
index 15eb3181726..b7897cd4c38 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.5.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.5.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 912439 2010-02-21 23:27:03Z niallp $
+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.
+
+=============================================================================
Commons Lang Package
Version 2.5
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.6.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.6.txt
index aaba61c090f..a48d9d1200f 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.6.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.6.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 1058313 2011-01-12 20:59:27Z niallp $
+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.
+
+=============================================================================
Commons Lang Package
Version 2.6
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.0.1.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.0.1.txt
index 241b2a30bb6..8e7b39d7df7 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.0.1.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.0.1.txt
@@ -1,4 +1,19 @@
-$Id$
+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.
+
+=============================================================================
Commons Lang Package
Version 3.0.1
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt
index e0ec133663e..68b69cb4f30 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 1199820 2011-11-09 16:14:52Z bayard $
+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.
+
+=============================================================================
Commons Lang Package
Version 3.1
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.2.1.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.2.1.txt
index 1f340244499..d67c8e82972 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.2.1.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.2.1.txt
@@ -1,20 +1,19 @@
-$Id: RELEASE-NOTES.txt 1555524 2014-01-05 15:24:49Z britter $
-
- 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.
-
+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.
+
+=============================================================================
Apache Commons Lang
Version 3.2.1
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.2.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.2.txt
index fdce240a1c4..f20f581b1c3 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.2.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.2.txt
@@ -1,20 +1,19 @@
-$Id$
-
- 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.
-
+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.
+
+=============================================================================
Apache Commons Lang
Version 3.2
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.3.1.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.3.1.txt
index d14de3a6232..59975036c6b 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.3.1.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.3.1.txt
@@ -1,3 +1,20 @@
+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.
+
+=============================================================================
+
Apache Commons Lang
Version 3.3.1
Release Notes
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.3.2.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.3.2.txt
index 1ad880a361d..1ddb14bf366 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.3.2.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.3.2.txt
@@ -1,3 +1,20 @@
+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.
+
+=============================================================================
+
Apache Commons Lang
Version 3.3.2
Release Notes
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.3.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.3.txt
index 1e069ebd228..083fb1cea23 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.3.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.3.txt
@@ -1,20 +1,19 @@
-$Id$
-
- 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.
-
+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.
+
+=============================================================================
Apache Commons Lang
Version 3.3
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.4.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.4.txt
index eb149d77599..170f00b44d4 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.4.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.4.txt
@@ -1,3 +1,20 @@
+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.
+
+=============================================================================
+
Apache Commons Lang
Version 3.4
Release Notes
From ea1e46dd06975c8ac0be5badf0e3e5358c94dc15 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 8 Nov 2017 10:50:17 -0700
Subject: [PATCH 0086/3439] Use the same license header for all files.
---
.../release-notes/RELEASE-NOTES-3.0.txt | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.0.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.0.txt
index d753bfbe630..6701c14d77f 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.0.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.0.txt
@@ -1,4 +1,19 @@
-$Id: RELEASE-NOTES.txt 1144999 2011-07-11 01:02:13Z ggregory $
+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.
+
+=============================================================================
Commons Lang Package
Version 3.0
From 6e48ce6cd6dff9a82061382f7897e0c93c2d3534 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 8 Nov 2017 10:50:51 -0700
Subject: [PATCH 0087/3439] Add missing release notes.
---
.../release-notes/RELEASE-NOTES-3.5.txt | 940 +++++++++++++
.../release-notes/RELEASE-NOTES-3.6.txt | 1124 ++++++++++++++++
.../release-notes/RELEASE-NOTES-3.7.txt | 1176 +++++++++++++++++
3 files changed, 3240 insertions(+)
create mode 100644 src/site/resources/release-notes/RELEASE-NOTES-3.5.txt
create mode 100644 src/site/resources/release-notes/RELEASE-NOTES-3.6.txt
create mode 100644 src/site/resources/release-notes/RELEASE-NOTES-3.7.txt
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.5.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.5.txt
new file mode 100644
index 00000000000..48f0348b6d3
--- /dev/null
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.5.txt
@@ -0,0 +1,940 @@
+
+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.
+
+=============================================================================
+
+ Release Notes for version 3.5
+
+
+HIGHLIGHTS
+==========
+
+Some of the highlights in this release include:
+
+o Added Java 9 detection to org.apache.commons.lang3.SystemUtils.
+o Support for shifting and swapping elements in
+ org.apache.commons.lang3.ArrayUtils.
+o New methods for generating random strings from different character classes
+ including alphabetic, alpha-numeric and ASCII added to
+ org.apache.commons.lang3.RandomStringUtils.
+o Numerous extensions to org.apache.commons.lang3.StringUtils including
+ null safe compare variants, more remove and replace variants, rotation and
+ truncation.
+o Added org.apache.commons.lang3.ThreadUtils - a utility class to work with
+ instances of java.lang.Thread and java.lang.ThreadGroup.
+o Added annotations @EqualsExclude, @HashCodeExclude and @ToStringEclude to
+ mark fields which should be ignored by the reflective builders in the
+ org.apache.commons.lang3.builder package.
+o Support for various modify and retrieve value use cases added to the classes
+ in org.apache.commons.lang3.mutable.
+
+COMPATIBILITY
+=============
+
+Apache Commons Lang 3.5 is binary compatible with the 3.4 release. Users
+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:
+
+o Added method 'public boolean parse(java.lang.String, java.text.ParsePosition,
+ java.util.Calendar)'
+o Added method 'public java.lang.Appendable format(long, java.lang.Appendable)'
+o Added method 'public java.lang.Appendable format(java.util.Date,
+ java.lang.Appendable)'
+o Added method 'public java.lang.Appendable format(java.util.Calendar,
+ java.lang.Appendable)'
+
+For this reason 3.5 is not strictly source compatible to 3.4. Since the
+DatePrinter interface is not meant to be implemented by clients, this
+change it not considered to cause any problems.
+
+JAVA 9 SUPPORT
+==============
+
+Java 9 introduces a new version-string scheme. Details of this new scheme are
+documented in JEP-223 (http://openjdk.java.net/jeps/223). In order to support
+JEP-223 two classes had to be changed:
+
+o org.apache.commons.lang3.JavaVersion
+ deprecated enum constant JAVA_1_9
+ introduced enum constant JAVA_9
+
+o org.apache.commons.lang3.SystemUtils
+ deprecated constant IS_JAVA_1_9
+ introduced constant IS_JAVA_9
+
+For more information see LANG-1197
+(https://issues.apache.org/jira/browse/LANG-1197). All other APIs are expected
+to work with Java 9.
+
+BUILDING ON JAVA 9
+==================
+
+Java 8 introduced the Unicode Consortium's Common Locale Data Repository as
+alternative source for locale data. Java 9 will use the CLDR provider as
+default provider for locale data (see http://openjdk.java.net/jeps/252). This
+causes an number of locale-sensitive test in Commons Lang to fail. In order
+to build Commons Lang 3.5 on Java 9, the locale provider has to be set to
+'JRE':
+
+ mvn -Djava.locale.providers=JRE clean install
+
+We are currently investigating ways to support building on Java 9 without
+further configuration. For more information see:
+https://issues.apache.org/jira/browse/LANG-1265
+
+
+NEW FEATURES
+==============
+
+o LANG-1275: Added a tryAcquire() method to TimedSemaphore.
+o LANG-1255: Add DateUtils.toCalendar(Date, TimeZone). Thanks to Kaiyuan Wang.
+o LANG-1023: Add WordUtils.wrap overload with customizable breakable character.
+ Thanks to Marko Bekhta.
+o LANG-787: Add method removeIgnoreCase(String, String) to StringUtils. Thanks
+ to Gokul Nanthakumar C.
+o LANG-1224: Extend RandomStringUtils with methods that generate strings
+ between a min and max length. Thanks to Caleb Cushing.
+o LANG-1257: Add APIs StringUtils.wrapIfMissing(String, char|String). Thanks to
+ Gary Gregory.
+o LANG-1253: Add RandomUtils#nextBoolean() method. Thanks to adilek.
+o LANG-1085: Add a circuit breaker implementation. Thanks to Oliver Heger and
+ Bruno P. Kinoshita.
+o LANG-1013: Add StringUtils.truncate(). Thanks to Thiago Andrade.
+o LANG-1195: Enhance MethodUtils to allow invocation of private methods. Thanks
+ to Derek C. Ashmore.
+o LANG-1189: Add getAndIncrement/getAndDecrement/getAndAdd/incrementAndGet/
+ decrementAndGet/addAndGet in Mutable* classes. Thanks to
+ Haiyang Li and Matthew Bartenschlag.
+o LANG-1225: Add RandomStringUtils#randomGraph and #randomPrint which match
+ corresponding regular expression class. Thanks to Caleb Cushing.
+o LANG-1223: Add StopWatch#getTime(TimeUnit). Thanks to Nick Manley.
+o LANG-781: Add methods to ObjectUtils class to check for null elements in the
+ array. Thanks to Krzysztof Wolny.
+o LANG-1228: Prefer Throwable.getCause() in ExceptionUtils.getCause().
+ Thanks to Brad Hess.
+o LANG-1233: DiffBuilder add method to allow appending from a DiffResult.
+ Thanks to Nick Manley.
+o LANG-1168: Add SystemUtils.IS_OS_WINDOWS_10 property.
+ Thanks to Pascal Schumacher.
+o LANG-1115: Add support for varargs in ConstructorUtils, MemberUtils, and
+ MethodUtils. Thanks to Jim Lloyd and Joe Ferner.
+o LANG-1134: Add methods to check numbers against NaN and inifinite to
+ Validate. Thanks to Alan Smithee.
+o LANG-1220: Add tests for missed branches in DateUtils.
+ Thanks to Casey Scarborough.
+o LANG-1146: z/OS identification in SystemUtils.
+ Thanks to Gabor Liptak.
+o LANG-1192: FastDateFormat support of the week-year component (uppercase 'Y').
+ Thanks to Dominik Stadler.
+o LANG-1169: Add StringUtils methods to compare a string to multiple strings.
+ Thanks to Rafal Glowinski, Robert Parr and Arman Sharif.
+o LANG-1185: Add remove by regular expression methods in StringUtils.
+o LANG-1139: Add replace by regular expression methods in StringUtils.
+o LANG-1171: Add compare methods in StringUtils.
+o LANG-1174: Add sugar to RandomUtils. Thanks to Punkratz312.
+o LANG-1154: FastDateFormat APIs that use a StringBuilder. Thanks to
+ Gary Gregory.
+o LANG-1149: Ability to throw checked exceptions without declaring them. Thanks
+ to Gregory Zak.
+o LANG-1153: Implement ParsePosition api for FastDateParser.
+o LANG-1137: Add check for duplicate event listener in EventListenerSupport.
+ Thanks to Matthew Aguirre.
+o LANG-1135: Add method containsAllWords to WordUtils. Thanks to
+ Eduardo Martins.
+o LANG-1132: ReflectionToStringBuilder doesn't throw IllegalArgumentException
+ when the constructor's object param is null. Thanks to Jack Tan.
+o LANG-701: StringUtils join with var args. Thanks to James Sawle.
+o LANG-1105: Add ThreadUtils - A utility class which provides helper methods
+ related to java.lang.Thread Issue: LANG-1105. Thanks to
+ Hendrik Saly.
+o LANG-1031: Add annotations to exclude fields from ReflectionEqualsBuilder,
+ ReflectionToStringBuilder and ReflectionHashCodeBuilder. Thanks
+ to Felipe Adorno.
+o LANG-1127: Use JUnit rules to set and reset the default Locale and TimeZone.
+o LANG-1119: Add rotate(string, int) method to StringUtils. Thanks to
+ Loic Guibert.
+o LANG-1099: Add swap and shift operations for arrays to ArrayUtils. Thanks to
+ Adrian Ber.
+o LANG-1050: Change nullToEmpty methods to generics. Thanks to James Sawle.
+o LANG-1074: Add a method to ArrayUtils for removing all occurrences of a given
+ element Issue: LANG-1074. Thanks to Haiyang Li.
+
+FIXED BUGS
+============
+
+o LANG-1261: ArrayUtils.contains returns false for instances of subtypes.
+o LANG-1252: Rename NumberUtils.isNumber, isCreatable to better reflect
+ createNumber. Also, accommodated for "+" symbol as prefix in
+ isCreatable and isNumber. Thanks to Rob Tompkins.
+o LANG-1230: Remove unnecessary synchronization from registry lookup in
+ EqualsBuilder and HashCodeBuilder. Thanks to Philippe Marschall.
+o LANG-1214: Handle "void" in ClassUtils.getClass(). Thanks to Henry Tung.
+o LANG-1250: SerializationUtils#deserialize has unnecessary code and a comment
+ for that. Thanks to Glease Wang.
+o LANG-1190: TypeUtils.isAssignable throws NullPointerException when fromType
+ has type variables and toType generic superclass specifies type
+ variable. Thanks to Pascal Schumacher.
+o LANG-1226: StringUtils#normalizeSpace does not trim the string anymore.
+ Thanks to Pascal Schumacher.
+o LANG-1251: SerializationUtils.ClassLoaderAwareObjectInputStream should use
+ static initializer to initialize primitiveTypes map. Thanks to
+ Takuya Ueshin.
+o LANG-1248: FastDatePrinter Memory allocation regression. Thanks to
+ Benoit Wiart.
+o LANG-1018: Fix precision loss on NumberUtils.createNumber(String). Thanks to
+ Nick Manley.
+o LANG-1199: Fix implementation of StringUtils.getJaroWinklerDistance(). Thanks
+ to M. Steiger.
+o LANG-1244: Fix dead links in StringUtils.getLevenshteinDistance() javadoc.
+ Thanks to jjbankert.
+o LANG-1242: "\u2284":"?" mapping missing from
+ EntityArrays#HTML40_EXTENDED_ESCAPE. Thanks to Neal Stewart.
+o LANG-901: StringUtils#startsWithAny/endsWithAny is case sensitive -
+ documented as case insensitive. Thanks to Matthew Bartenschlag.
+o LANG-1232: DiffBuilder: Add null check on fieldName when appending Object or
+ Object[]. Thanks to Nick Manley.
+o LANG-1178: ArrayUtils.removeAll(Object array, int... indices) should do the
+ clone, not its callers. Thanks to Henri Yandell.
+o LANG-1120: StringUtils.stripAccents should remove accents from "Ł" and "ł".
+ Thanks to kaching88.
+o LANG-1205: NumberUtils.createNumber() behaves inconsistently with
+ NumberUtils.isNumber(). Thanks to pbrose.
+o LANG-1222: Fix for incorrect comment on StringUtils.containsIgnoreCase
+ method. Thanks to Adam J.
+o LANG-1221: Fix typo on appendIfMissing javadoc. Thanks to Pierre Templier.
+o LANG-1202: parseDateStrictly does't pass specified locale. Thanks to
+ Markus Jelsma.
+o LANG-1219: FastDateFormat doesn't respect summer daylight in some localized
+ strings. Thanks to Jarek.
+o LANG-1175: Remove Ant-based build.
+o LANG-1194: Limit max heap memory for consistent Travis CI build.
+o LANG-1186: Fix NullPointerException in FastDateParser$TimeZoneStrategy.
+ Thanks to NickManley.
+o LANG-1193: ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1
+ (correct answer should be 0); revert fix for LANG-1077. Thanks to
+ Qin Li.
+o LANG-1002: Several predefined ISO FastDateFormats in DateFormatUtils are
+ incorrect. Thanks to Michael Osipov.
+o LANG-1152: StringIndexOutOfBoundsException or field over-write for large year
+ fields in FastDateParser. Thanks to Pas Filip.
+o LANG-1141: StrLookup.systemPropertiesLookup() no longer reacts on changes on
+ system properties.
+o LANG-1147: EnumUtils *BitVector issue with more than 32 values Enum. Thanks
+ to Loic Guibert.
+o LANG-1059: Capitalize javadoc is incorrect. Thanks to Colin Casey.
+o LANG-1122: Inconsistent behavior of swap for malformed inputs. Thanks to
+ Adrian Ber.
+o LANG-1130: Fix critical issues reported by SonarQube.
+o LANG-1131: StrBuilder.equals(StrBuilder) doesn't check for null inputs.
+o LANG-1128: JsonToStringStyle doesn't handle chars and objects correctly.
+ Thanks to Jack Tan.
+o LANG-1126: DateFormatUtilsTest.testSMTP depends on the default Locale.
+o LANG-1123: Unit test FastDatePrinterTimeZonesTest needs a timezone set.
+ Thanks to Christian P. Momon.
+o LANG-916: DateFormatUtils.format does not correctly change Calendar
+ TimeZone in certain situations. Thanks to Christian P. Momon.
+o LANG-1116: DateUtilsTest.testLang530 fails for some timezones. Thanks to
+ Aaron Sheldon.
+o LANG-1114: TypeUtils.ParameterizedType#equals doesn't work with wildcard
+ types. Thanks to Andy Coates.
+o LANG-1118: StringUtils.repeat('z', -1) throws NegativeArraySizeException.
+ Thanks to Loic Guibert.
+o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
+o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
+ identical leading prefix..
+o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
+o LANG-1200: Fix JavaDoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
+o LANG-1191: Incorrect Javadoc
+ StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
+ qed, Brent Worden and Gary Gregory.
+
+CHANGES
+=========
+o LANG-1197: Prepare Java 9 detection.
+o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
+ big to be inlined. Thanks to Ruslan Cheremin.
+o LANG-1259: JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
+ to Dominik Stadler.
+o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
+ Benoit Wiart.
+o LANG-1229: HashCodeBuilder.append(Object,Object) is too big to be inlined,
+ which prevents whole builder to be scalarized. Thanks to
+ Ruslan Cheremin.
+o LANG-1243: Simplify ArrayUtils removeElements by using new decrementAndGet()
+ method.
+o LANG-1240: Optimize BitField constructor implementation. Thanks to zhanhb.
+o LANG-1206: Improve CharSetUtils.squeeze() performance. Thanks to
+ Mohammed Alfallaj.
+o LANG-1176: Improve ArrayUtils removeElements time complexity to O(n). Thanks
+ to Jeffery Yuan.
+o LANG-1234: getLevenshteinDistance with a threshold: optimize implementation
+ if the strings lengths differ more than the threshold. Thanks to
+ Jonatan Jönsson.
+o LANG-1151: Performance improvements for NumberUtils.isParsable. Thanks to
+ Juan Pablo Santos Rodríguez.
+o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
+ which prevents whole builder to be scalarized. Thanks to
+ Ruslan Cheremin.
+o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
+ Matthias Niehoff.
+o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
+o LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
+ Larry West and Pascal Schumacher.
+o LANG-1183: Making replacePattern/removePattern methods null safe in
+ StringUtils.
+o LANG-1057: Replace StringBuilder with String concatenation for better
+ optimization. Thanks to Otávio Santana.
+o LANG-1075: Deprecate SystemUtils.FILE_SEPARATOR and
+ SystemUtils.PATH_SEPARATOR.
+o LANG-979: TypeUtils.parameterizeWithOwner - wrong format descriptor for
+ "invalid number of type parameters". Thanks to Bruno P. Kinoshita.
+o LANG-1112: MultilineRecursiveToStringStyle largely unusable due to being
+ package-private.
+o LANG-1058: StringUtils.uncapitalize performance improvement. Thanks to
+ Leo Wang.
+o LANG-1069: CharSet.getInstance documentation does not clearly explain how
+ to include negation character in set. Thanks to Arno Noordover.
+o LANG-1107: Fix parsing edge cases in FastDateParser.
+o LANG-1273: Added new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils. Thanks
+ to Jake Wang.
+
+=============================================================================
+
+ Release Notes for version 3.4
+
+
+COMPATIBILITY
+=============
+
+Commons Lang 3.4 is fully binary compatible to the last release and can
+therefore be used as a drop in replacement for 3.3.2. Note that the value of
+org.apache.commons.lang3.time.DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN
+has changed, which may affect clients using the constant. Furthermore the
+constant is used internally in
+o DurationFormatUtils.formatDurationISO(long)
+o DurationFormatUtils.formatPeriodISO(long, long)
+
+For more information see https://issues.apache.org/jira/browse/LANG-1000.
+
+NEW FEATURES
+==============
+
+o LANG-821: Support OS X versions in SystemUtils. Thanks to Timo Kockert.
+o LANG-1103: Add SystemUtils.IS_JAVA_1_9
+o LANG-1093: Add ClassUtils.getAbbreviatedName(). Thanks to Fabian Lange.
+o LANG-1082: Add option to disable the "objectsTriviallyEqual" test in
+ DiffBuilder. Thanks to Jonathan Baker.
+o LANG-1015: Add JsonToStringStyle implementation to ToStringStyle. Thanks to
+ Thiago Andrade.
+o LANG-1080: Add NoClassNameToStringStyle implementation of ToStringStyle.
+ Thanks to Innokenty Shuvalov.
+o LANG-883: Add StringUtils.containsAny(CharSequence, CharSequence...) method.
+ Thanks to Daniel Stewart.
+o LANG-1052: Multiline recursive to string style. Thanks to Jan Matèrne.
+o LANG-536: Add isSorted() to ArrayUtils. Thanks to James Sawle.
+o LANG-1033: Add StringUtils.countMatches(CharSequence, char)
+o LANG-1021: Provide methods to retrieve all fields/methods annotated with a
+ specific type. Thanks to Alexander Müller.
+o LANG-1016: NumberUtils#isParsable method(s). Thanks to
+ Juan Pablo Santos Rodríguez.
+o LANG-999: Add fuzzy String matching logic to StringUtils. Thanks to
+ Ben Ripkens.
+o LANG-994: Add zero copy read method to StrBuilder. Thanks to
+ Mikhail Mazursky.
+o LANG-993: Add zero copy write method to StrBuilder. Thanks to
+ Mikhail Mazursky.
+o LANG-1044: Add method MethodUtils.invokeExactMethod(Object, String)
+o LANG-1045: Add method MethodUtils.invokeMethod(Object, String)
+
+FIXED BUGS
+============
+
+o LANG-794: SystemUtils.IS_OS_WINDOWS_2008, VISTA are incorrect. Thanks to
+ Timo Kockert.
+o LANG-1104: Parse test fails for TimeZone America/Sao_Paulo
+o LANG-948: Exception while using ExtendedMessageFormat and escaping braces.
+ Thanks to Andrey Khobnya.
+o LANG-1092: Wrong formating of time zones with daylight saving time in
+ FastDatePrinter
+o LANG-1090: FastDateParser does not set error indication in ParsePosition
+o LANG-1089: FastDateParser does not handle excess hours as per
+ SimpleDateFormat
+o LANG-1061: FastDateParser error - timezones not handled correctly. Thanks to
+ dmeneses.
+o LANG-1087: NumberUtils#createNumber() returns positive BigDecimal when
+ negative Float is expected. Thanks to Renat Zhilkibaev.
+o LANG-1081: DiffBuilder.append(String, Object left, Object right) does not do
+ a left.equals(right) check. Thanks to Jonathan Baker.
+o LANG-1055: StrSubstitutor.replaceSystemProperties does not work consistently.
+ Thanks to Jonathan Baker.
+o LANG-1083: Add (T) casts to get unit tests to pass in old JDK. Thanks to
+ Jonathan Baker.
+o LANG-1073: Read wrong component type of array in add in ArrayUtils.
+ Thanks to haiyang li.
+o LANG-1077: StringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils.
+ Thanks to haiyang li.
+o LANG-1072: Duplicated "0x" check in createBigInteger in NumberUtils. Thanks
+ to haiyang li.
+o LANG-1064: StringUtils.abbreviate description doesn't agree with the
+ examples. Thanks to B.J. Herbison.
+o LANG-1041: Fix MethodUtilsTest so it does not depend on JDK method ordering.
+ Thanks to Alexandre Bartel.
+o LANG-1000: ParseException when trying to parse UTC dates with Z as zone
+ designator using DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT
+o LANG-1035: Javadoc for EqualsBuilder.reflectionEquals() is unclear
+o LANG-1001: ISO 8601 misspelled throughout the Javadocs. Thanks to
+ Michael Osipov.
+o LANG-1088: FastDateParser should be case insensitive
+o LANG-995: Fix bug with stripping spaces on last line in WordUtils.wrap().
+ Thanks to Andrey Khobnya.
+
+CHANGES
+=========
+
+o LANG-1102: Make logic for comparing OS versions in SystemUtils smarter
+o LANG-1091: Shutdown thread pools in test cases. Thanks to Fabian Lange.
+o LANG-1101: FastDateParser and FastDatePrinter support 'X' format
+o LANG-1100: Avoid memory allocation when using date formating to StringBuffer.
+ Thanks to mbracher.
+o LANG-935: Possible performance improvement on string escape functions.
+ Thanks to Fabian Lange, Thomas Neidhart.
+o LANG-1098: Avoid String allocation in StrBuilder.append(CharSequence). Thanks
+ to Mikhail Mazurskiy, Fabian Lange.
+o LANG-1098: Update maven-checkstyle-plugin to 2.14. Thanks to Micha? Kordas.
+o LANG-1097: Update org.easymock:easymock to 3.3.1. Thanks to Micha? Kordas.
+o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
+o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
+o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
+ Fabian Lange.
+o LANG-1071: Fix wrong examples in JavaDoc of
+ StringUtils.replaceEachRepeatedly(...),
+ StringUtils.replaceEach(...) Thanks to Arno Noordover.
+o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
+ uses in performing comparisons
+o LANG-1020: Improve performance of normalize space. Thanks to Libor Ondrusek.
+o LANG-1027: org.apache.commons.lang3.SystemUtils#isJavaVersionAtLeast should
+ return true by default
+o LANG-1026: Bring static method references in StringUtils to consistent style.
+ Thanks to Alex Yursha.
+o LANG-1017: Use non-ASCII digits in Javadoc examples for
+ StringUtils.isNumeric. Thanks to Christoph Schneegans.
+o LANG-1008: Change min/max methods in NumberUtils/IEEE754rUtils from array
+ input parameters to varargs. Thanks to Thiago Andrade.
+o LANG-1006: Add wrap (with String or char) to StringUtils. Thanks to
+ Thiago Andrade.
+o LANG-1005: Extend DurationFormatUtils#formatDurationISO default pattern to
+ match #formatDurationHMS. Thanks to Michael Osipov.
+o LANG-1007: Fixing NumberUtils JAVADoc comments for max methods. Thanks to
+ Thiago Andrade.
+o LANG-731: Better Javadoc for BitField class
+o LANG-1004: DurationFormatUtils#formatDurationHMS implementation does not
+ correspond to Javadoc and vice versa. Thanks to Michael Osipov.
+o LANG-1003: DurationFormatUtils are not able to handle negative
+ durations/periods
+o LANG-998: Javadoc is not clear on preferred pattern to instantiate
+ FastDateParser / FastDatePrinter
+
+=============================================================================
+
+ Release Notes for version 3.3.2
+
+NEW FEATURES
+==============
+
+o LANG-989: Add org.apache.commons.lang3.SystemUtils.IS_JAVA_1_8
+
+FIXED BUGS
+============
+
+o LANG-992: NumberUtils#isNumber() returns false for "0.0", "0.4790", et al
+
+=============================================================================
+
+ Release Notes for version 3.3.1
+
+FIXED BUGS
+============
+
+o LANG-987: DateUtils.getFragmentInDays(Date, Calendar.MONTH) returns wrong
+ days
+o LANG-983: DurationFormatUtils does not describe format string fully
+o LANG-981: DurationFormatUtils#lexx does not detect unmatched quote char
+o LANG-984: DurationFormatUtils does not handle large durations correctly
+o LANG-982: DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field
+ size should be 4 digits
+o LANG-978: Failing tests with Java 8 b128
+
+=============================================================================
+
+ Release Notes for version 3.3
+
+NEW FEATURES
+==============
+
+o LANG-955: Add methods for removing all invalid characters according to
+ XML 1.0 and XML 1.1 in an input string to StringEscapeUtils.
+ Thanks to Adam Hooper.
+o LANG-970: Add APIs MutableBoolean setTrue() and setFalse()
+o LANG-962: Add SerializationUtils.roundtrip(T extends Serializable) to
+ serialize then deserialize
+o LANG-637: There should be a DifferenceBuilder with a
+ ReflectionDifferenceBuilder implementation
+o LANG-944: Add the Jaro-Winkler string distance algorithm to StringUtils.
+ Thanks to Rekha Joshi.
+o LANG-417: New class ClassPathUtils with methods for turning FQN into
+ resource path
+o LANG-834: Validate: add inclusiveBetween and exclusiveBetween overloads
+ for primitive types
+o LANG-900: New RandomUtils class. Thanks to Duncan Jones.
+o LANG-966: Add IBM OS/400 detection
+
+FIXED BUGS
+============
+
+o LANG-621: ReflectionToStringBuilder.toString does not debug 3rd party object
+ fields within 3rd party object. Thanks to Philip Hodges,
+ Thomas Neidhart.
+o LANG-977: NumericEntityEscaper incorrectly encodes supplementary characters.
+ Thanks to Chris Karcher.
+o LANG-973: Make some private fields final
+o LANG-971: NumberUtils#isNumber(String) fails to reject invalid Octal numbers
+o LANG-972: NumberUtils#isNumber does not allow for hex 0XABCD
+o LANG-969: StringUtils.toEncodedString(byte[], Charset) needlessly throws
+ UnsupportedEncodingException. Thanks to Matt Bishop.
+o LANG-946: ConstantInitializerTest fails when building with IBM JDK 7
+o LANG-954: uncaught PatternSyntaxException in FastDateFormat on Android.
+ Thanks to Michael Keppler.
+o LANG-936: StringUtils.getLevenshteinDistance with too big of a threshold
+ returns wrong result. Thanks to Yaniv Kunda, Eli Lindsey.
+o LANG-943: Test DurationFormatUtilsTest.testEdgeDuration fails in
+ JDK 1.6, 1.7 and 1.8, BRST time zone
+o LANG-613: ConstructorUtils.getAccessibleConstructor() Does Not Check the
+ Accessibility of Enclosing Classes
+o LANG-951: Fragments are wrong by 1 day when using fragment YEAR or MONTH.
+ Thanks to Sebastian Götz.
+o LANG-950: FastDateParser does not handle two digit year parsing like
+ SimpleDateFormat
+o LANG-949: FastDateParserTest.testParses does not test FastDateParser
+o LANG-915: Wrong locale handling in LocaleUtils.toLocale().
+ Thanks to Sergio Fernández.
+
+CHANGES
+=========
+
+o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field)
+ does not clean up after itself
+o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
+ is used internally
+o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-939: Move Documentation from user guide to package-info files
+o LANG-953: Convert package.html files to package-info.java files
+o LANG-940: Fix deprecation warnings
+o LANG-819: EnumUtils.generateBitVector needs a "? extends"
+
+=============================================================================
+
+ Release Notes for version 3.2.1
+
+BUG FIXES
+===========
+
+o LANG-937: Fix missing Hamcrest dependency in Ant Build
+o LANG-941: Test failure in LocaleUtilsTest when building with JDK 8
+o LANG-942: Test failure in FastDateParserTest and FastDateFormat_ParserTest
+ when building with JDK8. Thanks to Bruno P. Kinoshita,
+ Henri Yandell.
+o LANG-938: Build fails with test failures when building with JDK 8
+
+=============================================================================
+
+ Release Notes for version 3.2
+
+COMPATIBILITY WITH 3.1
+========================
+
+This release introduces backwards incompatible changes in
+org.apache.commons.lang3.time.FastDateFormat:
+o Method 'protected java.util.List parsePattern()' has been removed
+o Method 'protected java.lang.String parseToken(java.lang.String, int[])' has
+ been removed
+o Method 'protected org.apache.commons.lang3.time.FastDateFormat$NumberRule
+ selectNumberRule(int, int)' has been removed
+
+These changes were the result of [LANG-462]. It is assumed that this change
+will not break clients as Charles Honton pointed out on 25/Jan/12:
+"
+ 1. Methods "FastDateFormat$NumberRule selectNumberRule(int, int)" and
+ "List parsePattern()" couldn't have been overridden because
+ NumberRule and Rule were private to FastDateFormat.
+ 2. Due to the factory pattern used, it's unlikely other two methods would have
+ been overridden.
+ 3. The four methods are highly implementation specific. I consider it a
+ mistake that the methods were exposed.
+"
+For more information see https://issues.apache.org/jira/browse/LANG-462.
+
+NEW FEATURES
+==============
+
+o LANG-934: Add removeFinalModifier to FieldUtils
+o LANG-863: Method returns number of inheritance hops between parent and
+ subclass. Thanks to Daneel S. Yaitskov.
+o LANG-774: Added isStarted, isSuspended and isStopped to StopWatch.
+ Thanks to Erhan Bagdemir.
+o LANG-848: Added StringUtils.isBlank/isEmpty CharSequence... methods.
+ Thanks to Alexander Muthmann.
+o LANG-926: Added ArrayUtils.reverse(array, from, to) methods.
+o LANG-795: StringUtils.toString(byte[], String) deprecated in favour of a new
+ StringUtils.toString(byte[], CharSet). Thanks to Aaron Digulla.
+o LANG-893: StrSubstitutor now supports default values for variables.
+ Thanks to Woonsan Ko.
+o LANG-913: Adding .gitignore to commons-lang. Thanks to Allon Mureinik.
+o LANG-837: Add ObjectUtils.toIdentityString methods that support
+ StringBuilder, StrBuilder, and Appendable.
+o LANG-886: Added CharSetUtils.containsAny(String, String).
+o LANG-797: Added escape/unescapeJson to StringEscapeUtils.
+o LANG-875: Added appendIfMissing and prependIfMissing methods to StringUtils.
+o LANG-870: Add StringUtils.LF and StringUtils.CR values.
+o LANG-873: Add FieldUtils getAllFields() to return all the fields defined in
+ the given class and super classes.
+o LANG-835: StrBuilder should support StringBuilder as an input parameter.
+o LANG-857: StringIndexOutOfBoundsException in CharSequenceTranslator.
+o LANG-856: Code refactoring in NumberUtils.
+o LANG-855: NumberUtils#createBigInteger does not allow for hex and octal
+ numbers.
+o LANG-854: NumberUtils#createNumber - does not allow for hex numbers to be
+ larger than Long.
+o LANG-853: StringUtils join APIs for primitives.
+o LANG-841: Add StringUtils API to call String.replaceAll in DOTALL a.k.a.
+ single-line mode.
+o LANG-825: Create StrBuilder APIs similar to
+ String.format(String, Object...).
+o LANG-675: Add Triple class (ternary version of Pair).
+o LANG-462: FastDateFormat supports parse methods.
+
+BUG FIXES
+===========
+
+o LANG-932: Spelling fixes. Thanks to Ville Skyttä.
+o LANG-929: OctalUnescaper tried to parse all of \279.
+o LANG-928: OctalUnescaper had bugs when parsing octals starting with a zero.
+o LANG-905: EqualsBuilder returned true when comparing arrays, even when the
+ elements are different.
+o LANG-917: Fixed exception when combining custom and choice format in
+ ExtendedMessageFormat. Thanks to Arne Burmeister.
+o LANG-902: RandomStringUtils.random javadoc was incorrectly promising letters
+ and numbers would, as opposed to may, appear Issue:. Thanks to
+ Andrzej Winnicki.
+o LANG-921: BooleanUtils.xor(boolean...) produces wrong results.
+o LANG-896: BooleanUtils.toBoolean(String str) javadoc is not updated. Thanks
+ to Mark Bryan Yu.
+o LANG-879: LocaleUtils test fails with new Locale "ja_JP_JP_#u-ca-japanese"
+ of JDK7.
+o LANG-836: StrSubstitutor does not support StringBuilder or CharSequence.
+ Thanks to Arnaud Brunet.
+o LANG-693: Method createNumber from NumberUtils doesn't work for floating
+ point numbers other than Float Issue: LANG-693. Thanks to
+ Calvin Echols.
+o LANG-887: FastDateFormat does not use the locale specific cache correctly.
+o LANG-754: ClassUtils.getShortName(String) will now only do a reverse lookup
+ for array types.
+o LANG-881: NumberUtils.createNumber() Javadoc says it does not work for octal
+ numbers.
+o LANG-865: LocaleUtils.toLocale does not parse strings starting with an
+ underscore.
+o LANG-858: StringEscapeUtils.escapeJava() and escapeEcmaScript() do not
+ output the escaped surrogate pairs that are Java parsable.
+o LANG-849: FastDateFormat and FastDatePrinter generates Date objects
+ wastefully.
+o LANG-845: Spelling fixes.
+o LANG-844: Fix examples contained in javadoc of StringUtils.center methods.
+o LANG-832: FastDateParser does not handle unterminated quotes correctly.
+o LANG-831: FastDateParser does not handle white-space properly.
+o LANG-830: FastDateParser could use \Q \E to quote regexes.
+o LANG-828: FastDateParser does not handle non-Gregorian calendars properly.
+o LANG-826: FastDateParser does not handle non-ASCII digits correctly.
+o LANG-822: NumberUtils#createNumber - bad behaviour for leading "--".
+o LANG-818: FastDateFormat's "z" pattern does not respect timezone of Calendar
+ instances passed to format().
+o LANG-817: Add org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS_8.
+o LANG-813: StringUtils.equalsIgnoreCase doesn't check string reference
+ equality.
+o LANG-810: StringUtils.join() endIndex, bugged for loop.
+o LANG-807: RandomStringUtils throws confusing IAE when end <= start.
+o LANG-805: RandomStringUtils.random(count, 0, 0, false, false, universe,
+ random) always throws java.lang.ArrayIndexOutOfBoundsException.
+o LANG-802: LocaleUtils - unnecessary recursive call in SyncAvoid class.
+o LANG-800: Javadoc bug in DateUtils#ceiling for Calendar and Object versions.
+o LANG-788: SerializationUtils throws ClassNotFoundException when cloning
+ primitive classes.
+o LANG-786: StringUtils equals() relies on undefined behavior.
+o LANG-783: Documentation bug: StringUtils.split.
+o LANG-777: jar contains velocity template of release notes.
+o LANG-776: TypeUtilsTest contains incorrect type assignability assertion.
+o LANG-775: TypeUtils.getTypeArguments() misses type arguments for
+ partially-assigned classes.
+o LANG-773: ImmutablePair doc contains nonsense text.
+o LANG-772: ClassUtils.PACKAGE_SEPARATOR Javadoc contains garbage text.
+o LANG-765: EventListenerSupport.ProxyInvocationHandler no longer defines
+ serialVersionUID.
+o LANG-764: StrBuilder is now serializable.
+o LANG-761: Fix Javadoc Ant warnings.
+o LANG-747: NumberUtils does not handle Long Hex numbers.
+o LANG-743: Javadoc bug in static inner class DateIterator.
+
+CHANGES
+=========
+
+o LANG-931: Misleading Javadoc comment in StrBuilderReader class. Thanks
+ to Christoph Schneegans.
+o LANG-910: StringUtils.normalizeSpace now handles non-breaking spaces
+ (Unicode 00A0). Thanks to Timur Yarosh.
+o LANG-804: Redundant check for zero in HashCodeBuilder ctor. Thanks to
+ Allon Mureinik.
+o LANG-884: Simplify FastDateFormat; eliminate boxing.
+o LANG-882: LookupTranslator now works with implementations of CharSequence
+ other than String.
+o LANG-846: Provide CharSequenceUtils.regionMatches with a proper green
+ implementation instead of inefficiently converting to Strings.
+o LANG-839: ArrayUtils removeElements methods use unnecessary HashSet.
+o LANG-838: ArrayUtils removeElements methods clone temporary index arrays
+ unnecessarily.
+o LANG-799: DateUtils#parseDate uses default locale; add Locale support.
+o LANG-798: Use generics in SerializationUtils.
+
+CHANGES WITHOUT TICKET
+========================
+
+o Fixed URLs in javadoc to point to new oracle.com pages
+
+=============================================================================
+
+ Release Notes for version 3.1
+
+NEW FEATURES
+==============
+
+o LANG-801: Add Conversion utility to convert between data types on byte level
+o LANG-760: Add API StringUtils.toString(byte[] intput, String charsetName)
+o LANG-756: Add APIs ClassUtils.isPrimitiveWrapper(Class>) and
+ isPrimitiveOrWrapper(Class>)
+o LANG-695: SystemUtils.IS_OS_UNIX doesn't recognize FreeBSD as a Unix system
+
+BUG FIXES
+===========
+
+o LANG-749: Incorrect Bundle-SymbolicName in Manifest
+o LANG-746: NumberUtils does not handle upper-case hex: 0X and -0X
+o LANG-744: StringUtils throws java.security.AccessControlException on Google
+ App Engine
+o LANG-741: Ant build has wrong component.name
+o LANG-698: Document that the Mutable numbers don't work as expected with
+ String.format
+
+CHANGES
+=========
+
+o LANG-758: Add an example with whitespace in StringUtils.defaultIfEmpty
+o LANG-752: Fix createLong() so it behaves like createInteger()
+o LANG-751: Include the actual type in the Validate.isInstance and
+ isAssignableFrom exception messages
+o LANG-748: Deprecating chomp(String, String)
+o LANG-736: CharUtils static final array CHAR_STRING is not needed to compute
+ CHAR_STRING_ARRAY
+
+=============================================================================
+
+ Release Notes for version 3.0
+
+ADDITIONS
+===========
+
+o LANG-276: MutableBigDecimal and MutableBigInteger.
+o LANG-285: Wish : method unaccent.
+o LANG-358: ObjectUtils.coalesce.
+o LANG-386: LeftOf/RightOfNumber in Range convenience methods necessary.
+o LANG-435: Add ClassUtils.isAssignable() variants with autoboxing.
+o LANG-444: StringUtils.emptyToNull.
+o LANG-482: Enhance StrSubstitutor to support nested ${var-${subvr}} expansion
+o LANG-482: StrSubstitutor now supports substitution in variable names.
+o LANG-496: A generic implementation of the Lazy initialization pattern.
+o LANG-497: Addition of ContextedException and ContextedRuntimeException.
+o LANG-498: Add StringEscapeUtils.escapeText() methods.
+o LANG-499: Add support for the handling of ExecutionExceptions.
+o LANG-501: Add support for background initialization.
+o LANG-529: Add a concurrent package.
+o LANG-533: Validate: support for validating blank strings.
+o LANG-537: Add ArrayUtils.toArray to create generic arrays.
+o LANG-545: Add ability to create a Future for a constant.
+o LANG-546: Add methods to Validate to check whether the index is valid for
+ the array/list/string.
+o LANG-553: Add TypeUtils class to provide utility code for working with generic
+ types.
+o LANG-559: Added isAssignableFrom and isInstanceOf validation methods.
+o LANG-559: Added validState validation method.
+o LANG-560: New TimedSemaphore class.
+o LANG-582: Provide an implementation of the ThreadFactory interface.
+o LANG-588: Create a basic Pair class.
+o LANG-594: DateUtils equal & compare functions up to most significant field.
+o LANG-601: Add Builder Interface / Update Builders to Implement It.
+o LANG-609: Support lazy initialization using atomic variables
+o LANG-610: Extend exception handling in ConcurrentUtils to runtime exceptions.
+o LANG-614: StringUtils.endsWithAny method
+o LANG-640: Add normalizeSpace to StringUtils
+o LANG-644: Provide documentation about the new concurrent package
+o LANG-649: BooleanUtils.toBooleanObject to support single character input
+o LANG-651: Add AnnotationUtils
+o LANG-653: Provide a very basic ConcurrentInitializer implementation
+o LANG-655: Add StringUtils.defaultIfBlank()
+o LANG-667: Add a Null-safe compare() method to ObjectUtils
+o LANG-676: Documented potential NPE if auto-boxing occurs for some BooleanUtils
+ methods
+o LANG-678: Add support for ConcurrentMap.putIfAbsent()
+o LANG-692: Add hashCodeMulti varargs method
+o LANG-697: Add FormattableUtils class
+o LANG-684: Levenshtein Distance Within a Given Threshold
+
+REMOVALS
+==========
+
+o LANG-438: Remove @deprecateds.
+o LANG-492: Remove code handled now by the JDK.
+o LANG-493: Remove code that does not hold enough value to remain.
+o LANG-590: Remove JDK 1.2/1.3 bug handling in
+ StringUtils.indexOf(String, String, int).
+o LANG-673: WordUtils.abbreviate() removed
+o LANG-691: Removed DateUtils.UTC_TIME_ZONE
+
+IMPROVEMENTS
+==============
+
+o LANG-290: EnumUtils for JDK 5.0.
+o LANG-336: Finally start using generics.
+o LANG-355: StrBuilder should implement CharSequence and Appendable.
+o LANG-396: Investigate for vararg usages.
+o LANG-424: Improve Javadoc for StringUtils class.
+o LANG-458: Refactor Validate.java to eliminate code redundancy.
+o LANG-479: Document where in SVN trunk is.
+o LANG-504: bring ArrayUtils.isEmpty to the generics world.
+o LANG-505: Rewrite StringEscapeUtils.
+o LANG-507: StringEscapeUtils.unescapeJava should support \u+ notation.
+o LANG-510: Convert StringUtils API to take CharSequence.
+o LANG-513: Better EnumUtils.
+o LANG-528: Mutable classes should implement an appropriately typed Mutable
+ interface.
+o LANG-539: Compile commons.lang for CDC 1.1/Foundation 1.1.
+o LANG-540: Make NumericEntityEscaper immutable.
+o LANG-541: Replace StringBuffer with StringBuilder.
+o LANG-548: Use Iterable on API instead of Collection.
+o LANG-551: Replace Range classes with generic version.
+o LANG-562: Change Maven groupId.
+o LANG-563: Change Java package name.
+o LANG-570: Do the test cases really still require main() and suite() methods?
+o LANG-579: Add new Validate methods.
+o LANG-599: ClassUtils.getClass(): Allow Dots as Inner Class Separators.
+o LANG-605: DefaultExceptionContext overwrites values in recursive situations.
+o LANG-668: Change ObjectUtils min() & max() functions to use varargs rather
+ than just two parameters
+o LANG-681: Push down WordUtils to "text" sub-package.
+o LANG-711: Add includeantruntime=false to javac targets to quell warnings in
+ ant 1.8.1 and better (and modest performance gain).
+o LANG-713: Increase test coverage of FieldUtils read methods and tweak
+ javadoc.
+o LANG-718: build.xml Java 1.5+ updates.
+
+BUG FIXES
+===========
+
+o LANG-11: Depend on JDK 1.5+.
+o LANG-302: StrBuilder does not implement clone().
+o LANG-339: StringEscapeUtils.escapeHtml() escapes multibyte characters like
+ Chinese, Japanese, etc.
+o LANG-369: ExceptionUtils not thread-safe.
+o LANG-418: Javadoc incorrect for StringUtils.endsWithIgnoreCase.
+o LANG-428: StringUtils.isAlpha, isAlphanumeric and isNumeric now return false
+ for ""
+o LANG-439: StringEscapeUtils.escapeHTML() does not escape chars (0x00-0x20).
+o LANG-448: Lower Ascii Characters don't get encoded by Entities.java.
+o LANG-468: JDK 1.5 build/runtime failure on LANG-393 (EqualsBuilder).
+o LANG-474: Fixes for thread safety.
+o LANG-478: StopWatch does not resist to system time changes.
+o LANG-480: StringEscapeUtils.escapeHtml incorrectly converts unicode
+ characters above U+00FFFF into 2 characters.
+o LANG-481: Possible race-conditions in hashCode of the range classes.
+o LANG-564: Improve StrLookup API documentation.
+o LANG-568: @SuppressWarnings("unchecked") is used too generally.
+o LANG-571: ArrayUtils.add(T[: array, T element) can create unexpected
+ ClassCastException.
+o LANG-585: exception.DefaultExceptionContext.getFormattedExceptionMessage
+ catches Throwable.
+o LANG-596: StrSubstitutor should also handle the default properties of a
+ java.util.Properties class
+o LANG-600: Javadoc is incorrect for public static int
+ lastIndexOf(String str, String searchStr).
+o LANG-602: ContextedRuntimeException no longer an 'unchecked' exception.
+o LANG-606: EqualsBuilder causes StackOverflowException.
+o LANG-608: Some StringUtils methods should take an int character instead of
+ char to use String API features.
+o LANG-617: StringEscapeUtils.escapeXML() can't process UTF-16 supplementary
+ characters
+o LANG-624: SystemUtils.getJavaVersionAsFloat throws
+ StringIndexOutOfBoundsException on Android runtime/Dalvik VM
+o LANG-629: Charset may not be threadsafe, because the HashSet is not synch.
+o LANG-638: NumberUtils createNumber throws a StringIndexOutOfBoundsException
+ when argument containing "e" and "E" is passed in
+o LANG-643: Javadoc StringUtils.left() claims to throw on negative len, but
+ doesn't
+o LANG-645: FastDateFormat.format() outputs incorrect week of year because
+ locale isn't respected
+o LANG-646: StringEscapeUtils.unescapeJava doesn't handle octal escapes and
+ Unicode with extra u
+o LANG-656: Example StringUtils.indexOfAnyBut("zzabyycdxx", '') = 0 incorrect
+o LANG-658: Some Entitys like Ö are not matched properly against its
+ ISO8859-1 representation
+o LANG-659: EntityArrays typo: {"\u2122", "−"}, // minus sign, U+2212
+ ISOtech
+o LANG-66: StringEscaper.escapeXml() escapes characters > 0x7f.
+o LANG-662: org.apache.commons.lang3.math.Fraction does not reduce
+ (Integer.MIN_VALUE, 2^k)
+o LANG-663: org.apache.commons.lang3.math.Fraction does not always succeed in
+ multiplyBy and divideBy
+o LANG-664: NumberUtils.isNumber(String) is not right when the String is
+ "1.1L"
+o LANG-672: Doc bug in DateUtils#ceiling
+o LANG-677: DateUtils.isSameLocalTime compares using 12 hour clock and not
+ 24 hour
+o LANG-685: EqualsBuilder synchronizes on HashCodeBuilder.
+o LANG-703: StringUtils.join throws NPE when toString returns null for one of
+ objects in collection
+o LANG-710: StringIndexOutOfBoundsException when calling unescapeHtml4("")
+o LANG-714: StringUtils doc/comment spelling fixes.
+o LANG-715: CharSetUtils.squeeze() speedup.
+o LANG-716: swapCase and *capitalize speedups.
+
+
+Historical list of changes: http://commons.apache.org/lang/changes-report.html
+
+For complete information on Commons Lang, including instructions on how to
+submit bug reports, patches, or suggestions for improvement, see the
+Apache Commons Lang website:
+
+http://commons.apache.org/lang/
+
+Have fun!
+-Apache Commons Lang team
+
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.6.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.6.txt
new file mode 100644
index 00000000000..a3fc4b07488
--- /dev/null
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.6.txt
@@ -0,0 +1,1124 @@
+
+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.
+
+=============================================================================
+
+ Apache Commons Lang
+ Version 3.6
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 3.6 version of
+Apache Commons Lang as well as a history all changes in the Commons Lang 3.x
+release line. Commons Lang is a set of utility functions and reusable
+components that should be of use in any Java environment. Commons Lang 3.6 at
+least requires Java 7.0. Note that this has changed from Commons Lang 3.5, which
+only required Java 1.6.
+
+For the advice on upgrading from 2.x to 3.x, see the following page:
+
+ http://commons.apache.org/lang/article3_0.html
+
+HIGHLIGHTS
+==========
+
+Some of the highlights in this release include:
+
+o The class org.apache.commons.lang3.concurrent.Memoizer is an implementation
+ of the Memoizer pattern as shown in
+ Goetz, Brian et al. (2006) - Java Concurrency in Practice, p. 108.
+o The class org.apache.commons.lang3.ArchUtils has been added. ArchUtils is
+ a utility class for the "os.arch" system property.
+
+DEPRECATIONS
+============
+
+The Apache Commons Community has recently set up the Commons Text component
+as a home for algorithms working on strings. For this reason most of the string
+focused functionality in Commons Lang has been deprecated and moved to
+Commons Text. This includes:
+
+o All classes in the org.apache.commons.lang3.text and the
+ org.apache.commons.lang3.text.translate packages
+o org.apache.commons.lang3.StringEscapeUtils
+o org.apache.commons.lang3.RandomStringUtils
+o The methods org.apache.commons.lang3.StringUtils.getJaroWinklerDistance and
+ org.apache.commons.lang3.StringUtils.getLevenshteinDistance
+
+For more information see the Commons Text website:
+
+ http://commons.apache.org/text
+
+The class org.apache.commons.lang3.CharEncoding has been deprecated in favor of
+java.nio.charset.StandardCharsets.
+
+The following methods have been deprecated in
+org.apache.commons.lang3.ArrayUtils in favor of the corresponding insert
+methods. Note that the handling for null inputs differs between add and insert.
+
+o add(boolean[], int, boolean) -> insert(int, boolean[], boolean...)
+o add(byte[], int, boolean) -> insert(int, byte[], byte...)
+o add(char[], int, boolean) -> insert(int, char[], char...)
+o add(double[], int, boolean) -> insert(int, double[], double...)
+o add(float[], int, boolean) -> insert(int, float[], float...)
+o add(int[], int, boolean) -> insert(int, int[], int...)
+o add(long[], int, boolean) -> insert(int, long[], long...)
+o add(short[], int, boolean) -> insert(int, short[], short...)
+o add(T[], int, boolean) -> insert(int, T[], T...)
+
+
+COMPATIBILITY WITH JAVA 9
+==================
+
+The MANIFEST.MF now contains an additional entry:
+
+ Automatic-Module-Name: org.apache.commons.lang3
+
+This should make it possible to use Commons Lang 3.6 as a module in the Java 9
+module system. For more information see the corresponding issue and the
+referenced mailing list discussions:
+
+ https://issues.apache.org/jira/browse/LANG-1338
+
+The build problems present in the 3.5 release have been resolved. Building
+Commons Lang 3.6 should work out of the box with the latest Java 9 EA build.
+Please report any Java 9 related issues at:
+
+ https://issues.apache.org/jira/browse/LANG
+
+NEW FEATURES
+============
+
+o LANG-1336: Add NUL Byte To CharUtils. Thanks to Beluga Behr.
+o LANG-1304: Add method in StringUtils to determine if string contains both
+ mixed cased characters. Thanks to Andy Klimczak.
+o LANG-1325: Increase test coverage of ToStringBuilder class to 100%.
+ Thanks to Arshad Basha.
+o LANG-1307: Add a method in StringUtils to extract only digits out of input
+ string. Thanks to Arshad Basha.
+o LANG-1256: Add JMH maven dependencies. Thanks to C0rWin.
+o LANG-1167: Add null filter to ReflectionToStringBuilder.
+ Thanks to Mark Dacek.
+o LANG-1299: Add method for converting string to an array of code points.
+o LANG-660: Add methods to insert arrays into arrays at an index.
+o LANG-1034: Add support for recursive comparison to
+ EqualsBuilder#reflectionEquals. Thanks to Yathos UG.
+o LANG-1067: Add a reflection-based variant of DiffBuilder.
+o LANG-740: Implementation of a Memomizer. Thanks to James Sawle.
+o LANG-1258: Add ArrayUtils#toStringArray method.
+ Thanks to IG, Grzegorz Rożniecki.
+o LANG-1160: StringUtils#abbreviate should support 'custom ellipses' parameter.
+o LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods.
+ Thanks to Pierre Templier, Martin Tarjanyi.
+o LANG-1313: Add ArchUtils - An utility class for the "os.arch" system property.
+ Thanks to Tomschi.
+o LANG-1272: Add shuffle methods to ArrayUtils.
+o LANG-1317: Add MethodUtils#findAnnotation and extend
+ MethodUtils#getMethodsWithAnnotation for non-public, super-class
+ and interface methods. Thanks to Yasser Zamani.
+o LANG-1331: Add ImmutablePair.nullPair().
+o LANG-1332: Add ImmutableTriple.nullTriple().
+
+FIXED BUGS
+==========
+
+o LANG-1337: Fix test failures in IBM JDK 8 for ToStringBuilderTest.
+o LANG-1319: MultilineRecursiveToStringStyle StackOverflowError when object is
+ an array.
+o LANG-1320: LocaleUtils#toLocale does not support language followed by UN M.49
+ numeric-3 area code followed by variant.
+o LANG-1300: Clarify or improve behaviour of int-based indexOf methods in
+ StringUtils. Thanks to Mark Dacek.
+o LANG-1286: RandomStringUtils random method can overflow and return characters
+ outside of specified range.
+o LANG-1292: WordUtils.wrap throws StringIndexOutOfBoundsException.
+o LANG-1287: RandomStringUtils#random can enter infinite loop if end parameter
+ is to small. Thanks to Ivan Morozov.
+o LANG-1285: NullPointerException in FastDateParser$TimeZoneStrategy.
+ Thanks to Francesco Chicchiriccò.
+o LANG-1281: Javadoc of StringUtils.ordinalIndexOf is contradictory.
+ Thanks to Andreas Lundblad.
+o LANG-1188: StringUtils#join(T...): warning: [unchecked] Possible heap
+ pollution from parameterized vararg type T.
+o LANG-1144: Multiple calls of
+ org.apache.commons.lang3.concurrent.LazyInitializer.initialize()
+ are possible. Thanks to Waldemar Maier, Gary Gregory.
+o LANG-1276: StrBuilder#replaceAll ArrayIndexOutOfBoundsException.
+ Thanks to Andy Klimczak.
+o LANG-1278: BooleanUtils javadoc issues. Thanks to Duke Yin.
+o LANG-1070: ArrayUtils#add confusing example in javadoc.
+ Thanks to Paul Pogonyshev.
+o LANG-1271: StringUtils#isAnyEmpty and #isAnyBlank should return false for an
+ empty array. Thanks to Pierre Templier.
+o LANG-1155: Add StringUtils#unwrap. Thanks to Saif Asif, Thiago Andrade.
+o LANG-1311: TypeUtils.toString() doesn't handle primitive and Object arrays
+ correctly. Thanks to Aaron Digulla.
+o LANG-1312: LocaleUtils#toLocale does not support language followed by UN M.49
+ numeric-3 area code.
+o LANG-1265: Build failures when building with Java 9 EA.
+o LANG-1314: javadoc creation broken with Java 8. Thanks to Allon Murienik.
+o LANG-1310: MethodUtils.invokeMethod throws ArrayStoreException if using
+ varargs arguments and smaller types than the method defines.
+ Thanks to Don Jeba.
+
+CHANGES
+=======
+
+o LANG-1338: Add Automatic-Module-Name MANIFEST entry for Java 9
+ compatibility.
+o LANG-1334: Deprecate CharEncoding in favour of
+ java.nio.charset.StandardCharsets.
+o LANG-1110: Implement HashSetvBitSetTest using JMH.
+ Thanks to Bruno P. Kinoshita.
+o LANG-1290: Increase test coverage of org.apache.commons.lang3.ArrayUtils.
+ Thanks to Andrii Abramov.
+o LANG-1274: StrSubstitutor should state its thread safety.
+o LANG-1277: StringUtils#getLevenshteinDistance reduce memory consumption.
+ Thanks to yufcuy.
+o LANG-1279: Update Java requirement from Java 6 to 7.
+o LANG-1143: StringUtils should use toXxxxCase(int) rather than
+ toXxxxCase(char). Thanks to sebb.
+o LANG-1297: Add SystemUtils.getHostName() API.
+o LANG-1301: Moving apache-rat-plugin configuration into pluginManagement.
+ Thanks to Karl Heinz Marbaise.
+o LANG-1316: Deprecate classes/methods moved to commons-text.
+
+=============================================================================
+
+ Release Notes for version 3.5
+
+
+HIGHLIGHTS
+==========
+
+Some of the highlights in this release include:
+
+o Added Java 9 detection to org.apache.commons.lang3.SystemUtils.
+o Support for shifting and swapping elements in
+ org.apache.commons.lang3.ArrayUtils.
+o New methods for generating random strings from different character classes
+ including alphabetic, alpha-numeric and ASCII added to
+ org.apache.commons.lang3.RandomStringUtils.
+o Numerous extensions to org.apache.commons.lang3.StringUtils including
+ null safe compare variants, more remove and replace variants, rotation and
+ truncation.
+o Added org.apache.commons.lang3.ThreadUtils - a utility class to work with
+ instances of java.lang.Thread and java.lang.ThreadGroup.
+o Added annotations @EqualsExclude, @HashCodeExclude and @ToStringEclude to
+ mark fields which should be ignored by the reflective builders in the
+ org.apache.commons.lang3.builder package.
+o Support for various modify and retrieve value use cases added to the classes
+ in org.apache.commons.lang3.mutable.
+
+COMPATIBILITY
+=============
+
+Apache Commons Lang 3.5 is binary compatible with the 3.4 release. Users
+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:
+
+o Added method 'public boolean parse(java.lang.String, java.text.ParsePosition,
+ java.util.Calendar)'
+o Added method 'public java.lang.Appendable format(long, java.lang.Appendable)'
+o Added method 'public java.lang.Appendable format(java.util.Date,
+ java.lang.Appendable)'
+o Added method 'public java.lang.Appendable format(java.util.Calendar,
+ java.lang.Appendable)'
+
+For this reason 3.5 is not strictly source compatible to 3.4. Since the
+DatePrinter interface is not meant to be implemented by clients, this
+change it not considered to cause any problems.
+
+JAVA 9 SUPPORT
+==============
+
+Java 9 introduces a new version-string scheme. Details of this new scheme are
+documented in JEP-223 (http://openjdk.java.net/jeps/223). In order to support
+JEP-223 two classes had to be changed:
+
+o org.apache.commons.lang3.JavaVersion
+ deprecated enum constant JAVA_1_9
+ introduced enum constant JAVA_9
+
+o org.apache.commons.lang3.SystemUtils
+ deprecated constant IS_JAVA_1_9
+ introduced constant IS_JAVA_9
+
+For more information see LANG-1197
+(https://issues.apache.org/jira/browse/LANG-1197). All other APIs are expected
+to work with Java 9.
+
+BUILDING ON JAVA 9
+==================
+
+Java 8 introduced the Unicode Consortium's Common Locale Data Repository as
+alternative source for locale data. Java 9 will use the CLDR provider as
+default provider for locale data (see http://openjdk.java.net/jeps/252). This
+causes an number of locale-sensitive test in Commons Lang to fail. In order
+to build Commons Lang 3.5 on Java 9, the locale provider has to be set to
+'JRE':
+
+ mvn -Djava.locale.providers=JRE clean install
+
+We are currently investigating ways to support building on Java 9 without
+further configuration. For more information see:
+https://issues.apache.org/jira/browse/LANG-1265
+
+
+NEW FEATURES
+==============
+
+o LANG-1275: Added a tryAcquire() method to TimedSemaphore.
+o LANG-1255: Add DateUtils.toCalendar(Date, TimeZone). Thanks to Kaiyuan Wang.
+o LANG-1023: Add WordUtils.wrap overload with customizable breakable character.
+ Thanks to Marko Bekhta.
+o LANG-787: Add method removeIgnoreCase(String, String) to StringUtils. Thanks
+ to Gokul Nanthakumar C.
+o LANG-1224: Extend RandomStringUtils with methods that generate strings
+ between a min and max length. Thanks to Caleb Cushing.
+o LANG-1257: Add APIs StringUtils.wrapIfMissing(String, char|String). Thanks to
+ Gary Gregory.
+o LANG-1253: Add RandomUtils#nextBoolean() method. Thanks to adilek.
+o LANG-1085: Add a circuit breaker implementation. Thanks to Oliver Heger and
+ Bruno P. Kinoshita.
+o LANG-1013: Add StringUtils.truncate(). Thanks to Thiago Andrade.
+o LANG-1195: Enhance MethodUtils to allow invocation of private methods. Thanks
+ to Derek C. Ashmore.
+o LANG-1189: Add getAndIncrement/getAndDecrement/getAndAdd/incrementAndGet/
+ decrementAndGet/addAndGet in Mutable* classes. Thanks to
+ Haiyang Li and Matthew Bartenschlag.
+o LANG-1225: Add RandomStringUtils#randomGraph and #randomPrint which match
+ corresponding regular expression class. Thanks to Caleb Cushing.
+o LANG-1223: Add StopWatch#getTime(TimeUnit). Thanks to Nick Manley.
+o LANG-781: Add methods to ObjectUtils class to check for null elements in the
+ array. Thanks to Krzysztof Wolny.
+o LANG-1228: Prefer Throwable.getCause() in ExceptionUtils.getCause().
+ Thanks to Brad Hess.
+o LANG-1233: DiffBuilder add method to allow appending from a DiffResult.
+ Thanks to Nick Manley.
+o LANG-1168: Add SystemUtils.IS_OS_WINDOWS_10 property.
+ Thanks to Pascal Schumacher.
+o LANG-1115: Add support for varargs in ConstructorUtils, MemberUtils, and
+ MethodUtils. Thanks to Jim Lloyd and Joe Ferner.
+o LANG-1134: Add methods to check numbers against NaN and inifinite to
+ Validate. Thanks to Alan Smithee.
+o LANG-1220: Add tests for missed branches in DateUtils.
+ Thanks to Casey Scarborough.
+o LANG-1146: z/OS identification in SystemUtils.
+ Thanks to Gabor Liptak.
+o LANG-1192: FastDateFormat support of the week-year component (uppercase 'Y').
+ Thanks to Dominik Stadler.
+o LANG-1169: Add StringUtils methods to compare a string to multiple strings.
+ Thanks to Rafal Glowinski, Robert Parr and Arman Sharif.
+o LANG-1185: Add remove by regular expression methods in StringUtils.
+o LANG-1139: Add replace by regular expression methods in StringUtils.
+o LANG-1171: Add compare methods in StringUtils.
+o LANG-1174: Add sugar to RandomUtils. Thanks to Punkratz312.
+o LANG-1154: FastDateFormat APIs that use a StringBuilder. Thanks to
+ Gary Gregory.
+o LANG-1149: Ability to throw checked exceptions without declaring them. Thanks
+ to Gregory Zak.
+o LANG-1153: Implement ParsePosition api for FastDateParser.
+o LANG-1137: Add check for duplicate event listener in EventListenerSupport.
+ Thanks to Matthew Aguirre.
+o LANG-1135: Add method containsAllWords to WordUtils. Thanks to
+ Eduardo Martins.
+o LANG-1132: ReflectionToStringBuilder doesn't throw IllegalArgumentException
+ when the constructor's object param is null. Thanks to Jack Tan.
+o LANG-701: StringUtils join with var args. Thanks to James Sawle.
+o LANG-1105: Add ThreadUtils - A utility class which provides helper methods
+ related to java.lang.Thread Issue: LANG-1105. Thanks to
+ Hendrik Saly.
+o LANG-1031: Add annotations to exclude fields from ReflectionEqualsBuilder,
+ ReflectionToStringBuilder and ReflectionHashCodeBuilder. Thanks
+ to Felipe Adorno.
+o LANG-1127: Use JUnit rules to set and reset the default Locale and TimeZone.
+o LANG-1119: Add rotate(string, int) method to StringUtils. Thanks to
+ Loic Guibert.
+o LANG-1099: Add swap and shift operations for arrays to ArrayUtils. Thanks to
+ Adrian Ber.
+o LANG-1050: Change nullToEmpty methods to generics. Thanks to James Sawle.
+o LANG-1074: Add a method to ArrayUtils for removing all occurrences of a given
+ element Issue: LANG-1074. Thanks to Haiyang Li.
+
+FIXED BUGS
+============
+
+o LANG-1261: ArrayUtils.contains returns false for instances of subtypes.
+o LANG-1252: Rename NumberUtils.isNumber, isCreatable to better reflect
+ createNumber. Also, accommodated for "+" symbol as prefix in
+ isCreatable and isNumber. Thanks to Rob Tompkins.
+o LANG-1230: Remove unnecessary synchronization from registry lookup in
+ EqualsBuilder and HashCodeBuilder. Thanks to Philippe Marschall.
+o LANG-1214: Handle "void" in ClassUtils.getClass(). Thanks to Henry Tung.
+o LANG-1250: SerializationUtils#deserialize has unnecessary code and a comment
+ for that. Thanks to Glease Wang.
+o LANG-1190: TypeUtils.isAssignable throws NullPointerException when fromType
+ has type variables and toType generic superclass specifies type
+ variable. Thanks to Pascal Schumacher.
+o LANG-1226: StringUtils#normalizeSpace does not trim the string anymore.
+ Thanks to Pascal Schumacher.
+o LANG-1251: SerializationUtils.ClassLoaderAwareObjectInputStream should use
+ static initializer to initialize primitiveTypes map. Thanks to
+ Takuya Ueshin.
+o LANG-1248: FastDatePrinter Memory allocation regression. Thanks to
+ Benoit Wiart.
+o LANG-1018: Fix precision loss on NumberUtils.createNumber(String). Thanks to
+ Nick Manley.
+o LANG-1199: Fix implementation of StringUtils.getJaroWinklerDistance(). Thanks
+ to M. Steiger.
+o LANG-1244: Fix dead links in StringUtils.getLevenshteinDistance() javadoc.
+ Thanks to jjbankert.
+o LANG-1242: "\u2284":"?" mapping missing from
+ EntityArrays#HTML40_EXTENDED_ESCAPE. Thanks to Neal Stewart.
+o LANG-901: StringUtils#startsWithAny/endsWithAny is case sensitive -
+ documented as case insensitive. Thanks to Matthew Bartenschlag.
+o LANG-1232: DiffBuilder: Add null check on fieldName when appending Object or
+ Object[]. Thanks to Nick Manley.
+o LANG-1178: ArrayUtils.removeAll(Object array, int... indices) should do the
+ clone, not its callers. Thanks to Henri Yandell.
+o LANG-1120: StringUtils.stripAccents should remove accents from "Ł" and "ł".
+ Thanks to kaching88.
+o LANG-1205: NumberUtils.createNumber() behaves inconsistently with
+ NumberUtils.isNumber(). Thanks to pbrose.
+o LANG-1222: Fix for incorrect comment on StringUtils.containsIgnoreCase
+ method. Thanks to Adam J.
+o LANG-1221: Fix typo on appendIfMissing javadoc. Thanks to Pierre Templier.
+o LANG-1202: parseDateStrictly does't pass specified locale. Thanks to
+ Markus Jelsma.
+o LANG-1219: FastDateFormat doesn't respect summer daylight in some localized
+ strings. Thanks to Jarek.
+o LANG-1175: Remove Ant-based build.
+o LANG-1194: Limit max heap memory for consistent Travis CI build.
+o LANG-1186: Fix NullPointerException in FastDateParser$TimeZoneStrategy.
+ Thanks to NickManley.
+o LANG-1193: ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1
+ (correct answer should be 0); revert fix for LANG-1077. Thanks to
+ Qin Li.
+o LANG-1002: Several predefined ISO FastDateFormats in DateFormatUtils are
+ incorrect. Thanks to Michael Osipov.
+o LANG-1152: StringIndexOutOfBoundsException or field over-write for large year
+ fields in FastDateParser. Thanks to Pas Filip.
+o LANG-1141: StrLookup.systemPropertiesLookup() no longer reacts on changes on
+ system properties.
+o LANG-1147: EnumUtils *BitVector issue with more than 32 values Enum. Thanks
+ to Loic Guibert.
+o LANG-1059: Capitalize javadoc is incorrect. Thanks to Colin Casey.
+o LANG-1122: Inconsistent behavior of swap for malformed inputs. Thanks to
+ Adrian Ber.
+o LANG-1130: Fix critical issues reported by SonarQube.
+o LANG-1131: StrBuilder.equals(StrBuilder) doesn't check for null inputs.
+o LANG-1128: JsonToStringStyle doesn't handle chars and objects correctly.
+ Thanks to Jack Tan.
+o LANG-1126: DateFormatUtilsTest.testSMTP depends on the default Locale.
+o LANG-1123: Unit test FastDatePrinterTimeZonesTest needs a timezone set.
+ Thanks to Christian P. Momon.
+o LANG-916: DateFormatUtils.format does not correctly change Calendar
+ TimeZone in certain situations. Thanks to Christian P. Momon.
+o LANG-1116: DateUtilsTest.testLang530 fails for some timezones. Thanks to
+ Aaron Sheldon.
+o LANG-1114: TypeUtils.ParameterizedType#equals doesn't work with wildcard
+ types. Thanks to Andy Coates.
+o LANG-1118: StringUtils.repeat('z', -1) throws NegativeArraySizeException.
+ Thanks to Loic Guibert.
+o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
+o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
+ identical leading prefix..
+o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
+o LANG-1200: Fix JavaDoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
+o LANG-1191: Incorrect Javadoc
+ StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
+ qed, Brent Worden and Gary Gregory.
+
+CHANGES
+=========
+o LANG-1197: Prepare Java 9 detection.
+o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
+ big to be inlined. Thanks to Ruslan Cheremin.
+o LANG-1259: JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
+ to Dominik Stadler.
+o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
+ Benoit Wiart.
+o LANG-1229: HashCodeBuilder.append(Object,Object) is too big to be inlined,
+ which prevents whole builder to be scalarized. Thanks to
+ Ruslan Cheremin.
+o LANG-1243: Simplify ArrayUtils removeElements by using new decrementAndGet()
+ method.
+o LANG-1240: Optimize BitField constructor implementation. Thanks to zhanhb.
+o LANG-1206: Improve CharSetUtils.squeeze() performance. Thanks to
+ Mohammed Alfallaj.
+o LANG-1176: Improve ArrayUtils removeElements time complexity to O(n). Thanks
+ to Jeffery Yuan.
+o LANG-1234: getLevenshteinDistance with a threshold: optimize implementation
+ if the strings lengths differ more than the threshold. Thanks to
+ Jonatan Jönsson.
+o LANG-1151: Performance improvements for NumberUtils.isParsable. Thanks to
+ Juan Pablo Santos Rodríguez.
+o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
+ which prevents whole builder to be scalarized. Thanks to
+ Ruslan Cheremin.
+o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
+ Matthias Niehoff.
+o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
+o LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
+ Larry West and Pascal Schumacher.
+o LANG-1183: Making replacePattern/removePattern methods null safe in
+ StringUtils.
+o LANG-1057: Replace StringBuilder with String concatenation for better
+ optimization. Thanks to Otávio Santana.
+o LANG-1075: Deprecate SystemUtils.FILE_SEPARATOR and
+ SystemUtils.PATH_SEPARATOR.
+o LANG-979: TypeUtils.parameterizeWithOwner - wrong format descriptor for
+ "invalid number of type parameters". Thanks to Bruno P. Kinoshita.
+o LANG-1112: MultilineRecursiveToStringStyle largely unusable due to being
+ package-private.
+o LANG-1058: StringUtils.uncapitalize performance improvement. Thanks to
+ Leo Wang.
+o LANG-1069: CharSet.getInstance documentation does not clearly explain how
+ to include negation character in set. Thanks to Arno Noordover.
+o LANG-1107: Fix parsing edge cases in FastDateParser.
+o LANG-1273: Added new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils. Thanks
+ to Jake Wang.
+
+=============================================================================
+
+ Release Notes for version 3.4
+
+
+COMPATIBILITY
+=============
+
+Commons Lang 3.4 is fully binary compatible to the last release and can
+therefore be used as a drop in replacement for 3.3.2. Note that the value of
+org.apache.commons.lang3.time.DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN
+has changed, which may affect clients using the constant. Furthermore the
+constant is used internally in
+o DurationFormatUtils.formatDurationISO(long)
+o DurationFormatUtils.formatPeriodISO(long, long)
+
+For more information see https://issues.apache.org/jira/browse/LANG-1000.
+
+NEW FEATURES
+==============
+
+o LANG-821: Support OS X versions in SystemUtils. Thanks to Timo Kockert.
+o LANG-1103: Add SystemUtils.IS_JAVA_1_9
+o LANG-1093: Add ClassUtils.getAbbreviatedName(). Thanks to Fabian Lange.
+o LANG-1082: Add option to disable the "objectsTriviallyEqual" test in
+ DiffBuilder. Thanks to Jonathan Baker.
+o LANG-1015: Add JsonToStringStyle implementation to ToStringStyle. Thanks to
+ Thiago Andrade.
+o LANG-1080: Add NoClassNameToStringStyle implementation of ToStringStyle.
+ Thanks to Innokenty Shuvalov.
+o LANG-883: Add StringUtils.containsAny(CharSequence, CharSequence...) method.
+ Thanks to Daniel Stewart.
+o LANG-1052: Multiline recursive to string style. Thanks to Jan Matèrne.
+o LANG-536: Add isSorted() to ArrayUtils. Thanks to James Sawle.
+o LANG-1033: Add StringUtils.countMatches(CharSequence, char)
+o LANG-1021: Provide methods to retrieve all fields/methods annotated with a
+ specific type. Thanks to Alexander Müller.
+o LANG-1016: NumberUtils#isParsable method(s). Thanks to
+ Juan Pablo Santos Rodríguez.
+o LANG-999: Add fuzzy String matching logic to StringUtils. Thanks to
+ Ben Ripkens.
+o LANG-994: Add zero copy read method to StrBuilder. Thanks to
+ Mikhail Mazursky.
+o LANG-993: Add zero copy write method to StrBuilder. Thanks to
+ Mikhail Mazursky.
+o LANG-1044: Add method MethodUtils.invokeExactMethod(Object, String)
+o LANG-1045: Add method MethodUtils.invokeMethod(Object, String)
+
+FIXED BUGS
+============
+
+o LANG-794: SystemUtils.IS_OS_WINDOWS_2008, VISTA are incorrect. Thanks to
+ Timo Kockert.
+o LANG-1104: Parse test fails for TimeZone America/Sao_Paulo
+o LANG-948: Exception while using ExtendedMessageFormat and escaping braces.
+ Thanks to Andrey Khobnya.
+o LANG-1092: Wrong formating of time zones with daylight saving time in
+ FastDatePrinter
+o LANG-1090: FastDateParser does not set error indication in ParsePosition
+o LANG-1089: FastDateParser does not handle excess hours as per
+ SimpleDateFormat
+o LANG-1061: FastDateParser error - timezones not handled correctly. Thanks to
+ dmeneses.
+o LANG-1087: NumberUtils#createNumber() returns positive BigDecimal when
+ negative Float is expected. Thanks to Renat Zhilkibaev.
+o LANG-1081: DiffBuilder.append(String, Object left, Object right) does not do
+ a left.equals(right) check. Thanks to Jonathan Baker.
+o LANG-1055: StrSubstitutor.replaceSystemProperties does not work consistently.
+ Thanks to Jonathan Baker.
+o LANG-1083: Add (T) casts to get unit tests to pass in old JDK. Thanks to
+ Jonathan Baker.
+o LANG-1073: Read wrong component type of array in add in ArrayUtils.
+ Thanks to haiyang li.
+o LANG-1077: StringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils.
+ Thanks to haiyang li.
+o LANG-1072: Duplicated "0x" check in createBigInteger in NumberUtils. Thanks
+ to haiyang li.
+o LANG-1064: StringUtils.abbreviate description doesn't agree with the
+ examples. Thanks to B.J. Herbison.
+o LANG-1041: Fix MethodUtilsTest so it does not depend on JDK method ordering.
+ Thanks to Alexandre Bartel.
+o LANG-1000: ParseException when trying to parse UTC dates with Z as zone
+ designator using DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT
+o LANG-1035: Javadoc for EqualsBuilder.reflectionEquals() is unclear
+o LANG-1001: ISO 8601 misspelled throughout the Javadocs. Thanks to
+ Michael Osipov.
+o LANG-1088: FastDateParser should be case insensitive
+o LANG-995: Fix bug with stripping spaces on last line in WordUtils.wrap().
+ Thanks to Andrey Khobnya.
+
+CHANGES
+=========
+
+o LANG-1102: Make logic for comparing OS versions in SystemUtils smarter
+o LANG-1091: Shutdown thread pools in test cases. Thanks to Fabian Lange.
+o LANG-1101: FastDateParser and FastDatePrinter support 'X' format
+o LANG-1100: Avoid memory allocation when using date formating to StringBuffer.
+ Thanks to mbracher.
+o LANG-935: Possible performance improvement on string escape functions.
+ Thanks to Fabian Lange, Thomas Neidhart.
+o LANG-1098: Avoid String allocation in StrBuilder.append(CharSequence). Thanks
+ to Mikhail Mazurskiy, Fabian Lange.
+o LANG-1098: Update maven-checkstyle-plugin to 2.14. Thanks to Micha? Kordas.
+o LANG-1097: Update org.easymock:easymock to 3.3.1. Thanks to Micha? Kordas.
+o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
+o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
+o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
+ Fabian Lange.
+o LANG-1071: Fix wrong examples in JavaDoc of
+ StringUtils.replaceEachRepeatedly(...),
+ StringUtils.replaceEach(...) Thanks to Arno Noordover.
+o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
+ uses in performing comparisons
+o LANG-1020: Improve performance of normalize space. Thanks to Libor Ondrusek.
+o LANG-1027: org.apache.commons.lang3.SystemUtils#isJavaVersionAtLeast should
+ return true by default
+o LANG-1026: Bring static method references in StringUtils to consistent style.
+ Thanks to Alex Yursha.
+o LANG-1017: Use non-ASCII digits in Javadoc examples for
+ StringUtils.isNumeric. Thanks to Christoph Schneegans.
+o LANG-1008: Change min/max methods in NumberUtils/IEEE754rUtils from array
+ input parameters to varargs. Thanks to Thiago Andrade.
+o LANG-1006: Add wrap (with String or char) to StringUtils. Thanks to
+ Thiago Andrade.
+o LANG-1005: Extend DurationFormatUtils#formatDurationISO default pattern to
+ match #formatDurationHMS. Thanks to Michael Osipov.
+o LANG-1007: Fixing NumberUtils JAVADoc comments for max methods. Thanks to
+ Thiago Andrade.
+o LANG-731: Better Javadoc for BitField class
+o LANG-1004: DurationFormatUtils#formatDurationHMS implementation does not
+ correspond to Javadoc and vice versa. Thanks to Michael Osipov.
+o LANG-1003: DurationFormatUtils are not able to handle negative
+ durations/periods
+o LANG-998: Javadoc is not clear on preferred pattern to instantiate
+ FastDateParser / FastDatePrinter
+
+=============================================================================
+
+ Release Notes for version 3.3.2
+
+NEW FEATURES
+==============
+
+o LANG-989: Add org.apache.commons.lang3.SystemUtils.IS_JAVA_1_8
+
+FIXED BUGS
+============
+
+o LANG-992: NumberUtils#isNumber() returns false for "0.0", "0.4790", et al
+
+=============================================================================
+
+ Release Notes for version 3.3.1
+
+FIXED BUGS
+============
+
+o LANG-987: DateUtils.getFragmentInDays(Date, Calendar.MONTH) returns wrong
+ days
+o LANG-983: DurationFormatUtils does not describe format string fully
+o LANG-981: DurationFormatUtils#lexx does not detect unmatched quote char
+o LANG-984: DurationFormatUtils does not handle large durations correctly
+o LANG-982: DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field
+ size should be 4 digits
+o LANG-978: Failing tests with Java 8 b128
+
+=============================================================================
+
+ Release Notes for version 3.3
+
+NEW FEATURES
+==============
+
+o LANG-955: Add methods for removing all invalid characters according to
+ XML 1.0 and XML 1.1 in an input string to StringEscapeUtils.
+ Thanks to Adam Hooper.
+o LANG-970: Add APIs MutableBoolean setTrue() and setFalse()
+o LANG-962: Add SerializationUtils.roundtrip(T extends Serializable) to
+ serialize then deserialize
+o LANG-637: There should be a DifferenceBuilder with a
+ ReflectionDifferenceBuilder implementation
+o LANG-944: Add the Jaro-Winkler string distance algorithm to StringUtils.
+ Thanks to Rekha Joshi.
+o LANG-417: New class ClassPathUtils with methods for turning FQN into
+ resource path
+o LANG-834: Validate: add inclusiveBetween and exclusiveBetween overloads
+ for primitive types
+o LANG-900: New RandomUtils class. Thanks to Duncan Jones.
+o LANG-966: Add IBM OS/400 detection
+
+FIXED BUGS
+============
+
+o LANG-621: ReflectionToStringBuilder.toString does not debug 3rd party object
+ fields within 3rd party object. Thanks to Philip Hodges,
+ Thomas Neidhart.
+o LANG-977: NumericEntityEscaper incorrectly encodes supplementary characters.
+ Thanks to Chris Karcher.
+o LANG-973: Make some private fields final
+o LANG-971: NumberUtils#isNumber(String) fails to reject invalid Octal numbers
+o LANG-972: NumberUtils#isNumber does not allow for hex 0XABCD
+o LANG-969: StringUtils.toEncodedString(byte[], Charset) needlessly throws
+ UnsupportedEncodingException. Thanks to Matt Bishop.
+o LANG-946: ConstantInitializerTest fails when building with IBM JDK 7
+o LANG-954: uncaught PatternSyntaxException in FastDateFormat on Android.
+ Thanks to Michael Keppler.
+o LANG-936: StringUtils.getLevenshteinDistance with too big of a threshold
+ returns wrong result. Thanks to Yaniv Kunda, Eli Lindsey.
+o LANG-943: Test DurationFormatUtilsTest.testEdgeDuration fails in
+ JDK 1.6, 1.7 and 1.8, BRST time zone
+o LANG-613: ConstructorUtils.getAccessibleConstructor() Does Not Check the
+ Accessibility of Enclosing Classes
+o LANG-951: Fragments are wrong by 1 day when using fragment YEAR or MONTH.
+ Thanks to Sebastian Götz.
+o LANG-950: FastDateParser does not handle two digit year parsing like
+ SimpleDateFormat
+o LANG-949: FastDateParserTest.testParses does not test FastDateParser
+o LANG-915: Wrong locale handling in LocaleUtils.toLocale().
+ Thanks to Sergio Fernández.
+
+CHANGES
+=========
+
+o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field)
+ does not clean up after itself
+o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
+ is used internally
+o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-939: Move Documentation from user guide to package-info files
+o LANG-953: Convert package.html files to package-info.java files
+o LANG-940: Fix deprecation warnings
+o LANG-819: EnumUtils.generateBitVector needs a "? extends"
+
+=============================================================================
+
+ Release Notes for version 3.2.1
+
+BUG FIXES
+===========
+
+o LANG-937: Fix missing Hamcrest dependency in Ant Build
+o LANG-941: Test failure in LocaleUtilsTest when building with JDK 8
+o LANG-942: Test failure in FastDateParserTest and FastDateFormat_ParserTest
+ when building with JDK8. Thanks to Bruno P. Kinoshita,
+ Henri Yandell.
+o LANG-938: Build fails with test failures when building with JDK 8
+
+=============================================================================
+
+ Release Notes for version 3.2
+
+COMPATIBILITY WITH 3.1
+========================
+
+This release introduces backwards incompatible changes in
+org.apache.commons.lang3.time.FastDateFormat:
+o Method 'protected java.util.List parsePattern()' has been removed
+o Method 'protected java.lang.String parseToken(java.lang.String, int[])' has
+ been removed
+o Method 'protected org.apache.commons.lang3.time.FastDateFormat$NumberRule
+ selectNumberRule(int, int)' has been removed
+
+These changes were the result of [LANG-462]. It is assumed that this change
+will not break clients as Charles Honton pointed out on 25/Jan/12:
+"
+ 1. Methods "FastDateFormat$NumberRule selectNumberRule(int, int)" and
+ "List parsePattern()" couldn't have been overridden because
+ NumberRule and Rule were private to FastDateFormat.
+ 2. Due to the factory pattern used, it's unlikely other two methods would have
+ been overridden.
+ 3. The four methods are highly implementation specific. I consider it a
+ mistake that the methods were exposed.
+"
+For more information see https://issues.apache.org/jira/browse/LANG-462.
+
+NEW FEATURES
+==============
+
+o LANG-934: Add removeFinalModifier to FieldUtils
+o LANG-863: Method returns number of inheritance hops between parent and
+ subclass. Thanks to Daneel S. Yaitskov.
+o LANG-774: Added isStarted, isSuspended and isStopped to StopWatch.
+ Thanks to Erhan Bagdemir.
+o LANG-848: Added StringUtils.isBlank/isEmpty CharSequence... methods.
+ Thanks to Alexander Muthmann.
+o LANG-926: Added ArrayUtils.reverse(array, from, to) methods.
+o LANG-795: StringUtils.toString(byte[], String) deprecated in favour of a new
+ StringUtils.toString(byte[], CharSet). Thanks to Aaron Digulla.
+o LANG-893: StrSubstitutor now supports default values for variables.
+ Thanks to Woonsan Ko.
+o LANG-913: Adding .gitignore to commons-lang. Thanks to Allon Mureinik.
+o LANG-837: Add ObjectUtils.toIdentityString methods that support
+ StringBuilder, StrBuilder, and Appendable.
+o LANG-886: Added CharSetUtils.containsAny(String, String).
+o LANG-797: Added escape/unescapeJson to StringEscapeUtils.
+o LANG-875: Added appendIfMissing and prependIfMissing methods to StringUtils.
+o LANG-870: Add StringUtils.LF and StringUtils.CR values.
+o LANG-873: Add FieldUtils getAllFields() to return all the fields defined in
+ the given class and super classes.
+o LANG-835: StrBuilder should support StringBuilder as an input parameter.
+o LANG-857: StringIndexOutOfBoundsException in CharSequenceTranslator.
+o LANG-856: Code refactoring in NumberUtils.
+o LANG-855: NumberUtils#createBigInteger does not allow for hex and octal
+ numbers.
+o LANG-854: NumberUtils#createNumber - does not allow for hex numbers to be
+ larger than Long.
+o LANG-853: StringUtils join APIs for primitives.
+o LANG-841: Add StringUtils API to call String.replaceAll in DOTALL a.k.a.
+ single-line mode.
+o LANG-825: Create StrBuilder APIs similar to
+ String.format(String, Object...).
+o LANG-675: Add Triple class (ternary version of Pair).
+o LANG-462: FastDateFormat supports parse methods.
+
+BUG FIXES
+===========
+
+o LANG-932: Spelling fixes. Thanks to Ville Skyttä.
+o LANG-929: OctalUnescaper tried to parse all of \279.
+o LANG-928: OctalUnescaper had bugs when parsing octals starting with a zero.
+o LANG-905: EqualsBuilder returned true when comparing arrays, even when the
+ elements are different.
+o LANG-917: Fixed exception when combining custom and choice format in
+ ExtendedMessageFormat. Thanks to Arne Burmeister.
+o LANG-902: RandomStringUtils.random javadoc was incorrectly promising letters
+ and numbers would, as opposed to may, appear Issue:. Thanks to
+ Andrzej Winnicki.
+o LANG-921: BooleanUtils.xor(boolean...) produces wrong results.
+o LANG-896: BooleanUtils.toBoolean(String str) javadoc is not updated. Thanks
+ to Mark Bryan Yu.
+o LANG-879: LocaleUtils test fails with new Locale "ja_JP_JP_#u-ca-japanese"
+ of JDK7.
+o LANG-836: StrSubstitutor does not support StringBuilder or CharSequence.
+ Thanks to Arnaud Brunet.
+o LANG-693: Method createNumber from NumberUtils doesn't work for floating
+ point numbers other than Float Issue: LANG-693. Thanks to
+ Calvin Echols.
+o LANG-887: FastDateFormat does not use the locale specific cache correctly.
+o LANG-754: ClassUtils.getShortName(String) will now only do a reverse lookup
+ for array types.
+o LANG-881: NumberUtils.createNumber() Javadoc says it does not work for octal
+ numbers.
+o LANG-865: LocaleUtils.toLocale does not parse strings starting with an
+ underscore.
+o LANG-858: StringEscapeUtils.escapeJava() and escapeEcmaScript() do not
+ output the escaped surrogate pairs that are Java parsable.
+o LANG-849: FastDateFormat and FastDatePrinter generates Date objects
+ wastefully.
+o LANG-845: Spelling fixes.
+o LANG-844: Fix examples contained in javadoc of StringUtils.center methods.
+o LANG-832: FastDateParser does not handle unterminated quotes correctly.
+o LANG-831: FastDateParser does not handle white-space properly.
+o LANG-830: FastDateParser could use \Q \E to quote regexes.
+o LANG-828: FastDateParser does not handle non-Gregorian calendars properly.
+o LANG-826: FastDateParser does not handle non-ASCII digits correctly.
+o LANG-822: NumberUtils#createNumber - bad behaviour for leading "--".
+o LANG-818: FastDateFormat's "z" pattern does not respect timezone of Calendar
+ instances passed to format().
+o LANG-817: Add org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS_8.
+o LANG-813: StringUtils.equalsIgnoreCase doesn't check string reference
+ equality.
+o LANG-810: StringUtils.join() endIndex, bugged for loop.
+o LANG-807: RandomStringUtils throws confusing IAE when end <= start.
+o LANG-805: RandomStringUtils.random(count, 0, 0, false, false, universe,
+ random) always throws java.lang.ArrayIndexOutOfBoundsException.
+o LANG-802: LocaleUtils - unnecessary recursive call in SyncAvoid class.
+o LANG-800: Javadoc bug in DateUtils#ceiling for Calendar and Object versions.
+o LANG-788: SerializationUtils throws ClassNotFoundException when cloning
+ primitive classes.
+o LANG-786: StringUtils equals() relies on undefined behavior.
+o LANG-783: Documentation bug: StringUtils.split.
+o LANG-777: jar contains velocity template of release notes.
+o LANG-776: TypeUtilsTest contains incorrect type assignability assertion.
+o LANG-775: TypeUtils.getTypeArguments() misses type arguments for
+ partially-assigned classes.
+o LANG-773: ImmutablePair doc contains nonsense text.
+o LANG-772: ClassUtils.PACKAGE_SEPARATOR Javadoc contains garbage text.
+o LANG-765: EventListenerSupport.ProxyInvocationHandler no longer defines
+ serialVersionUID.
+o LANG-764: StrBuilder is now serializable.
+o LANG-761: Fix Javadoc Ant warnings.
+o LANG-747: NumberUtils does not handle Long Hex numbers.
+o LANG-743: Javadoc bug in static inner class DateIterator.
+
+CHANGES
+=========
+
+o LANG-931: Misleading Javadoc comment in StrBuilderReader class. Thanks
+ to Christoph Schneegans.
+o LANG-910: StringUtils.normalizeSpace now handles non-breaking spaces
+ (Unicode 00A0). Thanks to Timur Yarosh.
+o LANG-804: Redundant check for zero in HashCodeBuilder ctor. Thanks to
+ Allon Mureinik.
+o LANG-884: Simplify FastDateFormat; eliminate boxing.
+o LANG-882: LookupTranslator now works with implementations of CharSequence
+ other than String.
+o LANG-846: Provide CharSequenceUtils.regionMatches with a proper green
+ implementation instead of inefficiently converting to Strings.
+o LANG-839: ArrayUtils removeElements methods use unnecessary HashSet.
+o LANG-838: ArrayUtils removeElements methods clone temporary index arrays
+ unnecessarily.
+o LANG-799: DateUtils#parseDate uses default locale; add Locale support.
+o LANG-798: Use generics in SerializationUtils.
+
+CHANGES WITHOUT TICKET
+========================
+
+o Fixed URLs in javadoc to point to new oracle.com pages
+
+=============================================================================
+
+ Release Notes for version 3.1
+
+NEW FEATURES
+==============
+
+o LANG-801: Add Conversion utility to convert between data types on byte level
+o LANG-760: Add API StringUtils.toString(byte[] intput, String charsetName)
+o LANG-756: Add APIs ClassUtils.isPrimitiveWrapper(Class>) and
+ isPrimitiveOrWrapper(Class>)
+o LANG-695: SystemUtils.IS_OS_UNIX doesn't recognize FreeBSD as a Unix system
+
+BUG FIXES
+===========
+
+o LANG-749: Incorrect Bundle-SymbolicName in Manifest
+o LANG-746: NumberUtils does not handle upper-case hex: 0X and -0X
+o LANG-744: StringUtils throws java.security.AccessControlException on Google
+ App Engine
+o LANG-741: Ant build has wrong component.name
+o LANG-698: Document that the Mutable numbers don't work as expected with
+ String.format
+
+CHANGES
+=========
+
+o LANG-758: Add an example with whitespace in StringUtils.defaultIfEmpty
+o LANG-752: Fix createLong() so it behaves like createInteger()
+o LANG-751: Include the actual type in the Validate.isInstance and
+ isAssignableFrom exception messages
+o LANG-748: Deprecating chomp(String, String)
+o LANG-736: CharUtils static final array CHAR_STRING is not needed to compute
+ CHAR_STRING_ARRAY
+
+=============================================================================
+
+ Release Notes for version 3.0
+
+ADDITIONS
+===========
+
+o LANG-276: MutableBigDecimal and MutableBigInteger.
+o LANG-285: Wish : method unaccent.
+o LANG-358: ObjectUtils.coalesce.
+o LANG-386: LeftOf/RightOfNumber in Range convenience methods necessary.
+o LANG-435: Add ClassUtils.isAssignable() variants with autoboxing.
+o LANG-444: StringUtils.emptyToNull.
+o LANG-482: Enhance StrSubstitutor to support nested ${var-${subvr}} expansion
+o LANG-482: StrSubstitutor now supports substitution in variable names.
+o LANG-496: A generic implementation of the Lazy initialization pattern.
+o LANG-497: Addition of ContextedException and ContextedRuntimeException.
+o LANG-498: Add StringEscapeUtils.escapeText() methods.
+o LANG-499: Add support for the handling of ExecutionExceptions.
+o LANG-501: Add support for background initialization.
+o LANG-529: Add a concurrent package.
+o LANG-533: Validate: support for validating blank strings.
+o LANG-537: Add ArrayUtils.toArray to create generic arrays.
+o LANG-545: Add ability to create a Future for a constant.
+o LANG-546: Add methods to Validate to check whether the index is valid for
+ the array/list/string.
+o LANG-553: Add TypeUtils class to provide utility code for working with generic
+ types.
+o LANG-559: Added isAssignableFrom and isInstanceOf validation methods.
+o LANG-559: Added validState validation method.
+o LANG-560: New TimedSemaphore class.
+o LANG-582: Provide an implementation of the ThreadFactory interface.
+o LANG-588: Create a basic Pair class.
+o LANG-594: DateUtils equal & compare functions up to most significant field.
+o LANG-601: Add Builder Interface / Update Builders to Implement It.
+o LANG-609: Support lazy initialization using atomic variables
+o LANG-610: Extend exception handling in ConcurrentUtils to runtime exceptions.
+o LANG-614: StringUtils.endsWithAny method
+o LANG-640: Add normalizeSpace to StringUtils
+o LANG-644: Provide documentation about the new concurrent package
+o LANG-649: BooleanUtils.toBooleanObject to support single character input
+o LANG-651: Add AnnotationUtils
+o LANG-653: Provide a very basic ConcurrentInitializer implementation
+o LANG-655: Add StringUtils.defaultIfBlank()
+o LANG-667: Add a Null-safe compare() method to ObjectUtils
+o LANG-676: Documented potential NPE if auto-boxing occurs for some BooleanUtils
+ methods
+o LANG-678: Add support for ConcurrentMap.putIfAbsent()
+o LANG-692: Add hashCodeMulti varargs method
+o LANG-697: Add FormattableUtils class
+o LANG-684: Levenshtein Distance Within a Given Threshold
+
+REMOVALS
+==========
+
+o LANG-438: Remove @deprecateds.
+o LANG-492: Remove code handled now by the JDK.
+o LANG-493: Remove code that does not hold enough value to remain.
+o LANG-590: Remove JDK 1.2/1.3 bug handling in
+ StringUtils.indexOf(String, String, int).
+o LANG-673: WordUtils.abbreviate() removed
+o LANG-691: Removed DateUtils.UTC_TIME_ZONE
+
+IMPROVEMENTS
+==============
+
+o LANG-290: EnumUtils for JDK 5.0.
+o LANG-336: Finally start using generics.
+o LANG-355: StrBuilder should implement CharSequence and Appendable.
+o LANG-396: Investigate for vararg usages.
+o LANG-424: Improve Javadoc for StringUtils class.
+o LANG-458: Refactor Validate.java to eliminate code redundancy.
+o LANG-479: Document where in SVN trunk is.
+o LANG-504: bring ArrayUtils.isEmpty to the generics world.
+o LANG-505: Rewrite StringEscapeUtils.
+o LANG-507: StringEscapeUtils.unescapeJava should support \u+ notation.
+o LANG-510: Convert StringUtils API to take CharSequence.
+o LANG-513: Better EnumUtils.
+o LANG-528: Mutable classes should implement an appropriately typed Mutable
+ interface.
+o LANG-539: Compile commons.lang for CDC 1.1/Foundation 1.1.
+o LANG-540: Make NumericEntityEscaper immutable.
+o LANG-541: Replace StringBuffer with StringBuilder.
+o LANG-548: Use Iterable on API instead of Collection.
+o LANG-551: Replace Range classes with generic version.
+o LANG-562: Change Maven groupId.
+o LANG-563: Change Java package name.
+o LANG-570: Do the test cases really still require main() and suite() methods?
+o LANG-579: Add new Validate methods.
+o LANG-599: ClassUtils.getClass(): Allow Dots as Inner Class Separators.
+o LANG-605: DefaultExceptionContext overwrites values in recursive situations.
+o LANG-668: Change ObjectUtils min() & max() functions to use varargs rather
+ than just two parameters
+o LANG-681: Push down WordUtils to "text" sub-package.
+o LANG-711: Add includeantruntime=false to javac targets to quell warnings in
+ ant 1.8.1 and better (and modest performance gain).
+o LANG-713: Increase test coverage of FieldUtils read methods and tweak
+ javadoc.
+o LANG-718: build.xml Java 1.5+ updates.
+
+BUG FIXES
+===========
+
+o LANG-11: Depend on JDK 1.5+.
+o LANG-302: StrBuilder does not implement clone().
+o LANG-339: StringEscapeUtils.escapeHtml() escapes multibyte characters like
+ Chinese, Japanese, etc.
+o LANG-369: ExceptionUtils not thread-safe.
+o LANG-418: Javadoc incorrect for StringUtils.endsWithIgnoreCase.
+o LANG-428: StringUtils.isAlpha, isAlphanumeric and isNumeric now return false
+ for ""
+o LANG-439: StringEscapeUtils.escapeHTML() does not escape chars (0x00-0x20).
+o LANG-448: Lower Ascii Characters don't get encoded by Entities.java.
+o LANG-468: JDK 1.5 build/runtime failure on LANG-393 (EqualsBuilder).
+o LANG-474: Fixes for thread safety.
+o LANG-478: StopWatch does not resist to system time changes.
+o LANG-480: StringEscapeUtils.escapeHtml incorrectly converts unicode
+ characters above U+00FFFF into 2 characters.
+o LANG-481: Possible race-conditions in hashCode of the range classes.
+o LANG-564: Improve StrLookup API documentation.
+o LANG-568: @SuppressWarnings("unchecked") is used too generally.
+o LANG-571: ArrayUtils.add(T[: array, T element) can create unexpected
+ ClassCastException.
+o LANG-585: exception.DefaultExceptionContext.getFormattedExceptionMessage
+ catches Throwable.
+o LANG-596: StrSubstitutor should also handle the default properties of a
+ java.util.Properties class
+o LANG-600: Javadoc is incorrect for public static int
+ lastIndexOf(String str, String searchStr).
+o LANG-602: ContextedRuntimeException no longer an 'unchecked' exception.
+o LANG-606: EqualsBuilder causes StackOverflowException.
+o LANG-608: Some StringUtils methods should take an int character instead of
+ char to use String API features.
+o LANG-617: StringEscapeUtils.escapeXML() can't process UTF-16 supplementary
+ characters
+o LANG-624: SystemUtils.getJavaVersionAsFloat throws
+ StringIndexOutOfBoundsException on Android runtime/Dalvik VM
+o LANG-629: Charset may not be threadsafe, because the HashSet is not synch.
+o LANG-638: NumberUtils createNumber throws a StringIndexOutOfBoundsException
+ when argument containing "e" and "E" is passed in
+o LANG-643: Javadoc StringUtils.left() claims to throw on negative len, but
+ doesn't
+o LANG-645: FastDateFormat.format() outputs incorrect week of year because
+ locale isn't respected
+o LANG-646: StringEscapeUtils.unescapeJava doesn't handle octal escapes and
+ Unicode with extra u
+o LANG-656: Example StringUtils.indexOfAnyBut("zzabyycdxx", '') = 0 incorrect
+o LANG-658: Some Entitys like Ö are not matched properly against its
+ ISO8859-1 representation
+o LANG-659: EntityArrays typo: {"\u2122", "−"}, // minus sign, U+2212
+ ISOtech
+o LANG-66: StringEscaper.escapeXml() escapes characters > 0x7f.
+o LANG-662: org.apache.commons.lang3.math.Fraction does not reduce
+ (Integer.MIN_VALUE, 2^k)
+o LANG-663: org.apache.commons.lang3.math.Fraction does not always succeed in
+ multiplyBy and divideBy
+o LANG-664: NumberUtils.isNumber(String) is not right when the String is
+ "1.1L"
+o LANG-672: Doc bug in DateUtils#ceiling
+o LANG-677: DateUtils.isSameLocalTime compares using 12 hour clock and not
+ 24 hour
+o LANG-685: EqualsBuilder synchronizes on HashCodeBuilder.
+o LANG-703: StringUtils.join throws NPE when toString returns null for one of
+ objects in collection
+o LANG-710: StringIndexOutOfBoundsException when calling unescapeHtml4("")
+o LANG-714: StringUtils doc/comment spelling fixes.
+o LANG-715: CharSetUtils.squeeze() speedup.
+o LANG-716: swapCase and *capitalize speedups.
+
+
+Historical list of changes: http://commons.apache.org/lang/changes-report.html
+
+For complete information on Commons Lang, including instructions on how to
+submit bug reports, patches, or suggestions for improvement, see the
+Apache Commons Lang website:
+
+http://commons.apache.org/lang/
+
+Have fun!
+-Apache Commons Lang team
+
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.7.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.7.txt
new file mode 100644
index 00000000000..b77a9b45267
--- /dev/null
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.7.txt
@@ -0,0 +1,1176 @@
+
+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.
+
+
+ Apache Commons Lang
+ Version 3.7
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 3.7 version of Apache Commons Lang.
+Commons Lang is a set of utility functions and reusable components that should be of use in any
+Java environment.
+
+Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
+variable arguments, autoboxing, concurrency and formatted output.
+
+For the advice on upgrading from 2.x to 3.x, see the following page:
+
+ http://commons.apache.org/lang/article3_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
+standard as to justify existence in java.lang.
+
+New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
+
+Changes in this version include:
+
+New features:
+o LANG-1355: TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.) Thanks to Chas Honton.
+o LANG-1360: Add methods to ObjectUtils to get various forms of class names in a null-safe manner Thanks to Gary Gregory.
+
+Fixed Bugs:
+o LANG-1362: Fix tests DateUtilsTest for Java 9 with en_GB locale Thanks to Stephen Colebourne.
+o LANG-1365: Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10 Thanks to Gary Gregory.
+o LANG-1348: StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf Thanks to mbusso.
+o LANG-1350: ConstructorUtils.invokeConstructor(Class, Object...) regression Thanks to Brett Kail.
+o LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug Thanks to Naman Nigam.
+o LANG-1357: org.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale) Thanks to BruceKuiLiu.
+
+Changes:
+o LANG-1358: Improve StringUtils#replace throughput Thanks to Stephane Landelle.
+o LANG-1346: Remove deprecation from RandomStringUtils
+o LANG-1361: ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Thanks to Ana.
+
+
+Historical list of changes: http://commons.apache.org/proper/commons-lang/changes-report.html
+
+For complete information on Apache Commons Lang, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Apache Commons Lang website:
+
+http://commons.apache.org/proper/commons-lang/
+
+=============================================================================
+
+ Apache Commons Lang
+ Version 3.6
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 3.6 version of
+Apache Commons Lang as well as a history all changes in the Commons Lang 3.x
+release line. Commons Lang is a set of utility functions and reusable
+components that should be of use in any Java environment. Commons Lang 3.6 at
+least requires Java 7.0. Note that this has changed from Commons Lang 3.5, which
+only required Java 1.6.
+
+For the advice on upgrading from 2.x to 3.x, see the following page:
+
+ http://commons.apache.org/lang/article3_0.html
+
+HIGHLIGHTS
+==========
+
+Some of the highlights in this release include:
+
+o The class org.apache.commons.lang3.concurrent.Memoizer is an implementation
+ of the Memoizer pattern as shown in
+ Goetz, Brian et al. (2006) - Java Concurrency in Practice, p. 108.
+o The class org.apache.commons.lang3.ArchUtils has been added. ArchUtils is
+ a utility class for the "os.arch" system property.
+
+DEPRECATIONS
+============
+
+The Apache Commons Community has recently set up the Commons Text component
+as a home for algorithms working on strings. For this reason most of the string
+focused functionality in Commons Lang has been deprecated and moved to
+Commons Text. This includes:
+
+o All classes in the org.apache.commons.lang3.text and the
+ org.apache.commons.lang3.text.translate packages
+o org.apache.commons.lang3.StringEscapeUtils
+o org.apache.commons.lang3.RandomStringUtils
+o The methods org.apache.commons.lang3.StringUtils.getJaroWinklerDistance and
+ org.apache.commons.lang3.StringUtils.getLevenshteinDistance
+
+For more information see the Commons Text website:
+
+ http://commons.apache.org/text
+
+The class org.apache.commons.lang3.CharEncoding has been deprecated in favor of
+java.nio.charset.StandardCharsets.
+
+The following methods have been deprecated in
+org.apache.commons.lang3.ArrayUtils in favor of the corresponding insert
+methods. Note that the handling for null inputs differs between add and insert.
+
+o add(boolean[], int, boolean) -> insert(int, boolean[], boolean...)
+o add(byte[], int, boolean) -> insert(int, byte[], byte...)
+o add(char[], int, boolean) -> insert(int, char[], char...)
+o add(double[], int, boolean) -> insert(int, double[], double...)
+o add(float[], int, boolean) -> insert(int, float[], float...)
+o add(int[], int, boolean) -> insert(int, int[], int...)
+o add(long[], int, boolean) -> insert(int, long[], long...)
+o add(short[], int, boolean) -> insert(int, short[], short...)
+o add(T[], int, boolean) -> insert(int, T[], T...)
+
+
+COMPATIBILITY WITH JAVA 9
+==================
+
+The MANIFEST.MF now contains an additional entry:
+
+ Automatic-Module-Name: org.apache.commons.lang3
+
+This should make it possible to use Commons Lang 3.6 as a module in the Java 9
+module system. For more information see the corresponding issue and the
+referenced mailing list discussions:
+
+ https://issues.apache.org/jira/browse/LANG-1338
+
+The build problems present in the 3.5 release have been resolved. Building
+Commons Lang 3.6 should work out of the box with the latest Java 9 EA build.
+Please report any Java 9 related issues at:
+
+ https://issues.apache.org/jira/browse/LANG
+
+NEW FEATURES
+============
+
+o LANG-1336: Add NUL Byte To CharUtils. Thanks to Beluga Behr.
+o LANG-1304: Add method in StringUtils to determine if string contains both
+ mixed cased characters. Thanks to Andy Klimczak.
+o LANG-1325: Increase test coverage of ToStringBuilder class to 100%.
+ Thanks to Arshad Basha.
+o LANG-1307: Add a method in StringUtils to extract only digits out of input
+ string. Thanks to Arshad Basha.
+o LANG-1256: Add JMH maven dependencies. Thanks to C0rWin.
+o LANG-1167: Add null filter to ReflectionToStringBuilder.
+ Thanks to Mark Dacek.
+o LANG-1299: Add method for converting string to an array of code points.
+o LANG-660: Add methods to insert arrays into arrays at an index.
+o LANG-1034: Add support for recursive comparison to
+ EqualsBuilder#reflectionEquals. Thanks to Yathos UG.
+o LANG-1067: Add a reflection-based variant of DiffBuilder.
+o LANG-740: Implementation of a Memomizer. Thanks to James Sawle.
+o LANG-1258: Add ArrayUtils#toStringArray method.
+ Thanks to IG, Grzegorz Rożniecki.
+o LANG-1160: StringUtils#abbreviate should support 'custom ellipses' parameter.
+o LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods.
+ Thanks to Pierre Templier, Martin Tarjanyi.
+o LANG-1313: Add ArchUtils - An utility class for the "os.arch" system property.
+ Thanks to Tomschi.
+o LANG-1272: Add shuffle methods to ArrayUtils.
+o LANG-1317: Add MethodUtils#findAnnotation and extend
+ MethodUtils#getMethodsWithAnnotation for non-public, super-class
+ and interface methods. Thanks to Yasser Zamani.
+o LANG-1331: Add ImmutablePair.nullPair().
+o LANG-1332: Add ImmutableTriple.nullTriple().
+
+FIXED BUGS
+==========
+
+o LANG-1337: Fix test failures in IBM JDK 8 for ToStringBuilderTest.
+o LANG-1319: MultilineRecursiveToStringStyle StackOverflowError when object is
+ an array.
+o LANG-1320: LocaleUtils#toLocale does not support language followed by UN M.49
+ numeric-3 area code followed by variant.
+o LANG-1300: Clarify or improve behaviour of int-based indexOf methods in
+ StringUtils. Thanks to Mark Dacek.
+o LANG-1286: RandomStringUtils random method can overflow and return characters
+ outside of specified range.
+o LANG-1292: WordUtils.wrap throws StringIndexOutOfBoundsException.
+o LANG-1287: RandomStringUtils#random can enter infinite loop if end parameter
+ is to small. Thanks to Ivan Morozov.
+o LANG-1285: NullPointerException in FastDateParser$TimeZoneStrategy.
+ Thanks to Francesco Chicchiriccò.
+o LANG-1281: Javadoc of StringUtils.ordinalIndexOf is contradictory.
+ Thanks to Andreas Lundblad.
+o LANG-1188: StringUtils#join(T...): warning: [unchecked] Possible heap
+ pollution from parameterized vararg type T.
+o LANG-1144: Multiple calls of
+ org.apache.commons.lang3.concurrent.LazyInitializer.initialize()
+ are possible. Thanks to Waldemar Maier, Gary Gregory.
+o LANG-1276: StrBuilder#replaceAll ArrayIndexOutOfBoundsException.
+ Thanks to Andy Klimczak.
+o LANG-1278: BooleanUtils javadoc issues. Thanks to Duke Yin.
+o LANG-1070: ArrayUtils#add confusing example in javadoc.
+ Thanks to Paul Pogonyshev.
+o LANG-1271: StringUtils#isAnyEmpty and #isAnyBlank should return false for an
+ empty array. Thanks to Pierre Templier.
+o LANG-1155: Add StringUtils#unwrap. Thanks to Saif Asif, Thiago Andrade.
+o LANG-1311: TypeUtils.toString() doesn't handle primitive and Object arrays
+ correctly. Thanks to Aaron Digulla.
+o LANG-1312: LocaleUtils#toLocale does not support language followed by UN M.49
+ numeric-3 area code.
+o LANG-1265: Build failures when building with Java 9 EA.
+o LANG-1314: javadoc creation broken with Java 8. Thanks to Allon Murienik.
+o LANG-1310: MethodUtils.invokeMethod throws ArrayStoreException if using
+ varargs arguments and smaller types than the method defines.
+ Thanks to Don Jeba.
+
+CHANGES
+=======
+
+o LANG-1338: Add Automatic-Module-Name MANIFEST entry for Java 9
+ compatibility.
+o LANG-1334: Deprecate CharEncoding in favour of
+ java.nio.charset.StandardCharsets.
+o LANG-1110: Implement HashSetvBitSetTest using JMH.
+ Thanks to Bruno P. Kinoshita.
+o LANG-1290: Increase test coverage of org.apache.commons.lang3.ArrayUtils.
+ Thanks to Andrii Abramov.
+o LANG-1274: StrSubstitutor should state its thread safety.
+o LANG-1277: StringUtils#getLevenshteinDistance reduce memory consumption.
+ Thanks to yufcuy.
+o LANG-1279: Update Java requirement from Java 6 to 7.
+o LANG-1143: StringUtils should use toXxxxCase(int) rather than
+ toXxxxCase(char). Thanks to sebb.
+o LANG-1297: Add SystemUtils.getHostName() API.
+o LANG-1301: Moving apache-rat-plugin configuration into pluginManagement.
+ Thanks to Karl Heinz Marbaise.
+o LANG-1316: Deprecate classes/methods moved to commons-text.
+
+=============================================================================
+
+ Release Notes for version 3.5
+
+
+HIGHLIGHTS
+==========
+
+Some of the highlights in this release include:
+
+o Added Java 9 detection to org.apache.commons.lang3.SystemUtils.
+o Support for shifting and swapping elements in
+ org.apache.commons.lang3.ArrayUtils.
+o New methods for generating random strings from different character classes
+ including alphabetic, alpha-numeric and ASCII added to
+ org.apache.commons.lang3.RandomStringUtils.
+o Numerous extensions to org.apache.commons.lang3.StringUtils including
+ null safe compare variants, more remove and replace variants, rotation and
+ truncation.
+o Added org.apache.commons.lang3.ThreadUtils - a utility class to work with
+ instances of java.lang.Thread and java.lang.ThreadGroup.
+o Added annotations @EqualsExclude, @HashCodeExclude and @ToStringEclude to
+ mark fields which should be ignored by the reflective builders in the
+ org.apache.commons.lang3.builder package.
+o Support for various modify and retrieve value use cases added to the classes
+ in org.apache.commons.lang3.mutable.
+
+COMPATIBILITY
+=============
+
+Apache Commons Lang 3.5 is binary compatible with the 3.4 release. Users
+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:
+
+o Added method 'public boolean parse(java.lang.String, java.text.ParsePosition,
+ java.util.Calendar)'
+o Added method 'public java.lang.Appendable format(long, java.lang.Appendable)'
+o Added method 'public java.lang.Appendable format(java.util.Date,
+ java.lang.Appendable)'
+o Added method 'public java.lang.Appendable format(java.util.Calendar,
+ java.lang.Appendable)'
+
+For this reason 3.5 is not strictly source compatible to 3.4. Since the
+DatePrinter interface is not meant to be implemented by clients, this
+change it not considered to cause any problems.
+
+JAVA 9 SUPPORT
+==============
+
+Java 9 introduces a new version-string scheme. Details of this new scheme are
+documented in JEP-223 (http://openjdk.java.net/jeps/223). In order to support
+JEP-223 two classes had to be changed:
+
+o org.apache.commons.lang3.JavaVersion
+ deprecated enum constant JAVA_1_9
+ introduced enum constant JAVA_9
+
+o org.apache.commons.lang3.SystemUtils
+ deprecated constant IS_JAVA_1_9
+ introduced constant IS_JAVA_9
+
+For more information see LANG-1197
+(https://issues.apache.org/jira/browse/LANG-1197). All other APIs are expected
+to work with Java 9.
+
+BUILDING ON JAVA 9
+==================
+
+Java 8 introduced the Unicode Consortium's Common Locale Data Repository as
+alternative source for locale data. Java 9 will use the CLDR provider as
+default provider for locale data (see http://openjdk.java.net/jeps/252). This
+causes an number of locale-sensitive test in Commons Lang to fail. In order
+to build Commons Lang 3.5 on Java 9, the locale provider has to be set to
+'JRE':
+
+ mvn -Djava.locale.providers=JRE clean install
+
+We are currently investigating ways to support building on Java 9 without
+further configuration. For more information see:
+https://issues.apache.org/jira/browse/LANG-1265
+
+
+NEW FEATURES
+==============
+
+o LANG-1275: Added a tryAcquire() method to TimedSemaphore.
+o LANG-1255: Add DateUtils.toCalendar(Date, TimeZone). Thanks to Kaiyuan Wang.
+o LANG-1023: Add WordUtils.wrap overload with customizable breakable character.
+ Thanks to Marko Bekhta.
+o LANG-787: Add method removeIgnoreCase(String, String) to StringUtils. Thanks
+ to Gokul Nanthakumar C.
+o LANG-1224: Extend RandomStringUtils with methods that generate strings
+ between a min and max length. Thanks to Caleb Cushing.
+o LANG-1257: Add APIs StringUtils.wrapIfMissing(String, char|String). Thanks to
+ Gary Gregory.
+o LANG-1253: Add RandomUtils#nextBoolean() method. Thanks to adilek.
+o LANG-1085: Add a circuit breaker implementation. Thanks to Oliver Heger and
+ Bruno P. Kinoshita.
+o LANG-1013: Add StringUtils.truncate(). Thanks to Thiago Andrade.
+o LANG-1195: Enhance MethodUtils to allow invocation of private methods. Thanks
+ to Derek C. Ashmore.
+o LANG-1189: Add getAndIncrement/getAndDecrement/getAndAdd/incrementAndGet/
+ decrementAndGet/addAndGet in Mutable* classes. Thanks to
+ Haiyang Li and Matthew Bartenschlag.
+o LANG-1225: Add RandomStringUtils#randomGraph and #randomPrint which match
+ corresponding regular expression class. Thanks to Caleb Cushing.
+o LANG-1223: Add StopWatch#getTime(TimeUnit). Thanks to Nick Manley.
+o LANG-781: Add methods to ObjectUtils class to check for null elements in the
+ array. Thanks to Krzysztof Wolny.
+o LANG-1228: Prefer Throwable.getCause() in ExceptionUtils.getCause().
+ Thanks to Brad Hess.
+o LANG-1233: DiffBuilder add method to allow appending from a DiffResult.
+ Thanks to Nick Manley.
+o LANG-1168: Add SystemUtils.IS_OS_WINDOWS_10 property.
+ Thanks to Pascal Schumacher.
+o LANG-1115: Add support for varargs in ConstructorUtils, MemberUtils, and
+ MethodUtils. Thanks to Jim Lloyd and Joe Ferner.
+o LANG-1134: Add methods to check numbers against NaN and inifinite to
+ Validate. Thanks to Alan Smithee.
+o LANG-1220: Add tests for missed branches in DateUtils.
+ Thanks to Casey Scarborough.
+o LANG-1146: z/OS identification in SystemUtils.
+ Thanks to Gabor Liptak.
+o LANG-1192: FastDateFormat support of the week-year component (uppercase 'Y').
+ Thanks to Dominik Stadler.
+o LANG-1169: Add StringUtils methods to compare a string to multiple strings.
+ Thanks to Rafal Glowinski, Robert Parr and Arman Sharif.
+o LANG-1185: Add remove by regular expression methods in StringUtils.
+o LANG-1139: Add replace by regular expression methods in StringUtils.
+o LANG-1171: Add compare methods in StringUtils.
+o LANG-1174: Add sugar to RandomUtils. Thanks to Punkratz312.
+o LANG-1154: FastDateFormat APIs that use a StringBuilder. Thanks to
+ Gary Gregory.
+o LANG-1149: Ability to throw checked exceptions without declaring them. Thanks
+ to Gregory Zak.
+o LANG-1153: Implement ParsePosition api for FastDateParser.
+o LANG-1137: Add check for duplicate event listener in EventListenerSupport.
+ Thanks to Matthew Aguirre.
+o LANG-1135: Add method containsAllWords to WordUtils. Thanks to
+ Eduardo Martins.
+o LANG-1132: ReflectionToStringBuilder doesn't throw IllegalArgumentException
+ when the constructor's object param is null. Thanks to Jack Tan.
+o LANG-701: StringUtils join with var args. Thanks to James Sawle.
+o LANG-1105: Add ThreadUtils - A utility class which provides helper methods
+ related to java.lang.Thread Issue: LANG-1105. Thanks to
+ Hendrik Saly.
+o LANG-1031: Add annotations to exclude fields from ReflectionEqualsBuilder,
+ ReflectionToStringBuilder and ReflectionHashCodeBuilder. Thanks
+ to Felipe Adorno.
+o LANG-1127: Use JUnit rules to set and reset the default Locale and TimeZone.
+o LANG-1119: Add rotate(string, int) method to StringUtils. Thanks to
+ Loic Guibert.
+o LANG-1099: Add swap and shift operations for arrays to ArrayUtils. Thanks to
+ Adrian Ber.
+o LANG-1050: Change nullToEmpty methods to generics. Thanks to James Sawle.
+o LANG-1074: Add a method to ArrayUtils for removing all occurrences of a given
+ element Issue: LANG-1074. Thanks to Haiyang Li.
+
+FIXED BUGS
+============
+
+o LANG-1261: ArrayUtils.contains returns false for instances of subtypes.
+o LANG-1252: Rename NumberUtils.isNumber, isCreatable to better reflect
+ createNumber. Also, accommodated for "+" symbol as prefix in
+ isCreatable and isNumber. Thanks to Rob Tompkins.
+o LANG-1230: Remove unnecessary synchronization from registry lookup in
+ EqualsBuilder and HashCodeBuilder. Thanks to Philippe Marschall.
+o LANG-1214: Handle "void" in ClassUtils.getClass(). Thanks to Henry Tung.
+o LANG-1250: SerializationUtils#deserialize has unnecessary code and a comment
+ for that. Thanks to Glease Wang.
+o LANG-1190: TypeUtils.isAssignable throws NullPointerException when fromType
+ has type variables and toType generic superclass specifies type
+ variable. Thanks to Pascal Schumacher.
+o LANG-1226: StringUtils#normalizeSpace does not trim the string anymore.
+ Thanks to Pascal Schumacher.
+o LANG-1251: SerializationUtils.ClassLoaderAwareObjectInputStream should use
+ static initializer to initialize primitiveTypes map. Thanks to
+ Takuya Ueshin.
+o LANG-1248: FastDatePrinter Memory allocation regression. Thanks to
+ Benoit Wiart.
+o LANG-1018: Fix precision loss on NumberUtils.createNumber(String). Thanks to
+ Nick Manley.
+o LANG-1199: Fix implementation of StringUtils.getJaroWinklerDistance(). Thanks
+ to M. Steiger.
+o LANG-1244: Fix dead links in StringUtils.getLevenshteinDistance() javadoc.
+ Thanks to jjbankert.
+o LANG-1242: "\u2284":"?" mapping missing from
+ EntityArrays#HTML40_EXTENDED_ESCAPE. Thanks to Neal Stewart.
+o LANG-901: StringUtils#startsWithAny/endsWithAny is case sensitive -
+ documented as case insensitive. Thanks to Matthew Bartenschlag.
+o LANG-1232: DiffBuilder: Add null check on fieldName when appending Object or
+ Object[]. Thanks to Nick Manley.
+o LANG-1178: ArrayUtils.removeAll(Object array, int... indices) should do the
+ clone, not its callers. Thanks to Henri Yandell.
+o LANG-1120: StringUtils.stripAccents should remove accents from "Ł" and "ł".
+ Thanks to kaching88.
+o LANG-1205: NumberUtils.createNumber() behaves inconsistently with
+ NumberUtils.isNumber(). Thanks to pbrose.
+o LANG-1222: Fix for incorrect comment on StringUtils.containsIgnoreCase
+ method. Thanks to Adam J.
+o LANG-1221: Fix typo on appendIfMissing javadoc. Thanks to Pierre Templier.
+o LANG-1202: parseDateStrictly does't pass specified locale. Thanks to
+ Markus Jelsma.
+o LANG-1219: FastDateFormat doesn't respect summer daylight in some localized
+ strings. Thanks to Jarek.
+o LANG-1175: Remove Ant-based build.
+o LANG-1194: Limit max heap memory for consistent Travis CI build.
+o LANG-1186: Fix NullPointerException in FastDateParser$TimeZoneStrategy.
+ Thanks to NickManley.
+o LANG-1193: ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1
+ (correct answer should be 0); revert fix for LANG-1077. Thanks to
+ Qin Li.
+o LANG-1002: Several predefined ISO FastDateFormats in DateFormatUtils are
+ incorrect. Thanks to Michael Osipov.
+o LANG-1152: StringIndexOutOfBoundsException or field over-write for large year
+ fields in FastDateParser. Thanks to Pas Filip.
+o LANG-1141: StrLookup.systemPropertiesLookup() no longer reacts on changes on
+ system properties.
+o LANG-1147: EnumUtils *BitVector issue with more than 32 values Enum. Thanks
+ to Loic Guibert.
+o LANG-1059: Capitalize javadoc is incorrect. Thanks to Colin Casey.
+o LANG-1122: Inconsistent behavior of swap for malformed inputs. Thanks to
+ Adrian Ber.
+o LANG-1130: Fix critical issues reported by SonarQube.
+o LANG-1131: StrBuilder.equals(StrBuilder) doesn't check for null inputs.
+o LANG-1128: JsonToStringStyle doesn't handle chars and objects correctly.
+ Thanks to Jack Tan.
+o LANG-1126: DateFormatUtilsTest.testSMTP depends on the default Locale.
+o LANG-1123: Unit test FastDatePrinterTimeZonesTest needs a timezone set.
+ Thanks to Christian P. Momon.
+o LANG-916: DateFormatUtils.format does not correctly change Calendar
+ TimeZone in certain situations. Thanks to Christian P. Momon.
+o LANG-1116: DateUtilsTest.testLang530 fails for some timezones. Thanks to
+ Aaron Sheldon.
+o LANG-1114: TypeUtils.ParameterizedType#equals doesn't work with wildcard
+ types. Thanks to Andy Coates.
+o LANG-1118: StringUtils.repeat('z', -1) throws NegativeArraySizeException.
+ Thanks to Loic Guibert.
+o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
+o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
+ identical leading prefix..
+o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
+o LANG-1200: Fix JavaDoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
+o LANG-1191: Incorrect Javadoc
+ StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
+ qed, Brent Worden and Gary Gregory.
+
+CHANGES
+=========
+o LANG-1197: Prepare Java 9 detection.
+o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
+ big to be inlined. Thanks to Ruslan Cheremin.
+o LANG-1259: JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
+ to Dominik Stadler.
+o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
+ Benoit Wiart.
+o LANG-1229: HashCodeBuilder.append(Object,Object) is too big to be inlined,
+ which prevents whole builder to be scalarized. Thanks to
+ Ruslan Cheremin.
+o LANG-1243: Simplify ArrayUtils removeElements by using new decrementAndGet()
+ method.
+o LANG-1240: Optimize BitField constructor implementation. Thanks to zhanhb.
+o LANG-1206: Improve CharSetUtils.squeeze() performance. Thanks to
+ Mohammed Alfallaj.
+o LANG-1176: Improve ArrayUtils removeElements time complexity to O(n). Thanks
+ to Jeffery Yuan.
+o LANG-1234: getLevenshteinDistance with a threshold: optimize implementation
+ if the strings lengths differ more than the threshold. Thanks to
+ Jonatan Jönsson.
+o LANG-1151: Performance improvements for NumberUtils.isParsable. Thanks to
+ Juan Pablo Santos Rodríguez.
+o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
+ which prevents whole builder to be scalarized. Thanks to
+ Ruslan Cheremin.
+o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
+ Matthias Niehoff.
+o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
+o LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
+ Larry West and Pascal Schumacher.
+o LANG-1183: Making replacePattern/removePattern methods null safe in
+ StringUtils.
+o LANG-1057: Replace StringBuilder with String concatenation for better
+ optimization. Thanks to Otávio Santana.
+o LANG-1075: Deprecate SystemUtils.FILE_SEPARATOR and
+ SystemUtils.PATH_SEPARATOR.
+o LANG-979: TypeUtils.parameterizeWithOwner - wrong format descriptor for
+ "invalid number of type parameters". Thanks to Bruno P. Kinoshita.
+o LANG-1112: MultilineRecursiveToStringStyle largely unusable due to being
+ package-private.
+o LANG-1058: StringUtils.uncapitalize performance improvement. Thanks to
+ Leo Wang.
+o LANG-1069: CharSet.getInstance documentation does not clearly explain how
+ to include negation character in set. Thanks to Arno Noordover.
+o LANG-1107: Fix parsing edge cases in FastDateParser.
+o LANG-1273: Added new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils. Thanks
+ to Jake Wang.
+
+=============================================================================
+
+ Release Notes for version 3.4
+
+
+COMPATIBILITY
+=============
+
+Commons Lang 3.4 is fully binary compatible to the last release and can
+therefore be used as a drop in replacement for 3.3.2. Note that the value of
+org.apache.commons.lang3.time.DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN
+has changed, which may affect clients using the constant. Furthermore the
+constant is used internally in
+o DurationFormatUtils.formatDurationISO(long)
+o DurationFormatUtils.formatPeriodISO(long, long)
+
+For more information see https://issues.apache.org/jira/browse/LANG-1000.
+
+NEW FEATURES
+==============
+
+o LANG-821: Support OS X versions in SystemUtils. Thanks to Timo Kockert.
+o LANG-1103: Add SystemUtils.IS_JAVA_1_9
+o LANG-1093: Add ClassUtils.getAbbreviatedName(). Thanks to Fabian Lange.
+o LANG-1082: Add option to disable the "objectsTriviallyEqual" test in
+ DiffBuilder. Thanks to Jonathan Baker.
+o LANG-1015: Add JsonToStringStyle implementation to ToStringStyle. Thanks to
+ Thiago Andrade.
+o LANG-1080: Add NoClassNameToStringStyle implementation of ToStringStyle.
+ Thanks to Innokenty Shuvalov.
+o LANG-883: Add StringUtils.containsAny(CharSequence, CharSequence...) method.
+ Thanks to Daniel Stewart.
+o LANG-1052: Multiline recursive to string style. Thanks to Jan Matèrne.
+o LANG-536: Add isSorted() to ArrayUtils. Thanks to James Sawle.
+o LANG-1033: Add StringUtils.countMatches(CharSequence, char)
+o LANG-1021: Provide methods to retrieve all fields/methods annotated with a
+ specific type. Thanks to Alexander Müller.
+o LANG-1016: NumberUtils#isParsable method(s). Thanks to
+ Juan Pablo Santos Rodríguez.
+o LANG-999: Add fuzzy String matching logic to StringUtils. Thanks to
+ Ben Ripkens.
+o LANG-994: Add zero copy read method to StrBuilder. Thanks to
+ Mikhail Mazursky.
+o LANG-993: Add zero copy write method to StrBuilder. Thanks to
+ Mikhail Mazursky.
+o LANG-1044: Add method MethodUtils.invokeExactMethod(Object, String)
+o LANG-1045: Add method MethodUtils.invokeMethod(Object, String)
+
+FIXED BUGS
+============
+
+o LANG-794: SystemUtils.IS_OS_WINDOWS_2008, VISTA are incorrect. Thanks to
+ Timo Kockert.
+o LANG-1104: Parse test fails for TimeZone America/Sao_Paulo
+o LANG-948: Exception while using ExtendedMessageFormat and escaping braces.
+ Thanks to Andrey Khobnya.
+o LANG-1092: Wrong formating of time zones with daylight saving time in
+ FastDatePrinter
+o LANG-1090: FastDateParser does not set error indication in ParsePosition
+o LANG-1089: FastDateParser does not handle excess hours as per
+ SimpleDateFormat
+o LANG-1061: FastDateParser error - timezones not handled correctly. Thanks to
+ dmeneses.
+o LANG-1087: NumberUtils#createNumber() returns positive BigDecimal when
+ negative Float is expected. Thanks to Renat Zhilkibaev.
+o LANG-1081: DiffBuilder.append(String, Object left, Object right) does not do
+ a left.equals(right) check. Thanks to Jonathan Baker.
+o LANG-1055: StrSubstitutor.replaceSystemProperties does not work consistently.
+ Thanks to Jonathan Baker.
+o LANG-1083: Add (T) casts to get unit tests to pass in old JDK. Thanks to
+ Jonathan Baker.
+o LANG-1073: Read wrong component type of array in add in ArrayUtils.
+ Thanks to haiyang li.
+o LANG-1077: StringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils.
+ Thanks to haiyang li.
+o LANG-1072: Duplicated "0x" check in createBigInteger in NumberUtils. Thanks
+ to haiyang li.
+o LANG-1064: StringUtils.abbreviate description doesn't agree with the
+ examples. Thanks to B.J. Herbison.
+o LANG-1041: Fix MethodUtilsTest so it does not depend on JDK method ordering.
+ Thanks to Alexandre Bartel.
+o LANG-1000: ParseException when trying to parse UTC dates with Z as zone
+ designator using DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT
+o LANG-1035: Javadoc for EqualsBuilder.reflectionEquals() is unclear
+o LANG-1001: ISO 8601 misspelled throughout the Javadocs. Thanks to
+ Michael Osipov.
+o LANG-1088: FastDateParser should be case insensitive
+o LANG-995: Fix bug with stripping spaces on last line in WordUtils.wrap().
+ Thanks to Andrey Khobnya.
+
+CHANGES
+=========
+
+o LANG-1102: Make logic for comparing OS versions in SystemUtils smarter
+o LANG-1091: Shutdown thread pools in test cases. Thanks to Fabian Lange.
+o LANG-1101: FastDateParser and FastDatePrinter support 'X' format
+o LANG-1100: Avoid memory allocation when using date formating to StringBuffer.
+ Thanks to mbracher.
+o LANG-935: Possible performance improvement on string escape functions.
+ Thanks to Fabian Lange, Thomas Neidhart.
+o LANG-1098: Avoid String allocation in StrBuilder.append(CharSequence). Thanks
+ to Mikhail Mazurskiy, Fabian Lange.
+o LANG-1098: Update maven-checkstyle-plugin to 2.14. Thanks to Micha? Kordas.
+o LANG-1097: Update org.easymock:easymock to 3.3.1. Thanks to Micha? Kordas.
+o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
+o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
+o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
+ Fabian Lange.
+o LANG-1071: Fix wrong examples in JavaDoc of
+ StringUtils.replaceEachRepeatedly(...),
+ StringUtils.replaceEach(...) Thanks to Arno Noordover.
+o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
+ uses in performing comparisons
+o LANG-1020: Improve performance of normalize space. Thanks to Libor Ondrusek.
+o LANG-1027: org.apache.commons.lang3.SystemUtils#isJavaVersionAtLeast should
+ return true by default
+o LANG-1026: Bring static method references in StringUtils to consistent style.
+ Thanks to Alex Yursha.
+o LANG-1017: Use non-ASCII digits in Javadoc examples for
+ StringUtils.isNumeric. Thanks to Christoph Schneegans.
+o LANG-1008: Change min/max methods in NumberUtils/IEEE754rUtils from array
+ input parameters to varargs. Thanks to Thiago Andrade.
+o LANG-1006: Add wrap (with String or char) to StringUtils. Thanks to
+ Thiago Andrade.
+o LANG-1005: Extend DurationFormatUtils#formatDurationISO default pattern to
+ match #formatDurationHMS. Thanks to Michael Osipov.
+o LANG-1007: Fixing NumberUtils JAVADoc comments for max methods. Thanks to
+ Thiago Andrade.
+o LANG-731: Better Javadoc for BitField class
+o LANG-1004: DurationFormatUtils#formatDurationHMS implementation does not
+ correspond to Javadoc and vice versa. Thanks to Michael Osipov.
+o LANG-1003: DurationFormatUtils are not able to handle negative
+ durations/periods
+o LANG-998: Javadoc is not clear on preferred pattern to instantiate
+ FastDateParser / FastDatePrinter
+
+=============================================================================
+
+ Release Notes for version 3.3.2
+
+NEW FEATURES
+==============
+
+o LANG-989: Add org.apache.commons.lang3.SystemUtils.IS_JAVA_1_8
+
+FIXED BUGS
+============
+
+o LANG-992: NumberUtils#isNumber() returns false for "0.0", "0.4790", et al
+
+=============================================================================
+
+ Release Notes for version 3.3.1
+
+FIXED BUGS
+============
+
+o LANG-987: DateUtils.getFragmentInDays(Date, Calendar.MONTH) returns wrong
+ days
+o LANG-983: DurationFormatUtils does not describe format string fully
+o LANG-981: DurationFormatUtils#lexx does not detect unmatched quote char
+o LANG-984: DurationFormatUtils does not handle large durations correctly
+o LANG-982: DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field
+ size should be 4 digits
+o LANG-978: Failing tests with Java 8 b128
+
+=============================================================================
+
+ Release Notes for version 3.3
+
+NEW FEATURES
+==============
+
+o LANG-955: Add methods for removing all invalid characters according to
+ XML 1.0 and XML 1.1 in an input string to StringEscapeUtils.
+ Thanks to Adam Hooper.
+o LANG-970: Add APIs MutableBoolean setTrue() and setFalse()
+o LANG-962: Add SerializationUtils.roundtrip(T extends Serializable) to
+ serialize then deserialize
+o LANG-637: There should be a DifferenceBuilder with a
+ ReflectionDifferenceBuilder implementation
+o LANG-944: Add the Jaro-Winkler string distance algorithm to StringUtils.
+ Thanks to Rekha Joshi.
+o LANG-417: New class ClassPathUtils with methods for turning FQN into
+ resource path
+o LANG-834: Validate: add inclusiveBetween and exclusiveBetween overloads
+ for primitive types
+o LANG-900: New RandomUtils class. Thanks to Duncan Jones.
+o LANG-966: Add IBM OS/400 detection
+
+FIXED BUGS
+============
+
+o LANG-621: ReflectionToStringBuilder.toString does not debug 3rd party object
+ fields within 3rd party object. Thanks to Philip Hodges,
+ Thomas Neidhart.
+o LANG-977: NumericEntityEscaper incorrectly encodes supplementary characters.
+ Thanks to Chris Karcher.
+o LANG-973: Make some private fields final
+o LANG-971: NumberUtils#isNumber(String) fails to reject invalid Octal numbers
+o LANG-972: NumberUtils#isNumber does not allow for hex 0XABCD
+o LANG-969: StringUtils.toEncodedString(byte[], Charset) needlessly throws
+ UnsupportedEncodingException. Thanks to Matt Bishop.
+o LANG-946: ConstantInitializerTest fails when building with IBM JDK 7
+o LANG-954: uncaught PatternSyntaxException in FastDateFormat on Android.
+ Thanks to Michael Keppler.
+o LANG-936: StringUtils.getLevenshteinDistance with too big of a threshold
+ returns wrong result. Thanks to Yaniv Kunda, Eli Lindsey.
+o LANG-943: Test DurationFormatUtilsTest.testEdgeDuration fails in
+ JDK 1.6, 1.7 and 1.8, BRST time zone
+o LANG-613: ConstructorUtils.getAccessibleConstructor() Does Not Check the
+ Accessibility of Enclosing Classes
+o LANG-951: Fragments are wrong by 1 day when using fragment YEAR or MONTH.
+ Thanks to Sebastian Götz.
+o LANG-950: FastDateParser does not handle two digit year parsing like
+ SimpleDateFormat
+o LANG-949: FastDateParserTest.testParses does not test FastDateParser
+o LANG-915: Wrong locale handling in LocaleUtils.toLocale().
+ Thanks to Sergio Fernández.
+
+CHANGES
+=========
+
+o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field)
+ does not clean up after itself
+o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
+ is used internally
+o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-939: Move Documentation from user guide to package-info files
+o LANG-953: Convert package.html files to package-info.java files
+o LANG-940: Fix deprecation warnings
+o LANG-819: EnumUtils.generateBitVector needs a "? extends"
+
+=============================================================================
+
+ Release Notes for version 3.2.1
+
+BUG FIXES
+===========
+
+o LANG-937: Fix missing Hamcrest dependency in Ant Build
+o LANG-941: Test failure in LocaleUtilsTest when building with JDK 8
+o LANG-942: Test failure in FastDateParserTest and FastDateFormat_ParserTest
+ when building with JDK8. Thanks to Bruno P. Kinoshita,
+ Henri Yandell.
+o LANG-938: Build fails with test failures when building with JDK 8
+
+=============================================================================
+
+ Release Notes for version 3.2
+
+COMPATIBILITY WITH 3.1
+========================
+
+This release introduces backwards incompatible changes in
+org.apache.commons.lang3.time.FastDateFormat:
+o Method 'protected java.util.List parsePattern()' has been removed
+o Method 'protected java.lang.String parseToken(java.lang.String, int[])' has
+ been removed
+o Method 'protected org.apache.commons.lang3.time.FastDateFormat$NumberRule
+ selectNumberRule(int, int)' has been removed
+
+These changes were the result of [LANG-462]. It is assumed that this change
+will not break clients as Charles Honton pointed out on 25/Jan/12:
+"
+ 1. Methods "FastDateFormat$NumberRule selectNumberRule(int, int)" and
+ "List parsePattern()" couldn't have been overridden because
+ NumberRule and Rule were private to FastDateFormat.
+ 2. Due to the factory pattern used, it's unlikely other two methods would have
+ been overridden.
+ 3. The four methods are highly implementation specific. I consider it a
+ mistake that the methods were exposed.
+"
+For more information see https://issues.apache.org/jira/browse/LANG-462.
+
+NEW FEATURES
+==============
+
+o LANG-934: Add removeFinalModifier to FieldUtils
+o LANG-863: Method returns number of inheritance hops between parent and
+ subclass. Thanks to Daneel S. Yaitskov.
+o LANG-774: Added isStarted, isSuspended and isStopped to StopWatch.
+ Thanks to Erhan Bagdemir.
+o LANG-848: Added StringUtils.isBlank/isEmpty CharSequence... methods.
+ Thanks to Alexander Muthmann.
+o LANG-926: Added ArrayUtils.reverse(array, from, to) methods.
+o LANG-795: StringUtils.toString(byte[], String) deprecated in favour of a new
+ StringUtils.toString(byte[], CharSet). Thanks to Aaron Digulla.
+o LANG-893: StrSubstitutor now supports default values for variables.
+ Thanks to Woonsan Ko.
+o LANG-913: Adding .gitignore to commons-lang. Thanks to Allon Mureinik.
+o LANG-837: Add ObjectUtils.toIdentityString methods that support
+ StringBuilder, StrBuilder, and Appendable.
+o LANG-886: Added CharSetUtils.containsAny(String, String).
+o LANG-797: Added escape/unescapeJson to StringEscapeUtils.
+o LANG-875: Added appendIfMissing and prependIfMissing methods to StringUtils.
+o LANG-870: Add StringUtils.LF and StringUtils.CR values.
+o LANG-873: Add FieldUtils getAllFields() to return all the fields defined in
+ the given class and super classes.
+o LANG-835: StrBuilder should support StringBuilder as an input parameter.
+o LANG-857: StringIndexOutOfBoundsException in CharSequenceTranslator.
+o LANG-856: Code refactoring in NumberUtils.
+o LANG-855: NumberUtils#createBigInteger does not allow for hex and octal
+ numbers.
+o LANG-854: NumberUtils#createNumber - does not allow for hex numbers to be
+ larger than Long.
+o LANG-853: StringUtils join APIs for primitives.
+o LANG-841: Add StringUtils API to call String.replaceAll in DOTALL a.k.a.
+ single-line mode.
+o LANG-825: Create StrBuilder APIs similar to
+ String.format(String, Object...).
+o LANG-675: Add Triple class (ternary version of Pair).
+o LANG-462: FastDateFormat supports parse methods.
+
+BUG FIXES
+===========
+
+o LANG-932: Spelling fixes. Thanks to Ville Skyttä.
+o LANG-929: OctalUnescaper tried to parse all of \279.
+o LANG-928: OctalUnescaper had bugs when parsing octals starting with a zero.
+o LANG-905: EqualsBuilder returned true when comparing arrays, even when the
+ elements are different.
+o LANG-917: Fixed exception when combining custom and choice format in
+ ExtendedMessageFormat. Thanks to Arne Burmeister.
+o LANG-902: RandomStringUtils.random javadoc was incorrectly promising letters
+ and numbers would, as opposed to may, appear Issue:. Thanks to
+ Andrzej Winnicki.
+o LANG-921: BooleanUtils.xor(boolean...) produces wrong results.
+o LANG-896: BooleanUtils.toBoolean(String str) javadoc is not updated. Thanks
+ to Mark Bryan Yu.
+o LANG-879: LocaleUtils test fails with new Locale "ja_JP_JP_#u-ca-japanese"
+ of JDK7.
+o LANG-836: StrSubstitutor does not support StringBuilder or CharSequence.
+ Thanks to Arnaud Brunet.
+o LANG-693: Method createNumber from NumberUtils doesn't work for floating
+ point numbers other than Float Issue: LANG-693. Thanks to
+ Calvin Echols.
+o LANG-887: FastDateFormat does not use the locale specific cache correctly.
+o LANG-754: ClassUtils.getShortName(String) will now only do a reverse lookup
+ for array types.
+o LANG-881: NumberUtils.createNumber() Javadoc says it does not work for octal
+ numbers.
+o LANG-865: LocaleUtils.toLocale does not parse strings starting with an
+ underscore.
+o LANG-858: StringEscapeUtils.escapeJava() and escapeEcmaScript() do not
+ output the escaped surrogate pairs that are Java parsable.
+o LANG-849: FastDateFormat and FastDatePrinter generates Date objects
+ wastefully.
+o LANG-845: Spelling fixes.
+o LANG-844: Fix examples contained in javadoc of StringUtils.center methods.
+o LANG-832: FastDateParser does not handle unterminated quotes correctly.
+o LANG-831: FastDateParser does not handle white-space properly.
+o LANG-830: FastDateParser could use \Q \E to quote regexes.
+o LANG-828: FastDateParser does not handle non-Gregorian calendars properly.
+o LANG-826: FastDateParser does not handle non-ASCII digits correctly.
+o LANG-822: NumberUtils#createNumber - bad behaviour for leading "--".
+o LANG-818: FastDateFormat's "z" pattern does not respect timezone of Calendar
+ instances passed to format().
+o LANG-817: Add org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS_8.
+o LANG-813: StringUtils.equalsIgnoreCase doesn't check string reference
+ equality.
+o LANG-810: StringUtils.join() endIndex, bugged for loop.
+o LANG-807: RandomStringUtils throws confusing IAE when end <= start.
+o LANG-805: RandomStringUtils.random(count, 0, 0, false, false, universe,
+ random) always throws java.lang.ArrayIndexOutOfBoundsException.
+o LANG-802: LocaleUtils - unnecessary recursive call in SyncAvoid class.
+o LANG-800: Javadoc bug in DateUtils#ceiling for Calendar and Object versions.
+o LANG-788: SerializationUtils throws ClassNotFoundException when cloning
+ primitive classes.
+o LANG-786: StringUtils equals() relies on undefined behavior.
+o LANG-783: Documentation bug: StringUtils.split.
+o LANG-777: jar contains velocity template of release notes.
+o LANG-776: TypeUtilsTest contains incorrect type assignability assertion.
+o LANG-775: TypeUtils.getTypeArguments() misses type arguments for
+ partially-assigned classes.
+o LANG-773: ImmutablePair doc contains nonsense text.
+o LANG-772: ClassUtils.PACKAGE_SEPARATOR Javadoc contains garbage text.
+o LANG-765: EventListenerSupport.ProxyInvocationHandler no longer defines
+ serialVersionUID.
+o LANG-764: StrBuilder is now serializable.
+o LANG-761: Fix Javadoc Ant warnings.
+o LANG-747: NumberUtils does not handle Long Hex numbers.
+o LANG-743: Javadoc bug in static inner class DateIterator.
+
+CHANGES
+=========
+
+o LANG-931: Misleading Javadoc comment in StrBuilderReader class. Thanks
+ to Christoph Schneegans.
+o LANG-910: StringUtils.normalizeSpace now handles non-breaking spaces
+ (Unicode 00A0). Thanks to Timur Yarosh.
+o LANG-804: Redundant check for zero in HashCodeBuilder ctor. Thanks to
+ Allon Mureinik.
+o LANG-884: Simplify FastDateFormat; eliminate boxing.
+o LANG-882: LookupTranslator now works with implementations of CharSequence
+ other than String.
+o LANG-846: Provide CharSequenceUtils.regionMatches with a proper green
+ implementation instead of inefficiently converting to Strings.
+o LANG-839: ArrayUtils removeElements methods use unnecessary HashSet.
+o LANG-838: ArrayUtils removeElements methods clone temporary index arrays
+ unnecessarily.
+o LANG-799: DateUtils#parseDate uses default locale; add Locale support.
+o LANG-798: Use generics in SerializationUtils.
+
+CHANGES WITHOUT TICKET
+========================
+
+o Fixed URLs in javadoc to point to new oracle.com pages
+
+=============================================================================
+
+ Release Notes for version 3.1
+
+NEW FEATURES
+==============
+
+o LANG-801: Add Conversion utility to convert between data types on byte level
+o LANG-760: Add API StringUtils.toString(byte[] intput, String charsetName)
+o LANG-756: Add APIs ClassUtils.isPrimitiveWrapper(Class>) and
+ isPrimitiveOrWrapper(Class>)
+o LANG-695: SystemUtils.IS_OS_UNIX doesn't recognize FreeBSD as a Unix system
+
+BUG FIXES
+===========
+
+o LANG-749: Incorrect Bundle-SymbolicName in Manifest
+o LANG-746: NumberUtils does not handle upper-case hex: 0X and -0X
+o LANG-744: StringUtils throws java.security.AccessControlException on Google
+ App Engine
+o LANG-741: Ant build has wrong component.name
+o LANG-698: Document that the Mutable numbers don't work as expected with
+ String.format
+
+CHANGES
+=========
+
+o LANG-758: Add an example with whitespace in StringUtils.defaultIfEmpty
+o LANG-752: Fix createLong() so it behaves like createInteger()
+o LANG-751: Include the actual type in the Validate.isInstance and
+ isAssignableFrom exception messages
+o LANG-748: Deprecating chomp(String, String)
+o LANG-736: CharUtils static final array CHAR_STRING is not needed to compute
+ CHAR_STRING_ARRAY
+
+=============================================================================
+
+ Release Notes for version 3.0
+
+ADDITIONS
+===========
+
+o LANG-276: MutableBigDecimal and MutableBigInteger.
+o LANG-285: Wish : method unaccent.
+o LANG-358: ObjectUtils.coalesce.
+o LANG-386: LeftOf/RightOfNumber in Range convenience methods necessary.
+o LANG-435: Add ClassUtils.isAssignable() variants with autoboxing.
+o LANG-444: StringUtils.emptyToNull.
+o LANG-482: Enhance StrSubstitutor to support nested ${var-${subvr}} expansion
+o LANG-482: StrSubstitutor now supports substitution in variable names.
+o LANG-496: A generic implementation of the Lazy initialization pattern.
+o LANG-497: Addition of ContextedException and ContextedRuntimeException.
+o LANG-498: Add StringEscapeUtils.escapeText() methods.
+o LANG-499: Add support for the handling of ExecutionExceptions.
+o LANG-501: Add support for background initialization.
+o LANG-529: Add a concurrent package.
+o LANG-533: Validate: support for validating blank strings.
+o LANG-537: Add ArrayUtils.toArray to create generic arrays.
+o LANG-545: Add ability to create a Future for a constant.
+o LANG-546: Add methods to Validate to check whether the index is valid for
+ the array/list/string.
+o LANG-553: Add TypeUtils class to provide utility code for working with generic
+ types.
+o LANG-559: Added isAssignableFrom and isInstanceOf validation methods.
+o LANG-559: Added validState validation method.
+o LANG-560: New TimedSemaphore class.
+o LANG-582: Provide an implementation of the ThreadFactory interface.
+o LANG-588: Create a basic Pair class.
+o LANG-594: DateUtils equal & compare functions up to most significant field.
+o LANG-601: Add Builder Interface / Update Builders to Implement It.
+o LANG-609: Support lazy initialization using atomic variables
+o LANG-610: Extend exception handling in ConcurrentUtils to runtime exceptions.
+o LANG-614: StringUtils.endsWithAny method
+o LANG-640: Add normalizeSpace to StringUtils
+o LANG-644: Provide documentation about the new concurrent package
+o LANG-649: BooleanUtils.toBooleanObject to support single character input
+o LANG-651: Add AnnotationUtils
+o LANG-653: Provide a very basic ConcurrentInitializer implementation
+o LANG-655: Add StringUtils.defaultIfBlank()
+o LANG-667: Add a Null-safe compare() method to ObjectUtils
+o LANG-676: Documented potential NPE if auto-boxing occurs for some BooleanUtils
+ methods
+o LANG-678: Add support for ConcurrentMap.putIfAbsent()
+o LANG-692: Add hashCodeMulti varargs method
+o LANG-697: Add FormattableUtils class
+o LANG-684: Levenshtein Distance Within a Given Threshold
+
+REMOVALS
+==========
+
+o LANG-438: Remove @deprecateds.
+o LANG-492: Remove code handled now by the JDK.
+o LANG-493: Remove code that does not hold enough value to remain.
+o LANG-590: Remove JDK 1.2/1.3 bug handling in
+ StringUtils.indexOf(String, String, int).
+o LANG-673: WordUtils.abbreviate() removed
+o LANG-691: Removed DateUtils.UTC_TIME_ZONE
+
+IMPROVEMENTS
+==============
+
+o LANG-290: EnumUtils for JDK 5.0.
+o LANG-336: Finally start using generics.
+o LANG-355: StrBuilder should implement CharSequence and Appendable.
+o LANG-396: Investigate for vararg usages.
+o LANG-424: Improve Javadoc for StringUtils class.
+o LANG-458: Refactor Validate.java to eliminate code redundancy.
+o LANG-479: Document where in SVN trunk is.
+o LANG-504: bring ArrayUtils.isEmpty to the generics world.
+o LANG-505: Rewrite StringEscapeUtils.
+o LANG-507: StringEscapeUtils.unescapeJava should support \u+ notation.
+o LANG-510: Convert StringUtils API to take CharSequence.
+o LANG-513: Better EnumUtils.
+o LANG-528: Mutable classes should implement an appropriately typed Mutable
+ interface.
+o LANG-539: Compile commons.lang for CDC 1.1/Foundation 1.1.
+o LANG-540: Make NumericEntityEscaper immutable.
+o LANG-541: Replace StringBuffer with StringBuilder.
+o LANG-548: Use Iterable on API instead of Collection.
+o LANG-551: Replace Range classes with generic version.
+o LANG-562: Change Maven groupId.
+o LANG-563: Change Java package name.
+o LANG-570: Do the test cases really still require main() and suite() methods?
+o LANG-579: Add new Validate methods.
+o LANG-599: ClassUtils.getClass(): Allow Dots as Inner Class Separators.
+o LANG-605: DefaultExceptionContext overwrites values in recursive situations.
+o LANG-668: Change ObjectUtils min() & max() functions to use varargs rather
+ than just two parameters
+o LANG-681: Push down WordUtils to "text" sub-package.
+o LANG-711: Add includeantruntime=false to javac targets to quell warnings in
+ ant 1.8.1 and better (and modest performance gain).
+o LANG-713: Increase test coverage of FieldUtils read methods and tweak
+ javadoc.
+o LANG-718: build.xml Java 1.5+ updates.
+
+BUG FIXES
+===========
+
+o LANG-11: Depend on JDK 1.5+.
+o LANG-302: StrBuilder does not implement clone().
+o LANG-339: StringEscapeUtils.escapeHtml() escapes multibyte characters like
+ Chinese, Japanese, etc.
+o LANG-369: ExceptionUtils not thread-safe.
+o LANG-418: Javadoc incorrect for StringUtils.endsWithIgnoreCase.
+o LANG-428: StringUtils.isAlpha, isAlphanumeric and isNumeric now return false
+ for ""
+o LANG-439: StringEscapeUtils.escapeHTML() does not escape chars (0x00-0x20).
+o LANG-448: Lower Ascii Characters don't get encoded by Entities.java.
+o LANG-468: JDK 1.5 build/runtime failure on LANG-393 (EqualsBuilder).
+o LANG-474: Fixes for thread safety.
+o LANG-478: StopWatch does not resist to system time changes.
+o LANG-480: StringEscapeUtils.escapeHtml incorrectly converts unicode
+ characters above U+00FFFF into 2 characters.
+o LANG-481: Possible race-conditions in hashCode of the range classes.
+o LANG-564: Improve StrLookup API documentation.
+o LANG-568: @SuppressWarnings("unchecked") is used too generally.
+o LANG-571: ArrayUtils.add(T[: array, T element) can create unexpected
+ ClassCastException.
+o LANG-585: exception.DefaultExceptionContext.getFormattedExceptionMessage
+ catches Throwable.
+o LANG-596: StrSubstitutor should also handle the default properties of a
+ java.util.Properties class
+o LANG-600: Javadoc is incorrect for public static int
+ lastIndexOf(String str, String searchStr).
+o LANG-602: ContextedRuntimeException no longer an 'unchecked' exception.
+o LANG-606: EqualsBuilder causes StackOverflowException.
+o LANG-608: Some StringUtils methods should take an int character instead of
+ char to use String API features.
+o LANG-617: StringEscapeUtils.escapeXML() can't process UTF-16 supplementary
+ characters
+o LANG-624: SystemUtils.getJavaVersionAsFloat throws
+ StringIndexOutOfBoundsException on Android runtime/Dalvik VM
+o LANG-629: Charset may not be threadsafe, because the HashSet is not synch.
+o LANG-638: NumberUtils createNumber throws a StringIndexOutOfBoundsException
+ when argument containing "e" and "E" is passed in
+o LANG-643: Javadoc StringUtils.left() claims to throw on negative len, but
+ doesn't
+o LANG-645: FastDateFormat.format() outputs incorrect week of year because
+ locale isn't respected
+o LANG-646: StringEscapeUtils.unescapeJava doesn't handle octal escapes and
+ Unicode with extra u
+o LANG-656: Example StringUtils.indexOfAnyBut("zzabyycdxx", '') = 0 incorrect
+o LANG-658: Some Entitys like Ö are not matched properly against its
+ ISO8859-1 representation
+o LANG-659: EntityArrays typo: {"\u2122", "−"}, // minus sign, U+2212
+ ISOtech
+o LANG-66: StringEscaper.escapeXml() escapes characters > 0x7f.
+o LANG-662: org.apache.commons.lang3.math.Fraction does not reduce
+ (Integer.MIN_VALUE, 2^k)
+o LANG-663: org.apache.commons.lang3.math.Fraction does not always succeed in
+ multiplyBy and divideBy
+o LANG-664: NumberUtils.isNumber(String) is not right when the String is
+ "1.1L"
+o LANG-672: Doc bug in DateUtils#ceiling
+o LANG-677: DateUtils.isSameLocalTime compares using 12 hour clock and not
+ 24 hour
+o LANG-685: EqualsBuilder synchronizes on HashCodeBuilder.
+o LANG-703: StringUtils.join throws NPE when toString returns null for one of
+ objects in collection
+o LANG-710: StringIndexOutOfBoundsException when calling unescapeHtml4("")
+o LANG-714: StringUtils doc/comment spelling fixes.
+o LANG-715: CharSetUtils.squeeze() speedup.
+o LANG-716: swapCase and *capitalize speedups.
+
+
+Historical list of changes: http://commons.apache.org/lang/changes-report.html
+
+For complete information on Commons Lang, including instructions on how to
+submit bug reports, patches, or suggestions for improvement, see the
+Apache Commons Lang website:
+
+http://commons.apache.org/lang/
+
+Have fun!
+-Apache Commons Lang team
+
From 8dae1f2904b93127f101bd36c1c79e801385a8f7 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 10 Nov 2017 11:28:57 -0700
Subject: [PATCH 0088/3439] Better exception message.
---
src/main/java/org/apache/commons/lang3/ObjectUtils.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 1ec0956f7e8..5c73e0bd108 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -353,7 +353,7 @@ public static String identityToString(final Object object) {
* @since 3.2
*/
public static void identityToString(final Appendable appendable, final Object object) throws IOException {
- Validate.notNull(object, "Cannot get the toString of a null identity");
+ Validate.notNull(object, "Cannot get the toString of a null object");
appendable.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
@@ -378,7 +378,7 @@ public static void identityToString(final Appendable appendable, final Object ob
*/
@Deprecated
public static void identityToString(final StrBuilder builder, final Object object) {
- Validate.notNull(object, "Cannot get the toString of a null identity");
+ Validate.notNull(object, "Cannot get the toString of a null object");
builder.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
@@ -400,7 +400,7 @@ public static void identityToString(final StrBuilder builder, final Object objec
* @since 2.4
*/
public static void identityToString(final StringBuffer buffer, final Object object) {
- Validate.notNull(object, "Cannot get the toString of a null identity");
+ Validate.notNull(object, "Cannot get the toString of a null object");
buffer.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
@@ -422,7 +422,7 @@ public static void identityToString(final StringBuffer buffer, final Object obje
* @since 3.2
*/
public static void identityToString(final StringBuilder builder, final Object object) {
- Validate.notNull(object, "Cannot get the toString of a null identity");
+ Validate.notNull(object, "Cannot get the toString of a null object");
builder.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
From 4f928504ea91c3c1dd43ce696acadf76624240a1 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 10 Nov 2017 11:31:33 -0700
Subject: [PATCH 0089/3439] Refactor magic char.
---
.../java/org/apache/commons/lang3/ObjectUtils.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 5c73e0bd108..1bcf72d4cc5 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -46,6 +46,8 @@
// because it is part of the signature of deprecated methods
public class ObjectUtils {
+ private static final char AT_SIGN = '@';
+
/**
*
Singleton used as a {@code null} placeholder where
* {@code null} has another meaning.
@@ -355,7 +357,7 @@ public static String identityToString(final Object object) {
public static void identityToString(final Appendable appendable, final Object object) throws IOException {
Validate.notNull(object, "Cannot get the toString of a null object");
appendable.append(object.getClass().getName())
- .append('@')
+ .append(AT_SIGN)
.append(Integer.toHexString(System.identityHashCode(object)));
}
@@ -380,7 +382,7 @@ public static void identityToString(final Appendable appendable, final Object ob
public static void identityToString(final StrBuilder builder, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
builder.append(object.getClass().getName())
- .append('@')
+ .append(AT_SIGN)
.append(Integer.toHexString(System.identityHashCode(object)));
}
@@ -402,7 +404,7 @@ public static void identityToString(final StrBuilder builder, final Object objec
public static void identityToString(final StringBuffer buffer, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
buffer.append(object.getClass().getName())
- .append('@')
+ .append(AT_SIGN)
.append(Integer.toHexString(System.identityHashCode(object)));
}
@@ -424,7 +426,7 @@ public static void identityToString(final StringBuffer buffer, final Object obje
public static void identityToString(final StringBuilder builder, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
builder.append(object.getClass().getName())
- .append('@')
+ .append(AT_SIGN)
.append(Integer.toHexString(System.identityHashCode(object)));
}
From 22c30471564c730b02f5f7cedec28fcfe5749fc6 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 10 Nov 2017 11:47:35 -0700
Subject: [PATCH 0090/3439] Break up testIdentityToStringStringBuilder into
multiple test methods.
---
.../apache/commons/lang3/ObjectUtilsTest.java | 32 ++++++++++++++++---
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index d42b93a34e8..445e5e2e733 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -192,11 +192,27 @@ public void testIdentityToStringStringBuffer() {
}
@Test
- public void testIdentityToStringStringBuilder() {
+ public void testIdentityToStringObjectNull() {
assertNull(ObjectUtils.identityToString(null));
+ }
+
+ @Test
+ public void testIdentityToStringInteger() {
+ final Integer i = Integer.valueOf(90);
+ final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));
+
+ assertEquals(expected, ObjectUtils.identityToString(i));
+ }
+
+ @Test
+ public void testIdentityToStringString() {
assertEquals(
- "java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
- ObjectUtils.identityToString(FOO));
+ "java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
+ ObjectUtils.identityToString(FOO));
+ }
+
+ @Test
+ public void testIdentityToStringStringBuilder() {
final Integer i = Integer.valueOf(90);
final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));
@@ -205,15 +221,21 @@ public void testIdentityToStringStringBuilder() {
final StringBuilder builder = new StringBuilder();
ObjectUtils.identityToString(builder, i);
assertEquals(expected, builder.toString());
+ }
+ @Test
+ public void testIdentityToStringStringBuilderNullValue() {
try {
- ObjectUtils.identityToString((StringBuilder)null, "tmp");
+ ObjectUtils.identityToString(new StringBuilder(), null);
fail("NullPointerException expected");
} catch(final NullPointerException npe) {
}
+ }
+ @Test
+ public void testIdentityToStringStringBuilderNullStringBuilder() {
try {
- ObjectUtils.identityToString(new StringBuilder(), null);
+ ObjectUtils.identityToString((StringBuilder)null, "tmp");
fail("NullPointerException expected");
} catch(final NullPointerException npe) {
}
From 10122741eac52e218771f30c6dc2c0aca54ff006 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 10 Nov 2017 11:54:14 -0700
Subject: [PATCH 0091/3439] Break up testIdentityToStringStringBuilder into
multiple test methods.
---
.../org/apache/commons/lang3/ObjectUtilsTest.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index 445e5e2e733..06b97e2a0cf 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -216,13 +216,21 @@ public void testIdentityToStringStringBuilder() {
final Integer i = Integer.valueOf(90);
final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));
- assertEquals(expected, ObjectUtils.identityToString(i));
-
final StringBuilder builder = new StringBuilder();
ObjectUtils.identityToString(builder, i);
assertEquals(expected, builder.toString());
}
+ @Test
+ public void testIdentityToStringStringBuilderInUse() {
+ final Integer i = Integer.valueOf(90);
+ final String expected = "ABC = java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));
+
+ final StringBuilder builder = new StringBuilder("ABC = ");
+ ObjectUtils.identityToString(builder, i);
+ assertEquals(expected, builder.toString());
+ }
+
@Test
public void testIdentityToStringStringBuilderNullValue() {
try {
From e863dcb2e7a654af6b8eb5865d8d1d8eee0a6d28 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 10 Nov 2017 12:25:39 -0700
Subject: [PATCH 0092/3439] [LANG-1367] ObjectUtils.identityToString(Object)
and friends should allocate builders and buffers with a size
---
src/changes/changes.xml | 4 +++
.../org/apache/commons/lang3/ObjectUtils.java | 33 ++++++++++++++-----
.../apache/commons/lang3/ObjectUtilsTest.java | 6 ++--
3 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7d102003a75..07461bedf5c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,6 +45,10 @@ The type attribute can be add,update,fix,remove.
+
+ ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size
+
+
Fix tests DateUtilsTest for Java 9 with en_GB localeFix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 1bcf72d4cc5..6b93a7d65bd 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -47,7 +47,7 @@
public class ObjectUtils {
private static final char AT_SIGN = '@';
-
+
/**
*
Singleton used as a {@code null} placeholder where
* {@code null} has another meaning.
@@ -333,8 +333,14 @@ public static String identityToString(final Object object) {
if (object == null) {
return null;
}
- final StringBuilder builder = new StringBuilder();
- identityToString(builder, object);
+ final String name = object.getClass().getName();
+ final String hexString = Integer.toHexString(System.identityHashCode(object));
+ final StringBuilder builder = new StringBuilder(name.length() + 1 + hexString.length());
+ // @formatter:off
+ builder.append(name)
+ .append(AT_SIGN)
+ .append(hexString);
+ // @formatter:off
return builder.toString();
}
@@ -381,9 +387,12 @@ public static void identityToString(final Appendable appendable, final Object ob
@Deprecated
public static void identityToString(final StrBuilder builder, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
- builder.append(object.getClass().getName())
+ final String name = object.getClass().getName();
+ final String hexString = Integer.toHexString(System.identityHashCode(object));
+ builder.ensureCapacity(builder.length() + name.length() + 1 + hexString.length());
+ builder.append(name)
.append(AT_SIGN)
- .append(Integer.toHexString(System.identityHashCode(object)));
+ .append(hexString);
}
/**
@@ -403,9 +412,12 @@ public static void identityToString(final StrBuilder builder, final Object objec
*/
public static void identityToString(final StringBuffer buffer, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
- buffer.append(object.getClass().getName())
+ final String name = object.getClass().getName();
+ final String hexString = Integer.toHexString(System.identityHashCode(object));
+ buffer.ensureCapacity(buffer.length() + name.length() + 1 + hexString.length());
+ buffer.append(name)
.append(AT_SIGN)
- .append(Integer.toHexString(System.identityHashCode(object)));
+ .append(hexString);
}
/**
@@ -425,9 +437,12 @@ public static void identityToString(final StringBuffer buffer, final Object obje
*/
public static void identityToString(final StringBuilder builder, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
- builder.append(object.getClass().getName())
+ final String name = object.getClass().getName();
+ final String hexString = Integer.toHexString(System.identityHashCode(object));
+ builder.ensureCapacity(builder.length() + name.length() + 1 + hexString.length());
+ builder.append(name)
.append(AT_SIGN)
- .append(Integer.toHexString(System.identityHashCode(object)));
+ .append(hexString);
}
// ToString
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index 06b97e2a0cf..661722dacd8 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -195,7 +195,7 @@ public void testIdentityToStringStringBuffer() {
public void testIdentityToStringObjectNull() {
assertNull(ObjectUtils.identityToString(null));
}
-
+
@Test
public void testIdentityToStringInteger() {
final Integer i = Integer.valueOf(90);
@@ -203,14 +203,14 @@ public void testIdentityToStringInteger() {
assertEquals(expected, ObjectUtils.identityToString(i));
}
-
+
@Test
public void testIdentityToStringString() {
assertEquals(
"java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
ObjectUtils.identityToString(FOO));
}
-
+
@Test
public void testIdentityToStringStringBuilder() {
final Integer i = Integer.valueOf(90);
From 5aed9abe1636f43e8e97458a91da5107c6ebac4a Mon Sep 17 00:00:00 2001
From: Sebb
Date: Tue, 14 Nov 2017 00:40:28 +0000
Subject: [PATCH 0093/3439] Fix up component id
mvn commons:download-page -Dcommons.release.version=3.7
-Dcommons.componentid=lang
---
src/site/xdoc/download_lang.xml | 52 ++++++++++++++++-----------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/site/xdoc/download_lang.xml b/src/site/xdoc/download_lang.xml
index e4d0c7bb9bc..e9c95b1d0fb 100644
--- a/src/site/xdoc/download_lang.xml
+++ b/src/site/xdoc/download_lang.xml
@@ -115,28 +115,28 @@ limitations under the License.
From 721f3ef4aaa1f5cea764b3e9b1d639878b2a0a3b Mon Sep 17 00:00:00 2001
From: Sebb
Date: Tue, 14 Nov 2017 15:19:37 +0000
Subject: [PATCH 0094/3439] Document other usage
---
pom.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pom.xml b/pom.xml
index b2d1e9060b2..8bbe79d95ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -567,6 +567,8 @@
The above seems to change the download page name but not any other
properties that depend on the componentid.
+
+ N.B. The componentid is also used by the parent pom as part of the OSGI symbolic name.
-->
lang3org.apache.commons.lang3
From f7cbda67518ed7335566ebf942cd170a66746096 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 15 Nov 2017 21:06:36 -0700
Subject: [PATCH 0095/3439] Normalize private method names to camel-case.
---
.../org/apache/commons/lang3/SystemUtils.java | 84 +++++++++----------
1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 74a90fca5e0..badde7fba04 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -1003,7 +1003,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_AIX = getOSMatchesName("AIX");
+ public static final boolean IS_OS_AIX = getOsMatchesName("AIX");
/**
*
@@ -1015,7 +1015,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_HP_UX = getOSMatchesName("HP-UX");
+ public static final boolean IS_OS_HP_UX = getOsMatchesName("HP-UX");
/**
*
@@ -1027,7 +1027,7 @@ public class SystemUtils {
*
* @since 3.3
*/
- public static final boolean IS_OS_400 = getOSMatchesName("OS/400");
+ public static final boolean IS_OS_400 = getOsMatchesName("OS/400");
/**
*
@@ -1039,7 +1039,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_IRIX = getOSMatchesName("Irix");
+ public static final boolean IS_OS_IRIX = getOsMatchesName("Irix");
/**
*
@@ -1051,7 +1051,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_LINUX = getOSMatchesName("Linux") || getOSMatchesName("LINUX");
+ public static final boolean IS_OS_LINUX = getOsMatchesName("Linux") || getOsMatchesName("LINUX");
/**
*
@@ -1063,7 +1063,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_MAC = getOSMatchesName("Mac");
+ public static final boolean IS_OS_MAC = getOsMatchesName("Mac");
/**
*
@@ -1075,7 +1075,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_MAC_OSX = getOSMatchesName("Mac OS X");
+ public static final boolean IS_OS_MAC_OSX = getOsMatchesName("Mac OS X");
/**
*
@@ -1087,7 +1087,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_CHEETAH = getOSMatches("Mac OS X", "10.0");
+ public static final boolean IS_OS_MAC_OSX_CHEETAH = getOsMatches("Mac OS X", "10.0");
/**
*
@@ -1099,7 +1099,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_PUMA = getOSMatches("Mac OS X", "10.1");
+ public static final boolean IS_OS_MAC_OSX_PUMA = getOsMatches("Mac OS X", "10.1");
/**
*
@@ -1111,7 +1111,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_JAGUAR = getOSMatches("Mac OS X", "10.2");
+ public static final boolean IS_OS_MAC_OSX_JAGUAR = getOsMatches("Mac OS X", "10.2");
/**
*
@@ -1123,7 +1123,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_PANTHER = getOSMatches("Mac OS X", "10.3");
+ public static final boolean IS_OS_MAC_OSX_PANTHER = getOsMatches("Mac OS X", "10.3");
/**
*
@@ -1135,7 +1135,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_TIGER = getOSMatches("Mac OS X", "10.4");
+ public static final boolean IS_OS_MAC_OSX_TIGER = getOsMatches("Mac OS X", "10.4");
/**
*
@@ -1147,7 +1147,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_LEOPARD = getOSMatches("Mac OS X", "10.5");
+ public static final boolean IS_OS_MAC_OSX_LEOPARD = getOsMatches("Mac OS X", "10.5");
/**
*
@@ -1159,7 +1159,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_SNOW_LEOPARD = getOSMatches("Mac OS X", "10.6");
+ public static final boolean IS_OS_MAC_OSX_SNOW_LEOPARD = getOsMatches("Mac OS X", "10.6");
/**
*
@@ -1171,7 +1171,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_LION = getOSMatches("Mac OS X", "10.7");
+ public static final boolean IS_OS_MAC_OSX_LION = getOsMatches("Mac OS X", "10.7");
/**
*
@@ -1183,7 +1183,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_MOUNTAIN_LION = getOSMatches("Mac OS X", "10.8");
+ public static final boolean IS_OS_MAC_OSX_MOUNTAIN_LION = getOsMatches("Mac OS X", "10.8");
/**
*
@@ -1195,7 +1195,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_MAVERICKS = getOSMatches("Mac OS X", "10.9");
+ public static final boolean IS_OS_MAC_OSX_MAVERICKS = getOsMatches("Mac OS X", "10.9");
/**
*
@@ -1207,7 +1207,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_MAC_OSX_YOSEMITE = getOSMatches("Mac OS X", "10.10");
+ public static final boolean IS_OS_MAC_OSX_YOSEMITE = getOsMatches("Mac OS X", "10.10");
/**
*
@@ -1219,7 +1219,7 @@ public class SystemUtils {
*
* @since 3.5
*/
- public static final boolean IS_OS_MAC_OSX_EL_CAPITAN = getOSMatches("Mac OS X", "10.11");
+ public static final boolean IS_OS_MAC_OSX_EL_CAPITAN = getOsMatches("Mac OS X", "10.11");
/**
*
@@ -1231,7 +1231,7 @@ public class SystemUtils {
*
* @since 3.1
*/
- public static final boolean IS_OS_FREE_BSD = getOSMatchesName("FreeBSD");
+ public static final boolean IS_OS_FREE_BSD = getOsMatchesName("FreeBSD");
/**
*
@@ -1243,7 +1243,7 @@ public class SystemUtils {
*
* @since 3.1
*/
- public static final boolean IS_OS_OPEN_BSD = getOSMatchesName("OpenBSD");
+ public static final boolean IS_OS_OPEN_BSD = getOsMatchesName("OpenBSD");
/**
*
@@ -1255,7 +1255,7 @@ public class SystemUtils {
*
* @since 3.1
*/
- public static final boolean IS_OS_NET_BSD = getOSMatchesName("NetBSD");
+ public static final boolean IS_OS_NET_BSD = getOsMatchesName("NetBSD");
/**
*
@@ -1267,7 +1267,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_OS2 = getOSMatchesName("OS/2");
+ public static final boolean IS_OS_OS2 = getOsMatchesName("OS/2");
/**
*
@@ -1279,7 +1279,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_SOLARIS = getOSMatchesName("Solaris");
+ public static final boolean IS_OS_SOLARIS = getOsMatchesName("Solaris");
/**
*
@@ -1291,7 +1291,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_SUN_OS = getOSMatchesName("SunOS");
+ public static final boolean IS_OS_SUN_OS = getOsMatchesName("SunOS");
/**
*
@@ -1316,7 +1316,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_WINDOWS = getOSMatchesName(OS_NAME_WINDOWS_PREFIX);
+ public static final boolean IS_OS_WINDOWS = getOsMatchesName(OS_NAME_WINDOWS_PREFIX);
/**
*
@@ -1328,7 +1328,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_WINDOWS_2000 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " 2000");
+ public static final boolean IS_OS_WINDOWS_2000 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 2000");
/**
*
@@ -1340,7 +1340,7 @@ public class SystemUtils {
*
* @since 3.1
*/
- public static final boolean IS_OS_WINDOWS_2003 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " 2003");
+ public static final boolean IS_OS_WINDOWS_2003 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 2003");
/**
*
@@ -1352,7 +1352,7 @@ public class SystemUtils {
*
* @since 3.1
*/
- public static final boolean IS_OS_WINDOWS_2008 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " Server 2008");
+ public static final boolean IS_OS_WINDOWS_2008 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " Server 2008");
/**
*
@@ -1364,7 +1364,7 @@ public class SystemUtils {
*
* @since 3.4
*/
- public static final boolean IS_OS_WINDOWS_2012 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " Server 2012");
+ public static final boolean IS_OS_WINDOWS_2012 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " Server 2012");
/**
*
@@ -1376,7 +1376,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_WINDOWS_95 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " 95");
+ public static final boolean IS_OS_WINDOWS_95 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 95");
/**
*
@@ -1388,7 +1388,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_WINDOWS_98 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " 98");
+ public static final boolean IS_OS_WINDOWS_98 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 98");
/**
*
@@ -1400,7 +1400,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_WINDOWS_ME = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " Me");
+ public static final boolean IS_OS_WINDOWS_ME = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " Me");
/**
*
@@ -1412,7 +1412,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_WINDOWS_NT = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " NT");
+ public static final boolean IS_OS_WINDOWS_NT = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " NT");
/**
*
@@ -1424,7 +1424,7 @@ public class SystemUtils {
*
* @since 2.0
*/
- public static final boolean IS_OS_WINDOWS_XP = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " XP");
+ public static final boolean IS_OS_WINDOWS_XP = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " XP");
// -----------------------------------------------------------------------
/**
@@ -1437,7 +1437,7 @@ public class SystemUtils {
*
* @since 2.4
*/
- public static final boolean IS_OS_WINDOWS_VISTA = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " Vista");
+ public static final boolean IS_OS_WINDOWS_VISTA = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " Vista");
/**
*
@@ -1449,7 +1449,7 @@ public class SystemUtils {
*
* @since 3.0
*/
- public static final boolean IS_OS_WINDOWS_7 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " 7");
+ public static final boolean IS_OS_WINDOWS_7 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 7");
/**
*
@@ -1461,7 +1461,7 @@ public class SystemUtils {
*
* @since 3.2
*/
- public static final boolean IS_OS_WINDOWS_8 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " 8");
+ public static final boolean IS_OS_WINDOWS_8 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 8");
/**
*
@@ -1473,7 +1473,7 @@ public class SystemUtils {
*
* @since 3.5
*/
- public static final boolean IS_OS_WINDOWS_10 = getOSMatchesName(OS_NAME_WINDOWS_PREFIX + " 10");
+ public static final boolean IS_OS_WINDOWS_10 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 10");
/**
*
@@ -1490,7 +1490,7 @@ public class SystemUtils {
// os.encoding = ISO8859_1
// os.name = z/OS
// os.version = 02.02.00
- public static final boolean IS_OS_ZOS = getOSMatchesName("z/OS");
+ public static final boolean IS_OS_ZOS = getOsMatchesName("z/OS");
/**
*
@@ -1555,7 +1555,7 @@ private static boolean getJavaVersionMatches(final String versionPrefix) {
* @param osVersionPrefix the prefix for the version
* @return true if matches, or false if not or can't determine
*/
- private static boolean getOSMatches(final String osNamePrefix, final String osVersionPrefix) {
+ private static boolean getOsMatches(final String osNamePrefix, final String osVersionPrefix) {
return isOSMatch(OS_NAME, OS_VERSION, osNamePrefix, osVersionPrefix);
}
@@ -1565,7 +1565,7 @@ private static boolean getOSMatches(final String osNamePrefix, final String osVe
* @param osNamePrefix the prefix for the os name
* @return true if matches, or false if not or can't determine
*/
- private static boolean getOSMatchesName(final String osNamePrefix) {
+ private static boolean getOsMatchesName(final String osNamePrefix) {
return isOSNameMatch(OS_NAME, osNamePrefix);
}
From 6049e77fdcd021544a60651fc6de4d80e2ef1c2d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 15 Nov 2017 21:07:14 -0700
Subject: [PATCH 0096/3439] Fix Javadoc typos.
---
src/main/java/org/apache/commons/lang3/SystemUtils.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index badde7fba04..a6d9c2e9a60 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -1551,7 +1551,7 @@ private static boolean getJavaVersionMatches(final String versionPrefix) {
/**
* Decides if the operating system matches.
*
- * @param osNamePrefix the prefix for the os name
+ * @param osNamePrefix the prefix for the OS name
* @param osVersionPrefix the prefix for the version
* @return true if matches, or false if not or can't determine
*/
@@ -1562,7 +1562,7 @@ private static boolean getOsMatches(final String osNamePrefix, final String osVe
/**
* Decides if the operating system matches.
*
- * @param osNamePrefix the prefix for the os name
+ * @param osNamePrefix the prefix for the OS name
* @return true if matches, or false if not or can't determine
*/
private static boolean getOsMatchesName(final String osNamePrefix) {
From 7d061e33e59e23dc4b03378f35f50a7d70f033b3 Mon Sep 17 00:00:00 2001
From: Andre Dieb Martins
Date: Wed, 22 Nov 2017 13:44:23 -0500
Subject: [PATCH 0097/3439] LANG-1370 Fix EventCountCircuitBreaker increment
batch
Fixes #incrementAndCheckState(Integer increment) by passing the increment downstream.
---
.../concurrent/EventCountCircuitBreaker.java | 2 +-
.../concurrent/EventCountCircuitBreakerTest.java | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
index b40213e9b0a..dd282dc9b31 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
@@ -271,7 +271,7 @@ public boolean checkState() {
@Override
public boolean incrementAndCheckState(final Integer increment)
throws CircuitBreakingException {
- return performStateCheck(1);
+ return performStateCheck(increment);
}
/**
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
index 1c9e7941147..0053554e1d4 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
@@ -154,6 +154,21 @@ public void testOpeningWhenThresholdReached() {
assertFalse("Closed", breaker.isClosed());
}
+ /**
+ * Tests that the circuit breaker opens if all conditions are met when using
+ * {@link EventCountCircuitBreaker#incrementAndCheckState(Integer increment)}.
+ */
+ @Test
+ public void testOpeningWhenThresholdReachedThroughBatch() {
+ final long timeIncrement = NANO_FACTOR / OPENING_THRESHOLD - 1;
+ final EventCountCircuitBreakerTestImpl breaker = new EventCountCircuitBreakerTestImpl(OPENING_THRESHOLD, 1,
+ TimeUnit.SECONDS, CLOSING_THRESHOLD, 1, TimeUnit.SECONDS);
+ long startTime = timeIncrement * (OPENING_THRESHOLD + 1);
+ boolean open = !breaker.at(startTime).incrementAndCheckState(OPENING_THRESHOLD + 1);
+ assertTrue("Not open", open);
+ assertFalse("Closed", breaker.isClosed());
+ }
+
/**
* Tests that an open circuit breaker does not close itself when the number of events
* received is over the threshold.
From dd2394323b441e7a22d3c85ce751b619918ee161 Mon Sep 17 00:00:00 2001
From: "Bruno P. Kinoshita"
Date: Sat, 25 Nov 2017 21:38:17 +1300
Subject: [PATCH 0098/3439] LANG-1370: Add changes.xml entry
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 07461bedf5c..612816b1dd0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ Fix EventCountCircuitBreaker increment batchObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size
From bfb43d3fe2eafa80f45fc59a5b742d192efa8e3c Mon Sep 17 00:00:00 2001
From: nbarban
Date: Wed, 20 Dec 2017 12:14:59 +0200
Subject: [PATCH 0099/3439] StringUtils#getDigits : Fix a small mistake in
javadoc description. (closes #310)
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 7e62d32998e..924e10f1904 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -7168,7 +7168,7 @@ public static boolean isNumericSpace(final CharSequence cs) {
* StringUtils.getDigits("") = ""
* StringUtils.getDigits("abc") = ""
* StringUtils.getDigits("1000$") = "1000"
- * StringUtils.getDigits("1123~45") = "12345"
+ * StringUtils.getDigits("1123~45") = "112345"
* StringUtils.getDigits("(541) 754-3010") = "5417543010"
* StringUtils.getDigits("\u0967\u0968\u0969") = "\u0967\u0968\u0969"
*
From d8ec011d770e1e04ef4f87fba673f3748f363278 Mon Sep 17 00:00:00 2001
From: Dmitry Ovchinnikov
Date: Sun, 12 Nov 2017 21:49:07 +0300
Subject: [PATCH 0100/3439] LANG-1371: Fix TypeUtils.parameterize to work
correctly with narrower-typed varargs array (closes #307)
---
.../org/apache/commons/lang3/reflect/TypeUtils.java | 2 +-
.../apache/commons/lang3/reflect/TypeUtilsTest.java | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
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 3a7ac178064..efb630c62e0 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
@@ -157,7 +157,7 @@ private static final class ParameterizedTypeImpl implements ParameterizedType {
private ParameterizedTypeImpl(final Class> raw, final Type useOwner, final Type[] typeArguments) {
this.raw = raw;
this.useOwner = useOwner;
- this.typeArguments = typeArguments.clone();
+ this.typeArguments = Arrays.copyOf(typeArguments, typeArguments.length, Type[].class);
}
/**
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 acdf77c8675..a9bb9fab64c 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
@@ -34,6 +34,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -690,6 +691,15 @@ public void testParameterize() throws Exception {
assertEquals("java.lang.Comparable", stringComparableType.toString());
}
+ @Test
+ public void testParameterizeNarrowerTypeArray() {
+ final TypeVariable>[] variables = ArrayList.class.getTypeParameters();
+ final ParameterizedType parameterizedType = TypeUtils.parameterize(ArrayList.class, variables);
+ final Map, Type> mapping = Collections., Type>singletonMap(variables[0], String.class);
+ final Type unrolled = TypeUtils.unrollVariables(mapping, parameterizedType);
+ assertEquals(TypeUtils.parameterize(ArrayList.class, String.class), unrolled);
+ }
+
@Test
public void testParameterizeWithOwner() throws Exception {
final Type owner = TypeUtils.parameterize(TypeUtilsTest.class, String.class);
From 4661422633e155b9d4d6dfdfdcf27826aa8aeb84 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Wed, 20 Dec 2017 17:20:54 +0100
Subject: [PATCH 0101/3439] LANG-1371: Fix TypeUtils.parameterize to work
correctly with narrower-typed varargs array
add changes.xml entry
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 612816b1dd0..4a68f8cc4bf 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ Fix TypeUtils#parameterize to work correctly with narrower-typed arrayFix EventCountCircuitBreaker increment batchObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size
From 4f13c6891870ddfe9dbad34292b2c8d5715eb31c Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Wed, 20 Dec 2017 17:25:59 +0100
Subject: [PATCH 0102/3439] README.md: update version in dependency xml
fragment
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index bd2a4051d63..e3ad97b06aa 100644
--- a/README.md
+++ b/README.md
@@ -69,7 +69,7 @@ Alternatively you can pull it from the central Maven repositories:
org.apache.commonscommons-lang3
- 3.6
+ 3.7
```
From 49a876cb1c2a49583b9184ab58a579ac75525986 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 21 Dec 2017 08:46:30 -0700
Subject: [PATCH 0103/3439] Don't need internal ivar name for a boolean to
carry a "Flag" postfix.
---
.../commons/lang3/concurrent/BasicThreadFactory.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
index 3882b81c3b0..7746b7ad7be 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
@@ -122,7 +122,7 @@ private BasicThreadFactory(final Builder builder) {
namingPattern = builder.namingPattern;
priority = builder.priority;
- daemonFlag = builder.daemonFlag;
+ daemonFlag = builder.daemon;
uncaughtExceptionHandler = builder.exceptionHandler;
threadCounter = new AtomicLong();
@@ -267,7 +267,7 @@ public static class Builder
private Integer priority;
/** The daemon flag. */
- private Boolean daemonFlag;
+ private Boolean daemon;
/**
* Sets the {@code ThreadFactory} to be wrapped by the new {@code
@@ -310,7 +310,7 @@ public Builder namingPattern(final String pattern) {
* @return a reference to this {@code Builder}
*/
public Builder daemon(final boolean f) {
- daemonFlag = Boolean.valueOf(f);
+ daemon = Boolean.valueOf(f);
return this;
}
@@ -354,7 +354,7 @@ public void reset() {
exceptionHandler = null;
namingPattern = null;
priority = null;
- daemonFlag = null;
+ daemon = null;
}
/**
From 6dfc3e64037f10b84fe203415e79e2435acff558 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 21 Dec 2017 08:47:30 -0700
Subject: [PATCH 0104/3439] Don't need internal ivar name for a boolean to
carry a "Flag" postfix.
---
.../apache/commons/lang3/concurrent/BasicThreadFactory.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
index 7746b7ad7be..64a160670aa 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
@@ -105,7 +105,7 @@ public class BasicThreadFactory implements ThreadFactory {
private final Integer priority;
/** Stores the daemon status flag. */
- private final Boolean daemonFlag;
+ private final Boolean daemon;
/**
* Creates a new instance of {@code ThreadFactoryImpl} and configures it
@@ -122,7 +122,7 @@ private BasicThreadFactory(final Builder builder) {
namingPattern = builder.namingPattern;
priority = builder.priority;
- daemonFlag = builder.daemon;
+ daemon = builder.daemon;
uncaughtExceptionHandler = builder.exceptionHandler;
threadCounter = new AtomicLong();
@@ -159,7 +159,7 @@ public final String getNamingPattern() {
* @return the daemon flag
*/
public final Boolean getDaemonFlag() {
- return daemonFlag;
+ return daemon;
}
/**
From 5fb74a6618da0ca8b12a3346038164913a5d27d5 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 21 Dec 2017 08:57:29 -0700
Subject: [PATCH 0105/3439] Rename parameter 't' to 'thread'.
---
.../commons/lang3/concurrent/BasicThreadFactory.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
index 64a160670aa..39be5ecbd54 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
@@ -215,25 +215,25 @@ public Thread newThread(final Runnable r) {
* the wrapped thread factory. It initializes the thread according to the
* options set for this factory.
*
- * @param t the thread to be initialized
+ * @param thread the thread to be initialized
*/
- private void initializeThread(final Thread t) {
+ private void initializeThread(final Thread thread) {
if (getNamingPattern() != null) {
final Long count = Long.valueOf(threadCounter.incrementAndGet());
- t.setName(String.format(getNamingPattern(), count));
+ thread.setName(String.format(getNamingPattern(), count));
}
if (getUncaughtExceptionHandler() != null) {
- t.setUncaughtExceptionHandler(getUncaughtExceptionHandler());
+ thread.setUncaughtExceptionHandler(getUncaughtExceptionHandler());
}
if (getPriority() != null) {
- t.setPriority(getPriority().intValue());
+ thread.setPriority(getPriority().intValue());
}
if (getDaemonFlag() != null) {
- t.setDaemon(getDaemonFlag().booleanValue());
+ thread.setDaemon(getDaemonFlag().booleanValue());
}
}
From f5a9effebd7209f3fa5385f18a5e59e8a09122f2 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 21 Dec 2017 09:01:21 -0700
Subject: [PATCH 0106/3439] Don't use single letter variable names.
---
.../lang3/concurrent/BasicThreadFactory.java | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
index 39be5ecbd54..cd50ad1401c 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
@@ -198,15 +198,15 @@ public long getThreadCount() {
* factory for creating the thread. Then, on the newly created thread the
* corresponding configuration options are set.
*
- * @param r the {@code Runnable} to be executed by the new thread
+ * @param runnable the {@code Runnable} to be executed by the new thread
* @return the newly created thread
*/
@Override
- public Thread newThread(final Runnable r) {
- final Thread t = getWrappedFactory().newThread(r);
- initializeThread(t);
+ public Thread newThread(final Runnable runnable) {
+ final Thread thread = getWrappedFactory().newThread(runnable);
+ initializeThread(thread);
- return t;
+ return thread;
}
/**
@@ -306,11 +306,11 @@ public Builder namingPattern(final String pattern) {
* flag is set to true the new thread factory will create daemon
* threads.
*
- * @param f the value of the daemon flag
+ * @param daemon the value of the daemon flag
* @return a reference to this {@code Builder}
*/
- public Builder daemon(final boolean f) {
- daemon = Boolean.valueOf(f);
+ public Builder daemon(final boolean daemon) {
+ this.daemon = Boolean.valueOf(daemon);
return this;
}
@@ -318,11 +318,11 @@ public Builder daemon(final boolean f) {
* Sets the priority for the threads created by the new {@code
* BasicThreadFactory}.
*
- * @param prio the priority
+ * @param priority the priority
* @return a reference to this {@code Builder}
*/
- public Builder priority(final int prio) {
- priority = Integer.valueOf(prio);
+ public Builder priority(final int priority) {
+ this.priority = Integer.valueOf(priority);
return this;
}
From c614fbcc79615f93d2c60a153db6e82d7474c425 Mon Sep 17 00:00:00 2001
From: "Bruno P. Kinoshita"
Date: Thu, 4 Jan 2018 22:15:08 +1300
Subject: [PATCH 0107/3439] LANG-1374: fix logic in isJsonArray method of
JsonToStringStyle
---
src/changes/changes.xml | 1 +
.../commons/lang3/builder/ToStringStyle.java | 2 +-
.../lang3/builder/JsonToStringStyleTest.java | 20 +++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4a68f8cc4bf..a5e43011fdf 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ Parsing Json Array failedFix TypeUtils#parameterize to work correctly with narrower-typed arrayFix EventCountCircuitBreaker increment batchObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size
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 e24aa3100ae..36fe8677d5e 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
@@ -2591,7 +2591,7 @@ protected void appendDetail(final StringBuffer buffer, final String fieldName, f
private boolean isJsonArray(final String valueAsString) {
return valueAsString.startsWith(getArrayStart())
- && valueAsString.startsWith(getArrayEnd());
+ && valueAsString.endsWith(getArrayEnd());
}
private boolean isJsonObject(final String valueAsString) {
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 6f76cfecfdd..d6bbc646c3b 100644
--- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
@@ -358,6 +358,26 @@ public void testLongArrayArray() {
}
}
+ @Test
+ public void testArray() {
+ final Person p = new Person();
+ p.name = "Jane Doe";
+ p.age = 25;
+ p.smoker = true;
+
+ assertEquals(
+ "{\"name\":\"Jane Doe\",\"age\":25,\"smoker\":true,\"groups\":['admin', 'manager', 'user']}",
+ new ToStringBuilder(p).append("name", p.name)
+ .append("age", p.age).append("smoker", p.smoker)
+ .append("groups", new Object() {
+ @Override
+ public String toString() {
+ return "['admin', 'manager', 'user']";
+ }
+ })
+ .toString());
+ }
+
/**
* An object with nested object structures used to test {@link ToStringStyle.JsonToStringStyle}.
*
From 3c0308db7f0928dc2b81d74af279ffe35f94f58b Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Sat, 6 Jan 2018 20:28:52 -0500
Subject: [PATCH 0108/3439] Happy New Year
---
NOTICE.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NOTICE.txt b/NOTICE.txt
index 6a77d8601e9..45554e2b40b 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
Apache Commons Lang
-Copyright 2001-2017 The Apache Software Foundation
+Copyright 2001-2018 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
From d1b149fe123e9837a4a3d8921a734e51829138be Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 7 Jan 2018 11:03:42 +0100
Subject: [PATCH 0109/3439] Update to commons-parent version 43
---
pom.xml | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8bbe79d95ae..ba9c123513d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 42
+ 434.0.0commons-lang3
@@ -588,8 +588,6 @@
site-contentutf-8
-
- 2.82.17
@@ -837,8 +835,6 @@
-Xmx512m --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED
-
- 3.0.0-M1true
From b2939a7e30d973c6fa2ba90f1bb3ac674fabfad6 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 7 Jan 2018 11:06:27 +0100
Subject: [PATCH 0110/3439] Update to easymock version 3.5.1
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index ba9c123513d..a4e53ab9a6b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -525,7 +525,7 @@
org.easymockeasymock
- 3.5
+ 3.5.1test
From 066665ea6506b2c9f41e405038a3fe2041ea95bf Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 7 Jan 2018 18:01:46 +0100
Subject: [PATCH 0111/3439] pom.xml: remove outdated and no longer correct
comment about Automatic-Module-Name being implemented in Parent POM
---
pom.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index a4e53ab9a6b..ab66a9991e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -654,7 +654,6 @@
-
From 30dcb8de48393338deca5bfe68f251008f4d31d0 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 7 Jan 2018 18:13:07 +0100
Subject: [PATCH 0112/3439] pom.xml: use commons.module.name property as
Automatic-Module-Name
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index ab66a9991e1..5c3b0dc25e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -657,7 +657,7 @@
- org.apache.commons.lang3
+ ${commons.module.name}
From 0b70b01a9f1d9664bb5eac737175f58f06979b60 Mon Sep 17 00:00:00 2001
From: Ruslan Sibgatullin
Date: Thu, 14 Sep 2017 23:19:41 +0300
Subject: [PATCH 0113/3439] LANG-1352: EnumUtils.getEnumIgnoreCase and
isValidEnumIgnoreCase methods added (closes #286)
---
.../org/apache/commons/lang3/EnumUtils.java | 49 +++++++++++++++----
.../apache/commons/lang3/EnumUtilsTest.java | 44 ++++++++++++++++-
2 files changed, 82 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/EnumUtils.java b/src/main/java/org/apache/commons/lang3/EnumUtils.java
index ab062ad0538..5aa76689d3f 100644
--- a/src/main/java/org/apache/commons/lang3/EnumUtils.java
+++ b/src/main/java/org/apache/commons/lang3/EnumUtils.java
@@ -87,15 +87,23 @@ public static > List getEnumList(final Class enumClass)
* @return true if the enum name is valid, otherwise false
*/
public static > boolean isValidEnum(final Class enumClass, final String enumName) {
- if (enumName == null) {
- return false;
- }
- try {
- Enum.valueOf(enumClass, enumName);
- return true;
- } catch (final IllegalArgumentException ex) {
- return false;
- }
+ return getEnum(enumClass, enumName) != null;
+ }
+
+ /**
+ *
Checks if the specified name is a valid enum for the class.
+ *
+ *
This method differs from {@link Enum#valueOf} in that checks if the name is
+ * a valid enum without needing to catch the exception
+ * and performs case insensitive matching of the name.
+ *
+ * @param the type of the enumeration
+ * @param enumClass the class of the enum to query, not null
+ * @param enumName the enum name, null returns false
+ * @return true if the enum name is valid, otherwise false
+ */
+ public static > boolean isValidEnumIgnoreCase(final Class enumClass, final String enumName) {
+ return getEnumIgnoreCase(enumClass, enumName) != null;
}
/**
@@ -120,6 +128,29 @@ public static > E getEnum(final Class enumClass, final Stri
}
}
+ /**
+ *
Gets the enum for the class, returning {@code null} if not found.
+ *
+ *
This method differs from {@link Enum#valueOf} in that it does not throw an exception
+ * for an invalid enum name and performs case insensitive matching of the name.
+ *
+ * @param the type of the enumeration
+ * @param enumClass the class of the enum to query, not null
+ * @param enumName the enum name, null returns null
+ * @return the enum, null if not found
+ */
+ public static > E getEnumIgnoreCase(final Class enumClass, final String enumName) {
+ if (enumName == null || !enumClass.isEnum()) {
+ return null;
+ }
+ for (final E each : enumClass.getEnumConstants()) {
+ if (each.name().equalsIgnoreCase(enumName)) {
+ return each;
+ }
+ }
+ return null;
+ }
+
/**
*
Creates a long bit vector representation of the given subset of an Enum.
*
diff --git a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
index f17dddae68c..7c732b28a58 100644
--- a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
@@ -67,7 +67,7 @@ public void test_getEnumList() {
}
@Test
- public void test_isEnum() {
+ public void test_isValidEnum() {
assertTrue(EnumUtils.isValidEnum(Traffic.class, "RED"));
assertTrue(EnumUtils.isValidEnum(Traffic.class, "AMBER"));
assertTrue(EnumUtils.isValidEnum(Traffic.class, "GREEN"));
@@ -76,10 +76,24 @@ public void test_isEnum() {
}
@Test(expected=NullPointerException.class)
- public void test_isEnum_nullClass() {
+ public void test_isValidEnum_nullClass() {
EnumUtils.isValidEnum(null, "PURPLE");
}
+ @Test
+ public void test_isValidEnumIgnoreCase() {
+ assertTrue(EnumUtils.isValidEnumIgnoreCase(Traffic.class, "red"));
+ assertTrue(EnumUtils.isValidEnumIgnoreCase(Traffic.class, "Amber"));
+ assertTrue(EnumUtils.isValidEnumIgnoreCase(Traffic.class, "grEEn"));
+ assertFalse(EnumUtils.isValidEnumIgnoreCase(Traffic.class, "purple"));
+ assertFalse(EnumUtils.isValidEnumIgnoreCase(Traffic.class, null));
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void test_isValidEnumIgnoreCase_nullClass() {
+ EnumUtils.isValidEnumIgnoreCase(null, "PURPLE");
+ }
+
@Test
public void test_getEnum() {
assertEquals(Traffic.RED, EnumUtils.getEnum(Traffic.class, "RED"));
@@ -89,11 +103,37 @@ public void test_getEnum() {
assertNull(EnumUtils.getEnum(Traffic.class, null));
}
+ @Test
+ public void test_getEnum_nonEnumClass() {
+ final Class rawType = Object.class;
+ assertNull(EnumUtils.getEnum(rawType, "rawType"));
+ }
+
@Test(expected=NullPointerException.class)
public void test_getEnum_nullClass() {
EnumUtils.getEnum((Class) null, "PURPLE");
}
+ @Test
+ public void test_getEnumIgnoreCase() {
+ assertEquals(Traffic.RED, EnumUtils.getEnumIgnoreCase(Traffic.class, "red"));
+ assertEquals(Traffic.AMBER, EnumUtils.getEnumIgnoreCase(Traffic.class, "Amber"));
+ assertEquals(Traffic.GREEN, EnumUtils.getEnumIgnoreCase(Traffic.class, "grEEn"));
+ assertNull(EnumUtils.getEnumIgnoreCase(Traffic.class, "purple"));
+ assertNull(EnumUtils.getEnumIgnoreCase(Traffic.class, null));
+ }
+
+ @Test
+ public void test_getEnumIgnoreCase_nonEnumClass() {
+ final Class rawType = Object.class;
+ assertNull(EnumUtils.getEnumIgnoreCase(rawType, "rawType"));
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void test_getEnumIgnoreCase_nullClass() {
+ EnumUtils.getEnumIgnoreCase((Class) null, "PURPLE");
+ }
+
@Test(expected=NullPointerException.class)
public void test_generateBitVector_nullClass() {
EnumUtils.generateBitVector(null, EnumSet.of(Traffic.RED));
From 63f11e9dc1874abdde1bfe1d900b5ebfa4d3a941 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Fri, 12 Jan 2018 17:56:59 +0100
Subject: [PATCH 0114/3439] LANG-1352: EnumUtils.getEnumIgnoreCase and
isValidEnumIgnoreCase methods added
add since javadoc tags and changes.xml entry
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/lang3/EnumUtils.java | 2 ++
2 files changed, 3 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a5e43011fdf..bf9f499dd0f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,6 +50,7 @@ The type attribute can be add,update,fix,remove.
Fix TypeUtils#parameterize to work correctly with narrower-typed arrayFix EventCountCircuitBreaker increment batchObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size
+ EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added
diff --git a/src/main/java/org/apache/commons/lang3/EnumUtils.java b/src/main/java/org/apache/commons/lang3/EnumUtils.java
index 5aa76689d3f..0ebca28ee6a 100644
--- a/src/main/java/org/apache/commons/lang3/EnumUtils.java
+++ b/src/main/java/org/apache/commons/lang3/EnumUtils.java
@@ -101,6 +101,7 @@ public static > boolean isValidEnum(final Class enumClass,
* @param enumClass the class of the enum to query, not null
* @param enumName the enum name, null returns false
* @return true if the enum name is valid, otherwise false
+ * @since 3.8
*/
public static > boolean isValidEnumIgnoreCase(final Class enumClass, final String enumName) {
return getEnumIgnoreCase(enumClass, enumName) != null;
@@ -138,6 +139,7 @@ public static > E getEnum(final Class enumClass, final Stri
* @param enumClass the class of the enum to query, not null
* @param enumName the enum name, null returns null
* @return the enum, null if not found
+ * @since 3.8
*/
public static > E getEnumIgnoreCase(final Class enumClass, final String enumName) {
if (enumName == null || !enumClass.isEnum()) {
From f5ebb9a649e9dd0773f9bd3457d6ce1895266d59 Mon Sep 17 00:00:00 2001
From: Sergio Ozaki
Date: Sun, 30 Jul 2017 15:37:37 -0300
Subject: [PATCH 0115/3439] LANG-1372: Add ToStringSummary annotation (closes
#281)
---
.../builder/ReflectionToStringBuilder.java | 12 +++++-
.../lang3/builder/ToStringSummary.java | 40 +++++++++++++++++++
.../ReflectionToStringBuilderSummaryTest.java | 36 +++++++++++++++++
3 files changed, 87 insertions(+), 1 deletion(-)
create mode 100644 src/main/java/org/apache/commons/lang3/builder/ToStringSummary.java
create mode 100644 src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderSummaryTest.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 e720deb73c0..9390d831cde 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
@@ -84,6 +84,10 @@
* result.
*
*
+ * It is also possible to use the {@link ToStringSummary} annotation to output the summary information instead of the
+ * detailed information of a field.
+ *
+ *
* The exact format of the toString is determined by the {@link ToStringStyle} passed into the constructor.
*
*
@@ -119,6 +123,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* if the Object is null
*
* @see ToStringExclude
+ * @see ToStringSummary
*/
public static String toString(final Object object) {
return toString(object, null, false, false, null);
@@ -153,6 +158,7 @@ public static String toString(final Object object) {
* if the Object or ToStringStyle is null
*
* @see ToStringExclude
+ * @see ToStringSummary
*/
public static String toString(final Object object, final ToStringStyle style) {
return toString(object, style, false, false, null);
@@ -193,6 +199,7 @@ public static String toString(final Object object, final ToStringStyle style) {
* if the Object is null
*
* @see ToStringExclude
+ * @see ToStringSummary
*/
public static String toString(final Object object, final ToStringStyle style, final boolean outputTransients) {
return toString(object, style, outputTransients, false, null);
@@ -240,6 +247,7 @@ public static String toString(final Object object, final ToStringStyle style, fi
* if the Object is null
*
* @see ToStringExclude
+ * @see ToStringSummary
* @since 2.1
*/
public static String toString(final Object object, final ToStringStyle style, final boolean outputTransients, final boolean outputStatics) {
@@ -293,6 +301,7 @@ public static String toString(final Object object, final ToStringStyle style, fi
* if the Object is null
*
* @see ToStringExclude
+ * @see ToStringSummary
* @since 2.1
*/
public static String toString(
@@ -351,6 +360,7 @@ public static String toString(
* if the Object is null
*
* @see ToStringExclude
+ * @see ToStringSummary
* @since 3.6
*/
public static String toString(
@@ -639,7 +649,7 @@ protected void appendFieldsIn(final Class> clazz) {
// for primitive types.
final Object fieldValue = this.getValue(field);
if (!excludeNullValues || fieldValue != null) {
- this.append(fieldName, fieldValue);
+ this.append(fieldName, fieldValue, !field.isAnnotationPresent(ToStringSummary.class));
}
} catch (final IllegalAccessException ex) {
//this can't happen. Would get a Security exception
diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringSummary.java b/src/main/java/org/apache/commons/lang3/builder/ToStringSummary.java
new file mode 100644
index 00000000000..ba255d4e951
--- /dev/null
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringSummary.java
@@ -0,0 +1,40 @@
+/*
+ * 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.builder;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Use this annotation on the fields to get the summary instead of the detailed
+ * information when using {@link ReflectionToStringBuilder}.
+ *
+ *
+ * Notice that not all {@link ToStringStyle} implementations support the
+ * appendSummary method.
+ *
+ *
+ * @since 3.8
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ToStringSummary {
+
+}
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderSummaryTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderSummaryTest.java
new file mode 100644
index 00000000000..d13fd0f9a7a
--- /dev/null
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderSummaryTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.builder;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ReflectionToStringBuilderSummaryTest {
+
+ @SuppressWarnings("unused")
+ private String stringField = "string";
+
+ @ToStringSummary
+ private String summaryString = "summary";
+
+ @Test
+ public void testSummary() {
+ Assert.assertEquals("[stringField=string,summaryString=]",
+ new ReflectionToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE).build());
+ }
+
+}
From e843239cf9764bb9b8a3b1914c07e5215b9df3c5 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Fri, 12 Jan 2018 18:31:10 +0100
Subject: [PATCH 0116/3439] LANG-1372: Add ToStringSummary annotation
add changes.xml entry
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bf9f499dd0f..b1138d3c5e2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,7 @@ The type attribute can be add,update,fix,remove.
Fix EventCountCircuitBreaker increment batchObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a sizeEnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added
+ Add ToStringSummary annotation
From e72654ed5ad90e5dd1ec08b11760e2f27b64d5c7 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 14 Jan 2018 11:24:59 +0100
Subject: [PATCH 0117/3439] SystemDefaultsSwitch: fix javadoc code example
---
.../org/apache/commons/lang3/test/SystemDefaultsSwitch.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 cc26fa4658d..091e9d8cd47 100644
--- a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
+++ b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
@@ -44,7 +44,7 @@
* }
*
* {@literal @}Test
- * {@literal @}SystemDefaults(local="zh_CN")
+ * {@literal @}SystemDefaults(locale="zh_CN")
* public void testWithSimplifiedChinaDefaultLocale() {
* // Locale.getDefault() will return Locale.CHINA until the end of this test method
* }
From d575057852ab2be41abb39b8de69a35cace5c67d Mon Sep 17 00:00:00 2001
From: Jerry Zhao
Date: Fri, 19 Jan 2018 13:57:30 +1100
Subject: [PATCH 0118/3439] LANG-1375: defaultString(str) reuses
defaultString(str, defaultStr)
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 924e10f1904..4619a500633 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -4743,7 +4743,7 @@ public static String joinWith(final String separator, final Object... objects) {
throw new IllegalArgumentException("Object varargs must not be null");
}
- final String sanitizedSeparator = defaultString(separator, StringUtils.EMPTY);
+ final String sanitizedSeparator = defaultString(separator);
final StringBuilder result = new StringBuilder();
@@ -7359,7 +7359,7 @@ public static boolean isMixedCase(final CharSequence cs) {
* was {@code null}
*/
public static String defaultString(final String str) {
- return str == null ? EMPTY : str;
+ return defaultString(str, EMPTY);
}
/**
From f50ec5e608286b0c48d6b9b4c792352de8353804 Mon Sep 17 00:00:00 2001
From: "Bruno P. Kinoshita"
Date: Sat, 20 Jan 2018 17:02:55 +1300
Subject: [PATCH 0119/3439] LANG-1375: add changes.xml entry
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b1138d3c5e2..220578ca987 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ defaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr)Parsing Json Array failedFix TypeUtils#parameterize to work correctly with narrower-typed arrayFix EventCountCircuitBreaker increment batch
From c3b1fefbad0c67c8556ba6b4573f135197f87598 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 11 Feb 2018 11:49:44 +0100
Subject: [PATCH 0120/3439] NumberUtils#isCreatable: remove java 6 only code,
as commons-lang requires at java 7+ now
---
.../commons/lang3/math/NumberUtils.java | 7 +------
.../commons/lang3/math/NumberUtilsTest.java | 19 ++-----------------
2 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index 1175f5dfb83..5942db7f3a3 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -21,7 +21,6 @@
import java.math.BigInteger;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.lang3.Validate;
/**
@@ -1394,7 +1393,7 @@ public static boolean isNumber(final String str) {
*
* @param str the String to check
* @return true if the string is a correctly formatted number
- * @since 3.5 the code supports the "+" suffix on numbers except for integers in Java 1.6
+ * @since 3.5
*/
public static boolean isCreatable(final String str) {
if (StringUtils.isEmpty(str)) {
@@ -1408,7 +1407,6 @@ public static boolean isCreatable(final String str) {
boolean foundDigit = false;
// deal with any possible sign up front
final int start = chars[0] == '-' || chars[0] == '+' ? 1 : 0;
- final boolean hasLeadingPlusSign = start == 1 && chars[0] == '+';
if (sz > start + 1 && chars[start] == '0') { // leading 0
if (chars[start + 1] == 'x' || chars[start + 1] == 'X') { // leading 0x/0X
int i = start + 2;
@@ -1475,9 +1473,6 @@ public static boolean isCreatable(final String str) {
}
if (i < chars.length) {
if (chars[i] >= '0' && chars[i] <= '9') {
- if (SystemUtils.IS_JAVA_1_6 && hasLeadingPlusSign && !hasDecPoint) {
- return false;
- }
// no type qualifier, OK
return true;
}
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 31ca17435d6..20d87fe3013 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -27,7 +27,6 @@
import java.math.BigDecimal;
import java.math.BigInteger;
-import org.apache.commons.lang3.SystemUtils;
import org.junit.Test;
/**
@@ -1298,14 +1297,7 @@ public void testLANG972() {
@Test
public void testLANG1252() {
- //Check idiosyncrasies between java 1.6 and 1.7, 1.8 regarding leading + signs
- if (SystemUtils.IS_JAVA_1_6) {
- compareIsCreatableWithCreateNumber("+2", false);
- } else {
- compareIsCreatableWithCreateNumber("+2", true);
- }
-
- //The Following should work regardless of 1.6, 1.7, or 1.8
+ compareIsCreatableWithCreateNumber("+2", true);
compareIsCreatableWithCreateNumber("+2.0", true);
}
@@ -1399,14 +1391,7 @@ public void testIsNumberLANG972() {
@Test
public void testIsNumberLANG1252() {
- //Check idiosyncrasies between java 1.6 and 1.7,1.8 regarding leading + signs
- if (SystemUtils.IS_JAVA_1_6) {
- compareIsNumberWithCreateNumber("+2", false);
- } else {
- compareIsNumberWithCreateNumber("+2", true);
- }
-
- //The Following should work regardless of 1.6, 1.7, or 1.8
+ compareIsNumberWithCreateNumber("+2", true);
compareIsNumberWithCreateNumber("+2.0", true);
}
From c8e61afdb89c58ea8ffaf04593da41ff0888d30e Mon Sep 17 00:00:00 2001
From: Piotr Kosmala
Date: Sat, 10 Feb 2018 15:19:36 +0100
Subject: [PATCH 0121/3439] LANG-1060: NumberUtils.isNumber assumes number
starting with Zero is octal (closes #313)
---
.../java/org/apache/commons/lang3/math/NumberUtils.java | 2 +-
.../org/apache/commons/lang3/math/NumberUtilsTest.java | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index 5942db7f3a3..9428ba79780 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -1407,7 +1407,7 @@ public static boolean isCreatable(final String str) {
boolean foundDigit = false;
// deal with any possible sign up front
final int start = chars[0] == '-' || chars[0] == '+' ? 1 : 0;
- if (sz > start + 1 && chars[start] == '0') { // leading 0
+ if (sz > start + 1 && chars[start] == '0' && !StringUtils.contains(str, '.')) { // leading 0, skip if is a decimal number
if (chars[start + 1] == 'x' || chars[start + 1] == 'X') { // leading 0x/0X
int i = start + 2;
if (i == sz) {
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 20d87fe3013..376a579167b 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -1326,6 +1326,10 @@ public void testIsNumber() {
compareIsNumberWithCreateNumber("-1234", true);
compareIsNumberWithCreateNumber("-1234.5", true);
compareIsNumberWithCreateNumber("-.12345", true);
+ compareIsNumberWithCreateNumber("-0001.12345", true);
+ compareIsNumberWithCreateNumber("-000.12345", true);
+ compareIsNumberWithCreateNumber("+00.12345", true);
+ compareIsNumberWithCreateNumber("+0002.12345", true);
compareIsNumberWithCreateNumber("-1234E5", true);
compareIsNumberWithCreateNumber("0", true);
compareIsNumberWithCreateNumber("-0", true);
@@ -1342,6 +1346,7 @@ public void testIsNumber() {
compareIsNumberWithCreateNumber(" ", false);
compareIsNumberWithCreateNumber("\r\n\t", false);
compareIsNumberWithCreateNumber("--2.3", false);
+
compareIsNumberWithCreateNumber(".12.3", false);
compareIsNumberWithCreateNumber("-123E", false);
compareIsNumberWithCreateNumber("-123E+-212", false);
@@ -1352,6 +1357,8 @@ public void testIsNumber() {
compareIsNumberWithCreateNumber("-0ABC123", false);
compareIsNumberWithCreateNumber("123.4E-D", false);
compareIsNumberWithCreateNumber("123.4ED", false);
+ compareIsNumberWithCreateNumber("+000E.12345", false);
+ compareIsNumberWithCreateNumber("-000E.12345", false);
compareIsNumberWithCreateNumber("1234E5l", false);
compareIsNumberWithCreateNumber("11a", false);
compareIsNumberWithCreateNumber("1a", false);
From 6684a76317a5ca4ddd823c0915757b48e705427f Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 11 Feb 2018 12:09:19 +0100
Subject: [PATCH 0122/3439] add changes.xml entry for "LANG-1060:
NumberUtils.isNumber assumes number starting with Zero"
---
src/changes/changes.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 220578ca987..73297cc24e0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,7 +46,8 @@ The type attribute can be add,update,fix,remove.
- defaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr)
+ NumberUtils.isNumber assumes number starting with Zero
+ defaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr)Parsing Json Array failedFix TypeUtils#parameterize to work correctly with narrower-typed arrayFix EventCountCircuitBreaker increment batch
From 7eb47fd85e13486033950d91afcf04cf44d064fa Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 11 Feb 2018 14:03:33 +0100
Subject: [PATCH 0123/3439] CloneFailedException: remove "@since upcoming" from
constructors javadoc, because these constructors were added in the same
version as the class itself (3.0)
---
.../apache/commons/lang3/exception/CloneFailedException.java | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/exception/CloneFailedException.java b/src/main/java/org/apache/commons/lang3/exception/CloneFailedException.java
index ae534b4e9b3..5fff98ca2b9 100644
--- a/src/main/java/org/apache/commons/lang3/exception/CloneFailedException.java
+++ b/src/main/java/org/apache/commons/lang3/exception/CloneFailedException.java
@@ -33,7 +33,6 @@ public class CloneFailedException extends RuntimeException {
* Constructs a CloneFailedException.
*
* @param message description of the exception
- * @since upcoming
*/
public CloneFailedException(final String message) {
super(message);
@@ -43,7 +42,6 @@ public CloneFailedException(final String message) {
* Constructs a CloneFailedException.
*
* @param cause cause of the exception
- * @since upcoming
*/
public CloneFailedException(final Throwable cause) {
super(cause);
@@ -54,7 +52,6 @@ public CloneFailedException(final Throwable cause) {
*
* @param message description of the exception
* @param cause cause of the exception
- * @since upcoming
*/
public CloneFailedException(final String message, final Throwable cause) {
super(message, cause);
From 3a4ac357981283fd3a8817f9e6d57e8b181549be Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 11 Feb 2018 14:08:40 +0100
Subject: [PATCH 0124/3439] harmonize since javadoc tags content (remove
"(Commons )Lang")
---
.../java/org/apache/commons/lang3/Conversion.java | 2 +-
.../commons/lang3/exception/ExceptionUtils.java | 6 +++---
.../apache/commons/lang3/mutable/MutableByte.java | 12 ++++++------
.../apache/commons/lang3/mutable/MutableDouble.java | 12 ++++++------
.../apache/commons/lang3/mutable/MutableFloat.java | 12 ++++++------
.../org/apache/commons/lang3/mutable/MutableInt.java | 12 ++++++------
.../apache/commons/lang3/mutable/MutableLong.java | 12 ++++++------
.../apache/commons/lang3/mutable/MutableShort.java | 12 ++++++------
.../apache/commons/lang3/text/FormattableUtils.java | 2 +-
.../apache/commons/lang3/tuple/ImmutablePair.java | 2 +-
.../org/apache/commons/lang3/tuple/MutablePair.java | 2 +-
.../java/org/apache/commons/lang3/tuple/Pair.java | 2 +-
12 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/Conversion.java b/src/main/java/org/apache/commons/lang3/Conversion.java
index d177cc49c26..0427deede78 100644
--- a/src/main/java/org/apache/commons/lang3/Conversion.java
+++ b/src/main/java/org/apache/commons/lang3/Conversion.java
@@ -60,7 +60,7 @@
* so far.
*
*
- * @since Lang 3.2
+ * @since 3.2
*/
public class Conversion {
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 95e29925728..29f163e8a3e 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -274,7 +274,7 @@ public static Throwable[] getThrowables(final Throwable throwable) {
*
* @param throwable the throwable to inspect, may be null
* @return the list of throwables, never null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public static List getThrowableList(Throwable throwable) {
final List list = new ArrayList<>();
@@ -659,7 +659,7 @@ static List getStackFrameList(final Throwable t) {
*
* @param th the throwable to get a message for, null returns empty string
* @return the message, non-null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public static String getMessage(final Throwable th) {
if (th == null) {
@@ -679,7 +679,7 @@ public static String getMessage(final Throwable th) {
*
* @param th the throwable to get a message for, null returns empty string
* @return the message, non-null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public static String getRootCauseMessage(final Throwable th) {
Throwable root = ExceptionUtils.getRootCause(th);
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java b/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
index 0d07749ee6d..fa8853c42f8 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
@@ -113,7 +113,7 @@ public void setValue(final Number value) {
/**
* Increments the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void increment() {
value++;
@@ -147,7 +147,7 @@ public byte incrementAndGet() {
/**
* Decrements the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void decrement() {
value--;
@@ -183,7 +183,7 @@ public byte decrementAndGet() {
* Adds a value to the value of this instance.
*
* @param operand the value to add, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final byte operand) {
this.value += operand;
@@ -194,7 +194,7 @@ public void add(final byte operand) {
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final Number operand) {
this.value += operand.byteValue();
@@ -204,7 +204,7 @@ public void add(final Number operand) {
* Subtracts a value from the value of this instance.
*
* @param operand the value to subtract, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final byte operand) {
this.value -= operand;
@@ -215,7 +215,7 @@ public void subtract(final byte operand) {
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final Number operand) {
this.value -= operand.byteValue();
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java b/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
index dd0ac0edf6b..78aa4ff54fd 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
@@ -130,7 +130,7 @@ public boolean isInfinite() {
/**
* Increments the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void increment() {
value++;
@@ -164,7 +164,7 @@ public double incrementAndGet() {
/**
* Decrements the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void decrement() {
value--;
@@ -200,7 +200,7 @@ public double decrementAndGet() {
* Adds a value to the value of this instance.
*
* @param operand the value to add
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final double operand) {
this.value += operand;
@@ -211,7 +211,7 @@ public void add(final double operand) {
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final Number operand) {
this.value += operand.doubleValue();
@@ -221,7 +221,7 @@ public void add(final Number operand) {
* Subtracts a value from the value of this instance.
*
* @param operand the value to subtract, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final double operand) {
this.value -= operand;
@@ -232,7 +232,7 @@ public void subtract(final double operand) {
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final Number operand) {
this.value -= operand.doubleValue();
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java b/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
index eec7cf12613..53880f85b29 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
@@ -130,7 +130,7 @@ public boolean isInfinite() {
/**
* Increments the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void increment() {
value++;
@@ -164,7 +164,7 @@ public float incrementAndGet() {
/**
* Decrements the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void decrement() {
value--;
@@ -200,7 +200,7 @@ public float decrementAndGet() {
* Adds a value to the value of this instance.
*
* @param operand the value to add, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final float operand) {
this.value += operand;
@@ -211,7 +211,7 @@ public void add(final float operand) {
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final Number operand) {
this.value += operand.floatValue();
@@ -221,7 +221,7 @@ public void add(final Number operand) {
* Subtracts a value from the value of this instance.
*
* @param operand the value to subtract
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final float operand) {
this.value -= operand;
@@ -232,7 +232,7 @@ public void subtract(final float operand) {
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final Number operand) {
this.value -= operand.floatValue();
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java b/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
index 6e022bd7939..7484abdcbc4 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
@@ -113,7 +113,7 @@ public void setValue(final Number value) {
/**
* Increments the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void increment() {
value++;
@@ -147,7 +147,7 @@ public int incrementAndGet() {
/**
* Decrements the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void decrement() {
value--;
@@ -183,7 +183,7 @@ public int decrementAndGet() {
* Adds a value to the value of this instance.
*
* @param operand the value to add, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final int operand) {
this.value += operand;
@@ -194,7 +194,7 @@ public void add(final int operand) {
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final Number operand) {
this.value += operand.intValue();
@@ -204,7 +204,7 @@ public void add(final Number operand) {
* Subtracts a value from the value of this instance.
*
* @param operand the value to subtract, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final int operand) {
this.value -= operand;
@@ -215,7 +215,7 @@ public void subtract(final int operand) {
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final Number operand) {
this.value -= operand.intValue();
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java b/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
index dbd32d5d76d..520ff078d3c 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
@@ -113,7 +113,7 @@ public void setValue(final Number value) {
/**
* Increments the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void increment() {
value++;
@@ -147,7 +147,7 @@ public long incrementAndGet() {
/**
* Decrements the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void decrement() {
value--;
@@ -183,7 +183,7 @@ public long decrementAndGet() {
* Adds a value to the value of this instance.
*
* @param operand the value to add, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final long operand) {
this.value += operand;
@@ -194,7 +194,7 @@ public void add(final long operand) {
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final Number operand) {
this.value += operand.longValue();
@@ -204,7 +204,7 @@ public void add(final Number operand) {
* Subtracts a value from the value of this instance.
*
* @param operand the value to subtract, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final long operand) {
this.value -= operand;
@@ -215,7 +215,7 @@ public void subtract(final long operand) {
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final Number operand) {
this.value -= operand.longValue();
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java b/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
index 1cbd847686e..dbcaebf2bbf 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
@@ -113,7 +113,7 @@ public void setValue(final Number value) {
/**
* Increments the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void increment() {
value++;
@@ -147,7 +147,7 @@ public short incrementAndGet() {
/**
* Decrements the value.
*
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void decrement() {
value--;
@@ -183,7 +183,7 @@ public short decrementAndGet() {
* Adds a value to the value of this instance.
*
* @param operand the value to add, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final short operand) {
this.value += operand;
@@ -194,7 +194,7 @@ public void add(final short operand) {
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void add(final Number operand) {
this.value += operand.shortValue();
@@ -204,7 +204,7 @@ public void add(final Number operand) {
* Subtracts a value from the value of this instance.
*
* @param operand the value to subtract, not null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final short operand) {
this.value -= operand;
@@ -215,7 +215,7 @@ public void subtract(final short operand) {
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
- * @since Commons Lang 2.2
+ * @since 2.2
*/
public void subtract(final Number operand) {
this.value -= operand.shortValue();
diff --git a/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java b/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java
index 87cd84cef08..dd95561e9e6 100644
--- a/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java
+++ b/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java
@@ -32,7 +32,7 @@
* when using a {@code Formatter}. It is primarily concerned with numeric precision
* and padding, and is not designed to allow generalised alternate formats.
*
- * @since Lang 3.0
+ * @since 3.0
* @deprecated as of 3.6, use commons-text
*
* FormattableUtils instead
diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
index e84c49b110d..592bf3d7f44 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
@@ -29,7 +29,7 @@
* @param the left element type
* @param the right element type
*
- * @since Lang 3.0
+ * @since 3.0
*/
public final class ImmutablePair extends Pair {
diff --git a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
index 852edae9f86..46657170017 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
@@ -24,7 +24,7 @@
* @param the left element type
* @param the right element type
*
- * @since Lang 3.0
+ * @since 3.0
*/
public class MutablePair extends Pair {
diff --git a/src/main/java/org/apache/commons/lang3/tuple/Pair.java b/src/main/java/org/apache/commons/lang3/tuple/Pair.java
index dcf09222da3..5740f4e2444 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/Pair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/Pair.java
@@ -36,7 +36,7 @@
* @param the left element type
* @param the right element type
*
- * @since Lang 3.0
+ * @since 3.0
*/
public abstract class Pair implements Map.Entry, Comparable>, Serializable {
From 60412131f3679b720bcaaaf3dea4be666cefea7a Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 11 Feb 2018 14:19:56 +0100
Subject: [PATCH 0125/3439] LANG-1364: ExceptionUtils#getRootCause(Throwable t)
should return t if no lower level cause exists
This makes the behavior of getRootCause consistent with getRootCauseMessage and getRootCauseStackTrace.
---
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/exception/ExceptionUtils.java | 4 ++--
.../apache/commons/lang3/exception/ExceptionUtilsTest.java | 4 ++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 73297cc24e0..61eca688026 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ ExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause existsNumberUtils.isNumber assumes number starting with ZerodefaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr)Parsing Json Array failed
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 29f163e8a3e..bacb859d6fb 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -179,11 +179,11 @@ public static Throwable getCause(final Throwable throwable, String[] methodNames
*
* @param throwable the throwable to get the root cause for, may be null
* @return the root cause of the Throwable,
- * null if none found or null throwable input
+ * null if null throwable input
*/
public static Throwable getRootCause(final Throwable throwable) {
final List list = getThrowableList(throwable);
- return list.size() < 2 ? null : list.get(list.size() - 1);
+ return list.isEmpty() ? null : list.get(list.size() - 1);
}
/**
diff --git a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
index d6fb98a6609..0af68a8fbc6 100644
--- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
@@ -147,10 +147,10 @@ public void testGetCause_ThrowableArray() {
@Test
public void testGetRootCause_Throwable() {
assertSame(null, ExceptionUtils.getRootCause(null));
- assertSame(null, ExceptionUtils.getRootCause(withoutCause));
+ assertSame(withoutCause, ExceptionUtils.getRootCause(withoutCause));
assertSame(withoutCause, ExceptionUtils.getRootCause(nested));
assertSame(withoutCause, ExceptionUtils.getRootCause(withCause));
- assertSame(null, ExceptionUtils.getRootCause(jdkNoCause));
+ assertSame(jdkNoCause, ExceptionUtils.getRootCause(jdkNoCause));
assertSame(cyclicCause.getCause().getCause(), ExceptionUtils.getRootCause(cyclicCause));
}
From 2ce40494073aa4e9bdcba4c39d24727b7141d227 Mon Sep 17 00:00:00 2001
From: Piotr Kosmala
Date: Sun, 11 Feb 2018 14:32:13 +0100
Subject: [PATCH 0126/3439] LANG-1060: NumberUtils.isNumber assumes number
starting with Zero is octal
Add additional tests (closes #314)
---
.../commons/lang3/math/NumberUtilsTest.java | 47 ++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
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 376a579167b..7766d88b117 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -99,6 +99,12 @@ public void testToFloatString() {
assertTrue("toFloat(String) 1 failed", NumberUtils.toFloat("-1.2345") == -1.2345f);
assertTrue("toFloat(String) 2 failed", NumberUtils.toFloat("1.2345") == 1.2345f);
assertTrue("toFloat(String) 3 failed", NumberUtils.toFloat("abc") == 0.0f);
+ // LANG-1060
+ assertTrue("toFloat(String) 4 failed", NumberUtils.toFloat("-001.2345") == -1.2345f);
+ assertTrue("toFloat(String) 5 failed", NumberUtils.toFloat("+001.2345") == 1.2345f);
+ assertTrue("toFloat(String) 6 failed", NumberUtils.toFloat("001.2345") == 1.2345f);
+ assertTrue("toFloat(String) 7 failed", NumberUtils.toFloat("000.00") == 0f);
+
assertTrue("toFloat(Float.MAX_VALUE) failed", NumberUtils.toFloat(Float.MAX_VALUE+"") == Float.MAX_VALUE);
assertTrue("toFloat(Float.MIN_VALUE) failed", NumberUtils.toFloat(Float.MIN_VALUE+"") == Float.MIN_VALUE);
assertTrue("toFloat(empty) failed", NumberUtils.toFloat("") == 0.0f);
@@ -112,6 +118,10 @@ public void testToFloatString() {
public void testToFloatStringF() {
assertTrue("toFloat(String,int) 1 failed", NumberUtils.toFloat("1.2345", 5.1f) == 1.2345f);
assertTrue("toFloat(String,int) 2 failed", NumberUtils.toFloat("a", 5.0f) == 5.0f);
+ // LANG-1060
+ assertTrue("toFloat(String,int) 3 failed", NumberUtils.toFloat("-001Z.2345", 5.0f) == 5.0f);
+ assertTrue("toFloat(String,int) 4 failed", NumberUtils.toFloat("+001AB.2345", 5.0f) == 5.0f);
+ assertTrue("toFloat(String,int) 5 failed", NumberUtils.toFloat("001Z.2345", 5.0f) == 5.0f);
}
/**
@@ -122,10 +132,19 @@ public void testStringCreateNumberEnsureNoPrecisionLoss(){
final String shouldBeFloat = "1.23";
final String shouldBeDouble = "3.40282354e+38";
final String shouldBeBigDecimal = "1.797693134862315759e+308";
-
assertTrue(NumberUtils.createNumber(shouldBeFloat) instanceof Float);
assertTrue(NumberUtils.createNumber(shouldBeDouble) instanceof Double);
assertTrue(NumberUtils.createNumber(shouldBeBigDecimal) instanceof BigDecimal);
+ // LANG-1060
+ assertTrue(NumberUtils.createNumber("001.12") instanceof Float);
+ assertTrue(NumberUtils.createNumber("-001.12") instanceof Float);
+ assertTrue(NumberUtils.createNumber("+001.12") instanceof Float);
+ assertTrue(NumberUtils.createNumber("003.40282354e+38") instanceof Double);
+ assertTrue(NumberUtils.createNumber("-003.40282354e+38") instanceof Double);
+ assertTrue(NumberUtils.createNumber("+003.40282354e+38") instanceof Double);
+ assertTrue(NumberUtils.createNumber("0001.797693134862315759e+308") instanceof BigDecimal);
+ assertTrue(NumberUtils.createNumber("-001.797693134862315759e+308") instanceof BigDecimal);
+ assertTrue(NumberUtils.createNumber("+001.797693134862315759e+308") instanceof BigDecimal);
}
/**
* Test for {@link NumberUtils#toDouble(String)}.
@@ -135,6 +154,12 @@ public void testStringToDoubleString() {
assertTrue("toDouble(String) 1 failed", NumberUtils.toDouble("-1.2345") == -1.2345d);
assertTrue("toDouble(String) 2 failed", NumberUtils.toDouble("1.2345") == 1.2345d);
assertTrue("toDouble(String) 3 failed", NumberUtils.toDouble("abc") == 0.0d);
+ // LANG-1060
+ assertTrue("toDouble(String) 4 failed", NumberUtils.toDouble("-001.2345") == -1.2345d);
+ assertTrue("toDouble(String) 5 failed", NumberUtils.toDouble("+001.2345") == 1.2345d);
+ assertTrue("toDouble(String) 6 failed", NumberUtils.toDouble("001.2345") == 1.2345d);
+ assertTrue("toDouble(String) 7 failed", NumberUtils.toDouble("000.00000") == 0d);
+
assertTrue("toDouble(Double.MAX_VALUE) failed", NumberUtils.toDouble(Double.MAX_VALUE+"") == Double.MAX_VALUE);
assertTrue("toDouble(Double.MIN_VALUE) failed", NumberUtils.toDouble(Double.MIN_VALUE+"") == Double.MIN_VALUE);
assertTrue("toDouble(empty) failed", NumberUtils.toDouble("") == 0.0d);
@@ -148,6 +173,11 @@ public void testStringToDoubleString() {
public void testStringToDoubleStringD() {
assertTrue("toDouble(String,int) 1 failed", NumberUtils.toDouble("1.2345", 5.1d) == 1.2345d);
assertTrue("toDouble(String,int) 2 failed", NumberUtils.toDouble("a", 5.0d) == 5.0d);
+ // LANG-1060
+ assertTrue("toDouble(String,int) 3 failed", NumberUtils.toDouble("001.2345", 5.1d) == 1.2345d);
+ assertTrue("toDouble(String,int) 4 failed", NumberUtils.toDouble("-001.2345", 5.1d) == -1.2345d);
+ assertTrue("toDouble(String,int) 5 failed", NumberUtils.toDouble("+001.2345", 5.1d) == 1.2345d);
+ assertTrue("toDouble(String,int) 7 failed", NumberUtils.toDouble("000.00", 5.1d) == 0d);
}
/**
@@ -252,6 +282,21 @@ public void testCreateNumber() {
// LANG-1215
assertEquals("createNumber(String) LANG-1215 failed",
Double.valueOf("193343.82"), NumberUtils.createNumber("193343.82"));
+ // LANG-1060
+ assertEquals("createNumber(String) LANG-1060a failed", Double.valueOf("001234.5678"), NumberUtils.createNumber("001234.5678"));
+ assertEquals("createNumber(String) LANG-1060b failed", Double.valueOf("+001234.5678"), NumberUtils.createNumber("+001234.5678"));
+ assertEquals("createNumber(String) LANG-1060c failed", Double.valueOf("-001234.5678"), NumberUtils.createNumber("-001234.5678"));
+ assertEquals("createNumber(String) LANG-1060d failed", Double.valueOf("0000.00000"), NumberUtils.createNumber("0000.00000d"));
+ assertEquals("createNumber(String) LANG-1060e failed", Float.valueOf("001234.56"), NumberUtils.createNumber("001234.56"));
+ assertEquals("createNumber(String) LANG-1060f failed", Float.valueOf("+001234.56"), NumberUtils.createNumber("+001234.56"));
+ assertEquals("createNumber(String) LANG-1060g failed", Float.valueOf("-001234.56"), NumberUtils.createNumber("-001234.56"));
+ assertEquals("createNumber(String) LANG-1060h failed", Float.valueOf("0000.10"), NumberUtils.createNumber("0000.10"));
+ assertEquals("createNumber(String) LANG-1060i failed", Float.valueOf("001.1E20"), NumberUtils.createNumber("001.1E20"));
+ assertEquals("createNumber(String) LANG-1060j failed", Float.valueOf("+001.1E20"), NumberUtils.createNumber("+001.1E20"));
+ assertEquals("createNumber(String) LANG-1060k failed", Float.valueOf("-001.1E20"), NumberUtils.createNumber("-001.1E20"));
+ assertEquals("createNumber(String) LANG-1060l failed", Double.valueOf("001.1E200"), NumberUtils.createNumber("001.1E200"));
+ assertEquals("createNumber(String) LANG-1060m failed", Double.valueOf("+001.1E200"), NumberUtils.createNumber("+001.1E200"));
+ assertEquals("createNumber(String) LANG-1060n failed", Double.valueOf("-001.1E200"), NumberUtils.createNumber("-001.1E200"));
}
@Test
From 2e9f3a80146262511ca7bcdd3411f095dff4951d Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 11 Feb 2018 20:43:05 +0100
Subject: [PATCH 0127/3439] LANG-1356: Add bypass option for classes to
recursive and reflective EqualsBuilder
Patch supplied by Yathos UG
---
src/changes/changes.xml | 1 +
.../commons/lang3/builder/EqualsBuilder.java | 40 ++++++++++++++++--
.../lang3/builder/EqualsBuilderTest.java | 42 +++++++++++++++++++
3 files changed, 79 insertions(+), 4 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 61eca688026..5bfedf4ed30 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -55,6 +55,7 @@ The type attribute can be add,update,fix,remove.
ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a sizeEnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods addedAdd ToStringSummary annotation
+ Add bypass option for classes to recursive and reflective EqualsBuilder
diff --git a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
index d2cf7c7fb5e..60a532e02bb 100644
--- a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
@@ -19,8 +19,10 @@
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.ArrayUtils;
@@ -213,6 +215,7 @@ private static void unregister(final Object lhs, final Object rhs) {
private boolean testTransients = false;
private boolean testRecursive = false;
+ private List> bypassReflectionClasses;
private Class> reflectUpToClass = null;
private String[] excludeFields = null;
@@ -223,7 +226,9 @@ private static void unregister(final Object lhs, final Object rhs) {
* @see Object#equals(Object)
*/
public EqualsBuilder() {
- // do nothing for now.
+ // set up default classes to bypass reflection for
+ bypassReflectionClasses = new ArrayList>();
+ bypassReflectionClasses.add(String.class); //hashCode field being lazy but not transient
}
//-------------------------------------------------------------------------
@@ -250,6 +255,23 @@ public EqualsBuilder setTestRecursive(final boolean testRecursive) {
return this;
}
+ /**
+ *
Set Classes whose instances should be compared by calling their equals
+ * although being in recursive mode. So the fields of theses classes will not be compared recursively by reflection.
+ *
+ *
Here you should name classes having non-transient fields which are cache fields being set lazily.
+ * Prominent example being {@link String} class with its hash code cache field. Due to the importance
+ * of the String class, it is included in the default bypasses classes. Usually, if you use
+ * your own set of classes here, remember to include String class, too.
+ * @param bypassReflectionClasses classes to bypass reflection test
+ * @return EqualsBuilder - used to chain calls.
+ * @since 3.8
+ */
+ public EqualsBuilder setBypassReflectionClasses(List> bypassReflectionClasses) {
+ this.bypassReflectionClasses = bypassReflectionClasses;
+ return this;
+ }
+
/**
* Set the superclass to reflect up to at reflective tests.
* @param reflectUpToClass the super class to reflect up to
@@ -458,6 +480,10 @@ public static boolean reflectionEquals(final Object lhs, final Object rhs, final
*
*
Field names listed in field excludeFields will be ignored.
*
+ *
If either class of the compared objects is contained in
+ * bypassReflectionClasses, both objects are compared by calling
+ * the equals method of the left hand object with the right hand object as an argument.
+ *
* @param lhs the left hand object
* @param rhs the left hand object
* @return EqualsBuilder - used to chain calls.
@@ -503,10 +529,16 @@ public EqualsBuilder reflectionAppend(final Object lhs, final Object rhs) {
if (testClass.isArray()) {
append(lhs, rhs);
} else {
- reflectionAppend(lhs, rhs, testClass);
- while (testClass.getSuperclass() != null && testClass != reflectUpToClass) {
- testClass = testClass.getSuperclass();
+ //If either class is being excluded, call normal object equals method on lhsClass.
+ if (bypassReflectionClasses != null
+ && (bypassReflectionClasses.contains(lhsClass) || bypassReflectionClasses.contains(rhsClass))) {
+ isEquals = lhs.equals(rhs);
+ } else {
reflectionAppend(lhs, rhs, testClass);
+ while (testClass.getSuperclass() != null && testClass != reflectUpToClass) {
+ testClass = testClass.getSuperclass();
+ reflectionAppend(lhs, rhs, testClass);
+ }
}
}
} catch (final IllegalArgumentException e) {
diff --git a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
index 23651f61272..05f1da9a807 100644
--- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
@@ -168,6 +168,19 @@ public void setT(final int t) {
}
}
+ static class TestRecursiveGenericObject {
+
+ private final T a;
+
+ TestRecursiveGenericObject(final T a) {
+ this.a = a;
+ }
+
+ public T getA() {
+ return a;
+ }
+ }
+
static class TestRecursiveObject {
private final TestRecursiveInnerObject a;
private final TestRecursiveInnerObject b;
@@ -418,6 +431,35 @@ public void testObjectBuild() {
assertEquals(Boolean.TRUE, new EqualsBuilder().append((Object) null, null).build());
}
+ @Test
+ public void testObjectRecursiveGenericInteger() {
+ final TestRecursiveGenericObject o1_a = new TestRecursiveGenericObject(1);
+ final TestRecursiveGenericObject o1_b = new TestRecursiveGenericObject(1);
+ final TestRecursiveGenericObject o2 = new TestRecursiveGenericObject(2);
+
+ assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_b).isEquals());
+ assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_b, o1_a).isEquals());
+
+ assertFalse(new EqualsBuilder().setTestRecursive(true).append(o1_b, o2).isEquals());
+ }
+
+ @Test
+ public void testObjectRecursiveGenericString() {
+ // Note: Do not use literals, because string literals are always mapped by same object (internal() of String))!
+ String s1_a = String.valueOf(1);
+ final TestRecursiveGenericObject o1_a = new TestRecursiveGenericObject(s1_a);
+ final TestRecursiveGenericObject o1_b = new TestRecursiveGenericObject(String.valueOf(1));
+ final TestRecursiveGenericObject o2 = new TestRecursiveGenericObject(String.valueOf(2));
+
+ // To trigger bug reported in LANG-1356, call hashCode only on string in instance o1_a
+ s1_a.hashCode();
+
+ assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_b).isEquals());
+ assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_b, o1_a).isEquals());
+
+ assertFalse(new EqualsBuilder().setTestRecursive(true).append(o1_b, o2).isEquals());
+ }
+
@Test
public void testObjectRecursive() {
final TestRecursiveInnerObject i1_1 = new TestRecursiveInnerObject(1);
From 2c0429aabd2632c8c6a242e4a23d5eb6f46035c0 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Wed, 14 Feb 2018 12:56:44 -0500
Subject: [PATCH 0128/3439] formatting nit, one or the other is already null
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 4619a500633..d688b242fa2 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -8626,7 +8626,7 @@ public static boolean endsWithIgnoreCase(final CharSequence str, final CharSeque
*/
private static boolean endsWith(final CharSequence str, final CharSequence suffix, final boolean ignoreCase) {
if (str == null || suffix == null) {
- return str == null && suffix == null;
+ return str == suffix;
}
if (suffix.length() > str.length()) {
return false;
From bb3fe2a37975920d1c7b9cf16309d86fe86e1a35 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Wed, 14 Feb 2018 13:01:51 -0500
Subject: [PATCH 0129/3439] another formatting nit, one or the other is already
null
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index d688b242fa2..72f40195028 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -8513,7 +8513,7 @@ public static boolean startsWithIgnoreCase(final CharSequence str, final CharSeq
*/
private static boolean startsWith(final CharSequence str, final CharSequence prefix, final boolean ignoreCase) {
if (str == null || prefix == null) {
- return str == null && prefix == null;
+ return str == prefix;
}
if (prefix.length() > str.length()) {
return false;
From 284de66aafb82e279f78cf951f200aa5ce847a7c Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 23 Feb 2018 16:10:43 -0700
Subject: [PATCH 0130/3439] Update Maven PMD plugin from 3.8 to 3.9.0.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 5c3b0dc25e8..5cb432f0319 100644
--- a/pom.xml
+++ b/pom.xml
@@ -723,7 +723,7 @@
maven-pmd-plugin
- 3.8
+ 3.9.0${maven.compiler.target}
From 415eb9ebb755cea4753d6191b166b88192de5b41 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 23 Feb 2018 19:13:01 -0700
Subject: [PATCH 0131/3439] Update Maven Checstyle plugin from 2.17 to 3.0.0.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 5cb432f0319..d55fe8f7a9f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -588,7 +588,7 @@
site-contentutf-8
- 2.17
+ 3.0.01.19
From 0820c4c895f6e7c9ef4860d7373675550c87ac6c Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Fri, 2 Mar 2018 17:28:19 +0100
Subject: [PATCH 0132/3439] Use java9 profile on JDK 9 and later
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index d55fe8f7a9f..771e49e6855 100644
--- a/pom.xml
+++ b/pom.xml
@@ -827,9 +827,9 @@
- java9
+ java9+
- 9
+ [9,)
From cb686673a70a6f14c35575550c48c37d19a1598b Mon Sep 17 00:00:00 2001
From: Gilles Sadowski
Date: Thu, 8 Mar 2018 13:17:00 +0100
Subject: [PATCH 0133/3439] LANG-1384: Fix NPE when version >= 11
The fix is likely to be insufficient if the version naming scheme changes.
---
src/main/java/org/apache/commons/lang3/JavaVersion.java | 2 ++
src/test/java/org/apache/commons/lang3/JavaVersionTest.java | 1 +
2 files changed, 3 insertions(+)
diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java
index a0744536355..60258f63a54 100644
--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java
+++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java
@@ -191,6 +191,8 @@ static JavaVersion get(final String nom) {
if (Float.parseFloat(nom.substring(firstComma + 1, end)) > .9f) {
return JAVA_RECENT;
}
+ } else if (v > 10) {
+ return JAVA_RECENT;
}
return null;
}
diff --git a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
index 4d4202c49bc..ad285654f44 100644
--- a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
+++ b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
@@ -59,6 +59,7 @@ public void testGetJavaVersion() {
assertEquals("1.10 failed", JAVA_RECENT, get("1.10"));
// assertNull("2.10 unexpectedly worked", get("2.10"));
assertEquals("Wrapper method failed", get("1.5"), getJavaVersion("1.5"));
+ assertEquals("Unhandled", JAVA_RECENT, get("11")); // LANG-1384
}
@Test
From 50ce8c44e1601acffa39f5568f0fc140aade0564 Mon Sep 17 00:00:00 2001
From: Gilles Sadowski
Date: Thu, 8 Mar 2018 13:54:31 +0100
Subject: [PATCH 0134/3439] LANG-1384: Version "11" is available.
---
.../org/apache/commons/lang3/JavaVersion.java | 9 +++++++++
.../org/apache/commons/lang3/SystemUtils.java | 12 ++++++++++++
.../apache/commons/lang3/JavaVersionTest.java | 3 ++-
.../apache/commons/lang3/SystemUtilsTest.java | 17 +++++++++++++++++
4 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java
index 60258f63a54..148c99e8b08 100644
--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java
+++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java
@@ -94,6 +94,13 @@ public enum JavaVersion {
*/
JAVA_10(10.0f, "10"),
+ /**
+ * Java 11
+ *
+ * @since 3.8
+ */
+ JAVA_11(11.0f, "11"),
+
/**
* The most recent java version. Mainly introduced to avoid to break when a new version of Java is used.
*/
@@ -180,6 +187,8 @@ static JavaVersion get(final String nom) {
return JAVA_9;
} else if ("10".equals(nom)) {
return JAVA_10;
+ } else if ("11".equals(nom)) {
+ return JAVA_11;
}
if (nom == null) {
return null;
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index a6d9c2e9a60..f91628a4bae 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -985,6 +985,18 @@ public class SystemUtils {
*/
public static final boolean IS_JAVA_10 = getJavaVersionMatches("10");
+ /**
+ *
+ * Is {@code true} if this is Java version 11 (also 11.x versions).
+ *
+ *
+ * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
+ *
+ *
+ * @since 3.8
+ */
+ public static final boolean IS_JAVA_11 = getJavaVersionMatches("11");
+
// Operating system checks
// -----------------------------------------------------------------------
// These MUST be declared after those above as they depend on the
diff --git a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
index ad285654f44..7a6cbe297f9 100644
--- a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
+++ b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
@@ -56,10 +56,11 @@ public void testGetJavaVersion() {
assertEquals("1.8 failed", JAVA_1_8, get("1.8"));
assertEquals("9 failed", JAVA_9, get("9"));
assertEquals("10 failed", JAVA_10, get("10"));
+ assertEquals("11 failed", JavaVersion.JAVA_11, get("11"));
assertEquals("1.10 failed", JAVA_RECENT, get("1.10"));
// assertNull("2.10 unexpectedly worked", get("2.10"));
assertEquals("Wrapper method failed", get("1.5"), getJavaVersion("1.5"));
- assertEquals("Unhandled", JAVA_RECENT, get("11")); // LANG-1384
+ assertEquals("Unhandled", JAVA_RECENT, get("12")); // LANG-1384
}
@Test
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index b97cb811331..8e5610cf479 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -29,6 +29,7 @@
import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
import static org.apache.commons.lang3.JavaVersion.JAVA_9;
import static org.apache.commons.lang3.JavaVersion.JAVA_10;
+import static org.apache.commons.lang3.JavaVersion.JAVA_11;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -408,6 +409,7 @@ public void testIsJavaVersionAtLeast() throws Exception {
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_9));
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+ assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_11));
} else if (SystemUtils.IS_JAVA_1_8) {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
@@ -419,6 +421,7 @@ public void testIsJavaVersionAtLeast() throws Exception {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_9));
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+ assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_11));
} else if (SystemUtils.IS_JAVA_9) {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
@@ -430,6 +433,7 @@ public void testIsJavaVersionAtLeast() throws Exception {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_9));
assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+ assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_11));
} else if (SystemUtils.IS_JAVA_10) {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
@@ -441,6 +445,19 @@ public void testIsJavaVersionAtLeast() throws Exception {
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_9));
assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+ assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_11));
+ } else if (SystemUtils.IS_JAVA_11) {
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_3));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_4));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_5));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_6));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_9));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+ assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_11));
}
}
From 357fe1378889e5934e8f60c8d35397bf63871991 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 8 Mar 2018 08:19:25 -0700
Subject: [PATCH 0135/3439] Redundant specification of type arguments.
---
.../java/org/apache/commons/lang3/builder/EqualsBuilder.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
index 60a532e02bb..22ad16c06e0 100644
--- a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
@@ -227,7 +227,7 @@ private static void unregister(final Object lhs, final Object rhs) {
*/
public EqualsBuilder() {
// set up default classes to bypass reflection for
- bypassReflectionClasses = new ArrayList>();
+ bypassReflectionClasses = new ArrayList<>();
bypassReflectionClasses.add(String.class); //hashCode field being lazy but not transient
}
From 53bb395988044a874096495339aaa58f7fb5c6af Mon Sep 17 00:00:00 2001
From: Gilles Sadowski
Date: Thu, 8 Mar 2018 16:28:17 +0100
Subject: [PATCH 0136/3439] Track changes.
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5bfedf4ed30..403bb9d6124 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ New Java version ("11") must be handledExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause existsNumberUtils.isNumber assumes number starting with ZerodefaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr)
From 9c886bd4a188c91301029040b3a839e4b8e2812d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 9 Mar 2018 15:06:03 -0700
Subject: [PATCH 0137/3439] Predictable randomness in shuffle tests. Closes
#317 from Allon Murienik's PR https://github.com/apache/commons-lang/pull/317
---
.../apache/commons/lang3/ArrayUtilsTest.java | 22 +++++++++++--------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index 0effba70997..a853642e19b 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -32,6 +32,7 @@
import java.util.Comparator;
import java.util.Date;
import java.util.Map;
+import java.util.Random;
import org.junit.Test;
@@ -41,6 +42,9 @@
@SuppressWarnings("deprecation") // deliberate use of deprecated code
public class ArrayUtilsTest {
+ /** A predefined seed used to initialize {@link Random} in order to get predictable results */
+ private static final long SEED = 16111981L;
+
//-----------------------------------------------------------------------
@Test
public void testConstructor() {
@@ -5007,7 +5011,7 @@ public void testShuffle() {
final String[] array1 = new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
final String[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
for (final String element : array2) {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
@@ -5019,7 +5023,7 @@ public void testShuffleBoolean() {
final boolean[] array1 = new boolean[]{true, false, true, true, false, false, true, false, false, true};
final boolean[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
assertEquals(5, ArrayUtils.removeAllOccurences(array1, true).length);
}
@@ -5029,7 +5033,7 @@ public void testShuffleByte() {
final byte[] array1 = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
final byte[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
for (final byte element : array2) {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
@@ -5041,7 +5045,7 @@ public void testShuffleChar() {
final char[] array1 = new char[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
final char[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
for (final char element : array2) {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
@@ -5053,7 +5057,7 @@ public void testShuffleShort() {
final short[] array1 = new short[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
final short[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
for (final short element : array2) {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
@@ -5065,7 +5069,7 @@ public void testShuffleInt() {
final int[] array1 = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
final int[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
for (final int element : array2) {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
@@ -5077,7 +5081,7 @@ public void testShuffleLong() {
final long[] array1 = new long[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
final long[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
for (final long element : array2) {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
@@ -5089,7 +5093,7 @@ public void testShuffleFloat() {
final float[] array1 = new float[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
final float[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
for (final float element : array2) {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
@@ -5101,7 +5105,7 @@ public void testShuffleDouble() {
final double[] array1 = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
final double[] array2 = ArrayUtils.clone(array1);
- ArrayUtils.shuffle(array1);
+ ArrayUtils.shuffle(array1, new Random(SEED));
assertFalse(Arrays.equals(array1, array2));
for (final double element : array2) {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
From 8b62c114cfc5fd347bd8cb5a391fdfa8cb539435 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 10 Mar 2018 18:16:24 -0700
Subject: [PATCH 0138/3439] [LANG-1385] NumberUtils.createNumber() throws
StringIndexOutOfBoundsException instead of NumberFormatException.
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 2 +-
.../java/org/apache/commons/lang3/math/NumberUtilsTest.java | 5 +++++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 403bb9d6124..e20fd2fbd8a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -53,6 +53,7 @@ The type attribute can be add,update,fix,remove.
Parsing Json Array failedFix TypeUtils#parameterize to work correctly with narrower-typed arrayFix EventCountCircuitBreaker increment batch
+ NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatExceptionObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a sizeEnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods addedAdd ToStringSummary annotation
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index 9428ba79780..c9cdf6f95a4 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -526,7 +526,7 @@ public static Number createNumber(final String str) throws NumberFormatException
case 'L' :
if (dec == null
&& exp == null
- && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) {
+ && (numeric.length() > 0 && numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) {
try {
return createLong(numeric);
} catch (final NumberFormatException nfe) { // NOPMD
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 7766d88b117..b0ed8bb0b7c 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -1447,6 +1447,11 @@ public void testIsNumberLANG1252() {
compareIsNumberWithCreateNumber("+2.0", true);
}
+ @Test
+ public void testIsNumberLANG1385() {
+ compareIsNumberWithCreateNumber("L", false);
+ }
+
private void compareIsNumberWithCreateNumber(final String val, final boolean expected) {
final boolean isValid = NumberUtils.isCreatable(val);
final boolean canCreate = checkCreateNumber(val);
From 06be0be267fc8ccebf1ed6b0da030af048060c9f Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 29 Mar 2018 08:59:37 -0600
Subject: [PATCH 0139/3439] Next release will be this year one can only hope.
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e20fd2fbd8a..2cba158bf07 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,7 +45,7 @@ The type attribute can be add,update,fix,remove.
-
+ New Java version ("11") must be handledExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause existsNumberUtils.isNumber assumes number starting with Zero
From a098f0410680645ec344c55a2495dfd08271484c Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 29 Mar 2018 09:01:12 -0600
Subject: [PATCH 0140/3439] Better description.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 771e49e6855..114d370b828 100644
--- a/pom.xml
+++ b/pom.xml
@@ -574,7 +574,7 @@
org.apache.commons.lang33.8
- (Java 7.0+)
+ (Java 7+)2.6(Requires Java 1.2 or later)
From c53c2cbc11f80a385be1cd3952a76d37ace3505f Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 29 Mar 2018 09:13:54 -0600
Subject: [PATCH 0141/3439] Update commons-parent from 43 to 45.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 114d370b828..2384c5779de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 43
+ 454.0.0commons-lang3
From 56b7ae44f957aeb884efc797ec74c790a7a3abae Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 29 Mar 2018 11:52:05 -0600
Subject: [PATCH 0142/3439] Update test for Java 11 EA.
---
.../apache/commons/lang3/SystemUtilsTest.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index 8e5610cf479..77e6078f35c 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -122,6 +122,7 @@ public void testIS_JAVA() {
assertFalse(SystemUtils.IS_JAVA_1_9);
assertFalse(SystemUtils.IS_JAVA_9);
assertFalse(SystemUtils.IS_JAVA_10);
+ assertFalse(SystemUtils.IS_JAVA_11);
} else if (javaVersion.startsWith("1.7")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -134,6 +135,7 @@ public void testIS_JAVA() {
assertFalse(SystemUtils.IS_JAVA_1_9);
assertFalse(SystemUtils.IS_JAVA_9);
assertFalse(SystemUtils.IS_JAVA_10);
+ assertFalse(SystemUtils.IS_JAVA_11);
} else if (javaVersion.startsWith("1.8")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -146,6 +148,7 @@ public void testIS_JAVA() {
assertFalse(SystemUtils.IS_JAVA_1_9);
assertFalse(SystemUtils.IS_JAVA_9);
assertFalse(SystemUtils.IS_JAVA_10);
+ assertFalse(SystemUtils.IS_JAVA_11);
} else if (javaVersion.startsWith("9")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -158,6 +161,7 @@ public void testIS_JAVA() {
assertTrue(SystemUtils.IS_JAVA_1_9);
assertTrue(SystemUtils.IS_JAVA_9);
assertFalse(SystemUtils.IS_JAVA_10);
+ assertFalse(SystemUtils.IS_JAVA_11);
} else if (javaVersion.startsWith("10")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -170,6 +174,20 @@ public void testIS_JAVA() {
assertFalse(SystemUtils.IS_JAVA_1_9);
assertFalse(SystemUtils.IS_JAVA_9);
assertTrue(SystemUtils.IS_JAVA_10);
+ assertFalse(SystemUtils.IS_JAVA_11);
+ } else if (javaVersion.startsWith("11")) {
+ assertFalse(SystemUtils.IS_JAVA_1_1);
+ assertFalse(SystemUtils.IS_JAVA_1_2);
+ assertFalse(SystemUtils.IS_JAVA_1_3);
+ assertFalse(SystemUtils.IS_JAVA_1_4);
+ assertFalse(SystemUtils.IS_JAVA_1_5);
+ assertFalse(SystemUtils.IS_JAVA_1_6);
+ assertFalse(SystemUtils.IS_JAVA_1_7);
+ assertFalse(SystemUtils.IS_JAVA_1_8);
+ assertFalse(SystemUtils.IS_JAVA_1_9);
+ assertFalse(SystemUtils.IS_JAVA_9);
+ assertFalse(SystemUtils.IS_JAVA_10);
+ assertTrue(SystemUtils.IS_JAVA_11);
} else {
System.out.println("Can't test IS_JAVA value: " + javaVersion);
}
From 17f9d22f334c91e701808808170bf60aae7342f9 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 29 Mar 2018 13:26:59 -0600
Subject: [PATCH 0143/3439] Some reflection tests must account for classes
files being instrumented by Jacoco.
---
.../commons/lang3/reflect/FieldUtilsTest.java | 21 +++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
index 16a3f59f5b5..dbf114d7acf 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
@@ -165,7 +165,15 @@ public void testGetAllFields() {
assertArrayEquals(fieldsNumber, FieldUtils.getAllFields(Number.class));
final Field[] fieldsInteger = Integer.class.getDeclaredFields();
assertArrayEquals(ArrayUtils.addAll(fieldsInteger, fieldsNumber), FieldUtils.getAllFields(Integer.class));
- assertEquals(5, FieldUtils.getAllFields(PublicChild.class).length);
+ final Field[] allFields = FieldUtils.getAllFields(PublicChild.class);
+ // Under Jacoco,0.8.1 and Java 10, the field count is 7.
+ int expected = 5;
+ for (Field field : allFields) {
+ if (field.getName().equals("$jacocoData")) {
+ expected++;
+ }
+ }
+ assertEquals(Arrays.toString(allFields), expected, allFields.length);
}
@Test
@@ -177,7 +185,16 @@ public void testGetAllFieldsList() {
final List allFieldsInteger = new ArrayList<>(fieldsInteger);
allFieldsInteger.addAll(fieldsNumber);
assertEquals(allFieldsInteger, FieldUtils.getAllFieldsList(Integer.class));
- assertEquals(5, FieldUtils.getAllFieldsList(PublicChild.class).size());
+ final List allFields = FieldUtils.getAllFieldsList(PublicChild.class);
+ // Under Jacoco,0.8.1 and Java 10, the field count is 7.
+ int expected = 5;
+ for (Field field : allFields) {
+ if (field.getName().equals("$jacocoData")) {
+ expected++;
+ }
+ }
+ assertEquals(allFields.toString(), expected, allFields.size());
+
}
@Test
From 9901bf98e4921df1c85e323c4b096b7feb80221e Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 29 Mar 2018 13:27:45 -0600
Subject: [PATCH 0144/3439] Some reflection tests must account for classes
files being instrumented by Jacoco.
---
.../org/apache/commons/lang3/reflect/FieldUtilsTest.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
index dbf114d7acf..f98438f93ec 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
@@ -50,6 +50,7 @@
*/
public class FieldUtilsTest {
+ private static final String JACOCO_DATA_FIELD_NAME = "$jacocoData";
static final Integer I0 = Integer.valueOf(0);
static final Integer I1 = Integer.valueOf(1);
static final Double D0 = Double.valueOf(0.0);
@@ -169,7 +170,7 @@ public void testGetAllFields() {
// Under Jacoco,0.8.1 and Java 10, the field count is 7.
int expected = 5;
for (Field field : allFields) {
- if (field.getName().equals("$jacocoData")) {
+ if (field.getName().equals(JACOCO_DATA_FIELD_NAME)) {
expected++;
}
}
@@ -189,7 +190,7 @@ public void testGetAllFieldsList() {
// Under Jacoco,0.8.1 and Java 10, the field count is 7.
int expected = 5;
for (Field field : allFields) {
- if (field.getName().equals("$jacocoData")) {
+ if (field.getName().equals(JACOCO_DATA_FIELD_NAME)) {
expected++;
}
}
From aff0fae2ec3a7d74356776c183c6986eb9eed520 Mon Sep 17 00:00:00 2001
From: Allon Mureinik
Date: Wed, 4 Apr 2018 06:58:09 +0300
Subject: [PATCH 0145/3439] SerializationUtilsTest identity assertions
Replaced calls to assertTrue with a != condition with calls to
assertNotSame calls.
This change retains the functionality, but will produce a more
detailed error message in case the assertion fails.
It also (arguably) makes the test code more straight-forward.
---
.../commons/lang3/SerializationUtilsTest.java | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
index cc2614fb074..cd20602bdf2 100644
--- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
@@ -19,6 +19,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -197,12 +198,12 @@ public void testDeserializeStream() throws Exception {
final Object test = SerializationUtils.deserialize(inTest);
assertNotNull(test);
assertTrue(test instanceof HashMap, ?>);
- assertTrue(test != iMap);
+ assertNotSame(test, iMap);
final HashMap, ?> testMap = (HashMap, ?>) test;
assertEquals(iString, testMap.get("FOO"));
- assertTrue(iString != testMap.get("FOO"));
+ assertNotSame(iString, testMap.get("FOO"));
assertEquals(iInteger, testMap.get("BAR"));
- assertTrue(iInteger != testMap.get("BAR"));
+ assertNotSame(iInteger, testMap.get("BAR"));
assertEquals(iMap, testMap);
}
@@ -333,12 +334,12 @@ public void testDeserializeBytes() throws Exception {
final Object test = SerializationUtils.deserialize(streamReal.toByteArray());
assertNotNull(test);
assertTrue(test instanceof HashMap, ?>);
- assertTrue(test != iMap);
+ assertNotSame(test, iMap);
final HashMap, ?> testMap = (HashMap, ?>) test;
assertEquals(iString, testMap.get("FOO"));
- assertTrue(iString != testMap.get("FOO"));
+ assertNotSame(iString, testMap.get("FOO"));
assertEquals(iInteger, testMap.get("BAR"));
- assertTrue(iInteger != testMap.get("BAR"));
+ assertNotSame(iInteger, testMap.get("BAR"));
assertEquals(iMap, testMap);
}
@@ -381,12 +382,12 @@ public void testClone() throws Exception {
final Object test = SerializationUtils.clone(iMap);
assertNotNull(test);
assertTrue(test instanceof HashMap,?>);
- assertTrue(test != iMap);
+ assertNotSame(test, iMap);
final HashMap, ?> testMap = (HashMap, ?>) test;
assertEquals(iString, testMap.get("FOO"));
- assertTrue(iString != testMap.get("FOO"));
+ assertNotSame(iString, testMap.get("FOO"));
assertEquals(iInteger, testMap.get("BAR"));
- assertTrue(iInteger != testMap.get("BAR"));
+ assertNotSame(iInteger, testMap.get("BAR"));
assertEquals(iMap, testMap);
}
From 1415c9a2a6317dbdca6f1fbb530db1f558d9bef5 Mon Sep 17 00:00:00 2001
From: Allon Mureinik
Date: Wed, 4 Apr 2018 07:07:20 +0300
Subject: [PATCH 0146/3439] SerializationUtilsTest expected exceptions
Use the expected argument of the @Test annotation instead of
boiler-plate implementing this behavior with a try-catch-fail
construct in order to clean up the code and make it more obvious to
the reader.
---
.../commons/lang3/SerializationUtilsTest.java | 88 +++++--------------
1 file changed, 21 insertions(+), 67 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
index cd20602bdf2..ff65cb4d1d4 100644
--- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
@@ -23,7 +23,6 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -116,16 +115,11 @@ public void testSerializeStream() throws Exception {
}
}
- @Test
+ @Test(expected = SerializationException.class)
public void testSerializeStreamUnserializable() throws Exception {
final ByteArrayOutputStream streamTest = new ByteArrayOutputStream();
- try {
- iMap.put(new Object(), new Object());
- SerializationUtils.serialize(iMap, streamTest);
- } catch (final SerializationException ex) {
- return;
- }
- fail();
+ iMap.put(new Object(), new Object());
+ SerializationUtils.serialize(iMap, streamTest);
}
@Test
@@ -147,24 +141,14 @@ public void testSerializeStreamNullObj() throws Exception {
}
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testSerializeStreamObjNull() throws Exception {
- try {
- SerializationUtils.serialize(iMap, null);
- } catch (final IllegalArgumentException ex) {
- return;
- }
- fail();
+ SerializationUtils.serialize(iMap, null);
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testSerializeStreamNullNull() throws Exception {
- try {
- SerializationUtils.serialize(null, null);
- } catch (final IllegalArgumentException ex) {
- return;
- }
- fail();
+ SerializationUtils.serialize(null, null);
}
@Test
@@ -230,24 +214,14 @@ public void testDeserializeStreamOfNull() throws Exception {
assertNull(test);
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testDeserializeStreamNull() throws Exception {
- try {
- SerializationUtils.deserialize((InputStream) null);
- } catch (final IllegalArgumentException ex) {
- return;
- }
- fail();
+ SerializationUtils.deserialize((InputStream) null);
}
- @Test
+ @Test(expected = SerializationException.class)
public void testDeserializeStreamBadStream() throws Exception {
- try {
- SerializationUtils.deserialize(new ByteArrayInputStream(new byte[0]));
- } catch (final SerializationException ex) {
- return;
- }
- fail();
+ SerializationUtils.deserialize(new ByteArrayInputStream(new byte[0]));
}
@Test
@@ -293,15 +267,10 @@ public void testSerializeBytes() throws Exception {
}
}
- @Test
+ @Test(expected = SerializationException.class)
public void testSerializeBytesUnserializable() throws Exception {
- try {
- iMap.put(new Object(), new Object());
- SerializationUtils.serialize(iMap);
- } catch (final SerializationException ex) {
- return;
- }
- fail();
+ iMap.put(new Object(), new Object());
+ SerializationUtils.serialize(iMap);
}
@Test
@@ -355,24 +324,14 @@ public void testDeserializeBytesOfNull() throws Exception {
assertNull(test);
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testDeserializeBytesNull() throws Exception {
- try {
- SerializationUtils.deserialize((byte[]) null);
- } catch (final IllegalArgumentException ex) {
- return;
- }
- fail();
+ SerializationUtils.deserialize((byte[]) null);
}
- @Test
+ @Test(expected = SerializationException.class)
public void testDeserializeBytesBadStream() throws Exception {
- try {
- SerializationUtils.deserialize(new byte[0]);
- } catch (final SerializationException ex) {
- return;
- }
- fail();
+ SerializationUtils.deserialize(new byte[0]);
}
//-----------------------------------------------------------------------
@@ -397,15 +356,10 @@ public void testCloneNull() throws Exception {
assertNull(test);
}
- @Test
+ @Test(expected = SerializationException.class)
public void testCloneUnserializable() throws Exception {
- try {
- iMap.put(new Object(), new Object());
- SerializationUtils.clone(iMap);
- } catch (final SerializationException ex) {
- return;
- }
- fail();
+ iMap.put(new Object(), new Object());
+ SerializationUtils.clone(iMap);
}
@Test
From e51bd89201477092c32c180e4f8d00569db17ac1 Mon Sep 17 00:00:00 2001
From: Allon Mureinik
Date: Wed, 4 Apr 2018 07:10:28 +0300
Subject: [PATCH 0147/3439] SerializatoinUtilsTest assertArraysEquals (closes
#321)
Utilize assertArraysEquals to compare arrays instead of boiler plate
implementing it with a for loop.
This change both makes the test code cleaner and improves the output
in case of an assertion failure by showing all the differences between
the two arrays instead of stopping at the first.
---
.../commons/lang3/SerializationUtilsTest.java | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
index ff65cb4d1d4..000151d73de 100644
--- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.commons.lang3;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -110,9 +111,7 @@ public void testSerializeStream() throws Exception {
final byte[] testBytes = streamTest.toByteArray();
final byte[] realBytes = streamReal.toByteArray();
assertEquals(testBytes.length, realBytes.length);
- for (int i = 0; i < realBytes.length; i++) {
- assertEquals(realBytes[i], testBytes[i]);
- }
+ assertArrayEquals(realBytes, testBytes);
}
@Test(expected = SerializationException.class)
@@ -136,9 +135,7 @@ public void testSerializeStreamNullObj() throws Exception {
final byte[] testBytes = streamTest.toByteArray();
final byte[] realBytes = streamReal.toByteArray();
assertEquals(testBytes.length, realBytes.length);
- for (int i = 0; i < realBytes.length; i++) {
- assertEquals(realBytes[i], testBytes[i]);
- }
+ assertArrayEquals(realBytes, testBytes);
}
@Test(expected = IllegalArgumentException.class)
@@ -262,9 +259,7 @@ public void testSerializeBytes() throws Exception {
final byte[] realBytes = streamReal.toByteArray();
assertEquals(testBytes.length, realBytes.length);
- for (int i = 0; i < realBytes.length; i++) {
- assertEquals(realBytes[i], testBytes[i]);
- }
+ assertArrayEquals(realBytes, testBytes);
}
@Test(expected = SerializationException.class)
@@ -285,9 +280,7 @@ public void testSerializeBytesNull() throws Exception {
final byte[] realBytes = streamReal.toByteArray();
assertEquals(testBytes.length, realBytes.length);
- for (int i = 0; i < realBytes.length; i++) {
- assertEquals(realBytes[i], testBytes[i]);
- }
+ assertArrayEquals(realBytes, testBytes);
}
//-----------------------------------------------------------------------
From 937ae45ed4828d7ef3a517133edbe0b5858d94a5 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Wed, 4 Apr 2018 09:39:35 +0200
Subject: [PATCH 0148/3439] README.md: update javadoc badge for 3.7
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e3ad97b06aa..aff6efb3726 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ Apache Commons Lang
[](https://travis-ci.org/apache/commons-lang)
[](https://coveralls.io/r/apache/commons-lang)
[](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-lang3/)
-[](https://javadoc.io/doc/org.apache.commons/commons-lang3/3.6)
+[](https://javadoc.io/doc/org.apache.commons/commons-lang3/3.7)
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
From b41e91818614c2f1ac8f5e745f8bed342e80e727 Mon Sep 17 00:00:00 2001
From: Alfredo Ferreira
Date: Fri, 6 Apr 2018 15:08:15 +0200
Subject: [PATCH 0149/3439] Update GitHub PR help link (closes #322)
---
CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bc418fc26d1..b1a2f368938 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -90,7 +90,7 @@ Additional Resources
+ [Apache Commons Lang JIRA project page](https://issues.apache.org/jira/browse/LANG)
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
-+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
++ [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
+ #apachecommons IRC channel on freenode.org
From 8e3ec1722bc5c70ea932b13ec1b564950c623e77 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 18 Apr 2018 12:26:02 -0600
Subject: [PATCH 0150/3439] [LANG-1391] Improve Javadoc for
StringUtils.isAnyEmpty(null).
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/lang3/StringUtils.java | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2cba158bf07..a4cbbf34a9a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -58,6 +58,7 @@ The type attribute can be add,update,fix,remove.
EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods addedAdd ToStringSummary annotationAdd bypass option for classes to recursive and reflective EqualsBuilder
+ Improve Javadoc for StringUtils.isAnyEmpty(null)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 72f40195028..adbe262aec3 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -233,7 +233,8 @@ public static boolean isNotEmpty(final CharSequence cs) {
*
Checks if any of the CharSequences are empty ("") or null.
*
*
- * StringUtils.isAnyEmpty(null) = true
+ * StringUtils.isAnyEmpty((String) null) = true
+ * StringUtils.isAnyEmpty((String[]) null) = false
* StringUtils.isAnyEmpty(null, "foo") = true
* StringUtils.isAnyEmpty("", "bar") = true
* StringUtils.isAnyEmpty("bob", "") = true
From efba54d35fa094de5e580b200a8607bfc7bd5a7a Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 20 Apr 2018 08:55:32 -0600
Subject: [PATCH 0151/3439] [LANG-1393] Add API SystemUtils.String
getEnvironmentVariable(final String name, final String defaultValue).
---
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/SystemUtils.java | 27 +++++++++++++++++++
.../apache/commons/lang3/SystemUtilsTest.java | 18 +++++++++++++
3 files changed, 46 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a4cbbf34a9a..4ec19843008 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -59,6 +59,7 @@ The type attribute can be add,update,fix,remove.
Add ToStringSummary annotationAdd bypass option for classes to recursive and reflective EqualsBuilderImprove Javadoc for StringUtils.isAnyEmpty(null)
+ Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)
+ * Gets an environment variable, defaulting to {@code defaultValue} if the variable cannot be read.
+ *
+ *
+ * If a {@code SecurityException} is caught, the return value is {@code defaultValue} and a message is written to
+ * {@code System.err}.
+ *
+ *
+ * @param name
+ * the environment variable name
+ * @param defaultValue
+ * the default value
+ * @return the environment variable value or {@code defaultValue} if a security problem occurs
+ * @since 3.7
+ */
+ public static String getEnvironmentVariable(final String name, final String defaultValue) {
+ try {
+ final String value = System.getenv(name);
+ return value == null ? defaultValue : value;
+ } catch (final SecurityException ex) {
+ // we are not allowed to look at this property
+ System.err.println("Caught a SecurityException reading the environment variable '" + name + "'.");
+ return defaultValue;
+ }
+ }
+
/**
*
* Gets the user directory as a {@code File}.
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index 77e6078f35c..e89e20ceaae 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -40,6 +40,7 @@
import java.lang.reflect.Modifier;
import java.util.Locale;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -59,6 +60,23 @@ public void testConstructor() {
assertFalse(Modifier.isFinal(SystemUtils.class.getModifiers()));
}
+ @Test
+ public void testGetEnvironmentVariableAbsent() {
+ final String name = "THIS_ENV_VAR_SHOULD_NOT_EXIST_FOR_THIS_TEST_TO_PASS";
+ final String expected = System.getenv(name);
+ Assert.assertNull(expected);
+ final String value = SystemUtils.getEnvironmentVariable(name, "DEFAULT");
+ assertEquals("DEFAULT", value);
+ }
+
+ @Test
+ public void testGetEnvironmentVariablePresent() {
+ final String name = "PATH";
+ final String expected = System.getenv(name);
+ final String value = SystemUtils.getEnvironmentVariable(name, null);
+ assertEquals(expected, value);
+ }
+
@Test
public void testGetHostName() {
final String hostName = SystemUtils.getHostName();
From 7c441e87cf371c642ad9d50bfb863ef145b917c7 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 20 Apr 2018 10:15:32 -0600
Subject: [PATCH 0152/3439] [LANG-1393] Add API SystemUtils.String
getEnvironmentVariable(final String name, final String defaultValue). Fix
@since tag.
---
src/main/java/org/apache/commons/lang3/SystemUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 2289d5d2d0e..8a1ac9c6c49 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -1619,7 +1619,7 @@ private static String getSystemProperty(final String property) {
* @param defaultValue
* the default value
* @return the environment variable value or {@code defaultValue} if a security problem occurs
- * @since 3.7
+ * @since 3.8
*/
public static String getEnvironmentVariable(final String name, final String defaultValue) {
try {
From 58a8f12b443d7cbc16ec00b8841138ee55ee6630 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 22 Apr 2018 10:45:43 -0600
Subject: [PATCH 0153/3439] [LANG-1394] org.apache.commons.lang3.SystemUtils
should not write to System.err.
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/lang3/SystemUtils.java | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4ec19843008..69d194f51cb 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -60,6 +60,7 @@ The type attribute can be add,update,fix,remove.
Add bypass option for classes to recursive and reflective EqualsBuilderImprove Javadoc for StringUtils.isAnyEmpty(null)Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)
+ org.apache.commons.lang3.SystemUtils should not write to System.err.
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 8a1ac9c6c49..5e9e44f0b47 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -1599,8 +1599,8 @@ private static String getSystemProperty(final String property) {
return System.getProperty(property);
} catch (final SecurityException ex) {
// we are not allowed to look at this property
- System.err.println("Caught a SecurityException reading the system property '" + property
- + "'; the SystemUtils property value will default to null.");
+ // System.err.println("Caught a SecurityException reading the system property '" + property
+ // + "'; the SystemUtils property value will default to null.");
return null;
}
}
@@ -1627,7 +1627,7 @@ public static String getEnvironmentVariable(final String name, final String defa
return value == null ? defaultValue : value;
} catch (final SecurityException ex) {
// we are not allowed to look at this property
- System.err.println("Caught a SecurityException reading the environment variable '" + name + "'.");
+ // System.err.println("Caught a SecurityException reading the environment variable '" + name + "'.");
return defaultValue;
}
}
From 38cf0c68d577b46b506f75d896cbb5a4b186c6a6 Mon Sep 17 00:00:00 2001
From: Oleg Chubaryov
Date: Thu, 26 Apr 2018 12:07:11 -0400
Subject: [PATCH 0154/3439] [LANG-1391] Improve Javadoc for
StringUtils.isAnyEmpty(null).
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index adbe262aec3..b8f0a6b00fd 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -265,7 +265,8 @@ public static boolean isAnyEmpty(final CharSequence... css) {
*
Checks if none of the CharSequences are empty ("") or null.
Whitespace is defined by {@link Character#isWhitespace(char)}.
*
*
- * StringUtils.isNoneBlank(null) = false
+ * StringUtils.isNoneBlank((String) null) = false
+ * StringUtils.isNoneBlank((String[]) null) = true
* StringUtils.isNoneBlank(null, "foo") = false
* StringUtils.isNoneBlank(null, null) = false
* StringUtils.isNoneBlank("", "bar") = false
From 69a8ef318942898383508c2a3d1db240f38f1cb8 Mon Sep 17 00:00:00 2001
From: Roman Golyshev
Date: Sun, 29 Apr 2018 02:51:51 +0300
Subject: [PATCH 0155/3439] (doc) remove invalid example of `lastIndexOf`
(closes #327)
- `StringUtils.lastIndexOf("aabaabaa", "ba", 2) = -1` is invalid; moreover, example below is applied to the same arguments, but gets another (correct) result
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index b8f0a6b00fd..c6ec2b60fd0 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -1822,7 +1822,6 @@ public static int lastOrdinalIndexOf(final CharSequence str, final CharSequence
* StringUtils.lastIndexOf("aabaabaa", "b", 0) = -1
* StringUtils.lastIndexOf("aabaabaa", "b", 1) = -1
* StringUtils.lastIndexOf("aabaabaa", "b", 2) = 2
- * StringUtils.lastIndexOf("aabaabaa", "ba", 2) = -1
* StringUtils.lastIndexOf("aabaabaa", "ba", 2) = 2
*
*
From 393ad2db733c0fab7e69ec6c41fde4fe144cd129 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sat, 5 May 2018 13:41:30 +0200
Subject: [PATCH 0156/3439] Update commons-parent to version 46
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 2384c5779de..ca1186cebef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 45
+ 464.0.0commons-lang3
From 362dd935f84ef80b13cced13a74339e42c775809 Mon Sep 17 00:00:00 2001
From: Sebb
Date: Wed, 9 May 2018 09:47:25 +0100
Subject: [PATCH 0157/3439] Javadoc correction to agree with code
---
.../java/org/apache/commons/lang3/builder/ToStringStyle.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 36fe8677d5e..969812dc5dd 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
@@ -2600,7 +2600,7 @@ private boolean isJsonObject(final String valueAsString) {
}
/**
- * Appends the given String in parenthesis to the given StringBuffer.
+ * Appends the given String enclosed in double-quotes to the given StringBuffer.
*
* @param buffer the StringBuffer to append the value to.
* @param value the value to append.
From e7d16c27629722a93a9d36a0b5e0a3a793850544 Mon Sep 17 00:00:00 2001
From: Sebb
Date: Wed, 9 May 2018 18:28:19 +0100
Subject: [PATCH 0158/3439] LANG-1395 - JsonToStringStyle does not escape
double quote in a string value
---
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/builder/ToStringStyle.java | 4 +++-
.../commons/lang3/builder/JsonToStringStyleTest.java | 9 +++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 69d194f51cb..d83bf1509d7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ JsonToStringStyle does not escape double quote in a string valueNew Java version ("11") must be handledExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause existsNumberUtils.isNumber assumes number starting with Zero
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 969812dc5dd..097332f6209 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
@@ -24,6 +24,7 @@
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
/**
@@ -62,6 +63,7 @@
*
* @since 1.0
*/
+@SuppressWarnings("deprecation") // StringEscapeUtils
public abstract class ToStringStyle implements Serializable {
/**
@@ -2606,7 +2608,7 @@ private boolean isJsonObject(final String valueAsString) {
* @param value the value to append.
*/
private void appendValueAsString(final StringBuffer buffer, final String value) {
- buffer.append('"').append(value).append('"');
+ buffer.append('"').append(StringEscapeUtils.escapeJson(value)).append('"');
}
@Override
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 d6bbc646c3b..82467cbf615 100644
--- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
@@ -378,6 +378,15 @@ public String toString() {
.toString());
}
+ @Test
+ public void testLANG1395() {
+ assertEquals("{\"name\":\"value\"}",new ToStringBuilder(base).append("name","value").toString());
+ assertEquals("{\"name\":\"\"}",new ToStringBuilder(base).append("name","").toString());
+ assertEquals("{\"name\":\"\\\"\"}",new ToStringBuilder(base).append("name",'"').toString());
+ assertEquals("{\"name\":\"\\\\\"}",new ToStringBuilder(base).append("name",'\\').toString());
+ assertEquals("{\"name\":\"Let's \\\"quote\\\" this\"}",new ToStringBuilder(base).append("name","Let's \"quote\" this").toString());
+ }
+
/**
* An object with nested object structures used to test {@link ToStringStyle.JsonToStringStyle}.
*
From 3fadfdd69f4682f05563ce53e55743f55813f488 Mon Sep 17 00:00:00 2001
From: Sebb
Date: Thu, 10 May 2018 13:08:07 +0100
Subject: [PATCH 0159/3439] LANG-1396 - JsonToStringStyle does not escape
string names
---
src/changes/changes.xml | 1 +
.../java/org/apache/commons/lang3/builder/ToStringStyle.java | 2 +-
.../apache/commons/lang3/builder/JsonToStringStyleTest.java | 5 +++++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d83bf1509d7..cdf2a05b639 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ JsonToStringStyle does not escape string namesJsonToStringStyle does not escape double quote in a string valueNew Java version ("11") must be handledExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause exists
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 097332f6209..ff10a81183e 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
@@ -2619,7 +2619,7 @@ protected void appendFieldStart(final StringBuffer buffer, final String fieldNam
"Field names are mandatory when using JsonToStringStyle");
}
- super.appendFieldStart(buffer, FIELD_NAME_QUOTE + fieldName
+ super.appendFieldStart(buffer, FIELD_NAME_QUOTE + StringEscapeUtils.escapeJson(fieldName)
+ FIELD_NAME_QUOTE);
}
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 82467cbf615..2ae391e839f 100644
--- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
@@ -387,6 +387,11 @@ public void testLANG1395() {
assertEquals("{\"name\":\"Let's \\\"quote\\\" this\"}",new ToStringBuilder(base).append("name","Let's \"quote\" this").toString());
}
+ @Test
+ public void testLANG1396() {
+ assertEquals("{\"Let's \\\"quote\\\" this\":\"value\"}",new ToStringBuilder(base).append("Let's \"quote\" this","value").toString());
+ }
+
/**
* An object with nested object structures used to test {@link ToStringStyle.JsonToStringStyle}.
*
From 5fa073a5cac682b1a197b839aa6c0082ddcbf9ff Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 15 May 2018 12:58:01 -0600
Subject: [PATCH 0160/3439] Typo: 'JavaDoc' -> 'Javadoc'.
---
README.md | 2 +-
RELEASE-NOTES.txt | 10 +++++-----
src/changes/changes.xml | 10 +++++-----
src/site/resources/lang2-lang3-clirr-report.html | 4 ++--
src/site/resources/release-notes/RELEASE-NOTES-2.0.txt | 2 +-
src/site/resources/release-notes/RELEASE-NOTES-2.1.txt | 2 +-
src/site/resources/release-notes/RELEASE-NOTES-2.3.txt | 2 +-
src/site/resources/release-notes/RELEASE-NOTES-2.5.txt | 2 +-
.../resources/release-notes/RELEASE-NOTES-3.3.1.txt | 2 +-
.../resources/release-notes/RELEASE-NOTES-3.3.2.txt | 2 +-
src/site/resources/release-notes/RELEASE-NOTES-3.3.txt | 2 +-
src/site/resources/release-notes/RELEASE-NOTES-3.4.txt | 4 ++--
src/site/resources/release-notes/RELEASE-NOTES-3.5.txt | 10 +++++-----
src/site/resources/release-notes/RELEASE-NOTES-3.6.txt | 10 +++++-----
src/site/resources/release-notes/RELEASE-NOTES-3.7.txt | 10 +++++-----
src/site/xdoc/index.xml | 4 ++--
src/site/xdoc/upgradeto2_0.xml | 2 +-
src/site/xdoc/upgradeto2_1.xml | 2 +-
src/site/xdoc/upgradeto2_3.xml | 2 +-
src/site/xdoc/upgradeto2_5.xml | 2 +-
src/site/xdoc/userguide.xml | 2 +-
21 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/README.md b/README.md
index aff6efb3726..65fd0dc527a 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ Documentation
-------------
More information can be found on the [homepage](https://commons.apache.org/proper/commons-lang).
-The [JavaDoc](https://commons.apache.org/proper/commons-lang/javadocs/api-release) can be browsed.
+The [Javadoc](https://commons.apache.org/proper/commons-lang/javadocs/api-release) can be browsed.
Questions related to the usage of Apache Commons Lang should be posted to the [user mailing list][ml].
Where can I get the latest release?
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index b77a9b45267..950df0767d9 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -494,7 +494,7 @@ o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
identical leading prefix..
o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
-o LANG-1200: Fix JavaDoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
+o LANG-1200: Fix Javadoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
o LANG-1191: Incorrect Javadoc
StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
qed, Brent Worden and Gary Gregory.
@@ -504,7 +504,7 @@ CHANGES
o LANG-1197: Prepare Java 9 detection.
o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
big to be inlined. Thanks to Ruslan Cheremin.
-o LANG-1259: JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
+o LANG-1259: Javadoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
to Dominik Stadler.
o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
Benoit Wiart.
@@ -529,7 +529,7 @@ o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
Matthias Niehoff.
o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
-o LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
+o LANG-1182: Clarify Javadoc of StringUtils.containsAny(). Thanks to
Larry West and Pascal Schumacher.
o LANG-1183: Making replacePattern/removePattern methods null safe in
StringUtils.
@@ -657,7 +657,7 @@ o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
Fabian Lange.
-o LANG-1071: Fix wrong examples in JavaDoc of
+o LANG-1071: Fix wrong examples in Javadoc of
StringUtils.replaceEachRepeatedly(...),
StringUtils.replaceEach(...) Thanks to Arno Noordover.
o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
@@ -776,7 +776,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
-o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cdf2a05b639..062cef8da08 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -147,7 +147,7 @@ The type attribute can be add,update,fix,remove.
Extend RandomStringUtils with methods that generate strings between a min and max lengthHandle "void" in ClassUtils.getClass()SerializationUtils#deserialize has unnecessary code and a comment for that
- JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading
+ Javadoc for ArrayUtils.isNotEmpty() is slightly misleadingAdd APIs StringUtils.wrapIfMissing(String, char|String)TypeUtils.isAssignable throws NullPointerException when fromType has type variables and toType generic superclass specifies type variableStringUtils#normalizeSpace does not trim the string anymore
@@ -197,7 +197,7 @@ The type attribute can be add,update,fix,remove.
Limit max heap memory for consistent Travis CI buildFix NullPointerException in FastDateParser$TimeZoneStrategyordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1 (correct answer should be 0); revert fix for LANG-1077
- Clarify JavaDoc of StringUtils.containsAny()
+ Clarify Javadoc of StringUtils.containsAny()Add StringUtils methods to compare a string to multiple stringsAdd remove by regular expression methods in StringUtilsMaking replacePattern/removePattern methods null safe in StringUtils
@@ -244,7 +244,7 @@ The type attribute can be add,update,fix,remove.
Fix parsing edge cases in FastDateParserStringUtils#equals fails with Index OOBE on non-Strings with identical leading prefixThere are no tests for CharSequenceUtils.regionMatches
- StringUtils.ordinalIndexOf: Add missing right parenthesis in JavaDoc example
+ StringUtils.ordinalIndexOf: Add missing right parenthesis in Javadoc exampleIncorrect Javadoc StringUtils.containsAny(CharSequence, CharSequence...)Added new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils
@@ -278,7 +278,7 @@ The type attribute can be add,update,fix,remove.
Add (T) casts to get unit tests to pass in old JDKAdd JsonToStringStyle implementation to ToStringStyleAdd NoClassNameToStringStyle implementation of ToStringStyle
- Fix wrong examples in JavaDoc of StringUtils.replaceEachRepeatedly(...), StringUtils.replaceEach(...)
+ Fix wrong examples in Javadoc of StringUtils.replaceEachRepeatedly(...), StringUtils.replaceEach(...)Add StringUtils.containsAny(CharSequence, CharSequence...) methodRead wrong component type of array in add in ArrayUtilsStringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils
@@ -344,7 +344,7 @@ The type attribute can be add,update,fix,remove.
FastDateParser javadoc incorrectly states that SimpleDateFormat is used internallyThere should be a DifferenceBuilder with a ReflectionDifferenceBuilder implementationuncaught PatternSyntaxException in FastDateFormat on Android
- Improve JavaDoc of WordUtils.wrap methods
+ Improve Javadoc of WordUtils.wrap methodsAdd the Jaro-Winkler string distance algorithm to StringUtilsStringUtils.getLevenshteinDistance with too big of a threshold returns wrong resultTest DurationFormatUtilsTest.testEdgeDuration fails in JDK 1.6, 1.7 and 1.8, BRST time zone
diff --git a/src/site/resources/lang2-lang3-clirr-report.html b/src/site/resources/lang2-lang3-clirr-report.html
index 950e7d7f41c..ab5bd7b7e5e 100644
--- a/src/site/resources/lang2-lang3-clirr-report.html
+++ b/src/site/resources/lang2-lang3-clirr-report.html
@@ -144,7 +144,7 @@
Test Source Xref
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.0.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.0.txt
index 9ee37521ac8..c17c04f8b75 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.0.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.0.txt
@@ -147,7 +147,7 @@ ID Sev Pri Plt Owner State Result Summary
16284 MethodUtils: Removed unused code/unused local vars.
16341 No Javadoc for NestableDelegate
16622 Removed compile warning in FastDateFormat
-16669 JavaDoc Errata
+16669 Javadoc Errata
16676 StackOverflow due to ToStringBuilder
16689 ExceptionUtils new methods.
16690 Specify initial size for Enum's HashMap.
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.1.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.1.txt
index 609bccd18ad..137c3008361 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.1.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.1.txt
@@ -142,7 +142,7 @@ BUG FIXES:
31572 o.a.c.lang.enum.ValuedEnum: 'enum'is a keyword in JDK1.5.0
31933 ToStringStyle setArrayEnd handled null incorrectly
32133 SystemUtils fails init on HP-UX
-32198 Error in JavaDoc for StringUtils.chomp(String, String)
+32198 Error in Javadoc for StringUtils.chomp(String, String)
32625 Can't subclass EqualsBuilder because isEquals is private
33067 EqualsBuilder.append(Object[], Object[]) crashes with a NullPointerException if an element of the first array is null
33069 EqualsBuilder.append(Object[], Object[]) incorrectly checks that rhs[i] is instance of lhs[i]'s class
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.3.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.3.txt
index eed2ceb2c65..fcaaf2be1b4 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.3.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.3.txt
@@ -91,7 +91,7 @@ BUG FIXES IN 2.3:
IMPROVEMENTS IN 2.3:
- * [LANG-258] - Enum JavaDoc
+ * [LANG-258] - Enum Javadoc
* [LANG-266] - Wish for StringUtils.join(Collection, *)
* [LANG-268] - StringUtils.join should allow you to pass a range for it (so it only joins a part of the array)
* [LANG-275] - StringUtils substringsBetween
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-2.5.txt b/src/site/resources/release-notes/RELEASE-NOTES-2.5.txt
index b7897cd4c38..6fe9ebd2674 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-2.5.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-2.5.txt
@@ -81,7 +81,7 @@ BUG FIXES IN 2.5
* [LANG-521] - NumberUtils - isNumber(String) and createNumber(String) both modified to support '2.'
* [LANG-432] - StringUtils - improve handling of case-insensitive Strings
* [LANG-552] - StringUtils - replaceEach() no longer NPEs when null appears in the last String[]
- * [LANG-460] - StringUtils - correct JavaDocs for startsWith() and startsWithIgnoreCase()
+ * [LANG-460] - StringUtils - correct Javadocs for startsWith() and startsWithIgnoreCase()
* [LANG-421] - StringEscapeUtils - escapeJava() escapes '/' characters
* [LANG-450] - StringEscapeUtils - change escapeJavaStyleString() to throw UnhandledException instead swallowing IOException
* [LANG-419] - WordUtils - fix StringIndexOutOfBoundsException when lower is greater than the String length
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.3.1.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.3.1.txt
index 59975036c6b..de7641c4114 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.3.1.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.3.1.txt
@@ -102,7 +102,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
-o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.3.2.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.3.2.txt
index 1ddb14bf366..c0684fa7973 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.3.2.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.3.2.txt
@@ -115,7 +115,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
-o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.3.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.3.txt
index 083fb1cea23..6afb509942b 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.3.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.3.txt
@@ -88,7 +88,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
-o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.4.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.4.txt
index 170f00b44d4..011c32ca7e9 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.4.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.4.txt
@@ -135,7 +135,7 @@ o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
Fabian Lange.
-o LANG-1071: Fix wrong examples in JavaDoc of
+o LANG-1071: Fix wrong examples in Javadoc of
StringUtils.replaceEachRepeatedly(...),
StringUtils.replaceEach(...) Thanks to Arno Noordover.
o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
@@ -248,7 +248,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
-o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.5.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.5.txt
index 48f0348b6d3..904caf3b896 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.5.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.5.txt
@@ -258,7 +258,7 @@ o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
identical leading prefix..
o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
-o LANG-1200: Fix JavaDoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
+o LANG-1200: Fix Javadoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
o LANG-1191: Incorrect Javadoc
StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
qed, Brent Worden and Gary Gregory.
@@ -268,7 +268,7 @@ CHANGES
o LANG-1197: Prepare Java 9 detection.
o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
big to be inlined. Thanks to Ruslan Cheremin.
-o LANG-1259: JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
+o LANG-1259: Javadoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
to Dominik Stadler.
o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
Benoit Wiart.
@@ -293,7 +293,7 @@ o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
Matthias Niehoff.
o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
-o LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
+o LANG-1182: Clarify Javadoc of StringUtils.containsAny(). Thanks to
Larry West and Pascal Schumacher.
o LANG-1183: Making replacePattern/removePattern methods null safe in
StringUtils.
@@ -421,7 +421,7 @@ o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
Fabian Lange.
-o LANG-1071: Fix wrong examples in JavaDoc of
+o LANG-1071: Fix wrong examples in Javadoc of
StringUtils.replaceEachRepeatedly(...),
StringUtils.replaceEach(...) Thanks to Arno Noordover.
o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
@@ -540,7 +540,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
-o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.6.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.6.txt
index a3fc4b07488..485557c30e6 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.6.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.6.txt
@@ -442,7 +442,7 @@ o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
identical leading prefix..
o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
-o LANG-1200: Fix JavaDoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
+o LANG-1200: Fix Javadoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
o LANG-1191: Incorrect Javadoc
StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
qed, Brent Worden and Gary Gregory.
@@ -452,7 +452,7 @@ CHANGES
o LANG-1197: Prepare Java 9 detection.
o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
big to be inlined. Thanks to Ruslan Cheremin.
-o LANG-1259: JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
+o LANG-1259: Javadoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
to Dominik Stadler.
o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
Benoit Wiart.
@@ -477,7 +477,7 @@ o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
Matthias Niehoff.
o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
-o LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
+o LANG-1182: Clarify Javadoc of StringUtils.containsAny(). Thanks to
Larry West and Pascal Schumacher.
o LANG-1183: Making replacePattern/removePattern methods null safe in
StringUtils.
@@ -605,7 +605,7 @@ o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
Fabian Lange.
-o LANG-1071: Fix wrong examples in JavaDoc of
+o LANG-1071: Fix wrong examples in Javadoc of
StringUtils.replaceEachRepeatedly(...),
StringUtils.replaceEach(...) Thanks to Arno Noordover.
o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
@@ -724,7 +724,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
-o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.7.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.7.txt
index b77a9b45267..950df0767d9 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.7.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.7.txt
@@ -494,7 +494,7 @@ o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
identical leading prefix..
o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
-o LANG-1200: Fix JavaDoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
+o LANG-1200: Fix Javadoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
o LANG-1191: Incorrect Javadoc
StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
qed, Brent Worden and Gary Gregory.
@@ -504,7 +504,7 @@ CHANGES
o LANG-1197: Prepare Java 9 detection.
o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
big to be inlined. Thanks to Ruslan Cheremin.
-o LANG-1259: JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
+o LANG-1259: Javadoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
to Dominik Stadler.
o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
Benoit Wiart.
@@ -529,7 +529,7 @@ o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
Matthias Niehoff.
o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
-o LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
+o LANG-1182: Clarify Javadoc of StringUtils.containsAny(). Thanks to
Larry West and Pascal Schumacher.
o LANG-1183: Making replacePattern/removePattern methods null safe in
StringUtils.
@@ -657,7 +657,7 @@ o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
Fabian Lange.
-o LANG-1071: Fix wrong examples in JavaDoc of
+o LANG-1071: Fix wrong examples in Javadoc of
StringUtils.replaceEachRepeatedly(...),
StringUtils.replaceEach(...) Thanks to Arno Noordover.
o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
@@ -776,7 +776,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
-o LANG-956: Improve JavaDoc of WordUtils.wrap methods
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 55c9d5635db..0111baae9b6 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -43,11 +43,11 @@ Note that Lang 3.0 (and subsequent versions) use a different package (org.ap
-The package descriptions in the JavaDoc give an overview of the available features
+The package descriptions in the Javadoc give an overview of the available features
and various project reports are provided.
-The JavaDoc API documents are available online:
+The Javadoc API documents are available online:
diff --git a/src/site/xdoc/upgradeto2_0.xml b/src/site/xdoc/upgradeto2_0.xml
index 10fee359a3a..02c50740505 100644
--- a/src/site/xdoc/upgradeto2_0.xml
+++ b/src/site/xdoc/upgradeto2_0.xml
@@ -154,7 +154,7 @@ ID Sev Pri Plt Owner State Result Summary
16284 MethodUtils: Removed unused code/unused local vars.
16341 No Javadoc for NestableDelegate
16622 Removed compile warning in FastDateFormat
-16669 JavaDoc Errata
+16669 Javadoc Errata
16676 StackOverflow due to ToStringBuilder
16689 ExceptionUtils new methods.
16690 Specify initial size for Enum's HashMap.
diff --git a/src/site/xdoc/upgradeto2_1.xml b/src/site/xdoc/upgradeto2_1.xml
index 02205b5d226..ea4015866ef 100644
--- a/src/site/xdoc/upgradeto2_1.xml
+++ b/src/site/xdoc/upgradeto2_1.xml
@@ -149,7 +149,7 @@ BUG FIXES:
31572 o.a.c.lang.enum.ValuedEnum: 'enum'is a keyword in JDK1.5.0
31933 ToStringStyle setArrayEnd handled null incorrectly
32133 SystemUtils fails init on HP-UX
-32198 Error in JavaDoc for StringUtils.chomp(String, String)
+32198 Error in Javadoc for StringUtils.chomp(String, String)
32625 Can't subclass EqualsBuilder because isEquals is private
33067 EqualsBuilder.append(Object[], Object[]) crashes with a NullPointerException if an element of the first array is null
33069 EqualsBuilder.append(Object[], Object[]) incorrectly checks that rhs[i] is instance of lhs[i]'s class
diff --git a/src/site/xdoc/upgradeto2_3.xml b/src/site/xdoc/upgradeto2_3.xml
index 2f43d557f94..3abf04bfccd 100644
--- a/src/site/xdoc/upgradeto2_3.xml
+++ b/src/site/xdoc/upgradeto2_3.xml
@@ -98,7 +98,7 @@ BUG FIXES IN 2.3:
IMPROVEMENTS IN 2.3:
- * [LANG-258] - Enum JavaDoc
+ * [LANG-258] - Enum Javadoc
* [LANG-266] - Wish for StringUtils.join(Collection, *)
* [LANG-268] - StringUtils.join should allow you to pass a range for it (so it only joins a part of the array)
* [LANG-275] - StringUtils substringsBetween
diff --git a/src/site/xdoc/upgradeto2_5.xml b/src/site/xdoc/upgradeto2_5.xml
index 2eb2c174213..be73c0d13ed 100644
--- a/src/site/xdoc/upgradeto2_5.xml
+++ b/src/site/xdoc/upgradeto2_5.xml
@@ -82,7 +82,7 @@ BUG FIXES IN 2.5
* [LANG-521] - NumberUtils - isNumber(String) and createNumber(String) both modified to support '2.'
* [LANG-432] - StringUtils - improve handling of case-insensitive Strings
* [LANG-552] - StringUtils - replaceEach() no longer NPEs when null appears in the last String[]
- * [LANG-460] - StringUtils - correct JavaDocs for startsWith() and startsWithIgnoreCase()
+ * [LANG-460] - StringUtils - correct Javadocs for startsWith() and startsWithIgnoreCase()
* [LANG-421] - StringEscapeUtils - escapeJava() escapes '/' characters
* [LANG-450] - StringEscapeUtils - change escapeJavaStyleString() to throw UnhandledException instead swallowing IOException
* [LANG-419] - WordUtils - fix StringIndexOutOfBoundsException when lower is greater than the String length
diff --git a/src/site/xdoc/userguide.xml b/src/site/xdoc/userguide.xml
index f5494d5db19..3633cf5eca8 100644
--- a/src/site/xdoc/userguide.xml
+++ b/src/site/xdoc/userguide.xml
@@ -27,7 +27,7 @@ limitations under the License.
- Looking for the User Guide? It has been moved to the package JavaDoc
+ Looking for the User Guide? It has been moved to the package Javadoc
From a7b06d6250e972fc14e14504c35042a84410a2e5 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Fri, 4 May 2018 21:32:56 +0200
Subject: [PATCH 0161/3439] Travis: Add Java 10 "Oracle JDK", Java 10
"OpenJDK", Java 11 "Oracle JDK"
---
.travis.yml | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 49775378969..9bbf26fbfc5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,10 +16,27 @@
language: java
sudo: false
-jdk:
- - openjdk7
- - oraclejdk8
- - oraclejdk9
+# Get latest install-jdk.sh script
+before_install:
+ - wget -P ./target/ https://github.com/sormuras/bach/raw/master/install-jdk.sh
+
+matrix:
+ include:
+ - env: JDK_RELEASE='OpenJDK 7'
+ jdk: openjdk7
+ - env: JDK_RELEASE='OracleJDK 8'
+ jdk: oraclejdk8
+ - env: JDK_RELEASE='OracleJDK 9'
+ jdk: oraclejdk9
+# Java 10 "Oracle JDK" (not yet provided by Travis CI)
+ - env: JDK='Oracle JDK 10'
+ install: . ./target/install-jdk.sh -F 10 -L BCL
+# Java 10 "OpenJDK" (not yet provided by Travis CI)
+ - env: JDK='OpenJDK 10'
+ install: . ./target/install-jdk.sh -F 10 -L GPL
+# Java 11 "Oracle JDK" (not yet provided by Travis CI)
+ - env: JDK='Oracle JDK 11'
+ install: . ./target/install-jdk.sh -F 11 -L BCL
script:
- mvn
From 6996686b6b41dd5d22947f9e5b1487547d247182 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Fri, 4 May 2018 22:38:34 +0200
Subject: [PATCH 0162/3439] Travis: Switch from Cobertura to Jacoco, because
Cobertura does not work on Java 9+. Cobertura-Maven-Plugin fails on Java 10+
even if execution is skipped.
Skip Jacoco on Java 11, because Jacoco does not support it yet (see: https://github.com/jacoco/jacoco/issues/663).
---
.travis.yml | 2 +-
pom.xml | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 9bbf26fbfc5..05813b8572c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -42,4 +42,4 @@ script:
- mvn
after_success:
- - mvn clean cobertura:cobertura coveralls:report -Ptravis-cobertura
+ - mvn clean test jacoco:report coveralls:report -Ptravis-jacoco
diff --git a/pom.xml b/pom.xml
index ca1186cebef..12760db8680 100644
--- a/pom.xml
+++ b/pom.xml
@@ -839,6 +839,17 @@
+
+ java11+
+
+ [11,)
+
+
+
+ true
+
+
+
benchmark
From 961e4a821b66b27c77418dece6017e3fe912fa56 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Thu, 10 May 2018 14:21:36 +0200
Subject: [PATCH 0163/3439] Travis: Allow failures on Java 11, because some
FastDateParser tests currently fail with "java.text.ParseException:
Unparseable date"
---
.travis.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 05813b8572c..f88d2c44360 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,6 +37,9 @@ matrix:
# Java 11 "Oracle JDK" (not yet provided by Travis CI)
- env: JDK='Oracle JDK 11'
install: . ./target/install-jdk.sh -F 11 -L BCL
+# some FastDateParser tests currently fail with java.text.ParseException: Unparseable date
+ allow_failures:
+ - env: JDK='Oracle JDK 11'
script:
- mvn
From 5d4916933d6259f1e698662bc7e85ed4db461d61 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 17 May 2018 15:15:28 -0600
Subject: [PATCH 0164/3439] Fix broken XML.
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 062cef8da08..fdceb08a9ca 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,7 +47,7 @@ The type attribute can be add,update,fix,remove.
JsonToStringStyle does not escape string names
- JsonToStringStyle does not escape double quote in a string value
+ JsonToStringStyle does not escape double quote in a string valueNew Java version ("11") must be handledExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause existsNumberUtils.isNumber assumes number starting with Zero
From 7129c43b08da58e1c907dd2b90bb58e7a09bf85c Mon Sep 17 00:00:00 2001
From: Oleg Chubaryov
Date: Thu, 17 May 2018 17:12:46 -0600
Subject: [PATCH 0165/3439] [LANG-1238] Add RegexUtils class instead of
overloadinh methods in StringUtils that take a regex to take precompiled
Pattern.
---
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/RegExUtils.java | 471 ++++++++++++++++++
.../org/apache/commons/lang3/StringUtils.java | 49 +-
.../apache/commons/lang3/RegExUtilsTest.java | 259 ++++++++++
.../apache/commons/lang3/StringUtilsTest.java | 12 +-
5 files changed, 766 insertions(+), 26 deletions(-)
create mode 100644 src/main/java/org/apache/commons/lang3/RegExUtils.java
create mode 100644 src/test/java/org/apache/commons/lang3/RegExUtilsTest.java
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index fdceb08a9ca..5960d00bc7e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -63,6 +63,7 @@ The type attribute can be add,update,fix,remove.
Improve Javadoc for StringUtils.isAnyEmpty(null)Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)org.apache.commons.lang3.SystemUtils should not write to System.err.
+ Add RegexUtils class instead of overloadinh methods in StringUtils that take a regex to take precompiled Pattern.
diff --git a/src/main/java/org/apache/commons/lang3/RegExUtils.java b/src/main/java/org/apache/commons/lang3/RegExUtils.java
new file mode 100644
index 00000000000..27463e34dad
--- /dev/null
+++ b/src/main/java/org/apache/commons/lang3/RegExUtils.java
@@ -0,0 +1,471 @@
+/*
+ * 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 java.util.regex.Pattern;
+
+/**
+ *
Helpers to process Strings using regular expressions.
A {@code null} reference passed to this method is a no-op.
+ *
+ *
Unlike in the {@link #removePattern(String, String)} method, the {@link Pattern#DOTALL} option
+ * is NOT automatically added.
+ * To use the DOTALL option prepend "(?s)" to the regex.
+ * DOTALL is also known as single-line mode in Perl.
+ *
+ * @param text text to remove from, may be null
+ * @param regex the regular expression to which this string is to be matched
+ * @return the text with any removes processed,
+ * {@code null} if null String input
+ *
+ * @see #replaceAll(String, Pattern, String)
+ * @see java.util.regex.Matcher#replaceAll(String)
+ * @see java.util.regex.Pattern
+ * @since 3.8
+ */
+ public static String removeAll(final String text, final Pattern regex) {
+ return replaceAll(text, regex, StringUtils.EMPTY);
+ }
+
+ /**
+ *
Removes the first substring of the text string that matches the given regular expression.
+ *
+ * This method is a {@code null} safe equivalent to:
+ *
A {@code null} reference passed to this method is a no-op.
+ *
+ *
The {@link Pattern#DOTALL} option is NOT automatically added.
+ * To use the DOTALL option prepend "(?s)" to the regex.
+ * DOTALL is also known as single-line mode in Perl.
+ *
+ * @param text text to remove from, may be null
+ * @param regex the regular expression to which this string is to be matched
+ * @return the text with the first replacement processed,
+ * {@code null} if null String input
+ *
+ * @throws java.util.regex.PatternSyntaxException
+ * if the regular expression's syntax is invalid
+ *
+ * @see #replaceFirst(String, String, String)
+ * @see String#replaceFirst(String, String)
+ * @see java.util.regex.Pattern
+ * @see java.util.regex.Pattern#DOTALL
+ * @since 3.5
+ */
+ public static String removeFirst(final String text, final String regex) {
+ return replaceFirst(text, regex, StringUtils.EMPTY);
+ }
+
+ /**
+ *
Removes the first substring of the text string that matches the given regular expression pattern.
+ *
+ * This method is a {@code null} safe equivalent to:
+ *
+ *
+ * @param text text to remove from, may be null
+ * @param regex the regular expression pattern to which this string is to be matched
+ * @return the text with the first replacement processed,
+ * {@code null} if null String input
+ *
+ * @see #replaceFirst(String, Pattern, String)
+ * @see java.util.regex.Matcher#replaceFirst(String)
+ * @see java.util.regex.Pattern
+ * @since 3.8
+ */
+ public static String removeFirst(final String text, final Pattern regex) {
+ return replaceFirst(text, regex, StringUtils.EMPTY);
+ }
+
+ /**
+ *
Replaces each substring of the source String that matches the given regular expression with the given
+ * replacement using the {@link Pattern#DOTALL} option. DOTALL is also known as single-line mode in Perl.
+ *
+ * This call is a {@code null} safe equivalent to:
+ *
A {@code null} reference passed to this method is a no-op.
+ *
+ *
Unlike in the {@link #replacePattern(String, String, String)} method, the {@link Pattern#DOTALL} option
+ * is NOT automatically added.
+ * To use the DOTALL option prepend "(?s)" to the regex.
+ * DOTALL is also known as single-line mode in Perl.
+ *
+ * @param text text to search and replace in, may be null
+ * @param regex the regular expression to which this string is to be matched
+ * @param replacement the string to be substituted for each match
+ * @return the text with any replacements processed,
+ * {@code null} if null String input
+ *
+ * @throws java.util.regex.PatternSyntaxException
+ * if the regular expression's syntax is invalid
+ *
+ * @see #replacePattern(String, String, String)
+ * @see String#replaceAll(String, String)
+ * @see java.util.regex.Pattern
+ * @see java.util.regex.Pattern#DOTALL
+ * @since 3.5
+ */
+ public static String replaceAll(final String text, final String regex, final String replacement) {
+ if (text == null || regex == null || replacement == null) {
+ return text;
+ }
+ return text.replaceAll(regex, replacement);
+ }
+
+ /**
+ *
Replaces each substring of the text String that matches the given regular expression pattern with the given replacement.
+ *
+ * This method is a {@code null} safe equivalent to:
+ *
+ *
+ * @param text text to search and replace in, may be null
+ * @param regex the regular expression pattern to which this string is to be matched
+ * @param replacement the string to be substituted for each match
+ * @return the text with any replacements processed,
+ * {@code null} if null String input
+ *
+ * @see java.util.regex.Matcher#replaceAll(String)
+ * @see java.util.regex.Pattern
+ * @since 3.8
+ */
+ public static String replaceAll(final String text, final Pattern regex, final String replacement) {
+ if (text == null || regex == null || replacement == null) {
+ return text;
+ }
+ return regex.matcher(text).replaceAll(replacement);
+ }
+
+ /**
+ *
Replaces the first substring of the text string that matches the given regular expression
+ * with the given replacement.
+ *
+ * This method is a {@code null} safe equivalent to:
+ *
A {@code null} reference passed to this method is a no-op.
+ *
+ *
The {@link Pattern#DOTALL} option is NOT automatically added.
+ * To use the DOTALL option prepend "(?s)" to the regex.
+ * DOTALL is also known as single-line mode in Perl.
+ *
+ * @param text text to search and replace in, may be null
+ * @param regex the regular expression to which this string is to be matched
+ * @param replacement the string to be substituted for the first match
+ * @return the text with the first replacement processed,
+ * {@code null} if null String input
+ *
+ * @throws java.util.regex.PatternSyntaxException
+ * if the regular expression's syntax is invalid
+ *
+ * @see String#replaceFirst(String, String)
+ * @see java.util.regex.Pattern
+ * @see java.util.regex.Pattern#DOTALL
+ * @since 3.5
+ */
+ public static String replaceFirst(final String text, final String regex, final String replacement) {
+ if (text == null || regex == null|| replacement == null ) {
+ return text;
+ }
+ return text.replaceFirst(regex, replacement);
+ }
+
+ /**
+ *
Replaces the first substring of the text string that matches the given regular expression pattern
+ * with the given replacement.
+ *
+ * This method is a {@code null} safe equivalent to:
+ *
+ *
+ * @param text text to search and replace in, may be null
+ * @param regex the regular expression pattern to which this string is to be matched
+ * @param replacement the string to be substituted for the first match
+ * @return the text with the first replacement processed,
+ * {@code null} if null String input
+ *
+ * @see java.util.regex.Matcher#replaceFirst(String)
+ * @see java.util.regex.Pattern
+ * @since 3.8
+ */
+ public static String replaceFirst(final String text, final Pattern regex, final String replacement) {
+ if (text == null || regex == null|| replacement == null ) {
+ return text;
+ }
+ return regex.matcher(text).replaceFirst(replacement);
+ }
+
+}
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index c6ec2b60fd0..495e4ec8ebf 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -5059,7 +5059,7 @@ public static String remove(final String str, final char remove) {
*
*
+ *
+ * @param text text to remove from, may be null
+ * @param regex the regular expression to which this string is to be matched
+ * @return the text with any removes processed,
+ * {@code null} if null String input
+ *
+ * @see #replaceAll(String, Pattern, String)
+ * @see java.util.regex.Matcher#replaceAll(String)
+ * @see java.util.regex.Pattern
+ */
+ public static String removeAll(final String text, final Pattern regex) {
+ return replaceAll(text, regex, StringUtils.EMPTY);
+ }
+
/**
*
Removes each substring of the text String that matches the given regular expression.
*
@@ -72,39 +108,39 @@ public static String removeAll(final String text, final String regex) {
}
/**
- *
Removes each substring of the text String that matches the given regular expression pattern.
+ *
Removes the first substring of the text string that matches the given regular expression pattern.
*
* This method is a {@code null} safe equivalent to:
*
*
* @param text text to remove from, may be null
- * @param regex the regular expression to which this string is to be matched
- * @return the text with any removes processed,
+ * @param regex the regular expression pattern to which this string is to be matched
+ * @return the text with the first replacement processed,
* {@code null} if null String input
*
- * @see #replaceAll(String, Pattern, String)
- * @see java.util.regex.Matcher#replaceAll(String)
+ * @see #replaceFirst(String, Pattern, String)
+ * @see java.util.regex.Matcher#replaceFirst(String)
* @see java.util.regex.Pattern
*/
- public static String removeAll(final String text, final Pattern regex) {
- return replaceAll(text, regex, StringUtils.EMPTY);
+ public static String removeFirst(final String text, final Pattern regex) {
+ return replaceFirst(text, regex, StringUtils.EMPTY);
}
/**
@@ -153,114 +189,77 @@ public static String removeFirst(final String text, final String regex) {
}
/**
- *
Removes the first substring of the text string that matches the given regular expression pattern.
- *
- * This method is a {@code null} safe equivalent to:
- *
- *
- * @param text text to remove from, may be null
- * @param regex the regular expression pattern to which this string is to be matched
- * @return the text with the first replacement processed,
- * {@code null} if null String input
- *
- * @see #replaceFirst(String, Pattern, String)
- * @see java.util.regex.Matcher#replaceFirst(String)
- * @see java.util.regex.Pattern
- */
- public static String removeFirst(final String text, final Pattern regex) {
- return replaceFirst(text, regex, StringUtils.EMPTY);
- }
-
- /**
- *
Replaces each substring of the source String that matches the given regular expression with the given
- * replacement using the {@link Pattern#DOTALL} option. DOTALL is also known as single-line mode in Perl.
+ *
Removes each substring of the source String that matches the given regular expression using the DOTALL option.
*
* This call is a {@code null} safe equivalent to:
*
*
- * @param text
- * the source string
- * @param regex
- * the regular expression to which this string is to be matched
- * @return The resulting {@code String}
- * @see #replacePattern(String, String, String)
- * @see String#replaceAll(String, String)
- * @see Pattern#DOTALL
+ * @param text text to search and replace in, may be null
+ * @param regex the regular expression pattern to which this string is to be matched
+ * @param replacement the string to be substituted for each match
+ * @return the text with any replacements processed,
+ * {@code null} if null String input
+ *
+ * @see java.util.regex.Matcher#replaceAll(String)
+ * @see java.util.regex.Pattern
*/
- public static String removePattern(final String text, final String regex) {
- return replacePattern(text, regex, StringUtils.EMPTY);
+ public static String replaceAll(final String text, final Pattern regex, final String replacement) {
+ if (text == null || regex == null || replacement == null) {
+ return text;
+ }
+ return regex.matcher(text).replaceAll(replacement);
}
/**
@@ -318,46 +317,46 @@ public static String replaceAll(final String text, final String regex, final Str
}
/**
- *
Replaces each substring of the text String that matches the given regular expression pattern with the given replacement.
+ *
Replaces the first substring of the text string that matches the given regular expression pattern
+ * with the given replacement.
*
* This method is a {@code null} safe equivalent to:
*
*
* @param text text to search and replace in, may be null
* @param regex the regular expression pattern to which this string is to be matched
- * @param replacement the string to be substituted for each match
- * @return the text with any replacements processed,
+ * @param replacement the string to be substituted for the first match
+ * @return the text with the first replacement processed,
* {@code null} if null String input
*
- * @see java.util.regex.Matcher#replaceAll(String)
+ * @see java.util.regex.Matcher#replaceFirst(String)
* @see java.util.regex.Pattern
*/
- public static String replaceAll(final String text, final Pattern regex, final String replacement) {
- if (text == null || regex == null || replacement == null) {
+ public static String replaceFirst(final String text, final Pattern regex, final String replacement) {
+ if (text == null || regex == null|| replacement == null ) {
return text;
}
- return regex.matcher(text).replaceAll(replacement);
+ return regex.matcher(text).replaceFirst(replacement);
}
/**
@@ -413,46 +412,47 @@ public static String replaceFirst(final String text, final String regex, final S
}
/**
- *
Replaces the first substring of the text string that matches the given regular expression pattern
- * with the given replacement.
+ *
Replaces each substring of the source String that matches the given regular expression with the given
+ * replacement using the {@link Pattern#DOTALL} option. DOTALL is also known as single-line mode in Perl.
*
- * This method is a {@code null} safe equivalent to:
+ * This call is a {@code null} safe equivalent to:
*
+ *
+ * @param list the {@code List} of values to join together, may be null
+ * @param separator the separator character to use
+ * @param startIndex the first index to start joining from. It is
+ * an error to pass in an end index past the end of the list
+ * @param endIndex the index to stop joining from (exclusive). It is
+ * an error to pass in an end index past the end of the list
+ * @return the joined String, {@code null} if null list input
+ * @since 3.8
+ */
+ public static String join(final List> list, final char separator, final int startIndex, final int endIndex) {
+ if (list == null) {
+ return null;
+ }
+ final int noOfItems = endIndex - startIndex;
+ if (noOfItems <= 0) {
+ return EMPTY;
+ }
+ final List> subList = list.subList(startIndex, endIndex);
+ return join(subList.iterator(), separator);
+ }
+
+ /**
+ *
Joins the elements of the provided {@code List} into a single String
+ * containing the provided list of elements.
+ *
+ *
No delimiter is added before or after the list.
+ * Null objects or empty strings within the array are represented by
+ * empty strings.
+ *
+ * @param list the {@code List} of values to join together, may be null
+ * @param separator the separator character to use
+ * @param startIndex the first index to start joining from. It is
+ * an error to pass in an end index past the end of the list
+ * @param endIndex the index to stop joining from (exclusive). It is
+ * an error to pass in an end index past the end of the list
+ * @return the joined String, {@code null} if null list input
+ * @since 3.8
+ */
+ public static String join(final List> list, final String separator, final int startIndex, final int endIndex) {
+ if (list == null) {
+ return null;
+ }
+ final int noOfItems = endIndex - startIndex;
+ if (noOfItems <= 0) {
+ return EMPTY;
+ }
+ final List> subList = list.subList(startIndex, endIndex);
+ return join(subList.iterator(), separator);
+ }
+
/**
*
Joins the elements of the provided varargs into a
* single String containing the provided elements.
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index c4299b8d1e3..ee3beeb656e 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -34,6 +34,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.regex.PatternSyntaxException;
@@ -100,6 +101,11 @@ public String toString() {
private static final char[] CHAR_PRIM_LIST = {'1', '2'};
private static final float[] FLOAT_PRIM_LIST = {1, 2};
private static final double[] DOUBLE_PRIM_LIST = {1, 2};
+ private static final List MIXED_STRING_LIST = Arrays.asList(null, "", "foo");
+ private static final List MIXED_TYPE_OBJECT_LIST = Arrays.asList("foo", Long.valueOf(2L));
+ private static final List STRING_LIST = Arrays.asList("foo", "bar", "baz");
+ private static final List EMPTY_STRING_LIST = Collections.emptyList();
+ private static final List NULL_STRING_LIST = Collections.singletonList(null);
private static final String SEPARATOR = ",";
private static final char SEPARATOR_CHAR = ';';
@@ -366,6 +372,38 @@ public void testJoin_ArrayString() {
assertEquals("", StringUtils.join(MIXED_TYPE_LIST, "/", 2, 1));
}
+ @Test
+ public void testJoin_List() {
+ assertNull(StringUtils.join((List) null, null));
+ assertEquals(TEXT_LIST_NOSEP, StringUtils.join(STRING_LIST, null));
+ assertEquals(TEXT_LIST_NOSEP, StringUtils.join(STRING_LIST, ""));
+
+ assertEquals("", StringUtils.join(NULL_STRING_LIST, null));
+
+ assertEquals("", StringUtils.join(EMPTY_STRING_LIST, null));
+ assertEquals("", StringUtils.join(EMPTY_STRING_LIST, ""));
+ assertEquals("", StringUtils.join(EMPTY_STRING_LIST, SEPARATOR));
+
+ assertEquals(TEXT_LIST, StringUtils.join(STRING_LIST, SEPARATOR));
+ assertEquals(",,foo", StringUtils.join(MIXED_STRING_LIST, SEPARATOR));
+ assertEquals("foo,2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, SEPARATOR));
+
+ assertEquals("/", StringUtils.join(MIXED_STRING_LIST, "/", 0, MIXED_STRING_LIST.size() - 1));
+ assertEquals("", StringUtils.join(MIXED_STRING_LIST, "", 0, MIXED_STRING_LIST.size()- 1));
+ assertEquals("foo", StringUtils.join(MIXED_TYPE_OBJECT_LIST, "/", 0, 1));
+ assertEquals("foo/2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, "/", 0, 2));
+ assertEquals("2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, "/", 1, 2));
+ assertEquals("", StringUtils.join(MIXED_TYPE_OBJECT_LIST, "/", 2, 1));
+ assertNull(null, StringUtils.join((List) null, "/", 0, 1));
+
+ assertEquals("/", StringUtils.join(MIXED_STRING_LIST, '/', 0, MIXED_STRING_LIST.size() - 1));
+ assertEquals("foo", StringUtils.join(MIXED_TYPE_OBJECT_LIST, '/', 0, 1));
+ assertEquals("foo/2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, '/', 0, 2));
+ assertEquals("2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, '/', 1, 2));
+ assertEquals("", StringUtils.join(MIXED_TYPE_OBJECT_LIST, '/', 2, 1));
+ assertNull(null, StringUtils.join((List) null, '/', 0, 1));
+ }
+
@Test
public void testJoin_IteratorChar() {
assertNull(StringUtils.join((Iterator>) null, ','));
From 9de7e1a1b4eeed5b5e3bd56c6b179266f550196d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 22 May 2018 08:41:35 -0600
Subject: [PATCH 0172/3439] [LANG-1290] StringUtils.join() with support for
List> with configurable start/end indices.
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 64469cf9ced..4e218ab1891 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,6 +65,7 @@ The type attribute can be add,update,fix,remove.
Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)org.apache.commons.lang3.SystemUtils should not write to System.err.Add RegexUtils class instead of overloadinh methods in StringUtils that take a regex to take precompiled Pattern.
+ StringUtils.join() with support for List> with configurable start/end indices.
From a5391bb34cbe168f2c5f5f6e8fc3a1eeb9399e13 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 22 May 2018 08:46:07 -0600
Subject: [PATCH 0173/3439] Format nit.
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 9387376c7b9..1b7802e595c 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -3263,7 +3263,7 @@ public static String[] split(final String str, final String separatorChars, fina
* @return an array of parsed Strings, {@code null} if null String was input
*/
public static String[] splitByWholeSeparator(final String str, final String separator) {
- return splitByWholeSeparatorWorker( str, separator, -1, false ) ;
+ return splitByWholeSeparatorWorker(str, separator, -1, false ) ;
}
/**
From 96cb498f9bb88b534e49f9b8301c9fe7113b2dfe Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 22 May 2018 08:55:54 -0600
Subject: [PATCH 0174/3439] [LANG-1290] StringUtils.join() with support for
List> with configurable start/end indices. Reuse constant.
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 1b7802e595c..82e4bee3b14 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -4614,7 +4614,7 @@ public static String join(final Iterator> iterator, final char separator) {
}
final Object first = iterator.next();
if (!iterator.hasNext()) {
- return Objects.toString(first, "");
+ return Objects.toString(first, EMPTY);
}
// two or more elements
From f4a262df5204221184f1f5008b06957868684a25 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 22 May 2018 08:57:50 -0600
Subject: [PATCH 0175/3439] [LANG-1290] StringUtils.join() with support for
List> with configurable start/end indices. Extract constant.
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 82e4bee3b14..550894e3aef 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -115,6 +115,9 @@
*/
//@Immutable
public class StringUtils {
+
+ private static final int STRING_BUILDER_SIZE = 256;
+
// Performance testing notes (JDK 1.4, Jul03, scolebourne)
// Whitespace:
// Character.isWhitespace() is faster than WHITESPACE.indexOf()
@@ -4618,7 +4621,7 @@ public static String join(final Iterator> iterator, final char separator) {
}
// two or more elements
- final StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small
+ final StringBuilder buf = new StringBuilder(STRING_BUILDER_SIZE); // Java default is 16, probably too small
if (first != null) {
buf.append(first);
}
@@ -4662,7 +4665,7 @@ public static String join(final Iterator> iterator, final String separator) {
}
// two or more elements
- final StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small
+ final StringBuilder buf = new StringBuilder(STRING_BUILDER_SIZE); // Java default is 16, probably too small
if (first != null) {
buf.append(first);
}
From 81ee0d062c888d8f8bcbc154cd7f0143710f458c Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 22 May 2018 09:00:55 -0600
Subject: [PATCH 0176/3439] Extract method.
---
.../org/apache/commons/lang3/StringUtils.java | 22 +++++++++++--------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 550894e3aef..182d27648b3 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -2833,6 +2833,10 @@ public static String mid(final String str, int pos, final int len) {
return str.substring(pos, pos + len);
}
+ private static StringBuilder newStringBuilder(final int noOfItems) {
+ return new StringBuilder(noOfItems * 16);
+ }
+
// SubStringAfter/SubStringBefore
//-----------------------------------------------------------------------
/**
@@ -4143,7 +4147,7 @@ public static String join(final Object[] array, final char separator, final int
if (noOfItems <= 0) {
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -4194,7 +4198,7 @@ public static String join(final long[] array, final char separator, final int st
if (noOfItems <= 0) {
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -4243,7 +4247,7 @@ public static String join(final int[] array, final char separator, final int sta
if (noOfItems <= 0) {
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -4292,7 +4296,7 @@ public static String join(final byte[] array, final char separator, final int st
if (noOfItems <= 0) {
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -4341,7 +4345,7 @@ public static String join(final short[] array, final char separator, final int s
if (noOfItems <= 0) {
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -4390,7 +4394,7 @@ public static String join(final char[] array, final char separator, final int st
if (noOfItems <= 0) {
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -4439,7 +4443,7 @@ public static String join(final double[] array, final char separator, final int
if (noOfItems <= 0) {
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -4488,7 +4492,7 @@ public static String join(final float[] array, final char separator, final int s
if (noOfItems <= 0) {
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
@@ -4579,7 +4583,7 @@ public static String join(final Object[] array, String separator, final int star
return EMPTY;
}
- final StringBuilder buf = new StringBuilder(noOfItems * 16);
+ final StringBuilder buf = newStringBuilder(noOfItems);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
From 2bb197d3d45b8e00d9276511c1e162d8cca6dfb0 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 22 May 2018 10:27:24 -0600
Subject: [PATCH 0177/3439] [LANG-1290] StringUtils.join() with support for
List> with configurable start/end indices. Fix XML.
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4e218ab1891..d07c6c6ae36 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,7 +65,7 @@ The type attribute can be add,update,fix,remove.
Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)org.apache.commons.lang3.SystemUtils should not write to System.err.Add RegexUtils class instead of overloadinh methods in StringUtils that take a regex to take precompiled Pattern.
- StringUtils.join() with support for List> with configurable start/end indices.
+ StringUtils.join() with support for List<?> with configurable start/end indices.
From ae7bef343faa17076de8da001f843d6346d37cbc Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 22 May 2018 10:30:29 -0600
Subject: [PATCH 0178/3439] [LANG-1238] Fix typo.
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d07c6c6ae36..b7c70d13950 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,7 +64,7 @@ The type attribute can be add,update,fix,remove.
Improve Javadoc for StringUtils.isAnyEmpty(null)Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)org.apache.commons.lang3.SystemUtils should not write to System.err.
- Add RegexUtils class instead of overloadinh methods in StringUtils that take a regex to take precompiled Pattern.
+ Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern.StringUtils.join() with support for List<?> with configurable start/end indices.
From b933f55e5878f366e966f1a80d7450f49cefb115 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sun, 27 May 2018 22:17:47 +0200
Subject: [PATCH 0179/3439] StringUtils: fix checkstyle violation
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 182d27648b3..66a2960c32b 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -115,7 +115,7 @@
*/
//@Immutable
public class StringUtils {
-
+
private static final int STRING_BUILDER_SIZE = 256;
// Performance testing notes (JDK 1.4, Jul03, scolebourne)
From 6850d88880093733c0ba29c371f2c9823256d749 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Mon, 28 May 2018 10:55:30 +0200
Subject: [PATCH 0180/3439] Fix javadoc errors reported by Java 11.
---
src/main/java/org/apache/commons/lang3/ClassUtils.java | 4 ++--
.../java/org/apache/commons/lang3/text/StrTokenizer.java | 6 ++----
.../java/org/apache/commons/lang3/text/WordUtils.java | 9 ++++++---
.../apache/commons/lang3/time/DurationFormatUtils.java | 5 +++--
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index f32f7796df0..11fab8667f2 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -429,8 +429,8 @@ public static String getAbbreviatedName(final Class> cls, final int len) {
* If enough space is available, rightmost sub-packages will be displayed in full
* length.
*
- *
The following table illustrates the algorithm:
- *
+ *
+ *
Examples
*
className
len
return
*
null
1
""
*
"java.lang.String"
5
"j.l.String"
diff --git a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
index 25db7c974bd..b84fde28ad3 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
@@ -58,11 +58,9 @@
* " a, b , c " - Three tokens "a","b","c" (default CSV processing trims whitespace)
* "a, ", b ,", c" - Three tokens "a, " , " b ", ", c" (quoted text untouched)
*
- *
- *
- * This tokenizer has the following properties and options:
*
- *
+ *
+ *
StrTokenizer properties and options
*
*
Property
Type
Default
*
diff --git a/src/main/java/org/apache/commons/lang3/text/WordUtils.java b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
index a42f9d6d9f7..3787f3339f9 100644
--- a/src/main/java/org/apache/commons/lang3/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
@@ -60,7 +60,8 @@ public WordUtils() {
*
Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.
*
- *
+ *
+ *
Examples
*
*
input
*
wrapLength
@@ -109,7 +110,8 @@ public static String wrap(final String str, final int wrapLength) {
*
Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.
*
- *
+ *
+ *
Examples
*
*
input
*
wrapLength
@@ -185,7 +187,8 @@ public static String wrap(final String str, final int wrapLength, final String n
*
Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.
Duration formatting utilities and constants. The following table describes the tokens
- * used in the pattern language for formatting.
- *
+ * used in the pattern language for formatting.
+ *
+ *
Pattern Tokens
*
character
duration element
*
y
years
*
M
months
From 9ea0063bc93cf0d5b45f95bcc6b9f225da94b951 Mon Sep 17 00:00:00 2001
From: amseager
Date: Fri, 8 Jun 2018 15:10:43 +0300
Subject: [PATCH 0181/3439] (doc) Fix typos in classes of tuple package
---
src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java | 2 +-
.../java/org/apache/commons/lang3/tuple/ImmutableTriple.java | 2 +-
src/main/java/org/apache/commons/lang3/tuple/MutablePair.java | 2 +-
src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java | 2 +-
src/main/java/org/apache/commons/lang3/tuple/Pair.java | 2 +-
src/main/java/org/apache/commons/lang3/tuple/Triple.java | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
index 592bf3d7f44..7c865ad5200 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
@@ -62,7 +62,7 @@ public static ImmutablePair nullPair() {
public final R right;
/**
- *
Obtains an immutable pair of from two objects inferring the generic types.
+ *
Obtains an immutable pair of two objects inferring the generic types.
*
*
This factory allows the pair to be created using inference to
* obtain the generic types.
diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
index 725f7212b27..3fd152bfedc 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
@@ -66,7 +66,7 @@ public static ImmutableTriple nullTriple() {
public final R right;
/**
- *
Obtains an immutable triple of from three objects inferring the generic types.
+ *
Obtains an immutable triple of three objects inferring the generic types.
*
*
This factory allows the triple to be created using inference to
* obtain the generic types.
diff --git a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
index 46657170017..386988bf083 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
@@ -37,7 +37,7 @@ public class MutablePair extends Pair {
public R right;
/**
- *
Obtains an immutable pair of from two objects inferring the generic types.
+ *
Obtains a mutable pair of two objects inferring the generic types.
*
*
This factory allows the pair to be created using inference to
* obtain the generic types.
diff --git a/src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java b/src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java
index bb695dd988f..f5d92be7664 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java
@@ -40,7 +40,7 @@ public class MutableTriple extends Triple {
public R right;
/**
- *
Obtains an mutable triple of three objects inferring the generic types.
+ *
Obtains a mutable triple of three objects inferring the generic types.
*
*
This factory allows the triple to be created using inference to
* obtain the generic types.
diff --git a/src/main/java/org/apache/commons/lang3/tuple/Pair.java b/src/main/java/org/apache/commons/lang3/tuple/Pair.java
index 5740f4e2444..55f1f8ac303 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/Pair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/Pair.java
@@ -44,7 +44,7 @@ public abstract class Pair implements Map.Entry, ComparableObtains an immutable pair of from two objects inferring the generic types.
+ *
Obtains an immutable pair of two objects inferring the generic types.
*
*
This factory allows the pair to be created using inference to
* obtain the generic types.
diff --git a/src/main/java/org/apache/commons/lang3/tuple/Triple.java b/src/main/java/org/apache/commons/lang3/tuple/Triple.java
index 2f4041e9291..c139a6c27a2 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/Triple.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/Triple.java
@@ -43,7 +43,7 @@ public abstract class Triple implements Comparable>, Se
private static final long serialVersionUID = 1L;
/**
- *
Obtains an immutable triple of from three objects inferring the generic types.
+ *
Obtains an immutable triple of three objects inferring the generic types.
*
*
This factory allows the triple to be created using inference to
* obtain the generic types.
From 152e5d48eac990bb3e08b2409816738020ba9a01 Mon Sep 17 00:00:00 2001
From: Jeff Nelson
Date: Thu, 19 Apr 2018 15:00:19 -0500
Subject: [PATCH 0182/3439] LANG-1392: Methods for getting first non empty or
non blank value (closes #325)
---
.../org/apache/commons/lang3/StringUtils.java | 66 +++++++++++++++++++
.../lang3/StringUtilsEmptyBlankTest.java | 28 ++++++++
2 files changed, 94 insertions(+)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 66a2960c32b..4e421d184d0 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -7478,6 +7478,72 @@ public static String defaultString(final String str, final String defaultStr) {
return str == null ? defaultStr : str;
}
+ /**
+ *
Returns the first value in the array which is not blank.
+ * If all the values are blank or the array is {@code null}
+ * or empty then {@code null} is returned.
+ *
+ * @param the specific kind of CharSequence
+ * @param values the values to test, may be {@code null} or empty
+ * @return the first value from {@code values} which is not blank,
+ * or {@code null} if there are no non-blank values
+ * @since 3.8
+ */
+ @SafeVarargs
+ public static T firstNonBlank(final T... values) {
+ if (values != null) {
+ for (final T val : values) {
+ if (isNotBlank(val)) {
+ return val;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
Returns the first value in the array which is not empty.
+ * If all the values are empty or the array is {@code null}
+ * or empty then {@code null} is returned.
+ *
+ * @param the specific kind of CharSequence
+ * @param values the values to test, may be {@code null} or empty
+ * @return the first value from {@code values} which is not empty,
+ * or {@code null} if there are no non-empty values
+ * @since 3.8
+ */
+ @SafeVarargs
+ public static T firstNonEmpty(final T... values) {
+ if (values != null) {
+ for (final T val : values) {
+ if (isNotEmpty(val)) {
+ return val;
+ }
+ }
+ }
+ return null;
+ }
+
/**
*
Returns either the passed in CharSequence, or if the CharSequence is
* whitespace, empty ("") or {@code null}, the value of {@code defaultStr}.
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
index 8e872c3e72c..2eb73680db5 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
@@ -16,7 +16,9 @@
*/
package org.apache.commons.lang3;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -140,4 +142,30 @@ public void testIsAllBlank() {
assertFalse(StringUtils.isAllBlank(" ", "bar"));
assertFalse(StringUtils.isAllBlank("foo", "bar"));
}
+
+ @Test
+ public void testFirstNonBlank() {
+ assertNull(StringUtils.firstNonBlank());
+ assertNull(StringUtils.firstNonBlank((String[]) null));
+ assertNull(StringUtils.firstNonBlank(null, null, null));
+ assertNull(StringUtils.firstNonBlank(null, "", " "));
+ assertNull(StringUtils.firstNonBlank(null, null, " "));
+ assertEquals("zz", StringUtils.firstNonBlank(null, "zz"));
+ assertEquals("abc", StringUtils.firstNonBlank("abc"));
+ assertEquals("xyz", StringUtils.firstNonBlank(null, "xyz"));
+ assertEquals("xyz", StringUtils.firstNonBlank(null, "xyz", "abc"));
+ }
+
+ @Test
+ public void testFirstNonEmpty() {
+ assertNull(StringUtils.firstNonEmpty());
+ assertNull(StringUtils.firstNonEmpty((String[]) null));
+ assertNull(StringUtils.firstNonEmpty(null, null, null));
+ assertEquals(" ", StringUtils.firstNonEmpty(null, "", " "));
+ assertNull(StringUtils.firstNonEmpty(null, null, ""));
+ assertEquals("zz", StringUtils.firstNonEmpty(null, "zz"));
+ assertEquals("abc", StringUtils.firstNonEmpty("abc"));
+ assertEquals("xyz", StringUtils.firstNonEmpty(null, "xyz"));
+ assertEquals("xyz", StringUtils.firstNonEmpty(null, "xyz", "abc"));
+ }
}
From 672cd146f2c2824c3c4ea28d406a6e5feeee7b18 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Fri, 8 Jun 2018 18:12:51 +0200
Subject: [PATCH 0183/3439] LANG-1392: add changes.xml entry
---
src/changes/changes.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b7c70d13950..4fb91b1862b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,7 +65,8 @@ The type attribute can be add,update,fix,remove.
Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)org.apache.commons.lang3.SystemUtils should not write to System.err.Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern.
- StringUtils.join() with support for List<?> with configurable start/end indices.
+ StringUtils.join() with support for List<?> with configurable start/end indices.
+ Methods for getting first non empty or non blank value
From 89cd538eaf7c555d33e7467ac8c2a51019c26372 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Fri, 8 Jun 2018 19:34:32 +0200
Subject: [PATCH 0184/3439] LANG-1392: Methods for getting first non empty or
non blank value
Improve javadoc
---
.../org/apache/commons/lang3/StringUtils.java | 42 +++++++++++--------
1 file changed, 24 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 4e421d184d0..b3a92f41ac1 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -7479,18 +7479,22 @@ public static String defaultString(final String str, final String defaultStr) {
}
/**
- *
Returns the first value in the array which is not blank.
- * If all the values are blank or the array is {@code null}
+ *
Returns the first value in the array which is not empty (""),
+ * {@code null} or whitespace only.
+ *
+ *
Whitespace is defined by {@link Character#isWhitespace(char)}.
+ *
+ *
If all values are blank or the array is {@code null}
* or empty then {@code null} is returned.
*
* @param the specific kind of CharSequence
From 70be8e5148a2f616399c3205c169df600400833c Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sat, 9 Jun 2018 10:31:13 +0200
Subject: [PATCH 0185/3439] Use oraclejdk10 and openjdk10 provided by travis.
---
.travis.yml | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index f88d2c44360..b8ef1b44f49 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -28,12 +28,10 @@ matrix:
jdk: oraclejdk8
- env: JDK_RELEASE='OracleJDK 9'
jdk: oraclejdk9
-# Java 10 "Oracle JDK" (not yet provided by Travis CI)
- - env: JDK='Oracle JDK 10'
- install: . ./target/install-jdk.sh -F 10 -L BCL
-# Java 10 "OpenJDK" (not yet provided by Travis CI)
- - env: JDK='OpenJDK 10'
- install: . ./target/install-jdk.sh -F 10 -L GPL
+ - env: JDK_RELEASE='OracleJDK 10'
+ jdk: oraclejdk10
+ - env: JDK_RELEASE='OpenJDK 10'
+ jdk: openjdk10
# Java 11 "Oracle JDK" (not yet provided by Travis CI)
- env: JDK='Oracle JDK 11'
install: . ./target/install-jdk.sh -F 11 -L BCL
From d9f1b897a28aeac97ff8d15948d3bc566021c53e Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Sat, 16 Jun 2018 23:12:03 +0200
Subject: [PATCH 0186/3439] Fraction#getFraction: Replace "the the" with "the"
in javadoc
---
src/main/java/org/apache/commons/lang3/math/Fraction.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/math/Fraction.java b/src/main/java/org/apache/commons/lang3/math/Fraction.java
index 0924ac91327..e849dcdbff1 100644
--- a/src/main/java/org/apache/commons/lang3/math/Fraction.java
+++ b/src/main/java/org/apache/commons/lang3/math/Fraction.java
@@ -243,7 +243,7 @@ public static Fraction getReducedFraction(int numerator, int denominator) {
* @throws ArithmeticException if |value| > Integer.MAX_VALUE
* or value = NaN
* @throws ArithmeticException if the calculated denominator is zero
- * @throws ArithmeticException if the the algorithm does not converge
+ * @throws ArithmeticException if the algorithm does not converge
*/
public static Fraction getFraction(double value) {
final int sign = value < 0 ? -1 : 1;
From 8e8b8e05e4eb9aa009444c2fea3552d28b57aa98 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 16 Jun 2018 15:46:28 -0600
Subject: [PATCH 0187/3439] The the patrol.
---
src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 efb630c62e0..deacce1ae59 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
@@ -1216,7 +1216,7 @@ public static Type[] getImplicitLowerBounds(final WildcardType wildcardType) {
*/
public static boolean typesSatisfyVariables(final Map, Type> typeVarAssigns) {
Validate.notNull(typeVarAssigns, "typeVarAssigns is null");
- // all types must be assignable to all the bounds of the their mapped
+ // all types must be assignable to all the bounds of their mapped
// type variable.
for (final Map.Entry, Type> entry : typeVarAssigns.entrySet()) {
final TypeVariable> typeVar = entry.getKey();
From e767af7e7eb8ff7724d5f72709ee4bb7a72d2284 Mon Sep 17 00:00:00 2001
From: Igor Curdvanovschi
Date: Wed, 20 Jun 2018 09:00:24 +0300
Subject: [PATCH 0188/3439] removes unchecked exceptions declared in 'throws'
clause
---
src/main/java/org/apache/commons/lang3/ArchUtils.java | 4 ++--
src/main/java/org/apache/commons/lang3/ClassUtils.java | 2 +-
src/main/java/org/apache/commons/lang3/ObjectUtils.java | 4 ++--
.../commons/lang3/builder/ReflectionToStringBuilder.java | 2 +-
.../commons/lang3/concurrent/EventCountCircuitBreaker.java | 3 +--
.../commons/lang3/concurrent/ThresholdCircuitBreaker.java | 4 ++--
src/main/java/org/apache/commons/lang3/math/NumberUtils.java | 2 +-
.../java/org/apache/commons/lang3/mutable/MutableByte.java | 2 +-
.../java/org/apache/commons/lang3/mutable/MutableDouble.java | 2 +-
.../java/org/apache/commons/lang3/mutable/MutableFloat.java | 2 +-
.../java/org/apache/commons/lang3/mutable/MutableInt.java | 2 +-
.../java/org/apache/commons/lang3/mutable/MutableLong.java | 2 +-
.../java/org/apache/commons/lang3/mutable/MutableShort.java | 2 +-
13 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArchUtils.java b/src/main/java/org/apache/commons/lang3/ArchUtils.java
index 9307b2280c8..05f2f8ae5cc 100644
--- a/src/main/java/org/apache/commons/lang3/ArchUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArchUtils.java
@@ -85,7 +85,7 @@ private static void init_PPC_64Bit() {
* @param processor The {@link Processor} to add.
* @throws IllegalStateException If the key already exists.
*/
- private static void addProcessor(final String key, final Processor processor) throws IllegalStateException {
+ private static void addProcessor(final String key, final Processor processor) {
if (!ARCH_TO_PROCESSOR.containsKey(key)) {
ARCH_TO_PROCESSOR.put(key, processor);
} else {
@@ -101,7 +101,7 @@ private static void addProcessor(final String key, final Processor processor) th
* @param processor The {@link Processor} to add.
* @throws IllegalStateException If the key already exists.
*/
- private static void addProcessors(final Processor processor, final String... keys) throws IllegalStateException {
+ private static void addProcessors(final Processor processor, final String... keys) {
for (final String key : keys) {
addProcessor(key, processor);
}
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index 11fab8667f2..be3770b5b37 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -1084,7 +1084,7 @@ public static Class> getClass(final String className, final boolean initialize
* or if the method doesn't conform with the requirements
*/
public static Method getPublicMethod(final Class> cls, final String methodName, final Class>... parameterTypes)
- throws SecurityException, NoSuchMethodException {
+ throws NoSuchMethodException {
final Method declaredMethod = cls.getMethod(methodName, parameterTypes);
if (Modifier.isPublic(declaredMethod.getDeclaringClass().getModifiers())) {
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 6b93a7d65bd..2f0c6687b66 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -867,7 +867,7 @@ public static byte CONST(final byte v) {
* @return the byte v, unchanged
* @since 3.2
*/
- public static byte CONST_BYTE(final int v) throws IllegalArgumentException {
+ public static byte CONST_BYTE(final int v) {
if (v < Byte.MIN_VALUE || v > Byte.MAX_VALUE) {
throw new IllegalArgumentException("Supplied value must be a valid byte literal between -128 and 127: [" + v + "]");
}
@@ -936,7 +936,7 @@ public static short CONST(final short v) {
* @return the byte v, unchanged
* @since 3.2
*/
- public static short CONST_SHORT(final int v) throws IllegalArgumentException {
+ public static short CONST_SHORT(final int v) {
if (v < Short.MIN_VALUE || v > Short.MAX_VALUE) {
throw new IllegalArgumentException("Supplied value must be a valid byte literal between -32768 and 32767: [" + v + "]");
}
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 9390d831cde..392cdb539c0 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
@@ -696,7 +696,7 @@ public Class> getUpToClass() {
*
* @see java.lang.reflect.Field#get(Object)
*/
- protected Object getValue(final Field field) throws IllegalArgumentException, IllegalAccessException {
+ protected Object getValue(final Field field) throws IllegalAccessException {
return field.get(this.getObject());
}
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
index dd282dc9b31..daac0261421 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
@@ -269,8 +269,7 @@ public boolean checkState() {
* {@inheritDoc}
*/
@Override
- public boolean incrementAndCheckState(final Integer increment)
- throws CircuitBreakingException {
+ public boolean incrementAndCheckState(final Integer increment) {
return performStateCheck(increment);
}
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreaker.java b/src/main/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreaker.java
index a6f423e7f2b..ac267399106 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreaker.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreaker.java
@@ -91,7 +91,7 @@ public long getThreshold() {
* {@inheritDoc}
*/
@Override
- public boolean checkState() throws CircuitBreakingException {
+ public boolean checkState() {
return isOpen();
}
@@ -112,7 +112,7 @@ public void close() {
*
If the threshold is zero, the circuit breaker will be in a permanent open state.
*/
@Override
- public boolean incrementAndCheckState(final Long increment) throws CircuitBreakingException {
+ public boolean incrementAndCheckState(final Long increment) {
if (threshold == 0) {
open();
}
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index c9cdf6f95a4..3837cc97c21 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -447,7 +447,7 @@ public static short toShort(final String str, final short defaultValue) {
* @return Number created from the string (or null if the input is null)
* @throws NumberFormatException if the value cannot be converted
*/
- public static Number createNumber(final String str) throws NumberFormatException {
+ public static Number createNumber(final String str) {
if (str == null) {
return null;
}
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java b/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
index fa8853c42f8..dfedf78a4f5 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
@@ -73,7 +73,7 @@ public MutableByte(final Number value) {
* @throws NumberFormatException if the string cannot be parsed into a byte
* @since 2.5
*/
- public MutableByte(final String value) throws NumberFormatException {
+ public MutableByte(final String value) {
super();
this.value = Byte.parseByte(value);
}
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java b/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
index 78aa4ff54fd..a9037bd37bc 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
@@ -71,7 +71,7 @@ public MutableDouble(final Number value) {
* @throws NumberFormatException if the string cannot be parsed into a double
* @since 2.5
*/
- public MutableDouble(final String value) throws NumberFormatException {
+ public MutableDouble(final String value) {
super();
this.value = Double.parseDouble(value);
}
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java b/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
index 53880f85b29..700ac5cc8d0 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
@@ -71,7 +71,7 @@ public MutableFloat(final Number value) {
* @throws NumberFormatException if the string cannot be parsed into a float
* @since 2.5
*/
- public MutableFloat(final String value) throws NumberFormatException {
+ public MutableFloat(final String value) {
super();
this.value = Float.parseFloat(value);
}
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java b/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
index 7484abdcbc4..330d02c37af 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
@@ -73,7 +73,7 @@ public MutableInt(final Number value) {
* @throws NumberFormatException if the string cannot be parsed into an int
* @since 2.5
*/
- public MutableInt(final String value) throws NumberFormatException {
+ public MutableInt(final String value) {
super();
this.value = Integer.parseInt(value);
}
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java b/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
index 520ff078d3c..4bf0fa5f05f 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
@@ -73,7 +73,7 @@ public MutableLong(final Number value) {
* @throws NumberFormatException if the string cannot be parsed into a long
* @since 2.5
*/
- public MutableLong(final String value) throws NumberFormatException {
+ public MutableLong(final String value) {
super();
this.value = Long.parseLong(value);
}
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java b/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
index dbcaebf2bbf..72c32dd51e3 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
@@ -73,7 +73,7 @@ public MutableShort(final Number value) {
* @throws NumberFormatException if the string cannot be parsed into a short
* @since 2.5
*/
- public MutableShort(final String value) throws NumberFormatException {
+ public MutableShort(final String value) {
super();
this.value = Short.parseShort(value);
}
From 96260205dceea0e4734fa275c8f72a617bd8ebc4 Mon Sep 17 00:00:00 2001
From: Igor Curdvanovschi
Date: Wed, 20 Jun 2018 12:44:10 +0300
Subject: [PATCH 0189/3439] deletes redundant 'new' expression in constant
array creation
---
.../org/apache/commons/lang3/CharUtils.java | 2 +-
.../org/apache/commons/lang3/Conversion.java | 32 +++++++++----------
.../commons/lang3/StringEscapeUtils.java | 6 ++--
.../commons/lang3/reflect/TypeUtils.java | 2 +-
.../translate/CharSequenceTranslator.java | 2 +-
5 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/CharUtils.java b/src/main/java/org/apache/commons/lang3/CharUtils.java
index c22896838de..3c8ad3e6688 100644
--- a/src/main/java/org/apache/commons/lang3/CharUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharUtils.java
@@ -30,7 +30,7 @@ public class CharUtils {
private static final String[] CHAR_STRING_ARRAY = new String[128];
- private static final char[] HEX_DIGITS = new char[] {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
+ private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
/**
* {@code \u000a} linefeed LF ('\n').
diff --git a/src/main/java/org/apache/commons/lang3/Conversion.java b/src/main/java/org/apache/commons/lang3/Conversion.java
index 0427deede78..5577be4b007 100644
--- a/src/main/java/org/apache/commons/lang3/Conversion.java
+++ b/src/main/java/org/apache/commons/lang3/Conversion.java
@@ -65,22 +65,22 @@
public class Conversion {
- private static final boolean[] TTTT = new boolean[] { true, true, true, true };
- private static final boolean[] FTTT = new boolean[] { false, true, true, true };
- private static final boolean[] TFTT = new boolean[] { true, false, true, true };
- private static final boolean[] FFTT = new boolean[] { false, false, true, true };
- private static final boolean[] TTFT = new boolean[] { true, true, false, true };
- private static final boolean[] FTFT = new boolean[] { false, true, false, true };
- private static final boolean[] TFFT = new boolean[] { true, false, false, true };
- private static final boolean[] FFFT = new boolean[] { false, false, false, true };
- private static final boolean[] TTTF = new boolean[] { true, true, true, false };
- private static final boolean[] FTTF = new boolean[] { false, true, true, false };
- private static final boolean[] TFTF = new boolean[] { true, false, true, false };
- private static final boolean[] FFTF = new boolean[] { false, false, true, false };
- private static final boolean[] TTFF = new boolean[] { true, true, false, false };
- private static final boolean[] FTFF = new boolean[] { false, true, false, false };
- private static final boolean[] TFFF = new boolean[] { true, false, false, false };
- private static final boolean[] FFFF = new boolean[] { false, false, false, false };
+ private static final boolean[] TTTT = {true, true, true, true};
+ private static final boolean[] FTTT = {false, true, true, true};
+ private static final boolean[] TFTT = {true, false, true, true};
+ private static final boolean[] FFTT = {false, false, true, true};
+ private static final boolean[] TTFT = {true, true, false, true};
+ private static final boolean[] FTFT = {false, true, false, true};
+ private static final boolean[] TFFT = {true, false, false, true};
+ private static final boolean[] FFFT = {false, false, false, true};
+ private static final boolean[] TTTF = {true, true, true, false};
+ private static final boolean[] FTTF = {false, true, true, false};
+ private static final boolean[] TFTF = {true, false, true, false};
+ private static final boolean[] FFTF = {false, false, true, false};
+ private static final boolean[] TTFF = {true, true, false, false};
+ private static final boolean[] FTFF = {false, true, false, false};
+ private static final boolean[] TFFF = {true, false, false, false};
+ private static final boolean[] FFFF = {false, false, false, false};
/**
*
diff --git a/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java b/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
index 2d0a5db7807..ce7eec5245e 100644
--- a/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
@@ -255,8 +255,7 @@ static class CsvEscaper extends CharSequenceTranslator {
private static final char CSV_DELIMITER = ',';
private static final char CSV_QUOTE = '"';
private static final String CSV_QUOTE_STR = String.valueOf(CSV_QUOTE);
- private static final char[] CSV_SEARCH_CHARS =
- new char[] {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
+ private static final char[] CSV_SEARCH_CHARS = { CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF };
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
@@ -389,8 +388,7 @@ static class CsvUnescaper extends CharSequenceTranslator {
private static final char CSV_DELIMITER = ',';
private static final char CSV_QUOTE = '"';
private static final String CSV_QUOTE_STR = String.valueOf(CSV_QUOTE);
- private static final char[] CSV_SEARCH_CHARS =
- new char[] {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
+ private static final char[] CSV_SEARCH_CHARS = {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
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 deacce1ae59..a421d5ce46c 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
@@ -1825,7 +1825,7 @@ private static void appendRecursiveTypes(final StringBuilder buf, final int[] re
private static int[] findRecursiveTypes(final ParameterizedType p) {
final Type[] filteredArgumentTypes = Arrays.copyOf(p.getActualTypeArguments(), p.getActualTypeArguments().length);
- int[] indexesToRemove = new int[] {};
+ int[] indexesToRemove = {};
for (int i = 0; i < filteredArgumentTypes.length; i++) {
if (filteredArgumentTypes[i] instanceof TypeVariable>) {
if (containsVariableTypeSameParametrizedTypeBound(((TypeVariable>) filteredArgumentTypes[i]), p)) {
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java b/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
index e79ebe60cd7..cac63bff3db 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
@@ -34,7 +34,7 @@
@Deprecated
public abstract class CharSequenceTranslator {
- static final char[] HEX_DIGITS = new char[] {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+ static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
/**
* Translate a set of codepoints, represented by an int index into a CharSequence,
From 214cc7fd596b575ed07a7d7c1006b46d5c75613d Mon Sep 17 00:00:00 2001
From: Igor Curdvanovschi
Date: Wed, 20 Jun 2018 13:05:02 +0300
Subject: [PATCH 0190/3439] replaces 'size() == 0' and 'length() == 0' with
'isEmpty()'
---
src/main/java/org/apache/commons/lang3/ClassUtils.java | 2 +-
.../java/org/apache/commons/lang3/LocaleUtils.java | 10 +++++-----
.../org/apache/commons/lang3/builder/DiffResult.java | 2 +-
.../lang3/exception/DefaultExceptionContext.java | 2 +-
.../org/apache/commons/lang3/math/NumberUtils.java | 4 ++--
.../java/org/apache/commons/lang3/text/StrLookup.java | 2 +-
.../apache/commons/lang3/time/DurationFormatUtils.java | 2 +-
7 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index be3770b5b37..74566263783 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -1347,7 +1347,7 @@ private static String getCanonicalName(String className) {
? className.length() - 1
: className.length());
} else {
- if (className.length() > 0) {
+ if (!className.isEmpty()) {
className = reverseAbbreviationMap.get(className.substring(0, 1));
}
}
diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
index cd1178139d6..d5b50432733 100644
--- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java
+++ b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
@@ -150,8 +150,8 @@ private static Locale parseLocale(final String str) {
final String country = segments[1];
final String variant = segments[2];
if (isISO639LanguageCode(language) &&
- (country.length() == 0 || isISO3166CountryCode(country) || isNumericAreaCode(country)) &&
- variant.length() > 0) {
+ (country.isEmpty() || isISO3166CountryCode(country) || isNumericAreaCode(country)) &&
+ !variant.isEmpty()) {
return new Locale(language, country, variant);
}
}
@@ -227,10 +227,10 @@ public static List localeLookupList(final Locale locale, final Locale de
final List list = new ArrayList<>(4);
if (locale != null) {
list.add(locale);
- if (locale.getVariant().length() > 0) {
+ if (!locale.getVariant().isEmpty()) {
list.add(new Locale(locale.getLanguage(), locale.getCountry()));
}
- if (locale.getCountry().length() > 0) {
+ if (!locale.getCountry().isEmpty()) {
list.add(new Locale(locale.getLanguage(), StringUtils.EMPTY));
}
if (!list.contains(defaultLocale)) {
@@ -330,7 +330,7 @@ public static List countriesByLanguage(final String languageCode) {
final List locales = availableLocaleList();
for (final Locale locale : locales) {
if (languageCode.equals(locale.getLanguage()) &&
- locale.getCountry().length() != 0 &&
+ !locale.getCountry().isEmpty() &&
locale.getVariant().isEmpty()) {
countries.add(locale);
}
diff --git a/src/main/java/org/apache/commons/lang3/builder/DiffResult.java b/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
index d8fa976c957..93b7f2f745d 100644
--- a/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
+++ b/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
@@ -170,7 +170,7 @@ public String toString() {
* @return a {@code String} description of the differences.
*/
public String toString(final ToStringStyle style) {
- if (diffs.size() == 0) {
+ if (diffs.isEmpty()) {
return OBJECTS_SAME_STRING;
}
diff --git a/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java b/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java
index 69a4ccf558e..277c224ab6c 100644
--- a/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java
+++ b/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java
@@ -130,7 +130,7 @@ public String getFormattedExceptionMessage(final String baseMessage){
buffer.append(baseMessage);
}
- if (contextValues.size() > 0) {
+ if (!contextValues.isEmpty()) {
if (buffer.length() > 0) {
buffer.append('\n');
}
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index 3837cc97c21..ff5552d5a09 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -526,7 +526,7 @@ public static Number createNumber(final String str) {
case 'L' :
if (dec == null
&& exp == null
- && (numeric.length() > 0 && numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) {
+ && (!numeric.isEmpty() && numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) {
try {
return createLong(numeric);
} catch (final NumberFormatException nfe) { // NOPMD
@@ -661,7 +661,7 @@ private static boolean isAllZeros(final String str) {
return false;
}
}
- return str.length() > 0;
+ return !str.isEmpty();
}
//-----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/StrLookup.java b/src/main/java/org/apache/commons/lang3/text/StrLookup.java
index a99c1b348de..bf6ccb23fbc 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrLookup.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrLookup.java
@@ -171,7 +171,7 @@ private static class SystemPropertiesStrLookup extends StrLookup {
*/
@Override
public String lookup(final String key) {
- if (key.length() > 0) {
+ if (!key.isEmpty()) {
try {
return System.getProperty(key);
} catch (final SecurityException scex) {
diff --git a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
index e09260cd407..8c6e20a5375 100644
--- a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
@@ -195,7 +195,7 @@ public static String formatDurationWords(
}
}
}
- if (duration.length() != 0) {
+ if (!duration.isEmpty()) {
// strip the space off again
duration = duration.substring(1);
}
From b610707cd072f07efb816074a4844bb1b31e482c Mon Sep 17 00:00:00 2001
From: Igor Curdvanovschi
Date: Wed, 20 Jun 2018 14:28:10 +0300
Subject: [PATCH 0191/3439] removes unnecessary class reference of static
method calls which are declared in the same class
---
.../org/apache/commons/lang3/ArrayUtils.java | 18 +++++++++---------
.../org/apache/commons/lang3/ClassUtils.java | 4 ++--
.../org/apache/commons/lang3/ObjectUtils.java | 6 +++---
.../commons/lang3/SerializationUtils.java | 4 ++--
.../org/apache/commons/lang3/StringUtils.java | 6 +++---
.../org/apache/commons/lang3/SystemUtils.java | 2 +-
.../org/apache/commons/lang3/Validate.java | 10 +++++-----
.../commons/lang3/builder/ToStringStyle.java | 14 +++++++-------
.../lang3/exception/ExceptionUtils.java | 4 ++--
.../apache/commons/lang3/math/Fraction.java | 2 +-
.../apache/commons/lang3/math/NumberUtils.java | 4 ++--
.../commons/lang3/reflect/MemberUtils.java | 4 ++--
.../commons/lang3/reflect/TypeUtils.java | 10 +++++-----
.../commons/lang3/text/StrSubstitutor.java | 2 +-
.../apache/commons/lang3/time/DateUtils.java | 6 +++---
.../commons/lang3/time/FastDatePrinter.java | 6 +++---
.../commons/lang3/tuple/ImmutablePair.java | 2 +-
.../commons/lang3/tuple/ImmutableTriple.java | 2 +-
18 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index 857dd70e1a8..daf9596b9cd 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -3870,7 +3870,7 @@ public static int indexOf(final double[] array, final double valueToFind, final
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int indexOf(final double[] array, final double valueToFind, int startIndex) {
- if (ArrayUtils.isEmpty(array)) {
+ if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
@@ -3902,7 +3902,7 @@ public static int indexOf(final double[] array, final double valueToFind, int st
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int indexOf(final double[] array, final double valueToFind, int startIndex, final double tolerance) {
- if (ArrayUtils.isEmpty(array)) {
+ if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
@@ -3964,7 +3964,7 @@ public static int lastIndexOf(final double[] array, final double valueToFind, fi
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int lastIndexOf(final double[] array, final double valueToFind, int startIndex) {
- if (ArrayUtils.isEmpty(array)) {
+ if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
@@ -3998,7 +3998,7 @@ public static int lastIndexOf(final double[] array, final double valueToFind, in
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int lastIndexOf(final double[] array, final double valueToFind, int startIndex, final double tolerance) {
- if (ArrayUtils.isEmpty(array)) {
+ if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
@@ -4077,7 +4077,7 @@ public static int indexOf(final float[] array, final float valueToFind) {
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int indexOf(final float[] array, final float valueToFind, int startIndex) {
- if (ArrayUtils.isEmpty(array)) {
+ if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
@@ -4120,7 +4120,7 @@ public static int lastIndexOf(final float[] array, final float valueToFind) {
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int lastIndexOf(final float[] array, final float valueToFind, int startIndex) {
- if (ArrayUtils.isEmpty(array)) {
+ if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
@@ -4181,7 +4181,7 @@ public static int indexOf(final boolean[] array, final boolean valueToFind) {
* array input
*/
public static int indexOf(final boolean[] array, final boolean valueToFind, int startIndex) {
- if (ArrayUtils.isEmpty(array)) {
+ if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
@@ -4225,7 +4225,7 @@ public static int lastIndexOf(final boolean[] array, final boolean valueToFind)
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int lastIndexOf(final boolean[] array, final boolean valueToFind, int startIndex) {
- if (ArrayUtils.isEmpty(array)) {
+ if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
@@ -7436,7 +7436,7 @@ static Object removeAll(final Object array, final int... indices) {
*/
// package protected for access by unit tests
static Object removeAll(final Object array, final BitSet indices) {
- final int srcLength = ArrayUtils.getLength(array);
+ final int srcLength = getLength(array);
// No need to check maxIndex here, because method only currently called from removeElements()
// which guarantee to generate on;y valid bit entries.
// final int maxIndex = indices.length();
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index 74566263783..799fa1c8b47 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -1263,7 +1263,7 @@ public static String getShortCanonicalName(final Class> cls) {
* @since 2.4
*/
public static String getShortCanonicalName(final String canonicalName) {
- return ClassUtils.getShortClassName(getCanonicalName(canonicalName));
+ return getShortClassName(getCanonicalName(canonicalName));
}
// Package name
@@ -1308,7 +1308,7 @@ public static String getPackageCanonicalName(final Class> cls) {
* @since 2.4
*/
public static String getPackageCanonicalName(final String canonicalName) {
- return ClassUtils.getPackageName(getCanonicalName(canonicalName));
+ return getPackageName(getCanonicalName(canonicalName));
}
/**
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 2f0c6687b66..c18e33b4c82 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -253,7 +253,7 @@ public static boolean equals(final Object object1, final Object object2) {
* @return {@code false} if the values of both objects are the same
*/
public static boolean notEqual(final Object object1, final Object object2) {
- return !ObjectUtils.equals(object1, object2);
+ return !equals(object1, object2);
}
/**
@@ -304,7 +304,7 @@ public static int hashCodeMulti(final Object... objects) {
int hash = 1;
if (objects != null) {
for (final Object object : objects) {
- final int tmpHash = ObjectUtils.hashCode(object);
+ final int tmpHash = hashCode(object);
hash = hash * 31 + tmpHash;
}
}
@@ -779,7 +779,7 @@ public static class Null implements Serializable {
* @return the singleton value
*/
private Object readResolve() {
- return ObjectUtils.NULL;
+ return NULL;
}
}
diff --git a/src/main/java/org/apache/commons/lang3/SerializationUtils.java b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
index 69c3664e9d8..abe0331c3b8 100644
--- a/src/main/java/org/apache/commons/lang3/SerializationUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
@@ -112,7 +112,7 @@ public static T clone(final T object) {
*/
@SuppressWarnings("unchecked") // OK, because we serialized a type `T`
public static T roundtrip(final T msg) {
- return (T) SerializationUtils.deserialize(SerializationUtils.serialize(msg));
+ return (T) deserialize(serialize(msg));
}
// Serialize
@@ -220,7 +220,7 @@ public static T deserialize(final InputStream inputStream) {
*/
public static T deserialize(final byte[] objectData) {
Validate.isTrue(objectData != null, "The byte[] must not be null");
- return SerializationUtils.deserialize(new ByteArrayInputStream(objectData));
+ return deserialize(new ByteArrayInputStream(objectData));
}
/**
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index b3a92f41ac1..ff06e8ccb52 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -959,7 +959,7 @@ public static String stripAccents(final String input) {
final StringBuilder decomposed = new StringBuilder(Normalizer.normalize(input, Normalizer.Form.NFD));
convertRemainingAccentCharacters(decomposed);
// Note that this doesn't correctly remove ligatures...
- return pattern.matcher(decomposed).replaceAll(StringUtils.EMPTY);
+ return pattern.matcher(decomposed).replaceAll(EMPTY);
}
private static void convertRemainingAccentCharacters(final StringBuilder decomposed) {
@@ -5220,7 +5220,7 @@ public static String removeAll(final String text, final String regex) {
*/
@Deprecated
public static String removeFirst(final String text, final String regex) {
- return replaceFirst(text, regex, StringUtils.EMPTY);
+ return replaceFirst(text, regex, EMPTY);
}
// Replacing
@@ -6897,7 +6897,7 @@ public static String uncapitalize(final String str) {
* @return the changed String, {@code null} if null String input
*/
public static String swapCase(final String str) {
- if (StringUtils.isEmpty(str)) {
+ if (isEmpty(str)) {
return str;
}
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 5e9e44f0b47..a37229badc3 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -1530,7 +1530,7 @@ public static File getJavaHome() {
* @since 3.6
*/
public static String getHostName() {
- return SystemUtils.IS_OS_WINDOWS ? System.getenv("COMPUTERNAME") : System.getenv("HOSTNAME");
+ return IS_OS_WINDOWS ? System.getenv("COMPUTERNAME") : System.getenv("HOSTNAME");
}
/**
diff --git a/src/main/java/org/apache/commons/lang3/Validate.java b/src/main/java/org/apache/commons/lang3/Validate.java
index 0f003fd5a28..980899093a8 100644
--- a/src/main/java/org/apache/commons/lang3/Validate.java
+++ b/src/main/java/org/apache/commons/lang3/Validate.java
@@ -506,7 +506,7 @@ public static T notBlank(final T chars) {
* @see #noNullElements(Object[])
*/
public static T[] noNullElements(final T[] array, final String message, final Object... values) {
- Validate.notNull(array);
+ notNull(array);
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
final Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i));
@@ -568,7 +568,7 @@ public static T[] noNullElements(final T[] array) {
* @see #noNullElements(Iterable)
*/
public static > T noNullElements(final T iterable, final String message, final Object... values) {
- Validate.notNull(iterable);
+ notNull(iterable);
int i = 0;
for (final Iterator> it = iterable.iterator(); it.hasNext(); i++) {
if (it.next() == null) {
@@ -629,7 +629,7 @@ public static > T noNullElements(final T iterable) {
* @since 3.0
*/
public static T[] validIndex(final T[] array, final int index, final String message, final Object... values) {
- Validate.notNull(array);
+ notNull(array);
if (index < 0 || index >= array.length) {
throw new IndexOutOfBoundsException(String.format(message, values));
}
@@ -688,7 +688,7 @@ public static T[] validIndex(final T[] array, final int index) {
* @since 3.0
*/
public static > T validIndex(final T collection, final int index, final String message, final Object... values) {
- Validate.notNull(collection);
+ notNull(collection);
if (index < 0 || index >= collection.size()) {
throw new IndexOutOfBoundsException(String.format(message, values));
}
@@ -745,7 +745,7 @@ public static > T validIndex(final T collection, final i
* @since 3.0
*/
public static T validIndex(final T chars, final int index, final String message, final Object... values) {
- Validate.notNull(chars);
+ notNull(chars);
if (index < 0 || index >= chars.length()) {
throw new IndexOutOfBoundsException(String.format(message, values));
}
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 ff10a81183e..d54b19c325d 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
@@ -2164,7 +2164,7 @@ private static final class DefaultToStringStyle extends ToStringStyle {
* @return the singleton
*/
private Object readResolve() {
- return ToStringStyle.DEFAULT_STYLE;
+ return DEFAULT_STYLE;
}
}
@@ -2198,7 +2198,7 @@ private static final class NoFieldNameToStringStyle extends ToStringStyle {
* @return the singleton
*/
private Object readResolve() {
- return ToStringStyle.NO_FIELD_NAMES_STYLE;
+ return NO_FIELD_NAMES_STYLE;
}
}
@@ -2232,7 +2232,7 @@ private static final class ShortPrefixToStringStyle extends ToStringStyle {
* @return the singleton
*/
private Object readResolve() {
- return ToStringStyle.SHORT_PREFIX_STYLE;
+ return SHORT_PREFIX_STYLE;
}
}
@@ -2269,7 +2269,7 @@ private static final class SimpleToStringStyle extends ToStringStyle {
* @return the singleton
*/
private Object readResolve() {
- return ToStringStyle.SIMPLE_STYLE;
+ return SIMPLE_STYLE;
}
}
@@ -2305,7 +2305,7 @@ private static final class MultiLineToStringStyle extends ToStringStyle {
* @return the singleton
*/
private Object readResolve() {
- return ToStringStyle.MULTI_LINE_STYLE;
+ return MULTI_LINE_STYLE;
}
}
@@ -2340,7 +2340,7 @@ private static final class NoClassNameToStringStyle extends ToStringStyle {
* @return the singleton
*/
private Object readResolve() {
- return ToStringStyle.NO_CLASS_NAME_STYLE;
+ return NO_CLASS_NAME_STYLE;
}
}
@@ -2631,7 +2631,7 @@ protected void appendFieldStart(final StringBuffer buffer, final String fieldNam
* @return the singleton
*/
private Object readResolve() {
- return ToStringStyle.JSON_STYLE;
+ return JSON_STYLE;
}
}
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 bacb859d6fb..16b26edc103 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -389,7 +389,7 @@ private static int indexOf(final Throwable throwable, final Class> type, int f
if (fromIndex < 0) {
fromIndex = 0;
}
- final Throwable[] throwables = ExceptionUtils.getThrowables(throwable);
+ final Throwable[] throwables = getThrowables(throwable);
if (fromIndex >= throwables.length) {
return -1;
}
@@ -682,7 +682,7 @@ public static String getMessage(final Throwable th) {
* @since 2.2
*/
public static String getRootCauseMessage(final Throwable th) {
- Throwable root = ExceptionUtils.getRootCause(th);
+ Throwable root = getRootCause(th);
root = root == null ? th : root;
return getMessage(root);
}
diff --git a/src/main/java/org/apache/commons/lang3/math/Fraction.java b/src/main/java/org/apache/commons/lang3/math/Fraction.java
index e849dcdbff1..a6ef8b3b266 100644
--- a/src/main/java/org/apache/commons/lang3/math/Fraction.java
+++ b/src/main/java/org/apache/commons/lang3/math/Fraction.java
@@ -465,7 +465,7 @@ public Fraction reduce() {
if (gcd == 1) {
return this;
}
- return Fraction.getFraction(numerator / gcd, denominator / gcd);
+ return getFraction(numerator / gcd, denominator / gcd);
}
/**
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index ff5552d5a09..63dd8b3b6a4 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -539,7 +539,7 @@ public static Number createNumber(final String str) {
case 'f' :
case 'F' :
try {
- final Float f = NumberUtils.createFloat(str);
+ final Float f = createFloat(str);
if (!(f.isInfinite() || f.floatValue() == 0.0F && !allZeros)) {
//If it's too big for a float or the float value = 0 and the string
//has non-zeros in it, then float does not have the precision we want
@@ -553,7 +553,7 @@ public static Number createNumber(final String str) {
case 'd' :
case 'D' :
try {
- final Double d = NumberUtils.createDouble(str);
+ final Double d = createDouble(str);
if (!(d.isInfinite() || d.floatValue() == 0.0D && !allZeros)) {
return d;
}
diff --git a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
index 9523858dbea..751e5e0c923 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
@@ -246,11 +246,11 @@ private static float getPrimitivePromotionCost(final Class> srcClass, final Cl
}
static boolean isMatchingMethod(final Method method, final Class>[] parameterTypes) {
- return MemberUtils.isMatchingExecutable(Executable.of(method), parameterTypes);
+ return isMatchingExecutable(Executable.of(method), parameterTypes);
}
static boolean isMatchingConstructor(final Constructor> method, final Class>[] parameterTypes) {
- return MemberUtils.isMatchingExecutable(Executable.of(method), parameterTypes);
+ return isMatchingExecutable(Executable.of(method), parameterTypes);
}
private static boolean isMatchingExecutable(final Executable method, final Class>[] parameterTypes) {
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 a421d5ce46c..037c3a4b79a 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
@@ -1378,7 +1378,7 @@ public static Type unrollVariables(Map, Type> typeArguments, fin
parameterizedTypeArguments = typeArguments;
} else {
parameterizedTypeArguments = new HashMap<>(typeArguments);
- parameterizedTypeArguments.putAll(TypeUtils.getTypeArguments(p));
+ parameterizedTypeArguments.putAll(getTypeArguments(p));
}
final Type[] args = p.getActualTypeArguments();
for (int i = 0; i < args.length; i++) {
@@ -1444,8 +1444,8 @@ public static boolean containsTypeVariables(final Type type) {
}
if (type instanceof WildcardType) {
final WildcardType wild = (WildcardType) type;
- return containsTypeVariables(TypeUtils.getImplicitLowerBounds(wild)[0])
- || containsTypeVariables(TypeUtils.getImplicitUpperBounds(wild)[0]);
+ return containsTypeVariables(getImplicitLowerBounds(wild)[0])
+ || containsTypeVariables(getImplicitUpperBounds(wild)[0]);
}
return false;
}
@@ -1497,7 +1497,7 @@ public static final ParameterizedType parameterizeWithOwner(final Type owner, fi
} else if (owner == null) {
useOwner = raw.getEnclosingClass();
} else {
- Validate.isTrue(TypeUtils.isAssignable(owner, raw.getEnclosingClass()),
+ Validate.isTrue(isAssignable(owner, raw.getEnclosingClass()),
"%s is invalid owner type for parameterized %s", owner, raw);
useOwner = owner;
}
@@ -1732,7 +1732,7 @@ public Type getType() {
* @since 3.2
*/
public static Typed wrap(final Class type) {
- return TypeUtils.wrap((Type) type);
+ return wrap((Type) type);
}
/**
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 db5ed0af1b9..49804a2ed6f 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
@@ -225,7 +225,7 @@ public static String replace(final Object source, final Properties valueProperti
final String propValue = valueProperties.getProperty(propName);
valueMap.put(propName, propValue);
}
- return StrSubstitutor.replace(source, valueMap);
+ return replace(source, valueMap);
}
/**
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 9d708c3ab3e..e917bf90e1a 100644
--- a/src/main/java/org/apache/commons/lang3/time/DateUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/DateUtils.java
@@ -88,7 +88,7 @@ public class DateUtils {
{Calendar.DATE, Calendar.DAY_OF_MONTH, Calendar.AM_PM
/* Calendar.DAY_OF_YEAR, Calendar.DAY_OF_WEEK, Calendar.DAY_OF_WEEK_IN_MONTH */
},
- {Calendar.MONTH, DateUtils.SEMI_MONTH},
+ {Calendar.MONTH, SEMI_MONTH},
{Calendar.YEAR},
{Calendar.ERA}};
@@ -1011,7 +1011,7 @@ private static void modify(final Calendar val, final int field, final ModifyType
if (element == field) {
//This is our field... we stop looping
if (modType == ModifyType.CEILING || modType == ModifyType.ROUND && roundUp) {
- if (field == DateUtils.SEMI_MONTH) {
+ if (field == SEMI_MONTH) {
//This is a special case that's hard to generalize
//If the date is 1, we round up to 16, otherwise
// we subtract 15 days and add 1 month
@@ -1047,7 +1047,7 @@ private static void modify(final Calendar val, final int field, final ModifyType
boolean offsetSet = false;
//These are special types of fields that require different rounding rules
switch (field) {
- case DateUtils.SEMI_MONTH:
+ case SEMI_MONTH:
if (aField[0] == Calendar.DATE) {
//If we're going to drop the DATE field's value,
// we want to do this our own way.
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
index 6a392d232f3..df7af4ebeef 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
@@ -1454,11 +1454,11 @@ private static class Iso8601_Rule implements Rule {
static Iso8601_Rule getRule(final int tokenLen) {
switch(tokenLen) {
case 1:
- return Iso8601_Rule.ISO8601_HOURS;
+ return ISO8601_HOURS;
case 2:
- return Iso8601_Rule.ISO8601_HOURS_MINUTES;
+ return ISO8601_HOURS_MINUTES;
case 3:
- return Iso8601_Rule.ISO8601_HOURS_COLON_MINUTES;
+ return ISO8601_HOURS_COLON_MINUTES;
default:
throw new IllegalArgumentException("invalid number of X");
}
diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
index 7c865ad5200..8ef18f33b81 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
@@ -38,7 +38,7 @@ public final class ImmutablePair extends Pair {
*/
// This is not defined with generics to avoid warnings in call sites.
@SuppressWarnings("rawtypes")
- private static final ImmutablePair NULL = ImmutablePair.of(null, null);
+ private static final ImmutablePair NULL = of(null, null);
/** Serialization version */
private static final long serialVersionUID = 4954918890077093841L;
diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
index 3fd152bfedc..f73bc03c3b7 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
@@ -39,7 +39,7 @@ public final class ImmutableTriple extends Triple {
*/
// This is not defined with generics to avoid warnings in call sites.
@SuppressWarnings("rawtypes")
- private static final ImmutableTriple NULL = ImmutableTriple.of(null, null, null);
+ private static final ImmutableTriple NULL = of(null, null, null);
/** Serialization version */
private static final long serialVersionUID = 1L;
From 77febcfa8d3a5e078330c4911a94e399589734e5 Mon Sep 17 00:00:00 2001
From: Igor Curdvanovschi
Date: Wed, 20 Jun 2018 14:45:54 +0300
Subject: [PATCH 0192/3439] flips the order of conditional expressions and 'if'
statements whose conditions were negated
---
src/main/java/org/apache/commons/lang3/ArchUtils.java | 8 +++-----
src/main/java/org/apache/commons/lang3/BitField.java | 2 +-
.../java/org/apache/commons/lang3/ObjectUtils.java | 6 +++---
.../java/org/apache/commons/lang3/StringUtils.java | 10 +++++-----
.../apache/commons/lang3/builder/CompareToBuilder.java | 6 +++---
.../apache/commons/lang3/builder/EqualsBuilder.java | 10 +++++-----
.../lang3/concurrent/EventCountCircuitBreaker.java | 4 ++--
.../org/apache/commons/lang3/time/FastDateParser.java | 2 +-
.../org/apache/commons/lang3/time/FastDatePrinter.java | 8 ++++----
9 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArchUtils.java b/src/main/java/org/apache/commons/lang3/ArchUtils.java
index 05f2f8ae5cc..4b0d3ff48e3 100644
--- a/src/main/java/org/apache/commons/lang3/ArchUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArchUtils.java
@@ -86,12 +86,10 @@ private static void init_PPC_64Bit() {
* @throws IllegalStateException If the key already exists.
*/
private static void addProcessor(final String key, final Processor processor) {
- if (!ARCH_TO_PROCESSOR.containsKey(key)) {
- ARCH_TO_PROCESSOR.put(key, processor);
- } else {
- final String msg = "Key " + key + " already exists in processor map";
- throw new IllegalStateException(msg);
+ if (ARCH_TO_PROCESSOR.containsKey(key)) {
+ throw new IllegalStateException("Key " + key + " already exists in processor map");
}
+ ARCH_TO_PROCESSOR.put(key, processor);
}
/**
diff --git a/src/main/java/org/apache/commons/lang3/BitField.java b/src/main/java/org/apache/commons/lang3/BitField.java
index bc2147e0b34..dc70df4a5d8 100644
--- a/src/main/java/org/apache/commons/lang3/BitField.java
+++ b/src/main/java/org/apache/commons/lang3/BitField.java
@@ -84,7 +84,7 @@ public class BitField {
*/
public BitField(final int mask) {
_mask = mask;
- _shift_count = mask != 0 ? Integer.numberOfTrailingZeros(mask) : 0;
+ _shift_count = mask == 0 ? 0 : Integer.numberOfTrailingZeros(mask);
}
/**
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index c18e33b4c82..c3b031e52e2 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -689,14 +689,14 @@ public static T clone(final T obj) {
final Object result;
if (obj.getClass().isArray()) {
final Class> componentType = obj.getClass().getComponentType();
- if (!componentType.isPrimitive()) {
- result = ((Object[]) obj).clone();
- } else {
+ if (componentType.isPrimitive()) {
int length = Array.getLength(obj);
result = Array.newInstance(componentType, length);
while (length-- > 0) {
Array.set(result, length, Array.get(obj, length));
}
+ } else {
+ result = ((Object[]) obj).clone();
}
} else {
try {
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index ff06e8ccb52..1d7b9b99335 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -8857,15 +8857,15 @@ public static String normalizeSpace(final String str) {
for (int i = 0; i < size; i++) {
final char actualChar = str.charAt(i);
final boolean isWhitespace = Character.isWhitespace(actualChar);
- if (!isWhitespace) {
- startWhitespaces = false;
- newChars[count++] = (actualChar == 160 ? 32 : actualChar);
- whitespacesCount = 0;
- } else {
+ if (isWhitespace) {
if (whitespacesCount == 0 && !startWhitespaces) {
newChars[count++] = SPACE.charAt(0);
}
whitespacesCount++;
+ } else {
+ startWhitespaces = false;
+ newChars[count++] = (actualChar == 160 ? 32 : actualChar);
+ whitespacesCount = 0;
}
}
if (startWhitespaces) {
diff --git a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
index 0884543b2b3..f4082a90cbf 100644
--- a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
@@ -600,10 +600,10 @@ public CompareToBuilder append(final boolean lhs, final boolean rhs) {
if (lhs == rhs) {
return this;
}
- if (!lhs) {
- comparison = -1;
- } else {
+ if (lhs) {
comparison = +1;
+ } else {
+ comparison = -1;
}
return this;
}
diff --git a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
index 22ad16c06e0..2af57c30951 100644
--- a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
@@ -637,17 +637,17 @@ public EqualsBuilder append(final Object lhs, final Object rhs) {
return this;
}
final Class> lhsClass = lhs.getClass();
- if (!lhsClass.isArray()) {
+ if (lhsClass.isArray()) {
+ // factor out array case in order to keep method small enough
+ // to be inlined
+ appendArray(lhs, rhs);
+ } else {
// The simple case, not an array, just test the element
if (testRecursive && !ClassUtils.isPrimitiveOrWrapper(lhsClass)) {
reflectionAppend(lhs, rhs);
} else {
isEquals = lhs.equals(rhs);
}
- } else {
- // factor out array case in order to keep method small enough
- // to be inlined
- appendArray(lhs, rhs);
}
return this;
}
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
index daac0261421..4a0a2e24052 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
@@ -469,8 +469,8 @@ public long getCheckIntervalStart() {
* @return the updated instance
*/
public CheckIntervalData increment(final int delta) {
- return (delta != 0) ? new CheckIntervalData(getEventCount() + delta,
- getCheckIntervalStart()) : this;
+ return (delta == 0) ? this : new CheckIntervalData(getEventCount() + delta,
+ getCheckIntervalStart());
}
}
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 6f31af38a5a..05eeb47e3f4 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
@@ -958,7 +958,7 @@ int modify(final FastDateParser parser, final int iValue) {
private static final Strategy DAY_OF_WEEK_STRATEGY = new NumberStrategy(Calendar.DAY_OF_WEEK) {
@Override
int modify(final FastDateParser parser, final int iValue) {
- return iValue != 7 ? iValue + 1 : Calendar.SUNDAY;
+ return iValue == 7 ? Calendar.SUNDAY : iValue + 1;
}
};
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
index df7af4ebeef..eaf95e8805c 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
@@ -1266,7 +1266,7 @@ public int estimateLength() {
@Override
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
final int value = calendar.get(Calendar.DAY_OF_WEEK);
- mRule.appendTo(buffer, value != Calendar.SUNDAY ? value - 1 : 7);
+ mRule.appendTo(buffer, value == Calendar.SUNDAY ? 7 : value - 1);
}
@Override
@@ -1369,10 +1369,10 @@ public int estimateLength() {
@Override
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
final TimeZone zone = calendar.getTimeZone();
- if (calendar.get(Calendar.DST_OFFSET) != 0) {
- buffer.append(getTimeZoneDisplay(zone, true, mStyle, mLocale));
- } else {
+ if (calendar.get(Calendar.DST_OFFSET) == 0) {
buffer.append(getTimeZoneDisplay(zone, false, mStyle, mLocale));
+ } else {
+ buffer.append(getTimeZoneDisplay(zone, true, mStyle, mLocale));
}
}
}
From 4aa4291ffc143486757617b743c9670001f8a7cd Mon Sep 17 00:00:00 2001
From: Igor Curdvanovschi
Date: Mon, 25 Jun 2018 21:30:13 +0200
Subject: [PATCH 0193/3439] removes redundant '+' sign
---
.../lang3/builder/CompareToBuilder.java | 40 +++++++++----------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
index f4082a90cbf..688e951560d 100644
--- a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
@@ -414,7 +414,7 @@ public CompareToBuilder append(final Object lhs, final Object rhs, final Compara
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.getClass().isArray()) {
@@ -601,7 +601,7 @@ public CompareToBuilder append(final boolean lhs, final boolean rhs) {
return this;
}
if (lhs) {
- comparison = +1;
+ comparison = 1;
} else {
comparison = -1;
}
@@ -668,11 +668,11 @@ public CompareToBuilder append(final Object[] lhs, final Object[] rhs, final Com
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
@@ -708,11 +708,11 @@ public CompareToBuilder append(final long[] lhs, final long[] rhs) {
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
@@ -748,11 +748,11 @@ public CompareToBuilder append(final int[] lhs, final int[] rhs) {
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
@@ -788,11 +788,11 @@ public CompareToBuilder append(final short[] lhs, final short[] rhs) {
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
@@ -828,11 +828,11 @@ public CompareToBuilder append(final char[] lhs, final char[] rhs) {
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
@@ -868,11 +868,11 @@ public CompareToBuilder append(final byte[] lhs, final byte[] rhs) {
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
@@ -908,11 +908,11 @@ public CompareToBuilder append(final double[] lhs, final double[] rhs) {
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
@@ -948,11 +948,11 @@ public CompareToBuilder append(final float[] lhs, final float[] rhs) {
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
@@ -988,11 +988,11 @@ public CompareToBuilder append(final boolean[] lhs, final boolean[] rhs) {
return this;
}
if (rhs == null) {
- comparison = +1;
+ comparison = 1;
return this;
}
if (lhs.length != rhs.length) {
- comparison = lhs.length < rhs.length ? -1 : +1;
+ comparison = lhs.length < rhs.length ? -1 : 1;
return this;
}
for (int i = 0; i < lhs.length && comparison == 0; i++) {
From ae6a24dd439a7b778e35b484a3a6eae1a8eb64d7 Mon Sep 17 00:00:00 2001
From: Igor Curdvanovschi
Date: Mon, 25 Jun 2018 22:17:41 +0200
Subject: [PATCH 0194/3439] replaces primitive comparison with x.compare()
where x is a wrapper class of the primitive
---
.../apache/commons/lang3/builder/CompareToBuilder.java | 10 +++++-----
.../commons/lang3/builder/CompareToBuilderTest.java | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
index 688e951560d..7d3b3920571 100644
--- a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
@@ -475,7 +475,7 @@ public CompareToBuilder append(final long lhs, final long rhs) {
if (comparison != 0) {
return this;
}
- comparison = lhs < rhs ? -1 : lhs > rhs ? 1 : 0;
+ comparison = Long.compare(lhs, rhs);
return this;
}
@@ -491,7 +491,7 @@ public CompareToBuilder append(final int lhs, final int rhs) {
if (comparison != 0) {
return this;
}
- comparison = lhs < rhs ? -1 : lhs > rhs ? 1 : 0;
+ comparison = Integer.compare(lhs, rhs);
return this;
}
@@ -507,7 +507,7 @@ public CompareToBuilder append(final short lhs, final short rhs) {
if (comparison != 0) {
return this;
}
- comparison = lhs < rhs ? -1 : lhs > rhs ? 1 : 0;
+ comparison = Short.compare(lhs, rhs);
return this;
}
@@ -523,7 +523,7 @@ public CompareToBuilder append(final char lhs, final char rhs) {
if (comparison != 0) {
return this;
}
- comparison = lhs < rhs ? -1 : lhs > rhs ? 1 : 0;
+ comparison = Character.compare(lhs, rhs);
return this;
}
@@ -539,7 +539,7 @@ public CompareToBuilder append(final byte lhs, final byte rhs) {
if (comparison != 0) {
return this;
}
- comparison = lhs < rhs ? -1 : lhs > rhs ? 1 : 0;
+ comparison = Byte.compare(lhs, rhs);
return this;
}
diff --git a/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
index 350b567758b..80ded8a264f 100644
--- a/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
@@ -61,7 +61,7 @@ public int getA() {
}
@Override
public int compareTo(final TestObject rhs) {
- return a < rhs.a ? -1 : a > rhs.a ? +1 : 0;
+ return Integer.compare(a, rhs.a);
}
}
From f56931c176fef5e164b681c740746aebdccccec3 Mon Sep 17 00:00:00 2001
From: Chas Honton
Date: Mon, 2 Jul 2018 20:39:24 -0700
Subject: [PATCH 0195/3439] LANG-1380: FastDateParser too strict on abbreviated
short month symbols
---
src/changes/changes.xml | 3 ++-
.../commons/lang3/time/FastDateParser.java | 18 ++++++++++++++++--
.../commons/lang3/time/FastDateParserTest.java | 13 ++++++++++++-
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4fb91b1862b..3701743778c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ FastDateParser too strict on abbreviated short month symbolsJsonToStringStyle does not escape string namesJsonToStringStyle does not escape double quote in a string valueNew Java version ("11") must be handled
@@ -64,7 +65,7 @@ The type attribute can be add,update,fix,remove.
Improve Javadoc for StringUtils.isAnyEmpty(null)Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)org.apache.commons.lang3.SystemUtils should not write to System.err.
- Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern.
+ Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern.StringUtils.join() with support for List<?> with configurable start/end indices.Methods for getting first non empty or non blank value
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 05eeb47e3f4..ed0301e24f4 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
@@ -448,6 +448,10 @@ private static StringBuilder simpleQuote(final StringBuilder sb, final String va
sb.append(c);
}
}
+ if(sb.charAt(sb.length() - 1) == '.') {
+ // trailing '.' is optional
+ sb.append('?');
+ }
return sb;
}
@@ -713,7 +717,12 @@ private static class CaseInsensitiveTextStrategy extends PatternStrategy {
*/
@Override
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
- final Integer iVal = lKeyValues.get(value.toLowerCase(locale));
+ final String lowerCase = value.toLowerCase(locale);
+ Integer iVal = lKeyValues.get(lowerCase);
+ if(iVal == null) {
+ // match missing the optional trailing period
+ iVal = lKeyValues.get(lowerCase + '.');
+ }
cal.set(field, iVal.intValue());
}
}
@@ -892,7 +901,12 @@ void setCalendar(final FastDateParser parser, final Calendar cal, final String t
if (tz != null) {
cal.setTimeZone(tz);
} else {
- final TzInfo tzInfo = tzNames.get(timeZone.toLowerCase(locale));
+ final String lowerCase = timeZone.toLowerCase(locale);
+ TzInfo tzInfo = tzNames.get(lowerCase);
+ if (tzInfo == null) {
+ // match missing the optional trailing period
+ tzInfo = tzNames.get(lowerCase + '.');
+ }
cal.set(Calendar.DST_OFFSET, tzInfo.dstOffset);
cal.set(Calendar.ZONE_OFFSET, tzInfo.zone.getRawOffset());
}
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
index f9c87473b04..51b7e8d1b33 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
@@ -32,7 +32,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
-
import org.apache.commons.lang3.LocaleUtils;
import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
@@ -717,4 +716,16 @@ public void testDayNumberOfWeek() throws ParseException {
calendar.setTime(parser.parse("7"));
assertEquals(Calendar.SUNDAY, calendar.get(Calendar.DAY_OF_WEEK));
}
+
+ @Test
+ public void testLang1380() throws ParseException {
+ final Calendar expected = Calendar.getInstance(GMT, Locale.FRANCE);
+ expected.clear();
+ expected.set(2014, Calendar.APRIL, 14);
+
+ final DateParser fdp = getInstance("dd MMM yyyy", GMT, Locale.FRANCE);
+ assertEquals(expected.getTime(), fdp.parse("14 avril 2014"));
+ assertEquals(expected.getTime(), fdp.parse("14 avr. 2014"));
+ assertEquals(expected.getTime(), fdp.parse("14 avr 2014"));
+ }
}
From c241b096d32f9ece918466f3614c143e8679dac5 Mon Sep 17 00:00:00 2001
From: pascalschumacher
Date: Tue, 3 Jul 2018 19:17:52 +0200
Subject: [PATCH 0196/3439] Update to commons-parent version 47
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 12760db8680..aafeb246beb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
org.apache.commonscommons-parent
- 46
+ 474.0.0commons-lang3
From 9379d0d36acdf78455e81518b3b1476c7691f056 Mon Sep 17 00:00:00 2001
From: MarkDacek
Date: Sat, 7 Jul 2018 12:45:15 -0400
Subject: [PATCH 0197/3439] LANG-1402: added get methods to ArrayUtils
---
.../org/apache/commons/lang3/ArrayUtils.java | 33 +++++++++++++++++++
.../apache/commons/lang3/ArrayUtilsTest.java | 16 +++++++++
2 files changed, 49 insertions(+)
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index daf9596b9cd..a51726d6058 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -8672,4 +8672,37 @@ public static void shuffle(final double[] array, final Random random) {
swap(array, i - 1, random.nextInt(i), 1);
}
}
+
+ /**
+ * Gets an element from the array if the array is non-null and appropriately long, otherwise returns null
+ *
+ * @param array the array holding the desired object
+ * @param index the index of the object in the array
+ * @return The Object in the array at the index, or null if it is ill-formatted
+ * @since 3.8
+ */
+ public static Object get(Object[] array, int index){
+ return get(array, index, null);
+ }
+
+ /**
+ * Gets an element from the array if the array is non-null and appropriately long, otherwise returns the specified value
+ *
+ * @param array the array holding the desired object
+ * @param index the index of the object in the array
+ * @param defaultReturn the object to be returned if the array is null or shorter than the index
+ * @return The object in the array at the specified index, or the given Object if it is ill-formatted
+ * @since 3.8
+ */
+ public static Object get(Object[] array, int index, Object defaultReturn){
+ if(getLength(array) == 0 || array.length <= index){
+ return defaultReturn;
+ }
+
+ if(index < 0 ){
+ index = 0;
+ }
+
+ return array[index];
+ }
}
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index a853642e19b..25028d0a328 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -5111,4 +5111,20 @@ public void testShuffleDouble() {
assertTrue("Element " + element + " not found", ArrayUtils.contains(array1, element));
}
}
+
+ @Test
+ public void testGet(){
+ assertNull(ArrayUtils.get(null, 0));
+ String[] array = new String[1];
+ assertNull(ArrayUtils.get(array, 1));
+ array[0] = "Hello World";
+ //test with happy path
+ assertNotNull(ArrayUtils.get(array, 0));
+
+ //test with default getter
+ assertEquals("Test", ArrayUtils.get(array, 10, "Test"));
+
+ //negative index
+ assertEquals("Hello World", ArrayUtils.get(array, -1));
+ }
}
From 2521d9619fe1f052ced8ea1107851ac98a1b7488 Mon Sep 17 00:00:00 2001
From: MarkDacek
Date: Sun, 8 Jul 2018 16:15:54 -0400
Subject: [PATCH 0198/3439] refactored to Generics and added isArrayIndexValid
---
.../org/apache/commons/lang3/ArrayUtils.java | 36 +++++++++++++------
.../apache/commons/lang3/ArrayUtilsTest.java | 15 ++++++++
2 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index a51726d6058..c7f73fe75a4 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -8675,26 +8675,26 @@ public static void shuffle(final double[] array, final Random random) {
/**
* Gets an element from the array if the array is non-null and appropriately long, otherwise returns null
- *
- * @param array the array holding the desired object
- * @param index the index of the object in the array
- * @return The Object in the array at the index, or null if it is ill-formatted
+ * @param the component type of the array
+ * @param array the array holding the desired element
+ * @param index the index of the element in the array
+ * @return The element in the array at the index, or null if it is ill-formatted
* @since 3.8
*/
- public static Object get(Object[] array, int index){
+ public static T get(T[] array, int index){
return get(array, index, null);
}
/**
* Gets an element from the array if the array is non-null and appropriately long, otherwise returns the specified value
- *
- * @param array the array holding the desired object
- * @param index the index of the object in the array
+ * @param the component type of the array
+ * @param array the array holding the desired element
+ * @param index the index of the element in the array
* @param defaultReturn the object to be returned if the array is null or shorter than the index
- * @return The object in the array at the specified index, or the given Object if it is ill-formatted
+ * @return The element in the array at the specified index, or the given argument if it is ill-formatted
* @since 3.8
*/
- public static Object get(Object[] array, int index, Object defaultReturn){
+ public static T get(T[] array, int index, T defaultReturn){
if(getLength(array) == 0 || array.length <= index){
return defaultReturn;
}
@@ -8705,4 +8705,20 @@ public static Object get(Object[] array, int index, Object defaultReturn){
return array[index];
}
+
+ /**
+ * Gets an element from the array if the array is non-null and appropriately long, otherwise returns the specified value
+ * @param the component type of the array
+ * @param array the array holding the desired element
+ * @param index the index of the element in the array
+ * @return Whether the given index is safely-accessible in the given array
+ * @since 3.8
+ */
+ public static boolean isArrayIndexValid(T[] array, int index){
+ if(getLength(array) == 0 || array.length <= index){
+ return false;
+ }
+
+ return index >= 0;
+ }
}
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index 25028d0a328..984184cbbfd 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -5127,4 +5127,19 @@ public void testGet(){
//negative index
assertEquals("Hello World", ArrayUtils.get(array, -1));
}
+
+ @Test
+ public void testIsArrayIndexValid(){
+ assertFalse(ArrayUtils.isArrayIndexValid(null, 0));
+ String[] array = new String[1];
+
+ //too big
+ assertFalse(ArrayUtils.isArrayIndexValid(array, 1));
+
+ //negative index
+ assertFalse(ArrayUtils.isArrayIndexValid(array, -1));
+
+ //good to go
+ assertTrue(ArrayUtils.isArrayIndexValid(array, 0));
+ }
}
From 625fbccaa9c42d5efbe4993e9701d8db0b53f5e9 Mon Sep 17 00:00:00 2001
From: MarkDacek
Date: Sun, 8 Jul 2018 19:06:48 -0400
Subject: [PATCH 0199/3439] LANG-1402: Fixed comment
---
src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index c7f73fe75a4..8b7e319e100 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -8707,7 +8707,7 @@ public static T get(T[] array, int index, T defaultReturn){
}
/**
- * Gets an element from the array if the array is non-null and appropriately long, otherwise returns the specified value
+ * Returns whether a given array can safely be accessed at the given index.
* @param the component type of the array
* @param array the array holding the desired element
* @param index the index of the element in the array
From 7721302ae5d70d2986d74ae7e7df648bf849997d Mon Sep 17 00:00:00 2001
From: MarkDacek
Date: Sun, 8 Jul 2018 19:11:19 -0400
Subject: [PATCH 0200/3439] LANG-1402: refactored to return default value on
negative index
---
src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2 +-
src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index 8b7e319e100..7a5f950e681 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -8700,7 +8700,7 @@ public static T get(T[] array, int index, T defaultReturn){
}
if(index < 0 ){
- index = 0;
+ return defaultReturn;
}
return array[index];
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index 984184cbbfd..0121473cc27 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -5125,7 +5125,7 @@ public void testGet(){
assertEquals("Test", ArrayUtils.get(array, 10, "Test"));
//negative index
- assertEquals("Hello World", ArrayUtils.get(array, -1));
+ assertEquals("Default", ArrayUtils.get(array, -1, "Default"));
}
@Test
From 96f3ab841096b6a480b4cae99bb05aebce1ff92d Mon Sep 17 00:00:00 2001
From: MarkDacek
Date: Sun, 8 Jul 2018 19:20:48 -0400
Subject: [PATCH 0201/3439] LANG-1402: comment proofread
---
src/main/java/org/apache/commons/lang3/ArrayUtils.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index 7a5f950e681..3d5c6b02083 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -8675,7 +8675,7 @@ public static void shuffle(final double[] array, final Random random) {
/**
* Gets an element from the array if the array is non-null and appropriately long, otherwise returns null
- * @param the component type of the array
+ * @param the component type of the array, may be null
* @param array the array holding the desired element
* @param index the index of the element in the array
* @return The element in the array at the index, or null if it is ill-formatted
@@ -8688,10 +8688,10 @@ public static T get(T[] array, int index){
/**
* Gets an element from the array if the array is non-null and appropriately long, otherwise returns the specified value
* @param the component type of the array
- * @param array the array holding the desired element
+ * @param array the array holding the desired element, may be null
* @param index the index of the element in the array
* @param defaultReturn the object to be returned if the array is null or shorter than the index
- * @return The element in the array at the specified index, or the given argument if it is ill-formatted
+ * @return The element in the array at the specified index, or the given argument if it the array is not sufficiently long for the index. May return null if the array contains null
* @since 3.8
*/
public static T get(T[] array, int index, T defaultReturn){
@@ -8709,8 +8709,8 @@ public static T get(T[] array, int index, T defaultReturn){
/**
* Returns whether a given array can safely be accessed at the given index.
* @param the component type of the array
- * @param array the array holding the desired element
- * @param index the index of the element in the array
+ * @param array the array to inspect
+ * @param index the index of the array to be inspected
* @return Whether the given index is safely-accessible in the given array
* @since 3.8
*/
From ec2ec774925cb845f85a82f85c32d0019de31f01 Mon Sep 17 00:00:00 2001
From: MarkDacek
Date: Sun, 8 Jul 2018 19:35:13 -0400
Subject: [PATCH 0202/3439] LANG-1402: more comment proofreading
---
src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index 3d5c6b02083..9ed6b684f03 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -8678,7 +8678,7 @@ public static void shuffle(final double[] array, final Random random) {
* @param the component type of the array, may be null
* @param array the array holding the desired element
* @param index the index of the element in the array
- * @return The element in the array at the index, or null if it is ill-formatted
+ * @return The element in the array at the index, or null if the array is not sufficiently long for the index. May return null if the array contains null
* @since 3.8
*/
public static T get(T[] array, int index){
From 1cec9a6fe588c047daa6c711814453840405561b Mon Sep 17 00:00:00 2001
From: Sebb
Date: Fri, 13 Jul 2018 15:05:35 +0100
Subject: [PATCH 0203/3439] Raw Types
---
src/test/java/org/apache/commons/lang3/StringUtilsTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index ee3beeb656e..04aecaea752 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -394,14 +394,14 @@ public void testJoin_List() {
assertEquals("foo/2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, "/", 0, 2));
assertEquals("2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, "/", 1, 2));
assertEquals("", StringUtils.join(MIXED_TYPE_OBJECT_LIST, "/", 2, 1));
- assertNull(null, StringUtils.join((List) null, "/", 0, 1));
+ assertNull(null, StringUtils.join((List>) null, "/", 0, 1));
assertEquals("/", StringUtils.join(MIXED_STRING_LIST, '/', 0, MIXED_STRING_LIST.size() - 1));
assertEquals("foo", StringUtils.join(MIXED_TYPE_OBJECT_LIST, '/', 0, 1));
assertEquals("foo/2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, '/', 0, 2));
assertEquals("2", StringUtils.join(MIXED_TYPE_OBJECT_LIST, '/', 1, 2));
assertEquals("", StringUtils.join(MIXED_TYPE_OBJECT_LIST, '/', 2, 1));
- assertNull(null, StringUtils.join((List) null, '/', 0, 1));
+ assertNull(null, StringUtils.join((List>) null, '/', 0, 1));
}
@Test
From 2cad60b6c25c87a6a59d3d315ec7d72c552fbc58 Mon Sep 17 00:00:00 2001
From: MarkDacek
Date: Sat, 14 Jul 2018 15:42:14 -0400
Subject: [PATCH 0204/3439] removed ArrayUtils.get
---
.../org/apache/commons/lang3/ArrayUtils.java | 33 -------------------
.../apache/commons/lang3/ArrayUtilsTest.java | 16 ---------
2 files changed, 49 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index 9ed6b684f03..f6b1131c821 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -8673,39 +8673,6 @@ public static void shuffle(final double[] array, final Random random) {
}
}
- /**
- * Gets an element from the array if the array is non-null and appropriately long, otherwise returns null
- * @param the component type of the array, may be null
- * @param array the array holding the desired element
- * @param index the index of the element in the array
- * @return The element in the array at the index, or null if the array is not sufficiently long for the index. May return null if the array contains null
- * @since 3.8
- */
- public static T get(T[] array, int index){
- return get(array, index, null);
- }
-
- /**
- * Gets an element from the array if the array is non-null and appropriately long, otherwise returns the specified value
- * @param the component type of the array
- * @param array the array holding the desired element, may be null
- * @param index the index of the element in the array
- * @param defaultReturn the object to be returned if the array is null or shorter than the index
- * @return The element in the array at the specified index, or the given argument if it the array is not sufficiently long for the index. May return null if the array contains null
- * @since 3.8
- */
- public static T get(T[] array, int index, T defaultReturn){
- if(getLength(array) == 0 || array.length <= index){
- return defaultReturn;
- }
-
- if(index < 0 ){
- return defaultReturn;
- }
-
- return array[index];
- }
-
/**
* Returns whether a given array can safely be accessed at the given index.
* @param the component type of the array
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index 0121473cc27..335b9a4a5cc 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -5112,22 +5112,6 @@ public void testShuffleDouble() {
}
}
- @Test
- public void testGet(){
- assertNull(ArrayUtils.get(null, 0));
- String[] array = new String[1];
- assertNull(ArrayUtils.get(array, 1));
- array[0] = "Hello World";
- //test with happy path
- assertNotNull(ArrayUtils.get(array, 0));
-
- //test with default getter
- assertEquals("Test", ArrayUtils.get(array, 10, "Test"));
-
- //negative index
- assertEquals("Default", ArrayUtils.get(array, -1, "Default"));
- }
-
@Test
public void testIsArrayIndexValid(){
assertFalse(ArrayUtils.isArrayIndexValid(null, 0));
From 0020780ddd4d5697d787272ae1788ca2d73e3929 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 15 Jul 2018 23:00:39 -0600
Subject: [PATCH 0205/3439] Prepare for release 3.8.
---
CONTRIBUTING.md | 42 +++++++++++++++++-------
NOTICE.txt | 3 --
README.md | 27 +++++++--------
RELEASE-NOTES.txt | 1 +
src/site/xdoc/download_lang.xml | 56 ++++++++++++++++----------------
src/site/xdoc/issue-tracking.xml | 30 ++++++++---------
src/site/xdoc/mail-lists.xml | 47 ++++++++++++++-------------
7 files changed, 113 insertions(+), 93 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b1a2f368938..cf6b5657134 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -50,48 +50,66 @@ Getting Started
+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
-+ If you're planning to implement a new feature it makes sense to discuss you're changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons Lang's scope.
-+ Submit a ticket for your issue, assuming one does not already exist.
++ If you're planning to implement a new feature it makes sense to discuss your changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons Lang's scope.
++ Submit a [Jira Ticket][jira] for your issue, assuming one does not already exist.
+ Clearly describe the issue including steps to reproduce when it is a bug.
+ Make sure you fill in the earliest version that you know has the issue.
-+ Fork the repository on GitHub.
++ Find the corresponding [repository on GitHub](https://github.com/apache/?query=commons-),
+[fork](https://help.github.com/articles/fork-a-repo/) and check out your forked repository.
Making Changes
--------------
-+ Create a topic branch from where you want to base your work (this is usually the master/trunk branch).
++ Create a _topic branch_ for your isolated work.
+ * Usually you should base your branch on the `master` or `trunk` branch.
+ * A good topic branch name can be the JIRA bug id plus a keyword, e.g. `LANG-123-InputStream`.
+ * If you have submitted multiple JIRA issues, try to maintain separate branches and pull requests.
+ Make commits of logical units.
+ * Make sure your commit messages are meaningful and in the proper format. Your commit message should contain the key of the JIRA issue.
+ * e.g. `LANG-123: Close input stream earlier`
+ Respect the original code style:
+ Only use spaces for indentation.
- + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
- + Check for unnecessary whitespace with git diff --check before committing.
-+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
-+ Make sure you have added the necessary tests for your changes.
+ + Create minimal diffs - disable _On Save_ actions like _Reformat Source Code_ or _Organize Imports_. If you feel the source code should be reformatted create a separate PR for this change first.
+ + Check for unnecessary whitespace with `git diff` -- check before committing.
++ Make sure you have added the necessary tests for your changes, typically in `src/test/java`.
+ Run all the tests with `mvn clean verify` to assure nothing else was accidentally broken.
Making Trivial Changes
----------------------
+The JIRA tickets are used to generate the changelog for the next release.
+
For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in JIRA.
In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number.
+
Submitting Changes
------------------
-+ Sign the [Contributor License Agreement][cla] if you haven't already.
++ Sign and submit the Apache [Contributor License Agreement][cla] if you haven't already.
+ * Note that small patches & typical bug fixes do not require a CLA as
+ clause 5 of the [Apache License](https://www.apache.org/licenses/LICENSE-2.0.html#contributions)
+ covers them.
+ Push your changes to a topic branch in your fork of the repository.
-+ Submit a pull request to the repository in the apache organization.
++ Submit a _Pull Request_ to the corresponding repository in the `apache` organization.
+ * Verify _Files Changed_ shows only your intended changes and does not
+ include additional files like `target/*.class`
+ Update your JIRA ticket and include a link to the pull request in the ticket.
+If you prefer to not use GitHub, then you can instead use
+`git format-patch` (or `svn diff`) and attach the patch file to the JIRA issue.
+
+
Additional Resources
--------------------
+ [Contributing patches](https://commons.apache.org/patches.html)
-+ [Apache Commons Lang JIRA project page](https://issues.apache.org/jira/browse/LANG)
++ [Apache Commons Lang JIRA project page][jira]
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
-+ #apachecommons IRC channel on freenode.org
++ `#apache-commons` IRC channel on `irc.freenode.net`
[cla]:https://www.apache.org/licenses/#clas
+[jira]:https://issues.apache.org/jira/browse/LANG
diff --git a/NOTICE.txt b/NOTICE.txt
index 45554e2b40b..0f4ac594ae5 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -3,6 +3,3 @@ Copyright 2001-2018 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
-
-This product includes software from the Spring Framework,
-under the Apache License 2.0 (see: StringUtils.containsWhitespace())
diff --git a/README.md b/README.md
index 65fd0dc527a..ba55b3151e3 100644
--- a/README.md
+++ b/README.md
@@ -43,10 +43,10 @@
Apache Commons Lang
===================
-[](https://travis-ci.org/apache/commons-lang)
-[](https://coveralls.io/r/apache/commons-lang)
+[](https://travis-ci.org/apache/commons-lang3)
+[](https://coveralls.io/r/apache/commons-lang3)
[](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-lang3/)
-[](https://javadoc.io/doc/org.apache.commons/commons-lang3/3.7)
+[](https://javadoc.io/doc/org.apache.commons/commons-lang3/3.8)
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
@@ -55,13 +55,13 @@ Apache Commons Lang, a package of Java utility classes for the
Documentation
-------------
-More information can be found on the [homepage](https://commons.apache.org/proper/commons-lang).
-The [Javadoc](https://commons.apache.org/proper/commons-lang/javadocs/api-release) can be browsed.
+More information can be found on the [Apache Commons Lang homepage](https://commons.apache.org/proper/commons-lang3).
+The [Javadoc](https://commons.apache.org/proper/commons-lang3/javadocs/api-release) can be browsed.
Questions related to the usage of Apache Commons Lang should be posted to the [user mailing list][ml].
Where can I get the latest release?
-----------------------------------
-You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-lang/download_lang.cgi).
+You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-lang3/download_lang3.cgi).
Alternatively you can pull it from the central Maven repositories:
@@ -69,14 +69,14 @@ Alternatively you can pull it from the central Maven repositories:
org.apache.commonscommons-lang3
- 3.7
+ 3.8
```
Contributing
------------
-We accept PRs via github. The [developer mailing list][ml] is the main channel of communication for contributors.
+We accept Pull Requests via GitHub. The [developer mailing list][ml] is the main channel of communication for contributors.
There are some guidelines which will make applying PRs easier for us:
+ No tabs! Please use spaces for indentation.
+ Respect the code style.
@@ -88,7 +88,9 @@ You can learn more about contributing via GitHub in our [contribution guidelines
License
-------
-Code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0.txt).
+This code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0).
+
+See the `NOTICE.txt` file for required notices and attributions.
Donations
---------
@@ -97,10 +99,9 @@ You like Apache Commons Lang? Then [donate back to the ASF](https://www.apache.o
Additional Resources
--------------------
-+ [Apache Commons Lang Homepage](https://commons.apache.org/proper/commons-lang)
-+ [Apache Commons Lang Bugtracker (JIRA)](https://issues.apache.org/jira/browse/LANG)
++ [Apache Commons Homepage](https://commons.apache.org/)
++ [Apache Issue Tracker (JIRA)](https://issues.apache.org/jira/browse/LANG)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
-+ #apachecommons IRC channel on freenode.org
++ `#apache-commons` IRC channel on `irc.freenode.org`
[ml]:https://commons.apache.org/mail-lists.html
-
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 950df0767d9..99e9a51be65 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -14,6 +14,7 @@ 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.
+=============================================================================
Apache Commons Lang
Version 3.7
diff --git a/src/site/xdoc/download_lang.xml b/src/site/xdoc/download_lang.xml
index e9c95b1d0fb..52704a78dc8 100644
--- a/src/site/xdoc/download_lang.xml
+++ b/src/site/xdoc/download_lang.xml
@@ -102,7 +102,7 @@ limitations under the License.
It is essential that you
verify the integrity
of downloaded files, preferably using the PGP signature (*.asc files);
- failing that using the MD5 hash (*.md5 checksum files).
+ failing that using the SHA1 hash (*.sha1 checksum files).
The KEYS
@@ -111,32 +111,32 @@ limitations under the License.
- To use JIRA you may need to create an account
+ To use JIRA you may need to create an account
(if you have previously created/updated Commons issues using Bugzilla an account will have been automatically
- created and you can use the Forgot Password
+ created and you can use the Forgot Password
page to get a new password).
If you would like to report a bug, or raise an enhancement request with
- Commons Lang please do the following:
+ Apache Commons Lang please do the following:
diff --git a/src/site/xdoc/mail-lists.xml b/src/site/xdoc/mail-lists.xml
index bbd0168348f..e0abee17ba9 100644
--- a/src/site/xdoc/mail-lists.xml
+++ b/src/site/xdoc/mail-lists.xml
@@ -41,42 +41,45 @@ limitations under the License.
-->
- Commons Lang Mailing Lists
- Commons Documentation Team
+ Apache Commons Lang Mailing Lists
+ Apache Commons Documentation Team
- Commons Lang shares mailing lists with all the other
+ Apache Commons Lang shares mailing lists with all the other
Commons Components.
To make it easier for people to only read messages related to components they are interested in,
the convention in Commons is to prefix the subject line of messages with the component's name,
for example:
-
[lang] Problem with the ...
+
[lang3] Problem with the ...
- Questions related to the usage of Commons Lang should be posted to the
+ Questions related to the usage of Apache Commons Lang should be posted to the
User List.
The Developer List
- is for questions and discussion related to the development of Commons Lang.
+ is for questions and discussion related to the development of Apache Commons Lang.
Please do not cross-post; developers are also subscribed to the user list.
+
+ You must be subscribed to post to the mailing lists. Follow the Subscribe links below
+ to subscribe.
Note: please don't send patches or attachments to any of the mailing lists.
- Patches are best handled via the Issue Tracking system.
- Otherwise, please upload the file to a public server and include the URL in the mail.
+ Patches are best handled via the Issue Tracking system.
+ Otherwise, please upload the file to a public server and include the URL in the mail.
-
+
- Please prefix the subject line of any messages for Commons Lang
- with [lang] - thanks!
+ Please prefix the subject line of any messages for Apache Commons Lang
+ with [lang3] - thanks!
@@ -96,12 +99,12 @@ limitations under the License.
Commons User List
- Questions on using Commons Lang.
+ Questions on using Apache Commons Lang.
@@ -74,7 +74,7 @@ Alternatively you can pull it from the central Maven repositories:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.7</version>
+ <version>3.8</version>
</dependency>
From fa66bd94e0c54eec0da1e637416c06fb45fee213 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Mon, 16 Jul 2018 07:58:27 -0600
Subject: [PATCH 0207/3439] Prepare for release 3.8.
---
src/site/xdoc/release-history.xml | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/site/xdoc/release-history.xml b/src/site/xdoc/release-history.xml
index 8244a3e6620..8df2e685686 100644
--- a/src/site/xdoc/release-history.xml
+++ b/src/site/xdoc/release-history.xml
@@ -32,31 +32,34 @@ limitations under the License.
+ *
+ * @param value the BigDecimal to convert, may be null.
+ * @return the double represented by the BigDecimal or
+ * 0.0d if the BigDecimal is null.
+ * @since 3.8
+ */
+ public static double toDouble(BigDecimal value) {
+ return toDouble(value, 0.0d);
+ }
+
+ /**
+ *
Convert a BigDecimal to a double.
+ *
+ *
If the BigDecimalvalue is
+ * null, then the specified default value is returned.
+ *
+ * @param value the BigDecimal to convert, may be null.
+ * @param defaultValue the default value
+ * @return the double represented by the BigDecimal or the
+ * defaultValue if the BigDecimal is null.
+ * @since 3.8
+ */
+ public static double toDouble(BigDecimal value, double defaultValue) {
+ return value == null ? defaultValue : value.doubleValue();
+ }
+
//-----------------------------------------------------------------------
/**
*
Convert a String to a byte, returning
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 b0ed8bb0b7c..c81976502f6 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -163,7 +163,7 @@ public void testStringToDoubleString() {
assertTrue("toDouble(Double.MAX_VALUE) failed", NumberUtils.toDouble(Double.MAX_VALUE+"") == Double.MAX_VALUE);
assertTrue("toDouble(Double.MIN_VALUE) failed", NumberUtils.toDouble(Double.MIN_VALUE+"") == Double.MIN_VALUE);
assertTrue("toDouble(empty) failed", NumberUtils.toDouble("") == 0.0d);
- assertTrue("toDouble(null) failed", NumberUtils.toDouble(null) == 0.0d);
+ assertTrue("toDouble(null) failed", NumberUtils.toDouble((String) null) == 0.0d);
}
/**
@@ -180,6 +180,24 @@ public void testStringToDoubleStringD() {
assertTrue("toDouble(String,int) 7 failed", NumberUtils.toDouble("000.00", 5.1d) == 0d);
}
+ /**
+ * Test for {@link NumberUtils#toDouble(BigDecimal)}
+ */
+ @Test
+ public void testBigIntegerToDoubleBigInteger() {
+ assertTrue("toDouble(BigInteger) 1 failed", NumberUtils.toDouble((BigDecimal) null) == 0.0d);
+ assertTrue("toDouble(BigInteger) 2 failed", NumberUtils.toDouble(BigDecimal.valueOf(8.5d)) == 8.5d);
+ }
+
+ /**
+ * Test for {@link NumberUtils#toDouble(BigDecimal, double)}
+ */
+ @Test
+ public void testBigIntegerToDoubleBigIntegerD() {
+ assertTrue("toDouble(BigInteger) 1 failed", NumberUtils.toDouble((BigDecimal) null, 1.1d) == 1.1d);
+ assertTrue("toDouble(BigInteger) 2 failed", NumberUtils.toDouble(BigDecimal.valueOf(8.5d), 1.1d) == 8.5d);
+ }
+
/**
* Test for {@link NumberUtils#toByte(String)}.
*/
From b31877a46009d5ee52af9b5f737dabe241689931 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Tue, 14 Aug 2018 15:48:19 -0400
Subject: [PATCH 0214/3439] LANG-1408: Rounding utilities for converting to
BigDecimal
---
src/changes/changes.xml | 1 +
.../commons/lang3/math/NumberUtils.java | 162 ++++++++++++++++-
.../commons/lang3/math/NumberUtilsTest.java | 164 ++++++++++++++++++
3 files changed, 325 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ee0471123b4..bbb5f343cfe 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -71,6 +71,7 @@ The type attribute can be add,update,fix,remove.
Methods for getting first non empty or non blank valueRemove checks for java versions below the minimum supported oneNull/index safe get methods for ArrayUtils
+ Rounding utilities for converting to BigDecimal
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index 5d17a5b3946..821ee668c69 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -20,6 +20,7 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.math.RoundingMode;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
@@ -40,6 +41,8 @@ public class NumberUtils {
public static final Integer INTEGER_ZERO = Integer.valueOf(0);
/** Reusable Integer constant for one. */
public static final Integer INTEGER_ONE = Integer.valueOf(1);
+ /** Reusable Integer constant for two */
+ public static final Integer INTEGER_TWO = Integer.valueOf(2);
/** Reusable Integer constant for minus one. */
public static final Integer INTEGER_MINUS_ONE = Integer.valueOf(-1);
/** Reusable Short constant for zero. */
@@ -298,7 +301,7 @@ public static double toDouble(final String str, final double defaultValue) {
* 0.0d if the BigDecimal is null.
* @since 3.8
*/
- public static double toDouble(BigDecimal value) {
+ public static double toDouble(final BigDecimal value) {
return toDouble(value, 0.0d);
}
@@ -319,7 +322,7 @@ public static double toDouble(BigDecimal value) {
* defaultValue if the BigDecimal is null.
* @since 3.8
*/
- public static double toDouble(BigDecimal value, double defaultValue) {
+ public static double toDouble(final BigDecimal value, final double defaultValue) {
return value == null ? defaultValue : value.doubleValue();
}
@@ -422,6 +425,161 @@ public static short toShort(final String str, final short defaultValue) {
}
}
+ /**
+ * Convert a BigDecimal to a BigDecimal with a scale of
+ * two that has been rounded using RoundingMode.HALF_EVEN. If the supplied
+ * value is null, then BigDecimal.ZERO is returned.
+ *
+ *
Note, the scale of a BigDecimal is the number of digits to the right of the
+ * decimal point.
+ *
+ * @param value the BigDecimal to convert, may be null.
+ * @return the scaled, with appropriate rounding, BigDecimal.
+ * @since 3.8
+ */
+ public static BigDecimal toScaledBigDecimal(BigDecimal value) {
+ return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
+ }
+
+ /**
+ * Convert a BigDecimal to a BigDecimal whose scale is the
+ * specified value with a RoundingMode applied. If the input value
+ * is null, we simply return BigDecimal.ZERO.
+ *
+ * @param value the BigDecimal to convert, may be null.
+ * @param scale the number of digits to the right of the decimal point.
+ * @param roundingMode a rounding behavior for numerical operations capable of
+ * discarding precision.
+ * @return the scaled, with appropriate rounding, BigDecimal.
+ * @since 3.8
+ */
+ public static BigDecimal toScaledBigDecimal(BigDecimal value, int scale, RoundingMode roundingMode) {
+ if (value == null) {
+ return BigDecimal.ZERO;
+ }
+ return value.setScale(
+ scale,
+ (roundingMode == null) ? RoundingMode.HALF_EVEN : roundingMode
+ );
+ }
+
+ /**
+ * Convert a Float to a BigDecimal with a scale of
+ * two that has been rounded using RoundingMode.HALF_EVEN. If the supplied
+ * value is null, then BigDecimal.ZERO is returned.
+ *
+ *
Note, the scale of a BigDecimal is the number of digits to the right of the
+ * decimal point.
+ *
+ * @param value the Float to convert, may be null.
+ * @return the scaled, with appropriate rounding, BigDecimal.
+ * @since 3.8
+ */
+ public static BigDecimal toScaledBigDecimal(Float value) {
+ return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
+ }
+
+ /**
+ * Convert a Float to a BigDecimal whose scale is the
+ * specified value with a RoundingMode applied. If the input value
+ * is null, we simply return BigDecimal.ZERO.
+ *
+ * @param value the Float to convert, may be null.
+ * @param scale the number of digits to the right of the decimal point.
+ * @param roundingMode a rounding behavior for numerical operations capable of
+ * discarding precision.
+ * @return the scaled, with appropriate rounding, BigDecimal.
+ * @since 3.8
+ */
+ public static BigDecimal toScaledBigDecimal(Float value, int scale, RoundingMode roundingMode) {
+ if (value == null) {
+ return BigDecimal.ZERO;
+ }
+ return toScaledBigDecimal(
+ BigDecimal.valueOf(value),
+ scale,
+ roundingMode
+ );
+ }
+
+ /**
+ * Convert a Double to a BigDecimal with a scale of
+ * two that has been rounded using RoundingMode.HALF_EVEN. If the supplied
+ * value is null, then BigDecimal.ZERO is returned.
+ *
+ *
Note, the scale of a BigDecimal is the number of digits to the right of the
+ * decimal point.
+ *
+ * @param value the Double to convert, may be null.
+ * @return the scaled, with appropriate rounding, BigDecimal.
+ * @since 3.8
+ */
+ public static BigDecimal toScaledBigDecimal(Double value) {
+ return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
+ }
+
+ /**
+ * Convert a Double to a BigDecimal whose scale is the
+ * specified value with a RoundingMode applied. If the input value
+ * is null, we simply return BigDecimal.ZERO.
+ *
+ * @param value the Double to convert, may be null.
+ * @param scale the number of digits to the right of the decimal point.
+ * @param roundingMode a rounding behavior for numerical operations capable of
+ * discarding precision.
+ * @return the scaled, with appropriate rounding, BigDecimal.
+ * @since 3.8
+ */
+ public static BigDecimal toScaledBigDecimal(Double value, int scale, RoundingMode roundingMode) {
+ if (value == null) {
+ return BigDecimal.ZERO;
+ }
+ return toScaledBigDecimal(
+ BigDecimal.valueOf(value),
+ scale,
+ roundingMode
+ );
+ }
+
+ /**
+ * Convert a String to a BigDecimal with a scale of
+ * two that has been rounded using RoundingMode.HALF_EVEN. If the supplied
+ * value is null, then BigDecimal.ZERO is returned.
+ *
+ *
Note, the scale of a BigDecimal is the number of digits to the right of the
+ * decimal point.
+ *
+ * @param value the String to convert, may be null.
+ * @return the scaled, with appropriate rounding, BigDecimal.
+ * @since 3.8
+ */
+ public static BigDecimal toScaledBigDecimal(String value) {
+ return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
+ }
+
+ /**
+ * Convert a String to a BigDecimal whose scale is the
+ * specified value with a RoundingMode applied. If the input value
+ * is null, we simply return BigDecimal.ZERO.
+ *
+ * @param value the String to convert, may be null.
+ * @param scale the number of digits to the right of the decimal point.
+ * @param roundingMode a rounding behavior for numerical operations capable of
+ * discarding precision.
+ * @return the scaled, with appropriate rounding, BigDecimal.
+ * @since 3.8
+ */
+ public static BigDecimal toScaledBigDecimal(String value, int scale, RoundingMode roundingMode) {
+ if (value == null) {
+ return BigDecimal.ZERO;
+ }
+ return toScaledBigDecimal(
+ createBigDecimal(value),
+ scale,
+ roundingMode
+ );
+ }
+
//-----------------------------------------------------------------------
// must handle Long, Float, Integer, Float, Short,
// BigDecimal, BigInteger and Byte
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 c81976502f6..468d91eee19 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -27,6 +27,7 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.math.RoundingMode;
import org.junit.Test;
/**
@@ -238,6 +239,169 @@ public void testToShortStringI() {
assertTrue("toShort(String,short) 2 failed", NumberUtils.toShort("1234.5", (short) 5) == 5);
}
+ /**
+ * Test for {@link NumberUtils#toScaledBigDecimal(BigDecimal)}.
+ */
+ @Test
+ public void testToScaledBigDecimalBigDecimal() {
+ assertTrue("toScaledBigDecimal(BigDecimal) 1 failed",
+ NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(123.456)).equals(BigDecimal.valueOf(123.46)));
+ // Test RoudingMode.HALF_EVEN default rounding.
+ assertTrue("toScaledBigDecimal(BigDecimal) 2 failed",
+ NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.515)).equals(BigDecimal.valueOf(23.52)));
+ assertTrue("toScaledBigDecimal(BigDecimal) 3 failed",
+ NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525)).equals(BigDecimal.valueOf(23.52)));
+ assertTrue("toScaledBigDecimal(BigDecimal) 4 failed",
+ NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525))
+ .multiply(BigDecimal.valueOf(100)).toString()
+ .equals("2352.00"));
+ assertTrue("toScaledBigDecimal(BigDecimal) 5 failed",
+ NumberUtils.toScaledBigDecimal((BigDecimal) null).equals(BigDecimal.ZERO));
+ }
+
+ /**
+ * Test for {@link NumberUtils#toScaledBigDecimal(BigDecimal, int, RoundingMode)}.
+ */
+ @Test
+ public void testToScaledBigDecimalBigDecimalIRM() {
+ assertTrue("toScaledBigDecimal(BigDecimal, int, RoudingMode) 1 failed",
+ NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(123.456), 1, RoundingMode.CEILING).equals(BigDecimal.valueOf(123.5)));
+ assertTrue("toScaledBigDecimal(BigDecimal, int, RoudingMode) 2 failed",
+ NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.5159), 3, RoundingMode.FLOOR).equals(BigDecimal.valueOf(23.515)));
+ assertTrue("toScaledBigDecimal(BigDecimal, int, RoudingMode) 3 failed",
+ NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525), 2, RoundingMode.HALF_UP).equals(BigDecimal.valueOf(23.53)));
+ assertTrue("toScaledBigDecimal(BigDecimal, int, RoudingMode) 4 failed",
+ NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.521), 4, RoundingMode.HALF_EVEN)
+ .multiply(BigDecimal.valueOf(1000))
+ .toString()
+ .equals("23521.0000"));
+ assertTrue("toScaledBigDecimal(BigDecimal, int, RoudingMode) 5 failed",
+ NumberUtils.toScaledBigDecimal((BigDecimal) null, 2, RoundingMode.HALF_UP).equals(BigDecimal.ZERO));
+ }
+
+ /**
+ * Test for {@link NumberUtils#toScaledBigDecimal(Float)}.
+ */
+ @Test
+ public void testToScaledBigDecimalFloat() {
+ assertTrue("toScaledBigDecimal(Float) 1 failed",
+ NumberUtils.toScaledBigDecimal(Float.valueOf(123.456f)).equals(BigDecimal.valueOf(123.46)));
+ // Test RoudingMode.HALF_EVEN default rounding.
+ assertTrue("toScaledBigDecimal(Float) 2 failed",
+ NumberUtils.toScaledBigDecimal(Float.valueOf(23.515f)).equals(BigDecimal.valueOf(23.51)));
+ // Note. NumberUtils.toScaledBigDecimal(Float.valueOf(23.515f)).equals(BigDecimal.valueOf(23.51))
+ // because of roundoff error. It is ok.
+ assertTrue("toScaledBigDecimal(Float) 3 failed",
+ NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f)).equals(BigDecimal.valueOf(23.52)));
+ assertTrue("toScaledBigDecimal(Float) 4 failed",
+ NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f))
+ .multiply(BigDecimal.valueOf(100)).toString()
+ .equals("2352.00"));
+ assertTrue("toScaledBigDecimal(Float) 5 failed",
+ NumberUtils.toScaledBigDecimal((Float) null).equals(BigDecimal.ZERO));
+ }
+
+ /**
+ * Test for {@link NumberUtils#toScaledBigDecimal(Float, int, RoundingMode)}.
+ */
+ @Test
+ public void testToScaledBigDecimalFloatIRM() {
+ assertTrue("toScaledBigDecimal(Float, int, RoudingMode) 1 failed",
+ NumberUtils.toScaledBigDecimal(Float.valueOf(123.456f), 1, RoundingMode.CEILING).equals(BigDecimal.valueOf(123.5)));
+ assertTrue("toScaledBigDecimal(Float, int, RoudingMode) 2 failed",
+ NumberUtils.toScaledBigDecimal(Float.valueOf(23.5159f), 3, RoundingMode.FLOOR).equals(BigDecimal.valueOf(23.515)));
+ // The following happens due to roundoff error. We're ok with this.
+ assertTrue("toScaledBigDecimal(Float, int, RoudingMode) 3 failed",
+ NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f), 2, RoundingMode.HALF_UP).equals(BigDecimal.valueOf(23.52)));
+ assertTrue("toScaledBigDecimal(Float, int, RoudingMode) 4 failed",
+ NumberUtils.toScaledBigDecimal(Float.valueOf(23.521f), 4, RoundingMode.HALF_EVEN)
+ .multiply(BigDecimal.valueOf(1000))
+ .toString()
+ .equals("23521.0000"));
+ assertTrue("toScaledBigDecimal(Float, int, RoudingMode) 5 failed",
+ NumberUtils.toScaledBigDecimal((Float) null, 2, RoundingMode.HALF_UP).equals(BigDecimal.ZERO));
+ }
+
+ /**
+ * Test for {@link NumberUtils#toScaledBigDecimal(Double)}.
+ */
+ @Test
+ public void testToScaledBigDecimalDouble() {
+ assertTrue("toScaledBigDecimal(Double) 1 failed",
+ NumberUtils.toScaledBigDecimal(Double.valueOf(123.456d)).equals(BigDecimal.valueOf(123.46)));
+ // Test RoudingMode.HALF_EVEN default rounding.
+ assertTrue("toScaledBigDecimal(Double) 2 failed",
+ NumberUtils.toScaledBigDecimal(Double.valueOf(23.515d)).equals(BigDecimal.valueOf(23.52)));
+ assertTrue("toScaledBigDecimal(Double) 3 failed",
+ NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d)).equals(BigDecimal.valueOf(23.52)));
+ assertTrue("toScaledBigDecimal(Double) 4 failed",
+ NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d))
+ .multiply(BigDecimal.valueOf(100)).toString()
+ .equals("2352.00"));
+ assertTrue("toScaledBigDecimal(Double) 5 failed",
+ NumberUtils.toScaledBigDecimal((Double) null).equals(BigDecimal.ZERO));
+ }
+
+ /**
+ * Test for {@link NumberUtils#toScaledBigDecimal(Double, int, RoundingMode)}.
+ */
+ @Test
+ public void testToScaledBigDecimalDoubleIRM() {
+ assertTrue("toScaledBigDecimal(Double, int, RoudingMode) 1 failed",
+ NumberUtils.toScaledBigDecimal(Double.valueOf(123.456d), 1, RoundingMode.CEILING).equals(BigDecimal.valueOf(123.5)));
+ assertTrue("toScaledBigDecimal(Double, int, RoudingMode) 2 failed",
+ NumberUtils.toScaledBigDecimal(Double.valueOf(23.5159d), 3, RoundingMode.FLOOR).equals(BigDecimal.valueOf(23.515)));
+ assertTrue("toScaledBigDecimal(Double, int, RoudingMode) 3 failed",
+ NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d), 2, RoundingMode.HALF_UP).equals(BigDecimal.valueOf(23.53)));
+ assertTrue("toScaledBigDecimal(Double, int, RoudingMode) 4 failed",
+ NumberUtils.toScaledBigDecimal(Double.valueOf(23.521d), 4, RoundingMode.HALF_EVEN)
+ .multiply(BigDecimal.valueOf(1000))
+ .toString()
+ .equals("23521.0000"));
+ assertTrue("toScaledBigDecimal(Double, int, RoudingMode) 5 failed",
+ NumberUtils.toScaledBigDecimal((Double) null, 2, RoundingMode.HALF_UP).equals(BigDecimal.ZERO));
+ }
+
+ /**
+ * Test for {@link NumberUtils#toScaledBigDecimal(Double)}.
+ */
+ @Test
+ public void testToScaledBigDecimalString() {
+ assertTrue("toScaledBigDecimal(String) 1 failed",
+ NumberUtils.toScaledBigDecimal("123.456").equals(BigDecimal.valueOf(123.46)));
+ // Test RoudingMode.HALF_EVEN default rounding.
+ assertTrue("toScaledBigDecimal(String) 2 failed",
+ NumberUtils.toScaledBigDecimal("23.515").equals(BigDecimal.valueOf(23.52)));
+ assertTrue("toScaledBigDecimal(String) 3 failed",
+ NumberUtils.toScaledBigDecimal("23.525").equals(BigDecimal.valueOf(23.52)));
+ assertTrue("toScaledBigDecimal(String) 4 failed",
+ NumberUtils.toScaledBigDecimal("23.525")
+ .multiply(BigDecimal.valueOf(100)).toString()
+ .equals("2352.00"));
+ assertTrue("toScaledBigDecimal(String) 5 failed",
+ NumberUtils.toScaledBigDecimal((String) null).equals(BigDecimal.ZERO));
+ }
+
+ /**
+ * Test for {@link NumberUtils#toScaledBigDecimal(Double, int, RoundingMode)}.
+ */
+ @Test
+ public void testToScaledBigDecimalStringIRM() {
+ assertTrue("toScaledBigDecimal(String, int, RoudingMode) 1 failed",
+ NumberUtils.toScaledBigDecimal("123.456", 1, RoundingMode.CEILING).equals(BigDecimal.valueOf(123.5)));
+ assertTrue("toScaledBigDecimal(String, int, RoudingMode) 2 failed",
+ NumberUtils.toScaledBigDecimal("23.5159", 3, RoundingMode.FLOOR).equals(BigDecimal.valueOf(23.515)));
+ assertTrue("toScaledBigDecimal(String, int, RoudingMode) 3 failed",
+ NumberUtils.toScaledBigDecimal("23.525", 2, RoundingMode.HALF_UP).equals(BigDecimal.valueOf(23.53)));
+ assertTrue("toScaledBigDecimal(String, int, RoudingMode) 4 failed",
+ NumberUtils.toScaledBigDecimal("23.521", 4, RoundingMode.HALF_EVEN)
+ .multiply(BigDecimal.valueOf(1000))
+ .toString()
+ .equals("23521.0000"));
+ assertTrue("toScaledBigDecimal(String, int, RoudingMode) 5 failed",
+ NumberUtils.toScaledBigDecimal((String) null, 2, RoundingMode.HALF_UP).equals(BigDecimal.ZERO));
+ }
+
@Test
public void testCreateNumber() {
// a lot of things can go wrong
From 4f4e2b064e98ce1abce98428965f8eed86f4543e Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Tue, 14 Aug 2018 15:53:09 -0400
Subject: [PATCH 0215/3439] LANG-1408: add final to method params
---
.../apache/commons/lang3/math/NumberUtils.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index 821ee668c69..2522acadc3c 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -437,7 +437,7 @@ public static short toShort(final String str, final short defaultValue) {
* @return the scaled, with appropriate rounding, BigDecimal.
* @since 3.8
*/
- public static BigDecimal toScaledBigDecimal(BigDecimal value) {
+ public static BigDecimal toScaledBigDecimal(final BigDecimal value) {
return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
}
@@ -453,7 +453,7 @@ public static BigDecimal toScaledBigDecimal(BigDecimal value) {
* @return the scaled, with appropriate rounding, BigDecimal.
* @since 3.8
*/
- public static BigDecimal toScaledBigDecimal(BigDecimal value, int scale, RoundingMode roundingMode) {
+ public static BigDecimal toScaledBigDecimal(final BigDecimal value, final int scale, final RoundingMode roundingMode) {
if (value == null) {
return BigDecimal.ZERO;
}
@@ -475,7 +475,7 @@ public static BigDecimal toScaledBigDecimal(BigDecimal value, int scale, Roundin
* @return the scaled, with appropriate rounding, BigDecimal.
* @since 3.8
*/
- public static BigDecimal toScaledBigDecimal(Float value) {
+ public static BigDecimal toScaledBigDecimal(final Float value) {
return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
}
@@ -491,7 +491,7 @@ public static BigDecimal toScaledBigDecimal(Float value) {
* @return the scaled, with appropriate rounding, BigDecimal.
* @since 3.8
*/
- public static BigDecimal toScaledBigDecimal(Float value, int scale, RoundingMode roundingMode) {
+ public static BigDecimal toScaledBigDecimal(final Float value, final int scale, final RoundingMode roundingMode) {
if (value == null) {
return BigDecimal.ZERO;
}
@@ -514,7 +514,7 @@ public static BigDecimal toScaledBigDecimal(Float value, int scale, RoundingMode
* @return the scaled, with appropriate rounding, BigDecimal.
* @since 3.8
*/
- public static BigDecimal toScaledBigDecimal(Double value) {
+ public static BigDecimal toScaledBigDecimal(final Double value) {
return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
}
@@ -530,7 +530,7 @@ public static BigDecimal toScaledBigDecimal(Double value) {
* @return the scaled, with appropriate rounding, BigDecimal.
* @since 3.8
*/
- public static BigDecimal toScaledBigDecimal(Double value, int scale, RoundingMode roundingMode) {
+ public static BigDecimal toScaledBigDecimal(final Double value, final int scale, final RoundingMode roundingMode) {
if (value == null) {
return BigDecimal.ZERO;
}
@@ -553,7 +553,7 @@ public static BigDecimal toScaledBigDecimal(Double value, int scale, RoundingMod
* @return the scaled, with appropriate rounding, BigDecimal.
* @since 3.8
*/
- public static BigDecimal toScaledBigDecimal(String value) {
+ public static BigDecimal toScaledBigDecimal(final String value) {
return toScaledBigDecimal(value, INTEGER_TWO, RoundingMode.HALF_EVEN);
}
@@ -569,7 +569,7 @@ public static BigDecimal toScaledBigDecimal(String value) {
* @return the scaled, with appropriate rounding, BigDecimal.
* @since 3.8
*/
- public static BigDecimal toScaledBigDecimal(String value, int scale, RoundingMode roundingMode) {
+ public static BigDecimal toScaledBigDecimal(final String value, final int scale, final RoundingMode roundingMode) {
if (value == null) {
return BigDecimal.ZERO;
}
From c1bdcb27a5e9afe1bc9c5964285022857f1e7c70 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Tue, 14 Aug 2018 16:01:55 -0400
Subject: [PATCH 0216/3439] (fix) README.md badges
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index ba55b3151e3..5c794aff836 100644
--- a/README.md
+++ b/README.md
@@ -43,8 +43,8 @@
Apache Commons Lang
===================
-[](https://travis-ci.org/apache/commons-lang3)
-[](https://coveralls.io/r/apache/commons-lang3)
+[](https://travis-ci.org/apache/commons-lang)
+[](https://coveralls.io/r/apache/commons-lang)
[](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-lang3/)
[](https://javadoc.io/doc/org.apache.commons/commons-lang3/3.8)
From cf406e5629f8fda4530158ad0b6c9bcdf4a23fdf Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Tue, 14 Aug 2018 21:27:42 -0400
Subject: [PATCH 0217/3439] jmh.version 1.19 -> 1.21
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index aafeb246beb..24455f804cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -591,7 +591,7 @@
3.0.0
- 1.19
+ 1.21benchmarks
From c3de2d69ce9ad778a0bc22971cb8ff36dd0ee062 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Tue, 14 Aug 2018 21:28:13 -0400
Subject: [PATCH 0218/3439] org.easymock:easymock:3.5.1 -> 3.6
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 24455f804cd..d3fa77b3cb8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -525,7 +525,7 @@
org.easymockeasymock
- 3.5.1
+ 3.6test
From 14e7f8db27454c9c364b46d72432c1d92e28ee07 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Tue, 14 Aug 2018 22:08:20 -0400
Subject: [PATCH 0219/3439] Preparing 3.8
---
RELEASE-NOTES.txt | 150 +++++++++++++++++++++----------
pom.xml | 13 ++-
src/site/xdoc/download_lang.xml | 153 ++++++++++++++++----------------
3 files changed, 193 insertions(+), 123 deletions(-)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 99e9a51be65..989e53bf1ac 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -17,13 +17,13 @@ limitations under the License.
=============================================================================
Apache Commons Lang
- Version 3.7
+ Version 3.8
Release Notes
INTRODUCTION:
-This document contains the release notes for the 3.7 version of Apache Commons Lang.
+This document contains the release notes for the 3.8 version of Apache Commons Lang.
Commons Lang is a set of utility functions and reusable components that should be of use in any
Java environment.
@@ -42,6 +42,74 @@ New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
Changes in this version include:
+New features:
+o LANG-1352: EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added Thanks to Ruslan Sibgatullin.
+o LANG-1372: Add ToStringSummary annotation Thanks to Srgio Ozaki.
+o LANG-1356: Add bypass option for classes to recursive and reflective EqualsBuilder Thanks to Yathos UG.
+o LANG-1391: Improve Javadoc for StringUtils.isAnyEmpty(null) Thanks to Sauro Matulli, Oleg Chubaryov.
+o LANG-1393: Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue) Thanks to Gary Gregory.
+o LANG-1394: org.apache.commons.lang3.SystemUtils should not write to System.err. Thanks to Sebb, Gary Gregory.
+o LANG-1238: Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern. Thanks to Christopher Cordeiro, Gary Gregory, Bruno P. Kinoshita, Oleg Chubaryov.
+o LANG-1290: StringUtils.join() with support for List> with configurable start/end indices. Thanks to Jochen Schalanda.
+o LANG-1392: Methods for getting first non empty or non blank value Thanks to Jeff Nelson.
+o LANG-1408: Rounding utilities for converting to BigDecimal
+
+Fixed Bugs:
+o LANG-1380: FastDateParser too strict on abbreviated short month symbols Thanks to Markus Jelsma.
+o LANG-1396: JsonToStringStyle does not escape string names
+o LANG-1395: JsonToStringStyle does not escape double quote in a string value Thanks to Jim Gan.
+o LANG-1384: New Java version ("11") must be handled Thanks to Ian Young.
+o LANG-1364: ExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause exists Thanks to Zheng Xie.
+o LANG-1060: NumberUtils.isNumber assumes number starting with Zero Thanks to Piotr Kosmala.
+o LANG-1375: defaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr) Thanks to Jerry Zhao.
+o LANG-1374: Parsing Json Array failed Thanks to Jaswanth Bala.
+o LANG-1371: Fix TypeUtils#parameterize to work correctly with narrower-typed array Thanks to Dmitry Ovchinnikov.
+o LANG-1370: Fix EventCountCircuitBreaker increment batch Thanks to Andre Dieb.
+o LANG-1385: NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatException Thanks to Rohan Padhye.
+o LANG-1397: WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE. Thanks to Takanobu Asanuma.
+o LANG-1401: Typo in JavaDoc for lastIndexOf Thanks to Roman Golyshev, Alex Mamedov.
+
+Changes:
+o LANG-1367: ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size Thanks to Gary Gregory.
+o LANG-1405: Remove checks for java versions below the minimum supported one Thanks to Lars Grefer.
+o LANG-1402: Null/index safe get methods for ArrayUtils Thanks to Mark Dacek.
+
+
+Historical list of changes: http://commons.apache.org/proper/commons-lang/changes-report.html
+
+For complete information on Apache Commons Lang, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Apache Commons Lang website:
+
+http://commons.apache.org/proper/commons-lang/
+
+=============================================================================
+
+ Apache Commons Lang
+ Version 3.7
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 3.7 version of Apache Commons Lang.
+Commons Lang is a set of utility functions and reusable components that should be of use in any
+Java environment.
+
+Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
+variable arguments, autoboxing, concurrency and formatted output.
+
+For the advice on upgrading from 2.x to 3.x, see the following page:
+
+ http://commons.apache.org/lang/article3_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
+standard as to justify existence in java.lang.
+
+New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
+
+Changes in this version include:
+
New features:
o LANG-1355: TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.) Thanks to Chas Honton.
o LANG-1360: Add methods to ObjectUtils to get various forms of class names in a null-safe manner Thanks to Gary Gregory.
@@ -59,14 +127,6 @@ o LANG-1358: Improve StringUtils#replace throughput Thanks to Stephane Landelle.
o LANG-1346: Remove deprecation from RandomStringUtils
o LANG-1361: ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Thanks to Ana.
-
-Historical list of changes: http://commons.apache.org/proper/commons-lang/changes-report.html
-
-For complete information on Apache Commons Lang, including instructions on how to submit bug reports,
-patches, or suggestions for improvement, see the Apache Apache Commons Lang website:
-
-http://commons.apache.org/proper/commons-lang/
-
=============================================================================
Apache Commons Lang
@@ -174,7 +234,7 @@ o LANG-1034: Add support for recursive comparison to
o LANG-1067: Add a reflection-based variant of DiffBuilder.
o LANG-740: Implementation of a Memomizer. Thanks to James Sawle.
o LANG-1258: Add ArrayUtils#toStringArray method.
- Thanks to IG, Grzegorz Rożniecki.
+ Thanks to IG, Grzegorz Ro?niecki.
o LANG-1160: StringUtils#abbreviate should support 'custom ellipses' parameter.
o LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods.
Thanks to Pierre Templier, Martin Tarjanyi.
@@ -203,7 +263,7 @@ o LANG-1292: WordUtils.wrap throws StringIndexOutOfBoundsException.
o LANG-1287: RandomStringUtils#random can enter infinite loop if end parameter
is to small. Thanks to Ivan Morozov.
o LANG-1285: NullPointerException in FastDateParser$TimeZoneStrategy.
- Thanks to Francesco Chicchiriccò.
+ Thanks to Francesco Chicchiricc.
o LANG-1281: Javadoc of StringUtils.ordinalIndexOf is contradictory.
Thanks to Andreas Lundblad.
o LANG-1188: StringUtils#join(T...): warning: [unchecked] Possible heap
@@ -447,7 +507,7 @@ o LANG-1232: DiffBuilder: Add null check on fieldName when appending Object or
Object[]. Thanks to Nick Manley.
o LANG-1178: ArrayUtils.removeAll(Object array, int... indices) should do the
clone, not its callers. Thanks to Henri Yandell.
-o LANG-1120: StringUtils.stripAccents should remove accents from "Ł" and "ł".
+o LANG-1120: StringUtils.stripAccents should remove accents from "?" and "?".
Thanks to kaching88.
o LANG-1205: NumberUtils.createNumber() behaves inconsistently with
NumberUtils.isNumber(). Thanks to pbrose.
@@ -521,9 +581,9 @@ o LANG-1176: Improve ArrayUtils removeElements time complexity to O(n). Thanks
to Jeffery Yuan.
o LANG-1234: getLevenshteinDistance with a threshold: optimize implementation
if the strings lengths differ more than the threshold. Thanks to
- Jonatan Jönsson.
+ Jonatan Jnsson.
o LANG-1151: Performance improvements for NumberUtils.isParsable. Thanks to
- Juan Pablo Santos Rodríguez.
+ Juan Pablo Santos Rodrguez.
o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
which prevents whole builder to be scalarized. Thanks to
Ruslan Cheremin.
@@ -535,7 +595,7 @@ o LANG-1182: Clarify Javadoc of StringUtils.containsAny(). Thanks to
o LANG-1183: Making replacePattern/removePattern methods null safe in
StringUtils.
o LANG-1057: Replace StringBuilder with String concatenation for better
- optimization. Thanks to Otávio Santana.
+ optimization. Thanks to Otvio Santana.
o LANG-1075: Deprecate SystemUtils.FILE_SEPARATOR and
SystemUtils.PATH_SEPARATOR.
o LANG-979: TypeUtils.parameterizeWithOwner - wrong format descriptor for
@@ -582,13 +642,13 @@ o LANG-1080: Add NoClassNameToStringStyle implementation of ToStringStyle.
Thanks to Innokenty Shuvalov.
o LANG-883: Add StringUtils.containsAny(CharSequence, CharSequence...) method.
Thanks to Daniel Stewart.
-o LANG-1052: Multiline recursive to string style. Thanks to Jan Matèrne.
+o LANG-1052: Multiline recursive to string style. Thanks to Jan Matrne.
o LANG-536: Add isSorted() to ArrayUtils. Thanks to James Sawle.
o LANG-1033: Add StringUtils.countMatches(CharSequence, char)
o LANG-1021: Provide methods to retrieve all fields/methods annotated with a
- specific type. Thanks to Alexander Müller.
+ specific type. Thanks to Alexander Mller.
o LANG-1016: NumberUtils#isParsable method(s). Thanks to
- Juan Pablo Santos Rodríguez.
+ Juan Pablo Santos Rodrguez.
o LANG-999: Add fuzzy String matching logic to StringUtils. Thanks to
Ben Ripkens.
o LANG-994: Add zero copy read method to StrBuilder. Thanks to
@@ -625,9 +685,9 @@ o LANG-1073: Read wrong component type of array in add in ArrayUtils.
Thanks to haiyang li.
o LANG-1077: StringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils.
Thanks to haiyang li.
-o LANG-1072: Duplicated "0x" check in createBigInteger in NumberUtils. Thanks
+o LANG-1072: Duplicated "0x" check in createBigInteger in NumberUtils. Thanks
to haiyang li.
-o LANG-1064: StringUtils.abbreviate description doesn't agree with the
+o LANG-1064: StringUtils.abbreviate description doesn't agree with the
examples. Thanks to B.J. Herbison.
o LANG-1041: Fix MethodUtilsTest so it does not depend on JDK method ordering.
Thanks to Alexandre Bartel.
@@ -658,8 +718,8 @@ o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
Fabian Lange.
-o LANG-1071: Fix wrong examples in Javadoc of
- StringUtils.replaceEachRepeatedly(...),
+o LANG-1071: Fix wrong examples in Javadoc of
+ StringUtils.replaceEachRepeatedly(...),
StringUtils.replaceEach(...) Thanks to Arno Noordover.
o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
uses in performing comparisons
@@ -668,7 +728,7 @@ o LANG-1027: org.apache.commons.lang3.SystemUtils#isJavaVersionAtLeast should
return true by default
o LANG-1026: Bring static method references in StringUtils to consistent style.
Thanks to Alex Yursha.
-o LANG-1017: Use non-ASCII digits in Javadoc examples for
+o LANG-1017: Use non-ASCII digits in Javadoc examples for
StringUtils.isNumeric. Thanks to Christoph Schneegans.
o LANG-1008: Change min/max methods in NumberUtils/IEEE754rUtils from array
input parameters to varargs. Thanks to Thiago Andrade.
@@ -763,12 +823,12 @@ o LANG-943: Test DurationFormatUtilsTest.testEdgeDuration fails in
o LANG-613: ConstructorUtils.getAccessibleConstructor() Does Not Check the
Accessibility of Enclosing Classes
o LANG-951: Fragments are wrong by 1 day when using fragment YEAR or MONTH.
- Thanks to Sebastian Götz.
+ Thanks to Sebastian Gtz.
o LANG-950: FastDateParser does not handle two digit year parsing like
SimpleDateFormat
o LANG-949: FastDateParserTest.testParses does not test FastDateParser
o LANG-915: Wrong locale handling in LocaleUtils.toLocale().
- Thanks to Sergio Fernández.
+ Thanks to Sergio Fernndez.
CHANGES
=========
@@ -795,7 +855,7 @@ o LANG-941: Test failure in LocaleUtilsTest when building with JDK 8
o LANG-942: Test failure in FastDateParserTest and FastDateFormat_ParserTest
when building with JDK8. Thanks to Bruno P. Kinoshita,
Henri Yandell.
-o LANG-938: Build fails with test failures when building with JDK 8
+o LANG-938: Build fails with test failures when building with JDK 8
=============================================================================
@@ -804,7 +864,7 @@ o LANG-938: Build fails with test failures when building with JDK 8
COMPATIBILITY WITH 3.1
========================
-This release introduces backwards incompatible changes in
+This release introduces backwards incompatible changes in
org.apache.commons.lang3.time.FastDateFormat:
o Method 'protected java.util.List parsePattern()' has been removed
o Method 'protected java.lang.String parseToken(java.lang.String, int[])' has
@@ -812,15 +872,15 @@ o Method 'protected java.lang.String parseToken(java.lang.String, int[])' has
o Method 'protected org.apache.commons.lang3.time.FastDateFormat$NumberRule
selectNumberRule(int, int)' has been removed
-These changes were the result of [LANG-462]. It is assumed that this change
+These changes were the result of [LANG-462]. It is assumed that this change
will not break clients as Charles Honton pointed out on 25/Jan/12:
"
- 1. Methods "FastDateFormat$NumberRule selectNumberRule(int, int)" and
+ 1. Methods "FastDateFormat$NumberRule selectNumberRule(int, int)" and
"List parsePattern()" couldn't have been overridden because
NumberRule and Rule were private to FastDateFormat.
- 2. Due to the factory pattern used, it's unlikely other two methods would have
+ 2. Due to the factory pattern used, it's unlikely other two methods would have
been overridden.
- 3. The four methods are highly implementation specific. I consider it a
+ 3. The four methods are highly implementation specific. I consider it a
mistake that the methods were exposed.
"
For more information see https://issues.apache.org/jira/browse/LANG-462.
@@ -855,10 +915,10 @@ o LANG-856: Code refactoring in NumberUtils.
o LANG-855: NumberUtils#createBigInteger does not allow for hex and octal
numbers.
o LANG-854: NumberUtils#createNumber - does not allow for hex numbers to be
- larger than Long.
-o LANG-853: StringUtils join APIs for primitives.
+ larger than Long.
+o LANG-853: StringUtils join APIs for primitives.
o LANG-841: Add StringUtils API to call String.replaceAll in DOTALL a.k.a.
- single-line mode.
+ single-line mode.
o LANG-825: Create StrBuilder APIs similar to
String.format(String, Object...).
o LANG-675: Add Triple class (ternary version of Pair).
@@ -867,7 +927,7 @@ o LANG-462: FastDateFormat supports parse methods.
BUG FIXES
===========
-o LANG-932: Spelling fixes. Thanks to Ville Skyttä.
+o LANG-932: Spelling fixes. Thanks to Ville Skytt.
o LANG-929: OctalUnescaper tried to parse all of \279.
o LANG-928: OctalUnescaper had bugs when parsing octals starting with a zero.
o LANG-905: EqualsBuilder returned true when comparing arrays, even when the
@@ -896,7 +956,7 @@ o LANG-865: LocaleUtils.toLocale does not parse strings starting with an
underscore.
o LANG-858: StringEscapeUtils.escapeJava() and escapeEcmaScript() do not
output the escaped surrogate pairs that are Java parsable.
-o LANG-849: FastDateFormat and FastDatePrinter generates Date objects
+o LANG-849: FastDateFormat and FastDatePrinter generates Date objects
wastefully.
o LANG-845: Spelling fixes.
o LANG-844: Fix examples contained in javadoc of StringUtils.center methods.
@@ -917,7 +977,7 @@ o LANG-805: RandomStringUtils.random(count, 0, 0, false, false, universe,
random) always throws java.lang.ArrayIndexOutOfBoundsException.
o LANG-802: LocaleUtils - unnecessary recursive call in SyncAvoid class.
o LANG-800: Javadoc bug in DateUtils#ceiling for Calendar and Object versions.
-o LANG-788: SerializationUtils throws ClassNotFoundException when cloning
+o LANG-788: SerializationUtils throws ClassNotFoundException when cloning
primitive classes.
o LANG-786: StringUtils equals() relies on undefined behavior.
o LANG-783: Documentation bug: StringUtils.split.
@@ -927,7 +987,7 @@ o LANG-775: TypeUtils.getTypeArguments() misses type arguments for
partially-assigned classes.
o LANG-773: ImmutablePair doc contains nonsense text.
o LANG-772: ClassUtils.PACKAGE_SEPARATOR Javadoc contains garbage text.
-o LANG-765: EventListenerSupport.ProxyInvocationHandler no longer defines
+o LANG-765: EventListenerSupport.ProxyInvocationHandler no longer defines
serialVersionUID.
o LANG-764: StrBuilder is now serializable.
o LANG-761: Fix Javadoc Ant warnings.
@@ -941,7 +1001,7 @@ o LANG-931: Misleading Javadoc comment in StrBuilderReader class. Thanks
to Christoph Schneegans.
o LANG-910: StringUtils.normalizeSpace now handles non-breaking spaces
(Unicode 00A0). Thanks to Timur Yarosh.
-o LANG-804: Redundant check for zero in HashCodeBuilder ctor. Thanks to
+o LANG-804: Redundant check for zero in HashCodeBuilder ctor. Thanks to
Allon Mureinik.
o LANG-884: Simplify FastDateFormat; eliminate boxing.
o LANG-882: LookupTranslator now works with implementations of CharSequence
@@ -968,7 +1028,7 @@ NEW FEATURES
o LANG-801: Add Conversion utility to convert between data types on byte level
o LANG-760: Add API StringUtils.toString(byte[] intput, String charsetName)
-o LANG-756: Add APIs ClassUtils.isPrimitiveWrapper(Class>) and
+o LANG-756: Add APIs ClassUtils.isPrimitiveWrapper(Class>) and
isPrimitiveOrWrapper(Class>)
o LANG-695: SystemUtils.IS_OS_UNIX doesn't recognize FreeBSD as a Unix system
@@ -1052,7 +1112,7 @@ REMOVALS
o LANG-438: Remove @deprecateds.
o LANG-492: Remove code handled now by the JDK.
o LANG-493: Remove code that does not hold enough value to remain.
-o LANG-590: Remove JDK 1.2/1.3 bug handling in
+o LANG-590: Remove JDK 1.2/1.3 bug handling in
StringUtils.indexOf(String, String, int).
o LANG-673: WordUtils.abbreviate() removed
o LANG-691: Removed DateUtils.UTC_TIME_ZONE
@@ -1121,7 +1181,7 @@ o LANG-585: exception.DefaultExceptionContext.getFormattedExceptionMessage
catches Throwable.
o LANG-596: StrSubstitutor should also handle the default properties of a
java.util.Properties class
-o LANG-600: Javadoc is incorrect for public static int
+o LANG-600: Javadoc is incorrect for public static int
lastIndexOf(String str, String searchStr).
o LANG-602: ContextedRuntimeException no longer an 'unchecked' exception.
o LANG-606: EqualsBuilder causes StackOverflowException.
@@ -1129,7 +1189,7 @@ o LANG-608: Some StringUtils methods should take an int character instead of
char to use String API features.
o LANG-617: StringEscapeUtils.escapeXML() can't process UTF-16 supplementary
characters
-o LANG-624: SystemUtils.getJavaVersionAsFloat throws
+o LANG-624: SystemUtils.getJavaVersionAsFloat throws
StringIndexOutOfBoundsException on Android runtime/Dalvik VM
o LANG-629: Charset may not be threadsafe, because the HashSet is not synch.
o LANG-638: NumberUtils createNumber throws a StringIndexOutOfBoundsException
@@ -1167,7 +1227,7 @@ o LANG-716: swapCase and *capitalize speedups.
Historical list of changes: http://commons.apache.org/lang/changes-report.html
For complete information on Commons Lang, including instructions on how to
-submit bug reports, patches, or suggestions for improvement, see the
+submit bug reports, patches, or suggestions for improvement, see the
Apache Commons Lang website:
http://commons.apache.org/lang/
diff --git a/pom.xml b/pom.xml
index d3fa77b3cb8..f08ab949cc5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
4.0.0commons-lang3
- 3.8-SNAPSHOT
+ 3.8Apache Commons Lang2001
@@ -47,7 +47,7 @@
scm:git:http://git-wip-us.apache.org/repos/asf/commons-lang.gitscm:git:https://git-wip-us.apache.org/repos/asf/commons-lang.githttps://git-wip-us.apache.org/repos/asf?p=commons-lang.git
- LANG_3_6
+ LANG_3_8
@@ -593,6 +593,15 @@
1.21benchmarks
+
+
+
+ 3.7
+ RC1
+ true
+ scm:svn:https://dist.apache.org/repos/dist/dev/commons/lang
+ Rob Tompkins
+ B6E73D84EA4FCC47166087253FAAD2CD5ECBB314
diff --git a/src/site/xdoc/download_lang.xml b/src/site/xdoc/download_lang.xml
index 52704a78dc8..dde8775d50c 100644
--- a/src/site/xdoc/download_lang.xml
+++ b/src/site/xdoc/download_lang.xml
@@ -61,82 +61,83 @@ limitations under the License.
-
-
- We recommend you use a mirror to download our release
- builds, but you mustverify the integrity of
- the downloaded files using signatures downloaded from our main
- distribution directories. Recent releases (48 hours) may not yet
- be available from all the mirrors.
-
-
-
- You are currently using [preferred]. If you
- encounter a problem with this mirror, please select another
- mirror. If all mirrors are failing, there are backup
- mirrors (at the end of the mirrors list) that should be
- available.
-
- [if-any logo][end]
-
+
+
+ We recommend you use a mirror to download our release
+ builds, but you mustverify the integrity of
+ the downloaded files using signatures downloaded from our main
+ distribution directories. Recent releases (48 hours) may not yet
+ be available from all the mirrors.
+
-
-
- It is essential that you
- verify the integrity
- of downloaded files, preferably using the PGP signature (*.asc files);
- failing that using the SHA1 hash (*.sha1 checksum files).
-
-
- The KEYS
- file contains the public PGP keys used by Apache Commons developers
- to sign releases.
-
-
+
+
+
+ It is essential that you
+ verify the integrity
+ of downloaded files, preferably using the PGP signature (*.asc files);
+ failing that using the SHA256 hash (*.sha256 checksum files) or
+ SHA1 hash (*.sha1 checksum files).
+
+
+ The KEYS
+ file contains the public PGP keys used by Apache Commons developers
+ to sign releases.
+
From 2abe26c1e4aab2a492619b7e8b2407fa03a67ad3 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Wed, 15 Aug 2018 21:06:00 -0400
Subject: [PATCH 0222/3439] (fix) ensure character encoding in old release
notes remains.
---
RELEASE-NOTES.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 989e53bf1ac..1b5ce02fc18 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -127,6 +127,7 @@ o LANG-1358: Improve StringUtils#replace throughput Thanks to Stephane Landelle.
o LANG-1346: Remove deprecation from RandomStringUtils
o LANG-1361: ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Thanks to Ana.
+
=============================================================================
Apache Commons Lang
From 6a02b5337be09bfba4a0af55f64c44fa46fda5b5 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Wed, 15 Aug 2018 21:16:41 -0400
Subject: [PATCH 0223/3439] (fix) typographical error in JIRA number LANG-1290
-> LANG-1390
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 058e7cdc002..732225a57f4 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -67,7 +67,7 @@ The type attribute can be add,update,fix,remove.
Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)org.apache.commons.lang3.SystemUtils should not write to System.err.Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern.
- StringUtils.join() with support for List<?> with configurable start/end indices.
+ StringUtils.join() with support for List<?> with configurable start/end indices.Methods for getting first non empty or non blank valueRemove checks for java versions below the minimum supported oneNull/index safe get methods for ArrayUtils
From f7d2bdd24db0aa9e8ad44b706c5d60c92b6825ca Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Wed, 15 Aug 2018 21:17:28 -0400
Subject: [PATCH 0224/3439] (fix) release notes LANG-1290 -> LANG-1390 typo
---
RELEASE-NOTES.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 1b5ce02fc18..c62c488890a 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -50,7 +50,7 @@ o LANG-1391: Improve Javadoc for StringUtils.isAnyEmpty(null) Thanks to Sauro Ma
o LANG-1393: Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue) Thanks to Gary Gregory.
o LANG-1394: org.apache.commons.lang3.SystemUtils should not write to System.err. Thanks to Sebb, Gary Gregory.
o LANG-1238: Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern. Thanks to Christopher Cordeiro, Gary Gregory, Bruno P. Kinoshita, Oleg Chubaryov.
-o LANG-1290: StringUtils.join() with support for List> with configurable start/end indices. Thanks to Jochen Schalanda.
+o LANG-1390: StringUtils.join() with support for List> with configurable start/end indices. Thanks to Jochen Schalanda.
o LANG-1392: Methods for getting first non empty or non blank value Thanks to Jeff Nelson.
o LANG-1408: Rounding utilities for converting to BigDecimal
From 9801e2fb9fcbf7ddd19221e9342608940d778f8c Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Wed, 15 Aug 2018 21:32:37 -0400
Subject: [PATCH 0225/3439] Add RELEASE-NOTES-3.8.txt to the site
---
.../release-notes/RELEASE-NOTES-3.8.txt | 1238 +++++++++++++++++
1 file changed, 1238 insertions(+)
create mode 100644 src/site/resources/release-notes/RELEASE-NOTES-3.8.txt
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.8.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.8.txt
new file mode 100644
index 00000000000..c62c488890a
--- /dev/null
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.8.txt
@@ -0,0 +1,1238 @@
+
+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.
+
+=============================================================================
+
+ Apache Commons Lang
+ Version 3.8
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 3.8 version of Apache Commons Lang.
+Commons Lang is a set of utility functions and reusable components that should be of use in any
+Java environment.
+
+Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
+variable arguments, autoboxing, concurrency and formatted output.
+
+For the advice on upgrading from 2.x to 3.x, see the following page:
+
+ http://commons.apache.org/lang/article3_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
+standard as to justify existence in java.lang.
+
+New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
+
+Changes in this version include:
+
+New features:
+o LANG-1352: EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added Thanks to Ruslan Sibgatullin.
+o LANG-1372: Add ToStringSummary annotation Thanks to Srgio Ozaki.
+o LANG-1356: Add bypass option for classes to recursive and reflective EqualsBuilder Thanks to Yathos UG.
+o LANG-1391: Improve Javadoc for StringUtils.isAnyEmpty(null) Thanks to Sauro Matulli, Oleg Chubaryov.
+o LANG-1393: Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue) Thanks to Gary Gregory.
+o LANG-1394: org.apache.commons.lang3.SystemUtils should not write to System.err. Thanks to Sebb, Gary Gregory.
+o LANG-1238: Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern. Thanks to Christopher Cordeiro, Gary Gregory, Bruno P. Kinoshita, Oleg Chubaryov.
+o LANG-1390: StringUtils.join() with support for List> with configurable start/end indices. Thanks to Jochen Schalanda.
+o LANG-1392: Methods for getting first non empty or non blank value Thanks to Jeff Nelson.
+o LANG-1408: Rounding utilities for converting to BigDecimal
+
+Fixed Bugs:
+o LANG-1380: FastDateParser too strict on abbreviated short month symbols Thanks to Markus Jelsma.
+o LANG-1396: JsonToStringStyle does not escape string names
+o LANG-1395: JsonToStringStyle does not escape double quote in a string value Thanks to Jim Gan.
+o LANG-1384: New Java version ("11") must be handled Thanks to Ian Young.
+o LANG-1364: ExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause exists Thanks to Zheng Xie.
+o LANG-1060: NumberUtils.isNumber assumes number starting with Zero Thanks to Piotr Kosmala.
+o LANG-1375: defaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr) Thanks to Jerry Zhao.
+o LANG-1374: Parsing Json Array failed Thanks to Jaswanth Bala.
+o LANG-1371: Fix TypeUtils#parameterize to work correctly with narrower-typed array Thanks to Dmitry Ovchinnikov.
+o LANG-1370: Fix EventCountCircuitBreaker increment batch Thanks to Andre Dieb.
+o LANG-1385: NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatException Thanks to Rohan Padhye.
+o LANG-1397: WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE. Thanks to Takanobu Asanuma.
+o LANG-1401: Typo in JavaDoc for lastIndexOf Thanks to Roman Golyshev, Alex Mamedov.
+
+Changes:
+o LANG-1367: ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size Thanks to Gary Gregory.
+o LANG-1405: Remove checks for java versions below the minimum supported one Thanks to Lars Grefer.
+o LANG-1402: Null/index safe get methods for ArrayUtils Thanks to Mark Dacek.
+
+
+Historical list of changes: http://commons.apache.org/proper/commons-lang/changes-report.html
+
+For complete information on Apache Commons Lang, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Apache Commons Lang website:
+
+http://commons.apache.org/proper/commons-lang/
+
+=============================================================================
+
+ Apache Commons Lang
+ Version 3.7
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 3.7 version of Apache Commons Lang.
+Commons Lang is a set of utility functions and reusable components that should be of use in any
+Java environment.
+
+Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
+variable arguments, autoboxing, concurrency and formatted output.
+
+For the advice on upgrading from 2.x to 3.x, see the following page:
+
+ http://commons.apache.org/lang/article3_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
+standard as to justify existence in java.lang.
+
+New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
+
+Changes in this version include:
+
+New features:
+o LANG-1355: TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.) Thanks to Chas Honton.
+o LANG-1360: Add methods to ObjectUtils to get various forms of class names in a null-safe manner Thanks to Gary Gregory.
+
+Fixed Bugs:
+o LANG-1362: Fix tests DateUtilsTest for Java 9 with en_GB locale Thanks to Stephen Colebourne.
+o LANG-1365: Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10 Thanks to Gary Gregory.
+o LANG-1348: StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf Thanks to mbusso.
+o LANG-1350: ConstructorUtils.invokeConstructor(Class, Object...) regression Thanks to Brett Kail.
+o LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug Thanks to Naman Nigam.
+o LANG-1357: org.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale) Thanks to BruceKuiLiu.
+
+Changes:
+o LANG-1358: Improve StringUtils#replace throughput Thanks to Stephane Landelle.
+o LANG-1346: Remove deprecation from RandomStringUtils
+o LANG-1361: ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Thanks to Ana.
+
+
+=============================================================================
+
+ Apache Commons Lang
+ Version 3.6
+ Release Notes
+
+
+INTRODUCTION:
+
+This document contains the release notes for the 3.6 version of
+Apache Commons Lang as well as a history all changes in the Commons Lang 3.x
+release line. Commons Lang is a set of utility functions and reusable
+components that should be of use in any Java environment. Commons Lang 3.6 at
+least requires Java 7.0. Note that this has changed from Commons Lang 3.5, which
+only required Java 1.6.
+
+For the advice on upgrading from 2.x to 3.x, see the following page:
+
+ http://commons.apache.org/lang/article3_0.html
+
+HIGHLIGHTS
+==========
+
+Some of the highlights in this release include:
+
+o The class org.apache.commons.lang3.concurrent.Memoizer is an implementation
+ of the Memoizer pattern as shown in
+ Goetz, Brian et al. (2006) - Java Concurrency in Practice, p. 108.
+o The class org.apache.commons.lang3.ArchUtils has been added. ArchUtils is
+ a utility class for the "os.arch" system property.
+
+DEPRECATIONS
+============
+
+The Apache Commons Community has recently set up the Commons Text component
+as a home for algorithms working on strings. For this reason most of the string
+focused functionality in Commons Lang has been deprecated and moved to
+Commons Text. This includes:
+
+o All classes in the org.apache.commons.lang3.text and the
+ org.apache.commons.lang3.text.translate packages
+o org.apache.commons.lang3.StringEscapeUtils
+o org.apache.commons.lang3.RandomStringUtils
+o The methods org.apache.commons.lang3.StringUtils.getJaroWinklerDistance and
+ org.apache.commons.lang3.StringUtils.getLevenshteinDistance
+
+For more information see the Commons Text website:
+
+ http://commons.apache.org/text
+
+The class org.apache.commons.lang3.CharEncoding has been deprecated in favor of
+java.nio.charset.StandardCharsets.
+
+The following methods have been deprecated in
+org.apache.commons.lang3.ArrayUtils in favor of the corresponding insert
+methods. Note that the handling for null inputs differs between add and insert.
+
+o add(boolean[], int, boolean) -> insert(int, boolean[], boolean...)
+o add(byte[], int, boolean) -> insert(int, byte[], byte...)
+o add(char[], int, boolean) -> insert(int, char[], char...)
+o add(double[], int, boolean) -> insert(int, double[], double...)
+o add(float[], int, boolean) -> insert(int, float[], float...)
+o add(int[], int, boolean) -> insert(int, int[], int...)
+o add(long[], int, boolean) -> insert(int, long[], long...)
+o add(short[], int, boolean) -> insert(int, short[], short...)
+o add(T[], int, boolean) -> insert(int, T[], T...)
+
+
+COMPATIBILITY WITH JAVA 9
+==================
+
+The MANIFEST.MF now contains an additional entry:
+
+ Automatic-Module-Name: org.apache.commons.lang3
+
+This should make it possible to use Commons Lang 3.6 as a module in the Java 9
+module system. For more information see the corresponding issue and the
+referenced mailing list discussions:
+
+ https://issues.apache.org/jira/browse/LANG-1338
+
+The build problems present in the 3.5 release have been resolved. Building
+Commons Lang 3.6 should work out of the box with the latest Java 9 EA build.
+Please report any Java 9 related issues at:
+
+ https://issues.apache.org/jira/browse/LANG
+
+NEW FEATURES
+============
+
+o LANG-1336: Add NUL Byte To CharUtils. Thanks to Beluga Behr.
+o LANG-1304: Add method in StringUtils to determine if string contains both
+ mixed cased characters. Thanks to Andy Klimczak.
+o LANG-1325: Increase test coverage of ToStringBuilder class to 100%.
+ Thanks to Arshad Basha.
+o LANG-1307: Add a method in StringUtils to extract only digits out of input
+ string. Thanks to Arshad Basha.
+o LANG-1256: Add JMH maven dependencies. Thanks to C0rWin.
+o LANG-1167: Add null filter to ReflectionToStringBuilder.
+ Thanks to Mark Dacek.
+o LANG-1299: Add method for converting string to an array of code points.
+o LANG-660: Add methods to insert arrays into arrays at an index.
+o LANG-1034: Add support for recursive comparison to
+ EqualsBuilder#reflectionEquals. Thanks to Yathos UG.
+o LANG-1067: Add a reflection-based variant of DiffBuilder.
+o LANG-740: Implementation of a Memomizer. Thanks to James Sawle.
+o LANG-1258: Add ArrayUtils#toStringArray method.
+ Thanks to IG, Grzegorz Ro?niecki.
+o LANG-1160: StringUtils#abbreviate should support 'custom ellipses' parameter.
+o LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods.
+ Thanks to Pierre Templier, Martin Tarjanyi.
+o LANG-1313: Add ArchUtils - An utility class for the "os.arch" system property.
+ Thanks to Tomschi.
+o LANG-1272: Add shuffle methods to ArrayUtils.
+o LANG-1317: Add MethodUtils#findAnnotation and extend
+ MethodUtils#getMethodsWithAnnotation for non-public, super-class
+ and interface methods. Thanks to Yasser Zamani.
+o LANG-1331: Add ImmutablePair.nullPair().
+o LANG-1332: Add ImmutableTriple.nullTriple().
+
+FIXED BUGS
+==========
+
+o LANG-1337: Fix test failures in IBM JDK 8 for ToStringBuilderTest.
+o LANG-1319: MultilineRecursiveToStringStyle StackOverflowError when object is
+ an array.
+o LANG-1320: LocaleUtils#toLocale does not support language followed by UN M.49
+ numeric-3 area code followed by variant.
+o LANG-1300: Clarify or improve behaviour of int-based indexOf methods in
+ StringUtils. Thanks to Mark Dacek.
+o LANG-1286: RandomStringUtils random method can overflow and return characters
+ outside of specified range.
+o LANG-1292: WordUtils.wrap throws StringIndexOutOfBoundsException.
+o LANG-1287: RandomStringUtils#random can enter infinite loop if end parameter
+ is to small. Thanks to Ivan Morozov.
+o LANG-1285: NullPointerException in FastDateParser$TimeZoneStrategy.
+ Thanks to Francesco Chicchiricc.
+o LANG-1281: Javadoc of StringUtils.ordinalIndexOf is contradictory.
+ Thanks to Andreas Lundblad.
+o LANG-1188: StringUtils#join(T...): warning: [unchecked] Possible heap
+ pollution from parameterized vararg type T.
+o LANG-1144: Multiple calls of
+ org.apache.commons.lang3.concurrent.LazyInitializer.initialize()
+ are possible. Thanks to Waldemar Maier, Gary Gregory.
+o LANG-1276: StrBuilder#replaceAll ArrayIndexOutOfBoundsException.
+ Thanks to Andy Klimczak.
+o LANG-1278: BooleanUtils javadoc issues. Thanks to Duke Yin.
+o LANG-1070: ArrayUtils#add confusing example in javadoc.
+ Thanks to Paul Pogonyshev.
+o LANG-1271: StringUtils#isAnyEmpty and #isAnyBlank should return false for an
+ empty array. Thanks to Pierre Templier.
+o LANG-1155: Add StringUtils#unwrap. Thanks to Saif Asif, Thiago Andrade.
+o LANG-1311: TypeUtils.toString() doesn't handle primitive and Object arrays
+ correctly. Thanks to Aaron Digulla.
+o LANG-1312: LocaleUtils#toLocale does not support language followed by UN M.49
+ numeric-3 area code.
+o LANG-1265: Build failures when building with Java 9 EA.
+o LANG-1314: javadoc creation broken with Java 8. Thanks to Allon Murienik.
+o LANG-1310: MethodUtils.invokeMethod throws ArrayStoreException if using
+ varargs arguments and smaller types than the method defines.
+ Thanks to Don Jeba.
+
+CHANGES
+=======
+
+o LANG-1338: Add Automatic-Module-Name MANIFEST entry for Java 9
+ compatibility.
+o LANG-1334: Deprecate CharEncoding in favour of
+ java.nio.charset.StandardCharsets.
+o LANG-1110: Implement HashSetvBitSetTest using JMH.
+ Thanks to Bruno P. Kinoshita.
+o LANG-1290: Increase test coverage of org.apache.commons.lang3.ArrayUtils.
+ Thanks to Andrii Abramov.
+o LANG-1274: StrSubstitutor should state its thread safety.
+o LANG-1277: StringUtils#getLevenshteinDistance reduce memory consumption.
+ Thanks to yufcuy.
+o LANG-1279: Update Java requirement from Java 6 to 7.
+o LANG-1143: StringUtils should use toXxxxCase(int) rather than
+ toXxxxCase(char). Thanks to sebb.
+o LANG-1297: Add SystemUtils.getHostName() API.
+o LANG-1301: Moving apache-rat-plugin configuration into pluginManagement.
+ Thanks to Karl Heinz Marbaise.
+o LANG-1316: Deprecate classes/methods moved to commons-text.
+
+=============================================================================
+
+ Release Notes for version 3.5
+
+
+HIGHLIGHTS
+==========
+
+Some of the highlights in this release include:
+
+o Added Java 9 detection to org.apache.commons.lang3.SystemUtils.
+o Support for shifting and swapping elements in
+ org.apache.commons.lang3.ArrayUtils.
+o New methods for generating random strings from different character classes
+ including alphabetic, alpha-numeric and ASCII added to
+ org.apache.commons.lang3.RandomStringUtils.
+o Numerous extensions to org.apache.commons.lang3.StringUtils including
+ null safe compare variants, more remove and replace variants, rotation and
+ truncation.
+o Added org.apache.commons.lang3.ThreadUtils - a utility class to work with
+ instances of java.lang.Thread and java.lang.ThreadGroup.
+o Added annotations @EqualsExclude, @HashCodeExclude and @ToStringEclude to
+ mark fields which should be ignored by the reflective builders in the
+ org.apache.commons.lang3.builder package.
+o Support for various modify and retrieve value use cases added to the classes
+ in org.apache.commons.lang3.mutable.
+
+COMPATIBILITY
+=============
+
+Apache Commons Lang 3.5 is binary compatible with the 3.4 release. Users
+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:
+
+o Added method 'public boolean parse(java.lang.String, java.text.ParsePosition,
+ java.util.Calendar)'
+o Added method 'public java.lang.Appendable format(long, java.lang.Appendable)'
+o Added method 'public java.lang.Appendable format(java.util.Date,
+ java.lang.Appendable)'
+o Added method 'public java.lang.Appendable format(java.util.Calendar,
+ java.lang.Appendable)'
+
+For this reason 3.5 is not strictly source compatible to 3.4. Since the
+DatePrinter interface is not meant to be implemented by clients, this
+change it not considered to cause any problems.
+
+JAVA 9 SUPPORT
+==============
+
+Java 9 introduces a new version-string scheme. Details of this new scheme are
+documented in JEP-223 (http://openjdk.java.net/jeps/223). In order to support
+JEP-223 two classes had to be changed:
+
+o org.apache.commons.lang3.JavaVersion
+ deprecated enum constant JAVA_1_9
+ introduced enum constant JAVA_9
+
+o org.apache.commons.lang3.SystemUtils
+ deprecated constant IS_JAVA_1_9
+ introduced constant IS_JAVA_9
+
+For more information see LANG-1197
+(https://issues.apache.org/jira/browse/LANG-1197). All other APIs are expected
+to work with Java 9.
+
+BUILDING ON JAVA 9
+==================
+
+Java 8 introduced the Unicode Consortium's Common Locale Data Repository as
+alternative source for locale data. Java 9 will use the CLDR provider as
+default provider for locale data (see http://openjdk.java.net/jeps/252). This
+causes an number of locale-sensitive test in Commons Lang to fail. In order
+to build Commons Lang 3.5 on Java 9, the locale provider has to be set to
+'JRE':
+
+ mvn -Djava.locale.providers=JRE clean install
+
+We are currently investigating ways to support building on Java 9 without
+further configuration. For more information see:
+https://issues.apache.org/jira/browse/LANG-1265
+
+
+NEW FEATURES
+==============
+
+o LANG-1275: Added a tryAcquire() method to TimedSemaphore.
+o LANG-1255: Add DateUtils.toCalendar(Date, TimeZone). Thanks to Kaiyuan Wang.
+o LANG-1023: Add WordUtils.wrap overload with customizable breakable character.
+ Thanks to Marko Bekhta.
+o LANG-787: Add method removeIgnoreCase(String, String) to StringUtils. Thanks
+ to Gokul Nanthakumar C.
+o LANG-1224: Extend RandomStringUtils with methods that generate strings
+ between a min and max length. Thanks to Caleb Cushing.
+o LANG-1257: Add APIs StringUtils.wrapIfMissing(String, char|String). Thanks to
+ Gary Gregory.
+o LANG-1253: Add RandomUtils#nextBoolean() method. Thanks to adilek.
+o LANG-1085: Add a circuit breaker implementation. Thanks to Oliver Heger and
+ Bruno P. Kinoshita.
+o LANG-1013: Add StringUtils.truncate(). Thanks to Thiago Andrade.
+o LANG-1195: Enhance MethodUtils to allow invocation of private methods. Thanks
+ to Derek C. Ashmore.
+o LANG-1189: Add getAndIncrement/getAndDecrement/getAndAdd/incrementAndGet/
+ decrementAndGet/addAndGet in Mutable* classes. Thanks to
+ Haiyang Li and Matthew Bartenschlag.
+o LANG-1225: Add RandomStringUtils#randomGraph and #randomPrint which match
+ corresponding regular expression class. Thanks to Caleb Cushing.
+o LANG-1223: Add StopWatch#getTime(TimeUnit). Thanks to Nick Manley.
+o LANG-781: Add methods to ObjectUtils class to check for null elements in the
+ array. Thanks to Krzysztof Wolny.
+o LANG-1228: Prefer Throwable.getCause() in ExceptionUtils.getCause().
+ Thanks to Brad Hess.
+o LANG-1233: DiffBuilder add method to allow appending from a DiffResult.
+ Thanks to Nick Manley.
+o LANG-1168: Add SystemUtils.IS_OS_WINDOWS_10 property.
+ Thanks to Pascal Schumacher.
+o LANG-1115: Add support for varargs in ConstructorUtils, MemberUtils, and
+ MethodUtils. Thanks to Jim Lloyd and Joe Ferner.
+o LANG-1134: Add methods to check numbers against NaN and inifinite to
+ Validate. Thanks to Alan Smithee.
+o LANG-1220: Add tests for missed branches in DateUtils.
+ Thanks to Casey Scarborough.
+o LANG-1146: z/OS identification in SystemUtils.
+ Thanks to Gabor Liptak.
+o LANG-1192: FastDateFormat support of the week-year component (uppercase 'Y').
+ Thanks to Dominik Stadler.
+o LANG-1169: Add StringUtils methods to compare a string to multiple strings.
+ Thanks to Rafal Glowinski, Robert Parr and Arman Sharif.
+o LANG-1185: Add remove by regular expression methods in StringUtils.
+o LANG-1139: Add replace by regular expression methods in StringUtils.
+o LANG-1171: Add compare methods in StringUtils.
+o LANG-1174: Add sugar to RandomUtils. Thanks to Punkratz312.
+o LANG-1154: FastDateFormat APIs that use a StringBuilder. Thanks to
+ Gary Gregory.
+o LANG-1149: Ability to throw checked exceptions without declaring them. Thanks
+ to Gregory Zak.
+o LANG-1153: Implement ParsePosition api for FastDateParser.
+o LANG-1137: Add check for duplicate event listener in EventListenerSupport.
+ Thanks to Matthew Aguirre.
+o LANG-1135: Add method containsAllWords to WordUtils. Thanks to
+ Eduardo Martins.
+o LANG-1132: ReflectionToStringBuilder doesn't throw IllegalArgumentException
+ when the constructor's object param is null. Thanks to Jack Tan.
+o LANG-701: StringUtils join with var args. Thanks to James Sawle.
+o LANG-1105: Add ThreadUtils - A utility class which provides helper methods
+ related to java.lang.Thread Issue: LANG-1105. Thanks to
+ Hendrik Saly.
+o LANG-1031: Add annotations to exclude fields from ReflectionEqualsBuilder,
+ ReflectionToStringBuilder and ReflectionHashCodeBuilder. Thanks
+ to Felipe Adorno.
+o LANG-1127: Use JUnit rules to set and reset the default Locale and TimeZone.
+o LANG-1119: Add rotate(string, int) method to StringUtils. Thanks to
+ Loic Guibert.
+o LANG-1099: Add swap and shift operations for arrays to ArrayUtils. Thanks to
+ Adrian Ber.
+o LANG-1050: Change nullToEmpty methods to generics. Thanks to James Sawle.
+o LANG-1074: Add a method to ArrayUtils for removing all occurrences of a given
+ element Issue: LANG-1074. Thanks to Haiyang Li.
+
+FIXED BUGS
+============
+
+o LANG-1261: ArrayUtils.contains returns false for instances of subtypes.
+o LANG-1252: Rename NumberUtils.isNumber, isCreatable to better reflect
+ createNumber. Also, accommodated for "+" symbol as prefix in
+ isCreatable and isNumber. Thanks to Rob Tompkins.
+o LANG-1230: Remove unnecessary synchronization from registry lookup in
+ EqualsBuilder and HashCodeBuilder. Thanks to Philippe Marschall.
+o LANG-1214: Handle "void" in ClassUtils.getClass(). Thanks to Henry Tung.
+o LANG-1250: SerializationUtils#deserialize has unnecessary code and a comment
+ for that. Thanks to Glease Wang.
+o LANG-1190: TypeUtils.isAssignable throws NullPointerException when fromType
+ has type variables and toType generic superclass specifies type
+ variable. Thanks to Pascal Schumacher.
+o LANG-1226: StringUtils#normalizeSpace does not trim the string anymore.
+ Thanks to Pascal Schumacher.
+o LANG-1251: SerializationUtils.ClassLoaderAwareObjectInputStream should use
+ static initializer to initialize primitiveTypes map. Thanks to
+ Takuya Ueshin.
+o LANG-1248: FastDatePrinter Memory allocation regression. Thanks to
+ Benoit Wiart.
+o LANG-1018: Fix precision loss on NumberUtils.createNumber(String). Thanks to
+ Nick Manley.
+o LANG-1199: Fix implementation of StringUtils.getJaroWinklerDistance(). Thanks
+ to M. Steiger.
+o LANG-1244: Fix dead links in StringUtils.getLevenshteinDistance() javadoc.
+ Thanks to jjbankert.
+o LANG-1242: "\u2284":"?" mapping missing from
+ EntityArrays#HTML40_EXTENDED_ESCAPE. Thanks to Neal Stewart.
+o LANG-901: StringUtils#startsWithAny/endsWithAny is case sensitive -
+ documented as case insensitive. Thanks to Matthew Bartenschlag.
+o LANG-1232: DiffBuilder: Add null check on fieldName when appending Object or
+ Object[]. Thanks to Nick Manley.
+o LANG-1178: ArrayUtils.removeAll(Object array, int... indices) should do the
+ clone, not its callers. Thanks to Henri Yandell.
+o LANG-1120: StringUtils.stripAccents should remove accents from "?" and "?".
+ Thanks to kaching88.
+o LANG-1205: NumberUtils.createNumber() behaves inconsistently with
+ NumberUtils.isNumber(). Thanks to pbrose.
+o LANG-1222: Fix for incorrect comment on StringUtils.containsIgnoreCase
+ method. Thanks to Adam J.
+o LANG-1221: Fix typo on appendIfMissing javadoc. Thanks to Pierre Templier.
+o LANG-1202: parseDateStrictly does't pass specified locale. Thanks to
+ Markus Jelsma.
+o LANG-1219: FastDateFormat doesn't respect summer daylight in some localized
+ strings. Thanks to Jarek.
+o LANG-1175: Remove Ant-based build.
+o LANG-1194: Limit max heap memory for consistent Travis CI build.
+o LANG-1186: Fix NullPointerException in FastDateParser$TimeZoneStrategy.
+ Thanks to NickManley.
+o LANG-1193: ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1
+ (correct answer should be 0); revert fix for LANG-1077. Thanks to
+ Qin Li.
+o LANG-1002: Several predefined ISO FastDateFormats in DateFormatUtils are
+ incorrect. Thanks to Michael Osipov.
+o LANG-1152: StringIndexOutOfBoundsException or field over-write for large year
+ fields in FastDateParser. Thanks to Pas Filip.
+o LANG-1141: StrLookup.systemPropertiesLookup() no longer reacts on changes on
+ system properties.
+o LANG-1147: EnumUtils *BitVector issue with more than 32 values Enum. Thanks
+ to Loic Guibert.
+o LANG-1059: Capitalize javadoc is incorrect. Thanks to Colin Casey.
+o LANG-1122: Inconsistent behavior of swap for malformed inputs. Thanks to
+ Adrian Ber.
+o LANG-1130: Fix critical issues reported by SonarQube.
+o LANG-1131: StrBuilder.equals(StrBuilder) doesn't check for null inputs.
+o LANG-1128: JsonToStringStyle doesn't handle chars and objects correctly.
+ Thanks to Jack Tan.
+o LANG-1126: DateFormatUtilsTest.testSMTP depends on the default Locale.
+o LANG-1123: Unit test FastDatePrinterTimeZonesTest needs a timezone set.
+ Thanks to Christian P. Momon.
+o LANG-916: DateFormatUtils.format does not correctly change Calendar
+ TimeZone in certain situations. Thanks to Christian P. Momon.
+o LANG-1116: DateUtilsTest.testLang530 fails for some timezones. Thanks to
+ Aaron Sheldon.
+o LANG-1114: TypeUtils.ParameterizedType#equals doesn't work with wildcard
+ types. Thanks to Andy Coates.
+o LANG-1118: StringUtils.repeat('z', -1) throws NegativeArraySizeException.
+ Thanks to Loic Guibert.
+o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
+o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
+ identical leading prefix..
+o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
+o LANG-1200: Fix Javadoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
+o LANG-1191: Incorrect Javadoc
+ StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
+ qed, Brent Worden and Gary Gregory.
+
+CHANGES
+=========
+o LANG-1197: Prepare Java 9 detection.
+o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
+ big to be inlined. Thanks to Ruslan Cheremin.
+o LANG-1259: Javadoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
+ to Dominik Stadler.
+o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
+ Benoit Wiart.
+o LANG-1229: HashCodeBuilder.append(Object,Object) is too big to be inlined,
+ which prevents whole builder to be scalarized. Thanks to
+ Ruslan Cheremin.
+o LANG-1243: Simplify ArrayUtils removeElements by using new decrementAndGet()
+ method.
+o LANG-1240: Optimize BitField constructor implementation. Thanks to zhanhb.
+o LANG-1206: Improve CharSetUtils.squeeze() performance. Thanks to
+ Mohammed Alfallaj.
+o LANG-1176: Improve ArrayUtils removeElements time complexity to O(n). Thanks
+ to Jeffery Yuan.
+o LANG-1234: getLevenshteinDistance with a threshold: optimize implementation
+ if the strings lengths differ more than the threshold. Thanks to
+ Jonatan Jnsson.
+o LANG-1151: Performance improvements for NumberUtils.isParsable. Thanks to
+ Juan Pablo Santos Rodrguez.
+o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
+ which prevents whole builder to be scalarized. Thanks to
+ Ruslan Cheremin.
+o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
+ Matthias Niehoff.
+o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
+o LANG-1182: Clarify Javadoc of StringUtils.containsAny(). Thanks to
+ Larry West and Pascal Schumacher.
+o LANG-1183: Making replacePattern/removePattern methods null safe in
+ StringUtils.
+o LANG-1057: Replace StringBuilder with String concatenation for better
+ optimization. Thanks to Otvio Santana.
+o LANG-1075: Deprecate SystemUtils.FILE_SEPARATOR and
+ SystemUtils.PATH_SEPARATOR.
+o LANG-979: TypeUtils.parameterizeWithOwner - wrong format descriptor for
+ "invalid number of type parameters". Thanks to Bruno P. Kinoshita.
+o LANG-1112: MultilineRecursiveToStringStyle largely unusable due to being
+ package-private.
+o LANG-1058: StringUtils.uncapitalize performance improvement. Thanks to
+ Leo Wang.
+o LANG-1069: CharSet.getInstance documentation does not clearly explain how
+ to include negation character in set. Thanks to Arno Noordover.
+o LANG-1107: Fix parsing edge cases in FastDateParser.
+o LANG-1273: Added new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils. Thanks
+ to Jake Wang.
+
+=============================================================================
+
+ Release Notes for version 3.4
+
+
+COMPATIBILITY
+=============
+
+Commons Lang 3.4 is fully binary compatible to the last release and can
+therefore be used as a drop in replacement for 3.3.2. Note that the value of
+org.apache.commons.lang3.time.DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN
+has changed, which may affect clients using the constant. Furthermore the
+constant is used internally in
+o DurationFormatUtils.formatDurationISO(long)
+o DurationFormatUtils.formatPeriodISO(long, long)
+
+For more information see https://issues.apache.org/jira/browse/LANG-1000.
+
+NEW FEATURES
+==============
+
+o LANG-821: Support OS X versions in SystemUtils. Thanks to Timo Kockert.
+o LANG-1103: Add SystemUtils.IS_JAVA_1_9
+o LANG-1093: Add ClassUtils.getAbbreviatedName(). Thanks to Fabian Lange.
+o LANG-1082: Add option to disable the "objectsTriviallyEqual" test in
+ DiffBuilder. Thanks to Jonathan Baker.
+o LANG-1015: Add JsonToStringStyle implementation to ToStringStyle. Thanks to
+ Thiago Andrade.
+o LANG-1080: Add NoClassNameToStringStyle implementation of ToStringStyle.
+ Thanks to Innokenty Shuvalov.
+o LANG-883: Add StringUtils.containsAny(CharSequence, CharSequence...) method.
+ Thanks to Daniel Stewart.
+o LANG-1052: Multiline recursive to string style. Thanks to Jan Matrne.
+o LANG-536: Add isSorted() to ArrayUtils. Thanks to James Sawle.
+o LANG-1033: Add StringUtils.countMatches(CharSequence, char)
+o LANG-1021: Provide methods to retrieve all fields/methods annotated with a
+ specific type. Thanks to Alexander Mller.
+o LANG-1016: NumberUtils#isParsable method(s). Thanks to
+ Juan Pablo Santos Rodrguez.
+o LANG-999: Add fuzzy String matching logic to StringUtils. Thanks to
+ Ben Ripkens.
+o LANG-994: Add zero copy read method to StrBuilder. Thanks to
+ Mikhail Mazursky.
+o LANG-993: Add zero copy write method to StrBuilder. Thanks to
+ Mikhail Mazursky.
+o LANG-1044: Add method MethodUtils.invokeExactMethod(Object, String)
+o LANG-1045: Add method MethodUtils.invokeMethod(Object, String)
+
+FIXED BUGS
+============
+
+o LANG-794: SystemUtils.IS_OS_WINDOWS_2008, VISTA are incorrect. Thanks to
+ Timo Kockert.
+o LANG-1104: Parse test fails for TimeZone America/Sao_Paulo
+o LANG-948: Exception while using ExtendedMessageFormat and escaping braces.
+ Thanks to Andrey Khobnya.
+o LANG-1092: Wrong formating of time zones with daylight saving time in
+ FastDatePrinter
+o LANG-1090: FastDateParser does not set error indication in ParsePosition
+o LANG-1089: FastDateParser does not handle excess hours as per
+ SimpleDateFormat
+o LANG-1061: FastDateParser error - timezones not handled correctly. Thanks to
+ dmeneses.
+o LANG-1087: NumberUtils#createNumber() returns positive BigDecimal when
+ negative Float is expected. Thanks to Renat Zhilkibaev.
+o LANG-1081: DiffBuilder.append(String, Object left, Object right) does not do
+ a left.equals(right) check. Thanks to Jonathan Baker.
+o LANG-1055: StrSubstitutor.replaceSystemProperties does not work consistently.
+ Thanks to Jonathan Baker.
+o LANG-1083: Add (T) casts to get unit tests to pass in old JDK. Thanks to
+ Jonathan Baker.
+o LANG-1073: Read wrong component type of array in add in ArrayUtils.
+ Thanks to haiyang li.
+o LANG-1077: StringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils.
+ Thanks to haiyang li.
+o LANG-1072: Duplicated "0x" check in createBigInteger in NumberUtils. Thanks
+ to haiyang li.
+o LANG-1064: StringUtils.abbreviate description doesn't agree with the
+ examples. Thanks to B.J. Herbison.
+o LANG-1041: Fix MethodUtilsTest so it does not depend on JDK method ordering.
+ Thanks to Alexandre Bartel.
+o LANG-1000: ParseException when trying to parse UTC dates with Z as zone
+ designator using DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT
+o LANG-1035: Javadoc for EqualsBuilder.reflectionEquals() is unclear
+o LANG-1001: ISO 8601 misspelled throughout the Javadocs. Thanks to
+ Michael Osipov.
+o LANG-1088: FastDateParser should be case insensitive
+o LANG-995: Fix bug with stripping spaces on last line in WordUtils.wrap().
+ Thanks to Andrey Khobnya.
+
+CHANGES
+=========
+
+o LANG-1102: Make logic for comparing OS versions in SystemUtils smarter
+o LANG-1091: Shutdown thread pools in test cases. Thanks to Fabian Lange.
+o LANG-1101: FastDateParser and FastDatePrinter support 'X' format
+o LANG-1100: Avoid memory allocation when using date formating to StringBuffer.
+ Thanks to mbracher.
+o LANG-935: Possible performance improvement on string escape functions.
+ Thanks to Fabian Lange, Thomas Neidhart.
+o LANG-1098: Avoid String allocation in StrBuilder.append(CharSequence). Thanks
+ to Mikhail Mazurskiy, Fabian Lange.
+o LANG-1098: Update maven-checkstyle-plugin to 2.14. Thanks to Micha? Kordas.
+o LANG-1097: Update org.easymock:easymock to 3.3.1. Thanks to Micha? Kordas.
+o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
+o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
+o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
+ Fabian Lange.
+o LANG-1071: Fix wrong examples in Javadoc of
+ StringUtils.replaceEachRepeatedly(...),
+ StringUtils.replaceEach(...) Thanks to Arno Noordover.
+o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
+ uses in performing comparisons
+o LANG-1020: Improve performance of normalize space. Thanks to Libor Ondrusek.
+o LANG-1027: org.apache.commons.lang3.SystemUtils#isJavaVersionAtLeast should
+ return true by default
+o LANG-1026: Bring static method references in StringUtils to consistent style.
+ Thanks to Alex Yursha.
+o LANG-1017: Use non-ASCII digits in Javadoc examples for
+ StringUtils.isNumeric. Thanks to Christoph Schneegans.
+o LANG-1008: Change min/max methods in NumberUtils/IEEE754rUtils from array
+ input parameters to varargs. Thanks to Thiago Andrade.
+o LANG-1006: Add wrap (with String or char) to StringUtils. Thanks to
+ Thiago Andrade.
+o LANG-1005: Extend DurationFormatUtils#formatDurationISO default pattern to
+ match #formatDurationHMS. Thanks to Michael Osipov.
+o LANG-1007: Fixing NumberUtils JAVADoc comments for max methods. Thanks to
+ Thiago Andrade.
+o LANG-731: Better Javadoc for BitField class
+o LANG-1004: DurationFormatUtils#formatDurationHMS implementation does not
+ correspond to Javadoc and vice versa. Thanks to Michael Osipov.
+o LANG-1003: DurationFormatUtils are not able to handle negative
+ durations/periods
+o LANG-998: Javadoc is not clear on preferred pattern to instantiate
+ FastDateParser / FastDatePrinter
+
+=============================================================================
+
+ Release Notes for version 3.3.2
+
+NEW FEATURES
+==============
+
+o LANG-989: Add org.apache.commons.lang3.SystemUtils.IS_JAVA_1_8
+
+FIXED BUGS
+============
+
+o LANG-992: NumberUtils#isNumber() returns false for "0.0", "0.4790", et al
+
+=============================================================================
+
+ Release Notes for version 3.3.1
+
+FIXED BUGS
+============
+
+o LANG-987: DateUtils.getFragmentInDays(Date, Calendar.MONTH) returns wrong
+ days
+o LANG-983: DurationFormatUtils does not describe format string fully
+o LANG-981: DurationFormatUtils#lexx does not detect unmatched quote char
+o LANG-984: DurationFormatUtils does not handle large durations correctly
+o LANG-982: DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field
+ size should be 4 digits
+o LANG-978: Failing tests with Java 8 b128
+
+=============================================================================
+
+ Release Notes for version 3.3
+
+NEW FEATURES
+==============
+
+o LANG-955: Add methods for removing all invalid characters according to
+ XML 1.0 and XML 1.1 in an input string to StringEscapeUtils.
+ Thanks to Adam Hooper.
+o LANG-970: Add APIs MutableBoolean setTrue() and setFalse()
+o LANG-962: Add SerializationUtils.roundtrip(T extends Serializable) to
+ serialize then deserialize
+o LANG-637: There should be a DifferenceBuilder with a
+ ReflectionDifferenceBuilder implementation
+o LANG-944: Add the Jaro-Winkler string distance algorithm to StringUtils.
+ Thanks to Rekha Joshi.
+o LANG-417: New class ClassPathUtils with methods for turning FQN into
+ resource path
+o LANG-834: Validate: add inclusiveBetween and exclusiveBetween overloads
+ for primitive types
+o LANG-900: New RandomUtils class. Thanks to Duncan Jones.
+o LANG-966: Add IBM OS/400 detection
+
+FIXED BUGS
+============
+
+o LANG-621: ReflectionToStringBuilder.toString does not debug 3rd party object
+ fields within 3rd party object. Thanks to Philip Hodges,
+ Thomas Neidhart.
+o LANG-977: NumericEntityEscaper incorrectly encodes supplementary characters.
+ Thanks to Chris Karcher.
+o LANG-973: Make some private fields final
+o LANG-971: NumberUtils#isNumber(String) fails to reject invalid Octal numbers
+o LANG-972: NumberUtils#isNumber does not allow for hex 0XABCD
+o LANG-969: StringUtils.toEncodedString(byte[], Charset) needlessly throws
+ UnsupportedEncodingException. Thanks to Matt Bishop.
+o LANG-946: ConstantInitializerTest fails when building with IBM JDK 7
+o LANG-954: uncaught PatternSyntaxException in FastDateFormat on Android.
+ Thanks to Michael Keppler.
+o LANG-936: StringUtils.getLevenshteinDistance with too big of a threshold
+ returns wrong result. Thanks to Yaniv Kunda, Eli Lindsey.
+o LANG-943: Test DurationFormatUtilsTest.testEdgeDuration fails in
+ JDK 1.6, 1.7 and 1.8, BRST time zone
+o LANG-613: ConstructorUtils.getAccessibleConstructor() Does Not Check the
+ Accessibility of Enclosing Classes
+o LANG-951: Fragments are wrong by 1 day when using fragment YEAR or MONTH.
+ Thanks to Sebastian Gtz.
+o LANG-950: FastDateParser does not handle two digit year parsing like
+ SimpleDateFormat
+o LANG-949: FastDateParserTest.testParses does not test FastDateParser
+o LANG-915: Wrong locale handling in LocaleUtils.toLocale().
+ Thanks to Sergio Fernndez.
+
+CHANGES
+=========
+
+o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field)
+ does not clean up after itself
+o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
+ is used internally
+o LANG-956: Improve Javadoc of WordUtils.wrap methods
+o LANG-939: Move Documentation from user guide to package-info files
+o LANG-953: Convert package.html files to package-info.java files
+o LANG-940: Fix deprecation warnings
+o LANG-819: EnumUtils.generateBitVector needs a "? extends"
+
+=============================================================================
+
+ Release Notes for version 3.2.1
+
+BUG FIXES
+===========
+
+o LANG-937: Fix missing Hamcrest dependency in Ant Build
+o LANG-941: Test failure in LocaleUtilsTest when building with JDK 8
+o LANG-942: Test failure in FastDateParserTest and FastDateFormat_ParserTest
+ when building with JDK8. Thanks to Bruno P. Kinoshita,
+ Henri Yandell.
+o LANG-938: Build fails with test failures when building with JDK 8
+
+=============================================================================
+
+ Release Notes for version 3.2
+
+COMPATIBILITY WITH 3.1
+========================
+
+This release introduces backwards incompatible changes in
+org.apache.commons.lang3.time.FastDateFormat:
+o Method 'protected java.util.List parsePattern()' has been removed
+o Method 'protected java.lang.String parseToken(java.lang.String, int[])' has
+ been removed
+o Method 'protected org.apache.commons.lang3.time.FastDateFormat$NumberRule
+ selectNumberRule(int, int)' has been removed
+
+These changes were the result of [LANG-462]. It is assumed that this change
+will not break clients as Charles Honton pointed out on 25/Jan/12:
+"
+ 1. Methods "FastDateFormat$NumberRule selectNumberRule(int, int)" and
+ "List parsePattern()" couldn't have been overridden because
+ NumberRule and Rule were private to FastDateFormat.
+ 2. Due to the factory pattern used, it's unlikely other two methods would have
+ been overridden.
+ 3. The four methods are highly implementation specific. I consider it a
+ mistake that the methods were exposed.
+"
+For more information see https://issues.apache.org/jira/browse/LANG-462.
+
+NEW FEATURES
+==============
+
+o LANG-934: Add removeFinalModifier to FieldUtils
+o LANG-863: Method returns number of inheritance hops between parent and
+ subclass. Thanks to Daneel S. Yaitskov.
+o LANG-774: Added isStarted, isSuspended and isStopped to StopWatch.
+ Thanks to Erhan Bagdemir.
+o LANG-848: Added StringUtils.isBlank/isEmpty CharSequence... methods.
+ Thanks to Alexander Muthmann.
+o LANG-926: Added ArrayUtils.reverse(array, from, to) methods.
+o LANG-795: StringUtils.toString(byte[], String) deprecated in favour of a new
+ StringUtils.toString(byte[], CharSet). Thanks to Aaron Digulla.
+o LANG-893: StrSubstitutor now supports default values for variables.
+ Thanks to Woonsan Ko.
+o LANG-913: Adding .gitignore to commons-lang. Thanks to Allon Mureinik.
+o LANG-837: Add ObjectUtils.toIdentityString methods that support
+ StringBuilder, StrBuilder, and Appendable.
+o LANG-886: Added CharSetUtils.containsAny(String, String).
+o LANG-797: Added escape/unescapeJson to StringEscapeUtils.
+o LANG-875: Added appendIfMissing and prependIfMissing methods to StringUtils.
+o LANG-870: Add StringUtils.LF and StringUtils.CR values.
+o LANG-873: Add FieldUtils getAllFields() to return all the fields defined in
+ the given class and super classes.
+o LANG-835: StrBuilder should support StringBuilder as an input parameter.
+o LANG-857: StringIndexOutOfBoundsException in CharSequenceTranslator.
+o LANG-856: Code refactoring in NumberUtils.
+o LANG-855: NumberUtils#createBigInteger does not allow for hex and octal
+ numbers.
+o LANG-854: NumberUtils#createNumber - does not allow for hex numbers to be
+ larger than Long.
+o LANG-853: StringUtils join APIs for primitives.
+o LANG-841: Add StringUtils API to call String.replaceAll in DOTALL a.k.a.
+ single-line mode.
+o LANG-825: Create StrBuilder APIs similar to
+ String.format(String, Object...).
+o LANG-675: Add Triple class (ternary version of Pair).
+o LANG-462: FastDateFormat supports parse methods.
+
+BUG FIXES
+===========
+
+o LANG-932: Spelling fixes. Thanks to Ville Skytt.
+o LANG-929: OctalUnescaper tried to parse all of \279.
+o LANG-928: OctalUnescaper had bugs when parsing octals starting with a zero.
+o LANG-905: EqualsBuilder returned true when comparing arrays, even when the
+ elements are different.
+o LANG-917: Fixed exception when combining custom and choice format in
+ ExtendedMessageFormat. Thanks to Arne Burmeister.
+o LANG-902: RandomStringUtils.random javadoc was incorrectly promising letters
+ and numbers would, as opposed to may, appear Issue:. Thanks to
+ Andrzej Winnicki.
+o LANG-921: BooleanUtils.xor(boolean...) produces wrong results.
+o LANG-896: BooleanUtils.toBoolean(String str) javadoc is not updated. Thanks
+ to Mark Bryan Yu.
+o LANG-879: LocaleUtils test fails with new Locale "ja_JP_JP_#u-ca-japanese"
+ of JDK7.
+o LANG-836: StrSubstitutor does not support StringBuilder or CharSequence.
+ Thanks to Arnaud Brunet.
+o LANG-693: Method createNumber from NumberUtils doesn't work for floating
+ point numbers other than Float Issue: LANG-693. Thanks to
+ Calvin Echols.
+o LANG-887: FastDateFormat does not use the locale specific cache correctly.
+o LANG-754: ClassUtils.getShortName(String) will now only do a reverse lookup
+ for array types.
+o LANG-881: NumberUtils.createNumber() Javadoc says it does not work for octal
+ numbers.
+o LANG-865: LocaleUtils.toLocale does not parse strings starting with an
+ underscore.
+o LANG-858: StringEscapeUtils.escapeJava() and escapeEcmaScript() do not
+ output the escaped surrogate pairs that are Java parsable.
+o LANG-849: FastDateFormat and FastDatePrinter generates Date objects
+ wastefully.
+o LANG-845: Spelling fixes.
+o LANG-844: Fix examples contained in javadoc of StringUtils.center methods.
+o LANG-832: FastDateParser does not handle unterminated quotes correctly.
+o LANG-831: FastDateParser does not handle white-space properly.
+o LANG-830: FastDateParser could use \Q \E to quote regexes.
+o LANG-828: FastDateParser does not handle non-Gregorian calendars properly.
+o LANG-826: FastDateParser does not handle non-ASCII digits correctly.
+o LANG-822: NumberUtils#createNumber - bad behaviour for leading "--".
+o LANG-818: FastDateFormat's "z" pattern does not respect timezone of Calendar
+ instances passed to format().
+o LANG-817: Add org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS_8.
+o LANG-813: StringUtils.equalsIgnoreCase doesn't check string reference
+ equality.
+o LANG-810: StringUtils.join() endIndex, bugged for loop.
+o LANG-807: RandomStringUtils throws confusing IAE when end <= start.
+o LANG-805: RandomStringUtils.random(count, 0, 0, false, false, universe,
+ random) always throws java.lang.ArrayIndexOutOfBoundsException.
+o LANG-802: LocaleUtils - unnecessary recursive call in SyncAvoid class.
+o LANG-800: Javadoc bug in DateUtils#ceiling for Calendar and Object versions.
+o LANG-788: SerializationUtils throws ClassNotFoundException when cloning
+ primitive classes.
+o LANG-786: StringUtils equals() relies on undefined behavior.
+o LANG-783: Documentation bug: StringUtils.split.
+o LANG-777: jar contains velocity template of release notes.
+o LANG-776: TypeUtilsTest contains incorrect type assignability assertion.
+o LANG-775: TypeUtils.getTypeArguments() misses type arguments for
+ partially-assigned classes.
+o LANG-773: ImmutablePair doc contains nonsense text.
+o LANG-772: ClassUtils.PACKAGE_SEPARATOR Javadoc contains garbage text.
+o LANG-765: EventListenerSupport.ProxyInvocationHandler no longer defines
+ serialVersionUID.
+o LANG-764: StrBuilder is now serializable.
+o LANG-761: Fix Javadoc Ant warnings.
+o LANG-747: NumberUtils does not handle Long Hex numbers.
+o LANG-743: Javadoc bug in static inner class DateIterator.
+
+CHANGES
+=========
+
+o LANG-931: Misleading Javadoc comment in StrBuilderReader class. Thanks
+ to Christoph Schneegans.
+o LANG-910: StringUtils.normalizeSpace now handles non-breaking spaces
+ (Unicode 00A0). Thanks to Timur Yarosh.
+o LANG-804: Redundant check for zero in HashCodeBuilder ctor. Thanks to
+ Allon Mureinik.
+o LANG-884: Simplify FastDateFormat; eliminate boxing.
+o LANG-882: LookupTranslator now works with implementations of CharSequence
+ other than String.
+o LANG-846: Provide CharSequenceUtils.regionMatches with a proper green
+ implementation instead of inefficiently converting to Strings.
+o LANG-839: ArrayUtils removeElements methods use unnecessary HashSet.
+o LANG-838: ArrayUtils removeElements methods clone temporary index arrays
+ unnecessarily.
+o LANG-799: DateUtils#parseDate uses default locale; add Locale support.
+o LANG-798: Use generics in SerializationUtils.
+
+CHANGES WITHOUT TICKET
+========================
+
+o Fixed URLs in javadoc to point to new oracle.com pages
+
+=============================================================================
+
+ Release Notes for version 3.1
+
+NEW FEATURES
+==============
+
+o LANG-801: Add Conversion utility to convert between data types on byte level
+o LANG-760: Add API StringUtils.toString(byte[] intput, String charsetName)
+o LANG-756: Add APIs ClassUtils.isPrimitiveWrapper(Class>) and
+ isPrimitiveOrWrapper(Class>)
+o LANG-695: SystemUtils.IS_OS_UNIX doesn't recognize FreeBSD as a Unix system
+
+BUG FIXES
+===========
+
+o LANG-749: Incorrect Bundle-SymbolicName in Manifest
+o LANG-746: NumberUtils does not handle upper-case hex: 0X and -0X
+o LANG-744: StringUtils throws java.security.AccessControlException on Google
+ App Engine
+o LANG-741: Ant build has wrong component.name
+o LANG-698: Document that the Mutable numbers don't work as expected with
+ String.format
+
+CHANGES
+=========
+
+o LANG-758: Add an example with whitespace in StringUtils.defaultIfEmpty
+o LANG-752: Fix createLong() so it behaves like createInteger()
+o LANG-751: Include the actual type in the Validate.isInstance and
+ isAssignableFrom exception messages
+o LANG-748: Deprecating chomp(String, String)
+o LANG-736: CharUtils static final array CHAR_STRING is not needed to compute
+ CHAR_STRING_ARRAY
+
+=============================================================================
+
+ Release Notes for version 3.0
+
+ADDITIONS
+===========
+
+o LANG-276: MutableBigDecimal and MutableBigInteger.
+o LANG-285: Wish : method unaccent.
+o LANG-358: ObjectUtils.coalesce.
+o LANG-386: LeftOf/RightOfNumber in Range convenience methods necessary.
+o LANG-435: Add ClassUtils.isAssignable() variants with autoboxing.
+o LANG-444: StringUtils.emptyToNull.
+o LANG-482: Enhance StrSubstitutor to support nested ${var-${subvr}} expansion
+o LANG-482: StrSubstitutor now supports substitution in variable names.
+o LANG-496: A generic implementation of the Lazy initialization pattern.
+o LANG-497: Addition of ContextedException and ContextedRuntimeException.
+o LANG-498: Add StringEscapeUtils.escapeText() methods.
+o LANG-499: Add support for the handling of ExecutionExceptions.
+o LANG-501: Add support for background initialization.
+o LANG-529: Add a concurrent package.
+o LANG-533: Validate: support for validating blank strings.
+o LANG-537: Add ArrayUtils.toArray to create generic arrays.
+o LANG-545: Add ability to create a Future for a constant.
+o LANG-546: Add methods to Validate to check whether the index is valid for
+ the array/list/string.
+o LANG-553: Add TypeUtils class to provide utility code for working with generic
+ types.
+o LANG-559: Added isAssignableFrom and isInstanceOf validation methods.
+o LANG-559: Added validState validation method.
+o LANG-560: New TimedSemaphore class.
+o LANG-582: Provide an implementation of the ThreadFactory interface.
+o LANG-588: Create a basic Pair class.
+o LANG-594: DateUtils equal & compare functions up to most significant field.
+o LANG-601: Add Builder Interface / Update Builders to Implement It.
+o LANG-609: Support lazy initialization using atomic variables
+o LANG-610: Extend exception handling in ConcurrentUtils to runtime exceptions.
+o LANG-614: StringUtils.endsWithAny method
+o LANG-640: Add normalizeSpace to StringUtils
+o LANG-644: Provide documentation about the new concurrent package
+o LANG-649: BooleanUtils.toBooleanObject to support single character input
+o LANG-651: Add AnnotationUtils
+o LANG-653: Provide a very basic ConcurrentInitializer implementation
+o LANG-655: Add StringUtils.defaultIfBlank()
+o LANG-667: Add a Null-safe compare() method to ObjectUtils
+o LANG-676: Documented potential NPE if auto-boxing occurs for some BooleanUtils
+ methods
+o LANG-678: Add support for ConcurrentMap.putIfAbsent()
+o LANG-692: Add hashCodeMulti varargs method
+o LANG-697: Add FormattableUtils class
+o LANG-684: Levenshtein Distance Within a Given Threshold
+
+REMOVALS
+==========
+
+o LANG-438: Remove @deprecateds.
+o LANG-492: Remove code handled now by the JDK.
+o LANG-493: Remove code that does not hold enough value to remain.
+o LANG-590: Remove JDK 1.2/1.3 bug handling in
+ StringUtils.indexOf(String, String, int).
+o LANG-673: WordUtils.abbreviate() removed
+o LANG-691: Removed DateUtils.UTC_TIME_ZONE
+
+IMPROVEMENTS
+==============
+
+o LANG-290: EnumUtils for JDK 5.0.
+o LANG-336: Finally start using generics.
+o LANG-355: StrBuilder should implement CharSequence and Appendable.
+o LANG-396: Investigate for vararg usages.
+o LANG-424: Improve Javadoc for StringUtils class.
+o LANG-458: Refactor Validate.java to eliminate code redundancy.
+o LANG-479: Document where in SVN trunk is.
+o LANG-504: bring ArrayUtils.isEmpty to the generics world.
+o LANG-505: Rewrite StringEscapeUtils.
+o LANG-507: StringEscapeUtils.unescapeJava should support \u+ notation.
+o LANG-510: Convert StringUtils API to take CharSequence.
+o LANG-513: Better EnumUtils.
+o LANG-528: Mutable classes should implement an appropriately typed Mutable
+ interface.
+o LANG-539: Compile commons.lang for CDC 1.1/Foundation 1.1.
+o LANG-540: Make NumericEntityEscaper immutable.
+o LANG-541: Replace StringBuffer with StringBuilder.
+o LANG-548: Use Iterable on API instead of Collection.
+o LANG-551: Replace Range classes with generic version.
+o LANG-562: Change Maven groupId.
+o LANG-563: Change Java package name.
+o LANG-570: Do the test cases really still require main() and suite() methods?
+o LANG-579: Add new Validate methods.
+o LANG-599: ClassUtils.getClass(): Allow Dots as Inner Class Separators.
+o LANG-605: DefaultExceptionContext overwrites values in recursive situations.
+o LANG-668: Change ObjectUtils min() & max() functions to use varargs rather
+ than just two parameters
+o LANG-681: Push down WordUtils to "text" sub-package.
+o LANG-711: Add includeantruntime=false to javac targets to quell warnings in
+ ant 1.8.1 and better (and modest performance gain).
+o LANG-713: Increase test coverage of FieldUtils read methods and tweak
+ javadoc.
+o LANG-718: build.xml Java 1.5+ updates.
+
+BUG FIXES
+===========
+
+o LANG-11: Depend on JDK 1.5+.
+o LANG-302: StrBuilder does not implement clone().
+o LANG-339: StringEscapeUtils.escapeHtml() escapes multibyte characters like
+ Chinese, Japanese, etc.
+o LANG-369: ExceptionUtils not thread-safe.
+o LANG-418: Javadoc incorrect for StringUtils.endsWithIgnoreCase.
+o LANG-428: StringUtils.isAlpha, isAlphanumeric and isNumeric now return false
+ for ""
+o LANG-439: StringEscapeUtils.escapeHTML() does not escape chars (0x00-0x20).
+o LANG-448: Lower Ascii Characters don't get encoded by Entities.java.
+o LANG-468: JDK 1.5 build/runtime failure on LANG-393 (EqualsBuilder).
+o LANG-474: Fixes for thread safety.
+o LANG-478: StopWatch does not resist to system time changes.
+o LANG-480: StringEscapeUtils.escapeHtml incorrectly converts unicode
+ characters above U+00FFFF into 2 characters.
+o LANG-481: Possible race-conditions in hashCode of the range classes.
+o LANG-564: Improve StrLookup API documentation.
+o LANG-568: @SuppressWarnings("unchecked") is used too generally.
+o LANG-571: ArrayUtils.add(T[: array, T element) can create unexpected
+ ClassCastException.
+o LANG-585: exception.DefaultExceptionContext.getFormattedExceptionMessage
+ catches Throwable.
+o LANG-596: StrSubstitutor should also handle the default properties of a
+ java.util.Properties class
+o LANG-600: Javadoc is incorrect for public static int
+ lastIndexOf(String str, String searchStr).
+o LANG-602: ContextedRuntimeException no longer an 'unchecked' exception.
+o LANG-606: EqualsBuilder causes StackOverflowException.
+o LANG-608: Some StringUtils methods should take an int character instead of
+ char to use String API features.
+o LANG-617: StringEscapeUtils.escapeXML() can't process UTF-16 supplementary
+ characters
+o LANG-624: SystemUtils.getJavaVersionAsFloat throws
+ StringIndexOutOfBoundsException on Android runtime/Dalvik VM
+o LANG-629: Charset may not be threadsafe, because the HashSet is not synch.
+o LANG-638: NumberUtils createNumber throws a StringIndexOutOfBoundsException
+ when argument containing "e" and "E" is passed in
+o LANG-643: Javadoc StringUtils.left() claims to throw on negative len, but
+ doesn't
+o LANG-645: FastDateFormat.format() outputs incorrect week of year because
+ locale isn't respected
+o LANG-646: StringEscapeUtils.unescapeJava doesn't handle octal escapes and
+ Unicode with extra u
+o LANG-656: Example StringUtils.indexOfAnyBut("zzabyycdxx", '') = 0 incorrect
+o LANG-658: Some Entitys like Ö are not matched properly against its
+ ISO8859-1 representation
+o LANG-659: EntityArrays typo: {"\u2122", "−"}, // minus sign, U+2212
+ ISOtech
+o LANG-66: StringEscaper.escapeXml() escapes characters > 0x7f.
+o LANG-662: org.apache.commons.lang3.math.Fraction does not reduce
+ (Integer.MIN_VALUE, 2^k)
+o LANG-663: org.apache.commons.lang3.math.Fraction does not always succeed in
+ multiplyBy and divideBy
+o LANG-664: NumberUtils.isNumber(String) is not right when the String is
+ "1.1L"
+o LANG-672: Doc bug in DateUtils#ceiling
+o LANG-677: DateUtils.isSameLocalTime compares using 12 hour clock and not
+ 24 hour
+o LANG-685: EqualsBuilder synchronizes on HashCodeBuilder.
+o LANG-703: StringUtils.join throws NPE when toString returns null for one of
+ objects in collection
+o LANG-710: StringIndexOutOfBoundsException when calling unescapeHtml4("")
+o LANG-714: StringUtils doc/comment spelling fixes.
+o LANG-715: CharSetUtils.squeeze() speedup.
+o LANG-716: swapCase and *capitalize speedups.
+
+
+Historical list of changes: http://commons.apache.org/lang/changes-report.html
+
+For complete information on Commons Lang, including instructions on how to
+submit bug reports, patches, or suggestions for improvement, see the
+Apache Commons Lang website:
+
+http://commons.apache.org/lang/
+
+Have fun!
+-Apache Commons Lang team
+
From 30fed5ecb02386cdfbb84ab76149133203ae3d35 Mon Sep 17 00:00:00 2001
From: Benedikt Ritter
Date: Thu, 16 Aug 2018 16:25:43 +0200
Subject: [PATCH 0226/3439] Update maven-pmd-plugin to latest version
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d3fa77b3cb8..562e415e18e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -723,7 +723,7 @@
maven-pmd-plugin
- 3.9.0
+ 3.10.0${maven.compiler.target}
From 2a11642511a3c69bac5aa1abd83d3219871395e3 Mon Sep 17 00:00:00 2001
From: Alexander Tsvetkov
Date: Fri, 17 Aug 2018 08:47:07 +0300
Subject: [PATCH 0227/3439] LANG-1411: Add empty checks to ObjectUtils
---
.../org/apache/commons/lang3/ObjectUtils.java | 74 +++++++++++++++++++
.../apache/commons/lang3/ObjectUtilsTest.java | 47 ++++++++++++
2 files changed, 121 insertions(+)
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index c3b031e52e2..6934f230c8b 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -21,6 +21,7 @@
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -77,6 +78,79 @@ public ObjectUtils() {
super();
}
+ // Empty checks
+ //-----------------------------------------------------------------------
+ /**
+ *
Checks if an Object is empty or null.
+ *
+ * The following types are supported:
+ *
+ *
{@link CharSequence}: Considered empty if its length is zero.
+ *
{@code Array}: Considered empty if its length is zero.
+ *
{@link Collection}: Considered empty if it has zero elements.
+ *
{@link Map}: Considered empty if it has zero key-value mappings.
+ *
+ * @param object the {@code Object} to test, may be {@code null}
+ * @return {@code true} if the object has an unsupported type or is not empty
+ * and not null, {@code false} otherwise
+ */
+ public static boolean isNotEmpty(final Object object) {
+ return !isEmpty(object);
+ }
+
// Defaulting
//-----------------------------------------------------------------------
/**
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index 661722dacd8..2ec631fcb09 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -31,9 +31,14 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
+import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang3.exception.CloneFailedException;
import org.apache.commons.lang3.mutable.MutableObject;
@@ -47,6 +52,13 @@
public class ObjectUtilsTest {
private static final String FOO = "foo";
private static final String BAR = "bar";
+ private static final String[] NON_EMPTY_ARRAY = new String[] { FOO, BAR, };
+ private static final List NON_EMPTY_LIST = Arrays.asList(NON_EMPTY_ARRAY);
+ private static final Set NON_EMPTY_SET = new HashSet<>(NON_EMPTY_LIST);
+ private static final Map NON_EMPTY_MAP = new HashMap<>();
+ static {
+ NON_EMPTY_MAP.put(FOO, BAR);
+ }
//-----------------------------------------------------------------------
@Test
@@ -59,6 +71,41 @@ public void testConstructor() {
assertFalse(Modifier.isFinal(ObjectUtils.class.getModifiers()));
}
+ //-----------------------------------------------------------------------
+ @Test
+ public void testIsEmpty() {
+ assertTrue(ObjectUtils.isEmpty(null));
+ assertTrue(ObjectUtils.isEmpty(""));
+ assertTrue(ObjectUtils.isEmpty(new int[] {}));
+ assertTrue(ObjectUtils.isEmpty(Collections.emptyList()));
+ assertTrue(ObjectUtils.isEmpty(Collections.emptySet()));
+ assertTrue(ObjectUtils.isEmpty(Collections.emptyMap()));
+
+ assertFalse(ObjectUtils.isEmpty(" "));
+ assertFalse(ObjectUtils.isEmpty("ab"));
+ assertFalse(ObjectUtils.isEmpty(NON_EMPTY_ARRAY));
+ assertFalse(ObjectUtils.isEmpty(NON_EMPTY_LIST));
+ assertFalse(ObjectUtils.isEmpty(NON_EMPTY_SET));
+ assertFalse(ObjectUtils.isEmpty(NON_EMPTY_MAP));
+ }
+
+ @Test
+ public void testIsNotEmpty() {
+ assertFalse(ObjectUtils.isNotEmpty(null));
+ assertFalse(ObjectUtils.isNotEmpty(""));
+ assertFalse(ObjectUtils.isNotEmpty(new int[] {}));
+ assertFalse(ObjectUtils.isNotEmpty(Collections.emptyList()));
+ assertFalse(ObjectUtils.isNotEmpty(Collections.emptySet()));
+ assertFalse(ObjectUtils.isNotEmpty(Collections.emptyMap()));
+
+ assertTrue(ObjectUtils.isNotEmpty(" "));
+ assertTrue(ObjectUtils.isNotEmpty("ab"));
+ assertTrue(ObjectUtils.isNotEmpty(NON_EMPTY_ARRAY));
+ assertTrue(ObjectUtils.isNotEmpty(NON_EMPTY_LIST));
+ assertTrue(ObjectUtils.isNotEmpty(NON_EMPTY_SET));
+ assertTrue(ObjectUtils.isNotEmpty(NON_EMPTY_MAP));
+ }
+
//-----------------------------------------------------------------------
@Test
public void testIsNull() {
From ccadc72fd9936805b21edc3d327132cc4bf747b0 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Sun, 19 Aug 2018 13:03:46 -0400
Subject: [PATCH 0228/3439] RELEASE-NOTES java 5.0 -> java 7.0
---
RELEASE-NOTES.txt | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index c62c488890a..f6a00464396 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -27,8 +27,7 @@ This document contains the release notes for the 3.8 version of Apache Commons L
Commons Lang is a set of utility functions and reusable components that should be of use in any
Java environment.
-Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
-variable arguments, autoboxing, concurrency and formatted output.
+Lang 3.0 and onwards now targets Java 7.0, making use of features that arrived with Java 7.0.
For the advice on upgrading from 2.x to 3.x, see the following page:
From ec464c9b2bdacb4a2a97f86cd693653fbd9e3e55 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Sun, 19 Aug 2018 13:04:45 -0400
Subject: [PATCH 0229/3439] Update pom.xml for release of commons-lang3-3.8
---
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4e78f427206..0da89ec03eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
4.0.0commons-lang3
- 3.8
+ 3.9-SNAPSHOTApache Commons Lang2001
@@ -573,7 +573,7 @@
lang3org.apache.commons.lang3
- 3.8
+ 3.9(Java 7+)2.6
@@ -601,7 +601,7 @@
0.11.1
- 3.7
+ 3.8RC1truescm:svn:https://dist.apache.org/repos/dist/dev/commons/lang
From baa410493b85e62b40bb918b6ee0ed846fd88fd0 Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Mon, 20 Aug 2018 08:47:32 -0400
Subject: [PATCH 0230/3439] (site) fix RELEASE-NOTES-3.8.txt java 5.0 -> 7.0
---
src/site/resources/release-notes/RELEASE-NOTES-3.8.txt | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/site/resources/release-notes/RELEASE-NOTES-3.8.txt b/src/site/resources/release-notes/RELEASE-NOTES-3.8.txt
index c62c488890a..f6a00464396 100644
--- a/src/site/resources/release-notes/RELEASE-NOTES-3.8.txt
+++ b/src/site/resources/release-notes/RELEASE-NOTES-3.8.txt
@@ -27,8 +27,7 @@ This document contains the release notes for the 3.8 version of Apache Commons L
Commons Lang is a set of utility functions and reusable components that should be of use in any
Java environment.
-Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
-variable arguments, autoboxing, concurrency and formatted output.
+Lang 3.0 and onwards now targets Java 7.0, making use of features that arrived with Java 7.0.
For the advice on upgrading from 2.x to 3.x, see the following page:
From c2bd8be86230f35cf521c4112f67ede2df0f527b Mon Sep 17 00:00:00 2001
From: Rob Tompkins
Date: Mon, 20 Aug 2018 08:54:02 -0400
Subject: [PATCH 0231/3439] (changes) add 3.9 area
---
src/changes/changes.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 732225a57f4..4a116764089 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,6 +45,9 @@ The type attribute can be add,update,fix,remove.
+
+
+
FastDateParser too strict on abbreviated short month symbolsJsonToStringStyle does not escape string names
From d1e72ebede93d73d1a3caf74e391fd83516e0685 Mon Sep 17 00:00:00 2001
From: Benedikt Ritter
Date: Mon, 20 Aug 2018 19:01:46 +0200
Subject: [PATCH 0232/3439] LANG-1411: Add changes.xml entry and @since tags.
This fixes #342 from GitHub. Thanks to Alexander Tsvetkov.
---
src/changes/changes.xml | 3 ++-
src/main/java/org/apache/commons/lang3/ObjectUtils.java | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4a116764089..5e87a0b4ea1 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,7 +45,8 @@ The type attribute can be add,update,fix,remove.
-
+
+ Add isEmpty method to ObjectUtils
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 6934f230c8b..4a84c4fc5fa 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -103,6 +103,7 @@ public ObjectUtils() {
* @param object the {@code Object} to test, may be {@code null}
* @return {@code true} if the object has a supported type and is empty or null,
* {@code false} otherwise
+ * @since 3.9
*/
public static boolean isEmpty(final Object object) {
if (object == null) {
@@ -146,6 +147,7 @@ public static boolean isEmpty(final Object object) {
* @param object the {@code Object} to test, may be {@code null}
* @return {@code true} if the object has an unsupported type or is not empty
* and not null, {@code false} otherwise
+ * @since 3.9
*/
public static boolean isNotEmpty(final Object object) {
return !isEmpty(object);
From ce178d8e87ff6f9a12aea4b217c1e09254936236 Mon Sep 17 00:00:00 2001
From: Eitan Adler
Date: Wed, 22 Aug 2018 04:06:44 -0700
Subject: [PATCH 0233/3439] (fix) Add missing @Test annotation
---
src/test/java/org/apache/commons/lang3/EnumUtilsTest.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
index 7c732b28a58..2b9dc085ca5 100644
--- a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
@@ -407,6 +407,7 @@ public void test_processBitVector_longClass() {
EnumUtils.processBitVector(TooMany.class, 0L);
}
+ @Test
public void test_processBitVectors_longClass() {
assertEquals(EnumSet.noneOf(TooMany.class), EnumUtils.processBitVectors(TooMany.class, 0L));
assertEquals(EnumSet.of(TooMany.A), EnumUtils.processBitVectors(TooMany.class, 1L));
From b4609c81e41d678cf03898a7cc4a4660beef0f88 Mon Sep 17 00:00:00 2001
From: Benedikt Ritter
Date: Thu, 23 Aug 2018 08:25:27 +0200
Subject: [PATCH 0234/3439] LANG-1415: Update Java Language requirement to 1.8
---
.travis.yml | 2 --
pom.xml | 6 +++---
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/SystemUtilsTest.java | 13 -------------
4 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index b8ef1b44f49..9914040c30a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,8 +22,6 @@ before_install:
matrix:
include:
- - env: JDK_RELEASE='OpenJDK 7'
- jdk: openjdk7
- env: JDK_RELEASE='OracleJDK 8'
jdk: oraclejdk8
- env: JDK_RELEASE='OracleJDK 9'
diff --git a/pom.xml b/pom.xml
index 57e43444b93..149e1514ec2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -557,8 +557,8 @@
-Xmx512mISO-8859-1UTF-8
- 1.7
- 1.7
+ 1.8
+ 1.83.9
- (Java 7+)
+ (Java 8+)2.6(Requires Java 1.2 or later)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5e87a0b4ea1..905c41f335e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove.
+ Update Java Language requirement to 1.8Add isEmpty method to ObjectUtils
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index e89e20ceaae..572a46e9ce7 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -141,19 +141,6 @@ public void testIS_JAVA() {
assertFalse(SystemUtils.IS_JAVA_9);
assertFalse(SystemUtils.IS_JAVA_10);
assertFalse(SystemUtils.IS_JAVA_11);
- } else if (javaVersion.startsWith("1.7")) {
- assertFalse(SystemUtils.IS_JAVA_1_1);
- assertFalse(SystemUtils.IS_JAVA_1_2);
- assertFalse(SystemUtils.IS_JAVA_1_3);
- assertFalse(SystemUtils.IS_JAVA_1_4);
- assertFalse(SystemUtils.IS_JAVA_1_5);
- assertFalse(SystemUtils.IS_JAVA_1_6);
- assertTrue(SystemUtils.IS_JAVA_1_7);
- assertFalse(SystemUtils.IS_JAVA_1_8);
- assertFalse(SystemUtils.IS_JAVA_1_9);
- assertFalse(SystemUtils.IS_JAVA_9);
- assertFalse(SystemUtils.IS_JAVA_10);
- assertFalse(SystemUtils.IS_JAVA_11);
} else if (javaVersion.startsWith("1.8")) {
assertFalse(SystemUtils.IS_JAVA_1_1);
assertFalse(SystemUtils.IS_JAVA_1_2);
From 33bd8349641240def753858ea7809f38650cc662 Mon Sep 17 00:00:00 2001
From: Benedikt Ritter
Date: Thu, 23 Aug 2018 19:06:59 +0200
Subject: [PATCH 0235/3439] Convert JavaDoc license headers to block comments
---
.../org/apache/commons/lang3/Conversion.java | 30 +++++++++----------
.../apache/commons/lang3/builder/Diff.java | 4 +--
.../commons/lang3/builder/DiffBuilder.java | 4 +--
.../commons/lang3/builder/DiffResult.java | 4 +--
.../commons/lang3/builder/Diffable.java | 4 +--
.../lang3/builder/ReflectionDiffBuilder.java | 4 +--
.../apache/commons/lang3/ConversionTest.java | 30 +++++++++----------
.../lang3/builder/DiffBuilderTest.java | 4 +--
.../commons/lang3/builder/DiffResultTest.java | 4 +--
.../commons/lang3/builder/DiffTest.java | 4 +--
.../builder/ReflectionDiffBuilderTest.java | 4 +--
11 files changed, 46 insertions(+), 50 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/Conversion.java b/src/main/java/org/apache/commons/lang3/Conversion.java
index 5577be4b007..4e11776874f 100644
--- a/src/main/java/org/apache/commons/lang3/Conversion.java
+++ b/src/main/java/org/apache/commons/lang3/Conversion.java
@@ -1,21 +1,19 @@
-/*******************************************************************************
- * 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
+/*
+ * 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
+ * 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.
- *******************************************************************************/
+ * 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 java.util.UUID;
diff --git a/src/main/java/org/apache/commons/lang3/builder/Diff.java b/src/main/java/org/apache/commons/lang3/builder/Diff.java
index aee0d249b27..7b062d0b537 100644
--- a/src/main/java/org/apache/commons/lang3/builder/Diff.java
+++ b/src/main/java/org/apache/commons/lang3/builder/Diff.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
diff --git a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java
index 3645ffc5447..20fc1503c57 100644
--- a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
diff --git a/src/main/java/org/apache/commons/lang3/builder/DiffResult.java b/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
index 93b7f2f745d..d6d031c95e1 100644
--- a/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
+++ b/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
diff --git a/src/main/java/org/apache/commons/lang3/builder/Diffable.java b/src/main/java/org/apache/commons/lang3/builder/Diffable.java
index 12bc07dbd36..4d435ab1c94 100644
--- a/src/main/java/org/apache/commons/lang3/builder/Diffable.java
+++ b/src/main/java/org/apache/commons/lang3/builder/Diffable.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
diff --git a/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java b/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
index e45360f1072..baca52043a5 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
diff --git a/src/test/java/org/apache/commons/lang3/ConversionTest.java b/src/test/java/org/apache/commons/lang3/ConversionTest.java
index c9ab1dbcf22..3c2a31e0427 100644
--- a/src/test/java/org/apache/commons/lang3/ConversionTest.java
+++ b/src/test/java/org/apache/commons/lang3/ConversionTest.java
@@ -1,21 +1,19 @@
-/*******************************************************************************
- * 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
+/*
+ * 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
+ * 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.
- *******************************************************************************/
+ * 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 static org.junit.Assert.assertArrayEquals;
diff --git a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
index b2453a47109..c115d71f4e1 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
diff --git a/src/test/java/org/apache/commons/lang3/builder/DiffResultTest.java b/src/test/java/org/apache/commons/lang3/builder/DiffResultTest.java
index a267a1b446a..0ddb3907f2f 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DiffResultTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DiffResultTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
diff --git a/src/test/java/org/apache/commons/lang3/builder/DiffTest.java b/src/test/java/org/apache/commons/lang3/builder/DiffTest.java
index 1aff66ff8f4..d75bec4fde0 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DiffTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DiffTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionDiffBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionDiffBuilderTest.java
index b957f3a6209..6542a489cfd 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionDiffBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionDiffBuilderTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -6,7 +6,7 @@
* (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
+ * 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,
From c696955b2ad1198d019f89df8578f660b41c421a Mon Sep 17 00:00:00 2001
From: Benedikt Ritter
Date: Thu, 23 Aug 2018 19:20:21 +0200
Subject: [PATCH 0236/3439] Looks like Java 11 no longer fails the build
---
.travis.yml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 9914040c30a..874e9173074 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,9 +33,6 @@ matrix:
# Java 11 "Oracle JDK" (not yet provided by Travis CI)
- env: JDK='Oracle JDK 11'
install: . ./target/install-jdk.sh -F 11 -L BCL
-# some FastDateParser tests currently fail with java.text.ParseException: Unparseable date
- allow_failures:
- - env: JDK='Oracle JDK 11'
script:
- mvn
From f013141f60df0bbbd57388c7bdd01a764ddfc1fd Mon Sep 17 00:00:00 2001
From: Benedikt Ritter
Date: Fri, 24 Aug 2018 15:37:52 +0200
Subject: [PATCH 0237/3439] Explicit type parameters can be removed
---
.../org/apache/commons/lang3/CharSet.java | 4 ++--
.../org/apache/commons/lang3/ClassUtils.java | 2 +-
.../commons/lang3/reflect/MethodUtils.java | 2 +-
.../commons/lang3/reflect/TypeUtils.java | 4 ++--
.../apache/commons/lang3/ObjectUtilsTest.java | 6 ++---
.../lang3/builder/EqualsBuilderTest.java | 12 +++++-----
...lectionToStringBuilderConcurrencyTest.java | 6 ++---
.../ReflectionToStringBuilderExcludeTest.java | 2 +-
.../builder/ToStringStyleConcurrencyTest.java | 6 ++---
.../lang3/concurrent/ConcurrentUtilsTest.java | 2 +-
.../lang3/reflect/MethodUtilsTest.java | 24 +++++++++----------
.../commons/lang3/reflect/TypeUtilsTest.java | 2 +-
12 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/CharSet.java b/src/main/java/org/apache/commons/lang3/CharSet.java
index 27e9464251e..6cf0246f2f3 100644
--- a/src/main/java/org/apache/commons/lang3/CharSet.java
+++ b/src/main/java/org/apache/commons/lang3/CharSet.java
@@ -75,7 +75,7 @@ public class CharSet implements Serializable {
* Subclasses can add more common patterns if desired
* @since 2.0
*/
- protected static final Map COMMON = Collections.synchronizedMap(new HashMap());
+ protected static final Map COMMON = Collections.synchronizedMap(new HashMap<>());
static {
COMMON.put(null, EMPTY);
@@ -88,7 +88,7 @@ public class CharSet implements Serializable {
}
/** The set of CharRange objects. */
- private final Set set = Collections.synchronizedSet(new HashSet());
+ private final Set set = Collections.synchronizedSet(new HashSet<>());
//-----------------------------------------------------------------------
/**
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index be9f0ddb50c..28500a5545f 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -1383,7 +1383,7 @@ public static Iterable> hierarchy(final Class> type, final Interfaces
@Override
public Iterator> iterator() {
- final MutableObject> next = new MutableObject>(type);
+ final MutableObject> next = new MutableObject<>(type);
return new Iterator>() {
@Override
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 c3b4a033e50..5874f594290 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
@@ -903,7 +903,7 @@ public static List getMethodsListWithAnnotation(final Class> cls,
Validate.isTrue(cls != null, "The class must not be null");
Validate.isTrue(annotationCls != null, "The annotation class must not be null");
final List> classes = (searchSupers ? getAllSuperclassesAndInterfaces(cls)
- : new ArrayList>());
+ : new ArrayList<>());
classes.add(0, cls);
final List annotatedMethods = new ArrayList<>();
for (final Class> acls : classes) {
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 037c3a4b79a..0ec0fb6bc44 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
@@ -864,7 +864,7 @@ private static Map, Type> getTypeArguments(
getRawType(parameterizedOwnerType), subtypeVarAssigns);
} else {
// no owner, prep the type variable assignments map
- typeVarAssigns = subtypeVarAssigns == null ? new HashMap, Type>()
+ typeVarAssigns = subtypeVarAssigns == null ? new HashMap<>()
: new HashMap<>(subtypeVarAssigns);
}
@@ -918,7 +918,7 @@ private static Map, Type> getTypeArguments(Class> cls, final C
}
// create a copy of the incoming map, or an empty one if it's null
- final HashMap, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap, Type>()
+ final HashMap, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap<>()
: new HashMap<>(subtypeVarAssigns);
// has target class been reached?
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index 2ec631fcb09..e12ac3fbe89 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -207,13 +207,13 @@ public void testHashCodeMulti_multiple_likeList() {
final List list0 = new ArrayList<>(Arrays.asList(new Object[0]));
assertEquals(list0.hashCode(), ObjectUtils.hashCodeMulti());
- final List list1 = new ArrayList(Arrays.asList("a"));
+ final List list1 = new ArrayList<>(Arrays.asList("a"));
assertEquals(list1.hashCode(), ObjectUtils.hashCodeMulti("a"));
- final List list2 = new ArrayList(Arrays.asList("a", "b"));
+ final List list2 = new ArrayList<>(Arrays.asList("a", "b"));
assertEquals(list2.hashCode(), ObjectUtils.hashCodeMulti("a", "b"));
- final List list3 = new ArrayList(Arrays.asList("a", "b", "c"));
+ final List list3 = new ArrayList<>(Arrays.asList("a", "b", "c"));
assertEquals(list3.hashCode(), ObjectUtils.hashCodeMulti("a", "b", "c"));
}
diff --git a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
index 05f1da9a807..00c463a84a4 100644
--- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
@@ -433,9 +433,9 @@ public void testObjectBuild() {
@Test
public void testObjectRecursiveGenericInteger() {
- final TestRecursiveGenericObject o1_a = new TestRecursiveGenericObject(1);
- final TestRecursiveGenericObject o1_b = new TestRecursiveGenericObject(1);
- final TestRecursiveGenericObject o2 = new TestRecursiveGenericObject(2);
+ final TestRecursiveGenericObject o1_a = new TestRecursiveGenericObject<>(1);
+ final TestRecursiveGenericObject o1_b = new TestRecursiveGenericObject<>(1);
+ final TestRecursiveGenericObject o2 = new TestRecursiveGenericObject<>(2);
assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_b).isEquals());
assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_b, o1_a).isEquals());
@@ -447,9 +447,9 @@ public void testObjectRecursiveGenericInteger() {
public void testObjectRecursiveGenericString() {
// Note: Do not use literals, because string literals are always mapped by same object (internal() of String))!
String s1_a = String.valueOf(1);
- final TestRecursiveGenericObject o1_a = new TestRecursiveGenericObject(s1_a);
- final TestRecursiveGenericObject o1_b = new TestRecursiveGenericObject(String.valueOf(1));
- final TestRecursiveGenericObject o2 = new TestRecursiveGenericObject(String.valueOf(2));
+ final TestRecursiveGenericObject o1_a = new TestRecursiveGenericObject<>(s1_a);
+ final TestRecursiveGenericObject o1_b = new TestRecursiveGenericObject<>(String.valueOf(1));
+ final TestRecursiveGenericObject o2 = new TestRecursiveGenericObject<>(String.valueOf(2));
// To trigger bug reported in LANG-1356, call hashCode only on string in instance o1_a
s1_a.hashCode();
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
index 6f076505f40..daa5111aba8 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
@@ -65,19 +65,19 @@ static class CollectionHolder> {
@Test
@Ignore
public void testLinkedList() throws InterruptedException, ExecutionException {
- this.testConcurrency(new CollectionHolder>(new LinkedList()));
+ this.testConcurrency(new CollectionHolder<>(new LinkedList<>()));
}
@Test
@Ignore
public void testArrayList() throws InterruptedException, ExecutionException {
- this.testConcurrency(new CollectionHolder>(new ArrayList()));
+ this.testConcurrency(new CollectionHolder<>(new ArrayList<>()));
}
@Test
@Ignore
public void testCopyOnWriteArrayList() throws InterruptedException, ExecutionException {
- this.testConcurrency(new CollectionHolder>(new CopyOnWriteArrayList()));
+ this.testConcurrency(new CollectionHolder<>(new CopyOnWriteArrayList<>()));
}
private void testConcurrency(final CollectionHolder> holder) throws InterruptedException,
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
index c0fa90112a1..49c131a582d 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
@@ -104,7 +104,7 @@ public void test_toStringExcludeEmptyArray() {
@Test
public void test_toStringExcludeEmptyCollection() {
- final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new ArrayList());
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new ArrayList<>());
this.validateSecretFieldPresent(toString);
}
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java
index 83fa0683638..12bcdb43fea 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java
@@ -68,17 +68,17 @@ static class CollectionHolder> {
@Test
public void testLinkedList() throws InterruptedException, ExecutionException {
- this.testConcurrency(new CollectionHolder>(new LinkedList()));
+ this.testConcurrency(new CollectionHolder<>(new LinkedList<>()));
}
@Test
public void testArrayList() throws InterruptedException, ExecutionException {
- this.testConcurrency(new CollectionHolder>(new ArrayList()));
+ this.testConcurrency(new CollectionHolder<>(new ArrayList<>()));
}
@Test
public void testCopyOnWriteArrayList() throws InterruptedException, ExecutionException {
- this.testConcurrency(new CollectionHolder>(new CopyOnWriteArrayList()));
+ this.testConcurrency(new CollectionHolder<>(new CopyOnWriteArrayList<>()));
}
private void testConcurrency(final CollectionHolder> holder) throws InterruptedException,
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java
index 6cbf1839ed8..004a92e1b10 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java
@@ -580,7 +580,7 @@ public void testCreateIfAbsentUncheckedException()
EasyMock.replay(init);
try {
ConcurrentUtils.createIfAbsentUnchecked(
- new ConcurrentHashMap(), "test", init);
+ new ConcurrentHashMap<>(), "test", init);
fail("Exception not thrown!");
} catch (final ConcurrentRuntimeException crex) {
assertEquals("Wrong cause", ex, crex.getCause());
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 0496664c546..f5ea7a7ff69 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
@@ -275,19 +275,19 @@ public static String numOverload(final Number... args) {
// not only is the correct overloaded variant invoked, but that the varags arguments
// are also delivered correctly to the method.
public ImmutablePair varOverloadEcho(final String... args) {
- return new ImmutablePair("String...", args);
+ return new ImmutablePair<>("String...", args);
}
public ImmutablePair varOverloadEcho(final Number... args) {
- return new ImmutablePair("Number...", args);
+ return new ImmutablePair<>("Number...", args);
}
public static ImmutablePair varOverloadEchoStatic(final String... args) {
- return new ImmutablePair("String...", args);
+ return new ImmutablePair<>("String...", args);
}
public static ImmutablePair varOverloadEchoStatic(final Number... args) {
- return new ImmutablePair("Number...", args);
+ return new ImmutablePair<>("Number...", args);
}
static void verify(final ImmutablePair a, final ImmutablePair b) {
@@ -441,13 +441,13 @@ public void testInvokeMethod() throws Exception {
} catch (final NoSuchMethodException expected) {
}
- TestBean.verify(new ImmutablePair("String...", new String[]{"x", "y"}),
+ TestBean.verify(new ImmutablePair<>("String...", new String[]{"x", "y"}),
MethodUtils.invokeMethod(testBean, "varOverloadEcho", "x", "y"));
- TestBean.verify(new ImmutablePair("Number...", new Number[]{17, 23, 42}),
+ TestBean.verify(new ImmutablePair<>("Number...", new Number[]{17, 23, 42}),
MethodUtils.invokeMethod(testBean, "varOverloadEcho", 17, 23, 42));
- TestBean.verify(new ImmutablePair("String...", new String[]{"x", "y"}),
+ TestBean.verify(new ImmutablePair<>("String...", new String[]{"x", "y"}),
MethodUtils.invokeMethod(testBean, "varOverloadEcho", "x", "y"));
- TestBean.verify(new ImmutablePair("Number...", new Number[]{17, 23, 42}),
+ TestBean.verify(new ImmutablePair<>("Number...", new Number[]{17, 23, 42}),
MethodUtils.invokeMethod(testBean, "varOverloadEcho", 17, 23, 42));
}
@@ -516,13 +516,13 @@ public void testInvokeStaticMethod() throws Exception {
assertEquals("bar(int, String...)", MethodUtils.invokeStaticMethod(
TestBean.class, "bar", NumberUtils.INTEGER_ONE, "a", "b"));
- TestBean.verify(new ImmutablePair("String...", new String[]{"x", "y"}),
+ TestBean.verify(new ImmutablePair<>("String...", new String[]{"x", "y"}),
MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", "x", "y"));
- TestBean.verify(new ImmutablePair("Number...", new Number[]{17, 23, 42}),
+ TestBean.verify(new ImmutablePair<>("Number...", new Number[]{17, 23, 42}),
MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", 17, 23, 42));
- TestBean.verify(new ImmutablePair("String...", new String[]{"x", "y"}),
+ TestBean.verify(new ImmutablePair<>("String...", new String[]{"x", "y"}),
MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", "x", "y"));
- TestBean.verify(new ImmutablePair("Number...", new Number[]{17, 23, 42}),
+ TestBean.verify(new ImmutablePair<>("Number...", new Number[]{17, 23, 42}),
MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", 17, 23, 42));
try {
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 a9bb9fab64c..7bd5380ab21 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
@@ -430,7 +430,7 @@ public void testIsAssignable() throws SecurityException, NoSuchMethodException,
final Type dClassType = AClass.class.getField("dClass").getGenericType();
final Type eClassType = AClass.class.getField("eClass").getGenericType();
final Type fClassType = AClass.class.getField("fClass").getGenericType();
- final AClass aClass = new AClass(new AAClass());
+ final AClass aClass = new AClass(new AAClass<>());
aClass.bClass = aClass.cClass;
assertTrue(TypeUtils.isAssignable(cClassType, bClassType));
aClass.bClass = aClass.dClass;
From 9fb4f47f352dc1c1f5f20de80840d39e1eebb985 Mon Sep 17 00:00:00 2001
From: Benedikt Ritter
Date: Sun, 26 Aug 2018 17:25:29 +0200
Subject: [PATCH 0238/3439] Identical catch blocks can be combined
---
.../java/org/apache/commons/lang3/reflect/FieldUtils.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
index c4ccccab74d..68146b16595 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
@@ -733,10 +733,8 @@ public static void removeFinalModifier(final Field field, final boolean forceAcc
}
}
}
- } catch (final NoSuchFieldException ignored) {
+ } catch (final NoSuchFieldException | IllegalAccessException ignored) {
// The field class contains always a modifiers field
- } catch (final IllegalAccessException ignored) {
- // The modifiers field is made accessible
}
}
From bff752134ba7626ca4cdb11a5a8d743d03af4cd8 Mon Sep 17 00:00:00 2001
From: Benedikt Ritter
Date: Sun, 26 Aug 2018 17:32:02 +0200
Subject: [PATCH 0239/3439] Use build in methods for comparing numerical values
---
src/main/java/org/apache/commons/lang3/math/Fraction.java | 8 +-------
.../org/apache/commons/lang3/reflect/MemberUtils.java | 2 +-
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/math/Fraction.java b/src/main/java/org/apache/commons/lang3/math/Fraction.java
index a6ef8b3b266..6271add0130 100644
--- a/src/main/java/org/apache/commons/lang3/math/Fraction.java
+++ b/src/main/java/org/apache/commons/lang3/math/Fraction.java
@@ -869,13 +869,7 @@ public int compareTo(final Fraction other) {
// otherwise see which is less
final long first = (long) numerator * (long) other.denominator;
final long second = (long) other.numerator * (long) denominator;
- if (first == second) {
- return 0;
- } else if (first < second) {
- return -1;
- } else {
- return 1;
- }
+ return Long.compare(first, second);
}
/**
diff --git a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
index 751e5e0c923..3a85b788d06 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
@@ -135,7 +135,7 @@ static int compareMethodFit(final Method left, final Method right, final Class
private static int compareParameterTypes(final Executable left, final Executable right, final Class>[] actual) {
final float leftCost = getTotalTransformationCost(actual, left);
final float rightCost = getTotalTransformationCost(actual, right);
- return leftCost < rightCost ? -1 : rightCost < leftCost ? 1 : 0;
+ return Float.compare(leftCost, rightCost);
}
/**
From 3ee9cc840088762c875a9c02531077279f7c237f Mon Sep 17 00:00:00 2001
From: Benedikt Ritter