Permalink
Browse files

Tagging 3.1 rc1

  • Loading branch information...
2 parents 8f5b6ea + d648eac commit 3c8e583efac85d8c2898ebf9e450d584aca6f0c1 Henri Yandell committed Nov 10, 2011
Showing with 251 additions and 209 deletions.
  1. +4 −4 src/main/java/org/apache/commons/lang3/BooleanUtils.java
  2. +1 −1 src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
  3. +1 −1 src/main/java/org/apache/commons/lang3/CharSet.java
  4. +1 −1 src/main/java/org/apache/commons/lang3/ClassUtils.java
  5. +2 −2 src/main/java/org/apache/commons/lang3/EnumUtils.java
  6. +4 −4 src/main/java/org/apache/commons/lang3/ObjectUtils.java
  7. +4 −4 src/main/java/org/apache/commons/lang3/RandomStringUtils.java
  8. +1 −1 src/main/java/org/apache/commons/lang3/Range.java
  9. +27 −27 src/main/java/org/apache/commons/lang3/StringUtils.java
  10. +2 −2 src/main/java/org/apache/commons/lang3/Validate.java
  11. +18 −24 src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
  12. +2 −2 src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java
  13. +1 −1 src/main/java/org/apache/commons/lang3/concurrent/ConstantInitializer.java
  14. +1 −1 src/main/java/org/apache/commons/lang3/concurrent/TimedSemaphore.java
  15. +2 −2 src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
  16. +13 −13 src/main/java/org/apache/commons/lang3/math/Fraction.java
  17. +3 −3 src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
  18. +2 −2 src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
  19. +1 −1 src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
  20. +4 −3 src/main/java/org/apache/commons/lang3/text/StrBuilder.java
  21. +3 −3 src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
  22. +3 −3 src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
  23. +3 −3 src/main/java/org/apache/commons/lang3/text/WordUtils.java
  24. +6 −6 src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
  25. +4 −4 src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java
  26. +1 −1 src/main/java/org/apache/commons/lang3/time/StopWatch.java
  27. +40 −0 src/site/resources/release-notes/RELEASE-NOTES-3.1.txt
  28. +21 −21 src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
  29. +1 −1 src/test/java/org/apache/commons/lang3/BitFieldTest.java
  30. +1 −1 src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
  31. +3 −3 src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
  32. +13 −13 src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
  33. +16 −10 src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
  34. +38 −38 src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
  35. +1 −0 src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
  36. +1 −1 src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
  37. +2 −2 src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
@@ -551,12 +551,12 @@ public static Boolean toBooleanObject(String str) {
switch (str.length()) {
case 1: {
char ch0 = str.charAt(0);
- if ((ch0 == 'y' || ch0 == 'Y') ||
- (ch0 == 't' || ch0 == 'T')) {
+ if (ch0 == 'y' || ch0 == 'Y' ||
+ ch0 == 't' || ch0 == 'T') {
return Boolean.TRUE;
}
- if ((ch0 == 'n' || ch0 == 'N') ||
- (ch0 == 'f' || ch0 == 'F')) {
+ if (ch0 == 'n' || ch0 == 'N' ||
+ ch0 == 'f' || ch0 == 'F') {
return Boolean.FALSE;
}
break;
@@ -187,7 +187,7 @@ static int lastIndexOf(CharSequence cs, CharSequence searchChar, int start) {
static boolean regionMatches(CharSequence cs, boolean ignoreCase, int thisStart,
CharSequence substring, int start, int length) {
if (cs instanceof String && substring instanceof String) {
- return ((String) cs).regionMatches(ignoreCase, thisStart, ((String) substring), start, length);
+ return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
} else {
// TODO: Implement rather than convert to String
return cs.toString().regionMatches(ignoreCase, thisStart, substring.toString(), start, length);
@@ -178,7 +178,7 @@ protected void add(String str) {
int len = str.length();
int pos = 0;
while (pos < len) {
- int remainder = (len - pos);
+ int remainder = len - pos;
if (remainder >= 4 && str.charAt(pos) == '^' && str.charAt(pos + 2) == '-') {
// negated range
set.add(CharRange.isNotIn(str.charAt(pos + 1), str.charAt(pos + 3)));
@@ -622,7 +622,7 @@ public static boolean isAssignable(Class<?> cls, Class<?> toClass, boolean autob
}
// have to check for null, as isAssignableFrom doesn't
if (cls == null) {
- return !(toClass.isPrimitive());
+ return !toClass.isPrimitive();
}
//autoboxing:
if (autoboxing) {
@@ -136,7 +136,7 @@ public EnumUtils() {
Validate.notNull(values);
long total = 0;
for (E constant : values) {
- total |= (1 << constant.ordinal());
+ total |= 1 << constant.ordinal();
}
return total;
}
@@ -179,7 +179,7 @@ public EnumUtils() {
final E[] constants = checkBitVectorable(enumClass).getEnumConstants();
final EnumSet<E> results = EnumSet.noneOf(enumClass);
for (E constant : constants) {
- if ((value & (1 << constant.ordinal())) != 0) {
+ if ((value & 1 << constant.ordinal()) != 0) {
results.add(constant);
}
}
@@ -152,7 +152,7 @@ public static boolean equals(Object object1, Object object2) {
if (object1 == object2) {
return true;
}
- if ((object1 == null) || (object2 == null)) {
+ if (object1 == null || object2 == null) {
return false;
}
return object1.equals(object2);
@@ -196,7 +196,7 @@ public static boolean notEqual(Object object1, Object object2) {
*/
public static int hashCode(Object obj) {
// hashCode(Object) retained for performance, as hash code is often critical
- return (obj == null) ? 0 : obj.hashCode();
+ return obj == null ? 0 : obj.hashCode();
}
/**
@@ -409,9 +409,9 @@ public static String toString(Object obj, String nullStr) {
if (c1 == c2) {
return 0;
} else if (c1 == null) {
- return (nullGreater ? 1 : -1);
+ return nullGreater ? 1 : -1;
} else if (c2 == null) {
- return (nullGreater ? -1 : 1);
+ return nullGreater ? -1 : 1;
}
return c1.compareTo(c2);
}
@@ -227,7 +227,7 @@ public static String random(int count, int start, int end, boolean letters, bool
} else if (count < 0) {
throw new IllegalArgumentException("Requested random string length " + count + " is less than 0.");
}
- if ((start == 0) && (end == 0)) {
+ if (start == 0 && end == 0) {
end = 'z' + 1;
start = ' ';
if (!letters && !numbers) {
@@ -246,9 +246,9 @@ public static String random(int count, int start, int end, boolean letters, bool
} else {
ch = chars[random.nextInt(gap) + start];
}
- if ((letters && Character.isLetter(ch))
- || (numbers && Character.isDigit(ch))
- || (!letters && !numbers)) {
+ if (letters && Character.isLetter(ch)
+ || numbers && Character.isDigit(ch)
+ || !letters && !numbers) {
if(ch >= 56320 && ch <= 57343) {
if(count == 0) {
count++;
@@ -219,7 +219,7 @@ public boolean contains(T element) {
if (element == null) {
return false;
}
- return (comparator.compare(element, minimum) > -1) && (comparator.compare(element, maximum) < 1);
+ return comparator.compare(element, minimum) > -1 && comparator.compare(element, maximum) < 1;
}
/**
@@ -225,7 +225,7 @@ public static boolean isBlank(CharSequence cs) {
return true;
}
for (int i = 0; i < strLen; i++) {
- if ((Character.isWhitespace(cs.charAt(i)) == false)) {
+ if (Character.isWhitespace(cs.charAt(i)) == false) {
return false;
}
}
@@ -484,13 +484,13 @@ public static String stripStart(String str, String stripChars) {
}
int start = 0;
if (stripChars == null) {
- while ((start != strLen) && Character.isWhitespace(str.charAt(start))) {
+ while (start != strLen && Character.isWhitespace(str.charAt(start))) {
start++;
}
} else if (stripChars.length() == 0) {
return str;
} else {
- while ((start != strLen) && (stripChars.indexOf(str.charAt(start)) != INDEX_NOT_FOUND)) {
+ while (start != strLen && stripChars.indexOf(str.charAt(start)) != INDEX_NOT_FOUND) {
start++;
}
}
@@ -529,13 +529,13 @@ public static String stripEnd(String str, String stripChars) {
}
if (stripChars == null) {
- while ((end != 0) && Character.isWhitespace(str.charAt(end - 1))) {
+ while (end != 0 && Character.isWhitespace(str.charAt(end - 1))) {
end--;
}
} else if (stripChars.length() == 0) {
return str;
} else {
- while ((end != 0) && (stripChars.indexOf(str.charAt(end - 1)) != INDEX_NOT_FOUND)) {
+ while (end != 0 && stripChars.indexOf(str.charAt(end - 1)) != INDEX_NOT_FOUND) {
end--;
}
}
@@ -1087,7 +1087,7 @@ public static int indexOfIgnoreCase(CharSequence str, CharSequence searchStr, in
if (startPos < 0) {
startPos = 0;
}
- int endLimit = (str.length() - searchStr.length()) + 1;
+ int endLimit = str.length() - searchStr.length() + 1;
if (startPos > endLimit) {
return INDEX_NOT_FOUND;
}
@@ -1333,7 +1333,7 @@ public static int lastIndexOfIgnoreCase(CharSequence str, CharSequence searchStr
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
- if (startPos > (str.length() - searchStr.length())) {
+ if (startPos > str.length() - searchStr.length()) {
startPos = str.length() - searchStr.length();
}
if (startPos < 0) {
@@ -1946,7 +1946,7 @@ public static int indexOfAny(CharSequence str, CharSequence... searchStrs) {
}
}
- return (ret == Integer.MAX_VALUE) ? INDEX_NOT_FOUND : ret;
+ return ret == Integer.MAX_VALUE ? INDEX_NOT_FOUND : ret;
}
/**
@@ -2212,7 +2212,7 @@ public static String mid(String str, int pos, int len) {
if (pos < 0) {
pos = 0;
}
- if (str.length() <= (pos + len)) {
+ if (str.length() <= pos + len) {
return str.substring(pos);
}
return str.substring(pos, pos + len);
@@ -2378,7 +2378,7 @@ public static String substringAfterLast(String str, String separator) {
return EMPTY;
}
int pos = str.lastIndexOf(separator);
- if (pos == INDEX_NOT_FOUND || pos == (str.length() - separator.length())) {
+ if (pos == INDEX_NOT_FOUND || pos == str.length() - separator.length()) {
return EMPTY;
}
return str.substring(pos + separator.length());
@@ -2486,7 +2486,7 @@ public static String substringBetween(String str, String open, String close) {
int openLen = open.length();
List<String> list = new ArrayList<String>();
int pos = 0;
- while (pos < (strLen - closeLen)) {
+ while (pos < strLen - closeLen) {
int start = str.indexOf(open, pos);
if (start < 0) {
break;
@@ -2773,7 +2773,7 @@ public static String substringBetween(String str, String open, String close) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
- if ((separator == null) || (EMPTY.equals(separator))) {
+ if (separator == null || EMPTY.equals(separator)) {
// Split on whitespace.
return splitWorker(str, null, max, preserveAllTokens);
}
@@ -2932,7 +2932,7 @@ public static String substringBetween(String str, String open, String close) {
match = true;
i++;
}
- if (match || (preserveAllTokens && lastMatch)) {
+ if (match || preserveAllTokens && lastMatch) {
list.add(str.substring(start, i));
}
return list.toArray(new String[list.size()]);
@@ -3108,7 +3108,7 @@ public static String substringBetween(String str, String open, String close) {
i++;
}
}
- if (match || (preserveAllTokens && lastMatch)) {
+ if (match || preserveAllTokens && lastMatch) {
list.add(str.substring(start, i));
}
return list.toArray(new String[list.size()]);
@@ -3299,7 +3299,7 @@ public static String join(Object[] array, char separator, int startIndex, int en
if (array == null) {
return null;
}
- int noOfItems = (endIndex - startIndex);
+ int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
@@ -3384,7 +3384,7 @@ public static String join(Object[] array, String separator, int startIndex, int
// endIndex - startIndex > 0: Len = NofStrings *(len(firstString) + len(separator))
// (Assuming that all Strings are roughly equally long)
- int noOfItems = (endIndex - startIndex);
+ int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
@@ -3867,8 +3867,8 @@ public static String replace(String text, String searchString, String replacemen
}
int replLength = searchString.length();
int increase = replacement.length() - replLength;
- increase = (increase < 0 ? 0 : increase);
- increase *= (max < 0 ? 16 : (max > 64 ? 64 : max));
+ increase = increase < 0 ? 0 : increase;
+ increase *= max < 0 ? 16 : max > 64 ? 64 : max;
StringBuilder buf = new StringBuilder(text.length() + increase);
while (end != INDEX_NOT_FOUND) {
buf.append(text.substring(start, end)).append(replacement);
@@ -5214,7 +5214,7 @@ public static boolean isAlphaSpace(CharSequence cs) {
}
int sz = cs.length();
for (int i = 0; i < sz; i++) {
- if ((Character.isLetter(cs.charAt(i)) == false) && (cs.charAt(i) != ' ')) {
+ if (Character.isLetter(cs.charAt(i)) == false && cs.charAt(i) != ' ') {
return false;
}
}
@@ -5284,7 +5284,7 @@ public static boolean isAlphanumericSpace(CharSequence cs) {
}
int sz = cs.length();
for (int i = 0; i < sz; i++) {
- if ((Character.isLetterOrDigit(cs.charAt(i)) == false) && (cs.charAt(i) != ' ')) {
+ if (Character.isLetterOrDigit(cs.charAt(i)) == false && cs.charAt(i) != ' ') {
return false;
}
}
@@ -5396,7 +5396,7 @@ public static boolean isNumericSpace(CharSequence cs) {
}
int sz = cs.length();
for (int i = 0; i < sz; i++) {
- if ((Character.isDigit(cs.charAt(i)) == false) && (cs.charAt(i) != ' ')) {
+ if (Character.isDigit(cs.charAt(i)) == false && cs.charAt(i) != ' ') {
return false;
}
}
@@ -5429,7 +5429,7 @@ public static boolean isWhitespace(CharSequence cs) {
}
int sz = cs.length();
for (int i = 0; i < sz; i++) {
- if ((Character.isWhitespace(cs.charAt(i)) == false)) {
+ if (Character.isWhitespace(cs.charAt(i)) == false) {
return false;
}
}
@@ -5726,7 +5726,7 @@ public static String abbreviate(String str, int offset, int maxWidth) {
if (offset > str.length()) {
offset = str.length();
}
- if ((str.length() - offset) < (maxWidth - 3)) {
+ if (str.length() - offset < maxWidth - 3) {
offset = str.length() - (maxWidth - 3);
}
final String abrevMarker = "...";
@@ -5736,7 +5736,7 @@ public static String abbreviate(String str, int offset, int maxWidth) {
if (maxWidth < 7) {
throw new IllegalArgumentException("Minimum abbreviation width with offset is 7");
}
- if ((offset + (maxWidth - 3)) < str.length()) {
+ if (offset + maxWidth - 3 < str.length()) {
return abrevMarker + abbreviate(str.substring(offset), maxWidth - 3);
}
return abrevMarker + str.substring(str.length() - (maxWidth - 3));
@@ -5776,7 +5776,7 @@ public static String abbreviateMiddle(String str, String middle, int length) {
return str;
}
- if (length >= str.length() || length < (middle.length()+2)) {
+ if (length >= str.length() || length < middle.length()+2) {
return str;
}
@@ -5934,7 +5934,7 @@ public static int indexOfDifference(CharSequence... css) {
}
// handle lists containing all nulls or all empty strings
- if (allStringsNull || (longestStrLen == 0 && !anyStringNull)) {
+ if (allStringsNull || longestStrLen == 0 && !anyStringNull) {
return INDEX_NOT_FOUND;
}
@@ -6365,7 +6365,7 @@ public static boolean startsWithIgnoreCase(CharSequence str, CharSequence prefix
*/
private static boolean startsWith(CharSequence str, CharSequence prefix, boolean ignoreCase) {
if (str == null || prefix == null) {
- return (str == null && prefix == null);
+ return str == null && prefix == null;
}
if (prefix.length() > str.length()) {
return false;
@@ -296,7 +296,7 @@ public static void isTrue(boolean expression) {
if (collection == null) {
throw new NullPointerException(String.format(message, values));
}
- if (collection.size() == 0) {
+ if (collection.isEmpty()) {
throw new IllegalArgumentException(String.format(message, values));
}
return collection;
@@ -345,7 +345,7 @@ public static void isTrue(boolean expression) {
if (map == null) {
throw new NullPointerException(String.format(message, values));
}
- if (map.size() == 0) {
+ if (map.isEmpty()) {
throw new IllegalArgumentException(String.format(message, values));
}
return map;
Oops, something went wrong.

0 comments on commit 3c8e583

Please sign in to comment.