You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2017/06/08 08:15:35 UTC
[01/48] [lang] Avoid endless loop printing array with
MultilineRecursiveToStringStyle [Forced Update!]
Repository: commons-lang
Updated Branches:
refs/heads/release 3a64cf6af -> 360198dfb (forced update)
Avoid endless loop printing array with MultilineRecursiveToStringStyle
Previous implementation was causing an endless loop by calling
'super.appendDetail' rather than 'super.reflectionAppendArrayDetail'
when it encountered an array type.
Fixes: LANG-1319
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/75874319
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/75874319
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/75874319
Branch: refs/heads/release
Commit: 7587431987258e94748d5f2fda1e6ca049a21600
Parents: 05e18cc
Author: duncan <du...@wortharead.com>
Authored: Fri May 19 21:44:28 2017 +0100
Committer: duncan <du...@wortharead.com>
Committed: Fri May 19 21:44:28 2017 +0100
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
.../builder/MultilineRecursiveToStringStyle.java | 4 ++--
.../MultilineRecursiveToStringStyleTest.java | 16 +++++++++++++++-
3 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/75874319/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6a22895..9f52a9b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="3.6" date="2017-MM-DD" description="TBD">
+ <action issue="LANG-1319" type="fix" dev="djones">MultilineRecursiveToStringStyle StackOverflowError when object is an array</action>
<action issue="LANG-1325" type="add" dev="kinow" due-to="Arshad Basha">Increase test coverage of ToStringBuilder class to 100%</action>
<action issue="LANG-1307" type="add" dev="pschumacher" due-to="Arshad Basha">Add a method in StringUtils to extract only digits out of input string</action>
<action issue="LANG-1110" type="update" dev="pschumacher" due-to="Bruno P. Kinoshita">Implement HashSetvBitSetTest using JMH</action>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/75874319/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
index df82787..7c0375a 100644
--- a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
@@ -138,11 +138,11 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle {
protected void reflectionAppendArrayDetail(final StringBuffer buffer, final String fieldName, final Object array) {
spaces += INDENT;
resetIndent();
- super.appendDetail(buffer, fieldName, array);
+ super.reflectionAppendArrayDetail(buffer, fieldName, array);
spaces -= INDENT;
resetIndent();
}
-
+
@Override
protected void appendDetail(final StringBuffer buffer, final String fieldName, final long[] array) {
spaces += INDENT;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/75874319/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
index daf2881..e3a87f6 100644
--- a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
@@ -17,7 +17,7 @@
package org.apache.commons.lang3.builder;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
@@ -200,6 +200,20 @@ public class MultilineRecursiveToStringStyleTest {
+ "]";
assertEquals(exp, toString(wa));
}
+
+
+ @Test
+ public void testLANG1319() throws Exception {
+ final String[] stringArray = {"1", "2"};
+
+ final String exp = getClassPrefix(stringArray) + "[" + BR
+ + " {" + BR
+ + " 1," + BR
+ + " 2" + BR
+ + " }" + BR
+ + "]";
+ assertEquals(exp, toString(stringArray));
+ }
private String getClassPrefix(final Object object) {
return object.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(object));
[20/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
----------------------------------------------------------------------
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 75bd48a..b2453a4 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
@@ -32,7 +32,7 @@ import org.junit.Test;
* Unit tests {@link DiffBuilder}.
*/
public class DiffBuilderTest {
-
+
private static final ToStringStyle SHORT_STYLE = ToStringStyle.SHORT_PREFIX_STYLE;
private static class TypeTestClass implements Diffable<TypeTestClass> {
@@ -78,20 +78,20 @@ public class DiffBuilderTest {
.append("objectField", objectField, obj.objectField)
.append("objectArrayField", objectArrayField, obj.objectArrayField)
.build();
- }
+ }
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this, false);
}
-
+
@Override
public boolean equals(final Object obj) {
return EqualsBuilder.reflectionEquals(this, obj, false);
}
}
-
-
+
+
@Test
public void testBoolean() {
final TypeTestClass class1 = new TypeTestClass();
@@ -102,7 +102,7 @@ public class DiffBuilderTest {
final Diff<?> diff = list.getDiffs().get(0);
assertEquals(Boolean.class, diff.getType());
assertEquals(Boolean.TRUE, diff.getLeft());
- assertEquals(Boolean.FALSE, diff.getRight());
+ assertEquals(Boolean.FALSE, diff.getRight());
}
@Test
@@ -113,13 +113,13 @@ public class DiffBuilderTest {
final DiffResult list = class1.diff(class2);
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
- assertArrayEquals(ArrayUtils.toObject(class1.booleanArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class1.booleanArrayField),
(Object[]) diff.getLeft());
- assertArrayEquals(ArrayUtils.toObject(class2.booleanArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class2.booleanArrayField),
(Object[]) diff.getRight());
}
-
+
@Test
public void testByte() {
final TypeTestClass class1 = new TypeTestClass();
@@ -129,9 +129,9 @@ public class DiffBuilderTest {
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
assertEquals(Byte.valueOf(class1.byteField), diff.getLeft());
- assertEquals(Byte.valueOf(class2.byteField), diff.getRight());
+ assertEquals(Byte.valueOf(class2.byteField), diff.getRight());
}
-
+
@Test
public void testByteArray() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
@@ -140,9 +140,9 @@ public class DiffBuilderTest {
final DiffResult list = class1.diff(class2);
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
- assertArrayEquals(ArrayUtils.toObject(class1.byteArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class1.byteArrayField),
(Object[]) diff.getLeft());
- assertArrayEquals(ArrayUtils.toObject(class2.byteArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class2.byteArrayField),
(Object[]) diff.getRight());
}
@@ -157,8 +157,8 @@ public class DiffBuilderTest {
assertEquals(Character.valueOf(class1.charField), diff.getLeft());
assertEquals(Character.valueOf(class2.charField), diff.getRight());
}
-
-
+
+
@Test
public void testCharArray() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
@@ -167,13 +167,13 @@ public class DiffBuilderTest {
final DiffResult list = class1.diff(class2);
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
- assertArrayEquals(ArrayUtils.toObject(class1.charArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class1.charArrayField),
(Object[]) diff.getLeft());
- assertArrayEquals(ArrayUtils.toObject(class2.charArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class2.charArrayField),
(Object[]) diff.getRight());
}
-
-
+
+
@Test
public void testDouble() {
final TypeTestClass class1 = new TypeTestClass();
@@ -184,9 +184,9 @@ public class DiffBuilderTest {
final Diff<?> diff = list.getDiffs().get(0);
assertEquals(Double.valueOf(class1.doubleField), diff.getLeft());
assertEquals(Double.valueOf(class2.doubleField), diff.getRight());
- }
+ }
+
-
@Test
public void testDoubleArray() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
@@ -195,12 +195,12 @@ public class DiffBuilderTest {
final DiffResult list = class1.diff(class2);
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
- assertArrayEquals(ArrayUtils.toObject(class1.doubleArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class1.doubleArrayField),
(Object[]) diff.getLeft());
- assertArrayEquals(ArrayUtils.toObject(class2.doubleArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class2.doubleArrayField),
(Object[]) diff.getRight());
}
-
+
@Test
public void testFloat() {
final TypeTestClass class1 = new TypeTestClass();
@@ -211,9 +211,9 @@ public class DiffBuilderTest {
final Diff<?> diff = list.getDiffs().get(0);
assertEquals(Float.valueOf(class1.floatField), diff.getLeft());
assertEquals(Float.valueOf(class2.floatField), diff.getRight());
- }
+ }
+
-
@Test
public void testFloatArray() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
@@ -222,13 +222,13 @@ public class DiffBuilderTest {
final DiffResult list = class1.diff(class2);
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
- assertArrayEquals(ArrayUtils.toObject(class1.floatArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class1.floatArrayField),
(Object[]) diff.getLeft());
- assertArrayEquals(ArrayUtils.toObject(class2.floatArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class2.floatArrayField),
(Object[]) diff.getRight());
- }
-
-
+ }
+
+
@Test
public void testInt() {
final TypeTestClass class1 = new TypeTestClass();
@@ -239,9 +239,9 @@ public class DiffBuilderTest {
final Diff<?> diff = list.getDiffs().get(0);
assertEquals(Integer.valueOf(class1.intField), diff.getLeft());
assertEquals(Integer.valueOf(class2.intField), diff.getRight());
- }
+ }
+
-
@Test
public void testIntArray() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
@@ -250,12 +250,12 @@ public class DiffBuilderTest {
final DiffResult list = class1.diff(class2);
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
- assertArrayEquals(ArrayUtils.toObject(class1.intArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class1.intArrayField),
(Object[]) diff.getLeft());
- assertArrayEquals(ArrayUtils.toObject(class2.intArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class2.intArrayField),
(Object[]) diff.getRight());
}
-
+
@Test
public void testLong() {
final TypeTestClass class1 = new TypeTestClass();
@@ -266,9 +266,9 @@ public class DiffBuilderTest {
final Diff<?> diff = list.getDiffs().get(0);
assertEquals(Long.valueOf(class1.longField), diff.getLeft());
assertEquals(Long.valueOf(class2.longField), diff.getRight());
- }
+ }
+
-
@Test
public void testLongArray() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
@@ -277,12 +277,12 @@ public class DiffBuilderTest {
final DiffResult list = class1.diff(class2);
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
- assertArrayEquals(ArrayUtils.toObject(class1.longArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class1.longArrayField),
(Object[]) diff.getLeft());
- assertArrayEquals(ArrayUtils.toObject(class2.longArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class2.longArrayField),
(Object[]) diff.getRight());
}
-
+
@Test
public void testShort() {
final TypeTestClass class1 = new TypeTestClass();
@@ -293,9 +293,9 @@ public class DiffBuilderTest {
final Diff<?> diff = list.getDiffs().get(0);
assertEquals(Short.valueOf(class1.shortField), diff.getLeft());
assertEquals(Short.valueOf(class2.shortField), diff.getRight());
- }
+ }
+
-
@Test
public void testShortArray() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
@@ -304,14 +304,14 @@ public class DiffBuilderTest {
final DiffResult list = class1.diff(class2);
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
- assertArrayEquals(ArrayUtils.toObject(class1.shortArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class1.shortArrayField),
(Object[]) diff.getLeft());
- assertArrayEquals(ArrayUtils.toObject(class2.shortArrayField),
+ assertArrayEquals(ArrayUtils.toObject(class2.shortArrayField),
(Object[]) diff.getRight());
}
-
+
@Test
- public void testObject() throws Exception {
+ public void testObject() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
final TypeTestClass class2 = new TypeTestClass();
class2.objectField = "Some string";
@@ -319,11 +319,11 @@ public class DiffBuilderTest {
assertEquals(1, list.getNumberOfDiffs());
final Diff<?> diff = list.getDiffs().get(0);
assertEquals(class1.objectField, diff.getLeft());
- assertEquals(class2.objectField, diff.getRight());
+ assertEquals(class2.objectField, diff.getRight());
}
- /**
- * Test that "left" and "right" are the same instance and are equal.
+ /**
+ * Test that "left" and "right" are the same instance and are equal.
*/
@Test
public void testObjectsSameAndEqual() throws Exception {
@@ -339,8 +339,8 @@ public class DiffBuilderTest {
assertEquals(0, list.getNumberOfDiffs());
}
- /**
- * Test that "left" and "right" are the same instance but are equal.
+ /**
+ * Test that "left" and "right" are the same instance but are equal.
*/
@Test
public void testObjectsNotSameButEqual() throws Exception {
@@ -355,8 +355,8 @@ public class DiffBuilderTest {
assertEquals(0, list.getNumberOfDiffs());
}
- /**
- * Test that "left" and "right" are not the same instance and are not equal.
+ /**
+ * Test that "left" and "right" are not the same instance and are not equal.
*/
@Test
public void testObjectsNotSameNorEqual() throws Exception {
@@ -381,8 +381,8 @@ public class DiffBuilderTest {
final Diff<?> diff = list.getDiffs().get(0);
assertArrayEquals(class1.objectArrayField, (Object[]) diff.getLeft());
assertArrayEquals(class2.objectArrayField, (Object[]) diff.getRight());
- }
-
+ }
+
@Test
public void testObjectArrayEqual() throws Exception {
final TypeTestClass class1 = new TypeTestClass();
@@ -391,9 +391,9 @@ public class DiffBuilderTest {
class2.objectArrayField = new Object[] {"string", 1, 2};
final DiffResult list = class1.diff(class2);
assertEquals(0, list.getNumberOfDiffs());
- }
-
-
+ }
+
+
@Test
public void testByteArrayEqualAsObject() throws Exception {
final DiffResult list = new DiffBuilder("String1", "String2", SHORT_STYLE)
@@ -410,7 +410,7 @@ public class DiffBuilderTest {
assertEquals(0, list.getNumberOfDiffs());
}
-
+
@Test
public void testDiffResult() {
final TypeTestClass class1 = new TypeTestClass();
@@ -425,25 +425,25 @@ public class DiffBuilderTest {
}
@Test(expected=IllegalArgumentException.class)
- public void testNullLhs() {
+ public void testNullLhs() {
new DiffBuilder(null, this, ToStringStyle.DEFAULT_STYLE);
}
-
+
@Test(expected=IllegalArgumentException.class)
- public void testNullRhs() {
+ public void testNullRhs() {
new DiffBuilder(this, null, ToStringStyle.DEFAULT_STYLE);
- }
-
+ }
+
@Test
public void testSameObjectIgnoresAppends() {
- final TypeTestClass testClass = new TypeTestClass();
+ final TypeTestClass testClass = new TypeTestClass();
final DiffResult list = new DiffBuilder(testClass, testClass, SHORT_STYLE)
.append("ignored", false, true)
.build();
assertEquals(0, list.getNumberOfDiffs());
}
-
+
@Test
public void testSimilarObjectIgnoresAppends() {
final TypeTestClass testClass1 = new TypeTestClass();
@@ -453,14 +453,14 @@ public class DiffBuilderTest {
.build();
assertEquals(0, list.getNumberOfDiffs());
}
-
-
+
+
@Test
public void testStylePassedToDiffResult() {
final TypeTestClass class1 = new TypeTestClass();
DiffResult list = class1.diff(class1);
assertEquals(SHORT_STYLE, list.getToStringStyle());
-
+
class1.style = ToStringStyle.MULTI_LINE_STYLE;
list = class1.diff(class1);
assertEquals(ToStringStyle.MULTI_LINE_STYLE, list.getToStringStyle());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/DiffTest.java
----------------------------------------------------------------------
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 26bf95a..1aff66f 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DiffTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DiffTest.java
@@ -28,12 +28,12 @@ public class DiffTest {
private static final String FIELD_NAME = "field";
private static final Diff<Boolean> booleanDiff = new BooleanDiff(FIELD_NAME);
-
- private static class BooleanDiff extends Diff<Boolean> {
+
+ private static class BooleanDiff extends Diff<Boolean> {
private static final long serialVersionUID = 1L;
protected BooleanDiff(final String fieldName) {
- super(fieldName);
+ super(fieldName);
}
@Override
@@ -44,27 +44,27 @@ public class DiffTest {
@Override
public Boolean getRight() {
return Boolean.FALSE;
- }
+ }
}
-
+
@Test(expected = UnsupportedOperationException.class)
public void testCannotModify() {
booleanDiff.setValue(Boolean.FALSE);
}
-
+
@Test
public void testGetFieldName() {
assertEquals(FIELD_NAME, booleanDiff.getFieldName());
}
-
+
@Test
public void testGetType() {
assertEquals(Boolean.class, booleanDiff.getType());
}
-
+
@Test
public void testToString() {
- assertEquals(String.format("[%s: %s, %s]", FIELD_NAME, booleanDiff.getLeft(),
+ assertEquals(String.format("[%s: %s, %s]", FIELD_NAME, booleanDiff.getLeft(),
booleanDiff.getRight()), booleanDiff.toString());
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
----------------------------------------------------------------------
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 b5cfdfa..0e0f5f4 100644
--- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -99,7 +99,7 @@ public class EqualsBuilderTest {
return b;
}
}
-
+
static class TestEmptySubObject extends TestObject {
public TestEmptySubObject(final int a) {
super(a);
@@ -150,17 +150,17 @@ public class EqualsBuilderTest {
private final TestRecursiveInnerObject a;
private final TestRecursiveInnerObject b;
private int z;
-
- public TestRecursiveObject(final TestRecursiveInnerObject a,
+
+ public TestRecursiveObject(final TestRecursiveInnerObject a,
final TestRecursiveInnerObject b, final int z) {
this.a = a;
this.b = b;
}
-
+
public TestRecursiveInnerObject getA() {
return a;
}
-
+
public TestRecursiveInnerObject getB() {
return b;
}
@@ -168,7 +168,7 @@ public class EqualsBuilderTest {
public int getZ() {
return z;
}
-
+
}
static class TestRecursiveInnerObject {
@@ -176,7 +176,7 @@ public class EqualsBuilderTest {
public TestRecursiveInnerObject(final int n) {
this.n = n;
}
-
+
public int getN() {
return n;
}
@@ -189,20 +189,20 @@ public class EqualsBuilderTest {
this.n = n;
this.cycle = this;
}
-
+
public TestRecursiveCycleObject(final TestRecursiveCycleObject cycle, final int n) {
this.n = n;
this.cycle = cycle;
}
-
+
public int getN() {
return n;
}
-
+
public TestRecursiveCycleObject getCycle() {
return cycle;
}
-
+
public void setCycle(final TestRecursiveCycleObject cycle) {
this.cycle = cycle;
}
@@ -223,7 +223,7 @@ public class EqualsBuilderTest {
assertFalse(EqualsBuilder.reflectionEquals(null, o2));
assertTrue(EqualsBuilder.reflectionEquals(null, null));
}
-
+
@Test
public void testReflectionHierarchyEquals() {
testReflectionHierarchyEquals(false);
@@ -306,7 +306,7 @@ public class EqualsBuilderTest {
* @param toTer Left hand side, equal to to and toBis
* @param to2 a different TestObject
* @param oToChange a TestObject that will be changed
- * @param testTransients whether to test transient instance variables
+ * @param testTransients whether to test transient instance variables
*/
private void testReflectionEqualsEquivalenceRelationship(
final TestObject to,
@@ -371,12 +371,12 @@ public class EqualsBuilderTest {
assertTrue(new EqualsBuilder().append(o1, o2).isEquals());
assertFalse(new EqualsBuilder().append(o1, this).isEquals());
-
+
assertFalse(new EqualsBuilder().append(o1, null).isEquals());
assertFalse(new EqualsBuilder().append(null, o2).isEquals());
assertTrue(new EqualsBuilder().append((Object) null, null).isEquals());
}
-
+
@Test
public void testObjectBuild() {
final TestObject o1 = new TestObject(4);
@@ -387,7 +387,7 @@ public class EqualsBuilderTest {
assertEquals(Boolean.TRUE, new EqualsBuilder().append(o1, o2).build());
assertEquals(Boolean.FALSE, new EqualsBuilder().append(o1, this).build());
-
+
assertEquals(Boolean.FALSE, new EqualsBuilder().append(o1, null).build());
assertEquals(Boolean.FALSE, new EqualsBuilder().append(null, o2).build());
assertEquals(Boolean.TRUE, new EqualsBuilder().append((Object) null, null).build());
@@ -401,17 +401,17 @@ public class EqualsBuilderTest {
final TestRecursiveInnerObject i2_2 = new TestRecursiveInnerObject(2);
final TestRecursiveInnerObject i3 = new TestRecursiveInnerObject(3);
final TestRecursiveInnerObject i4 = new TestRecursiveInnerObject(4);
-
+
final TestRecursiveObject o1_a = new TestRecursiveObject(i1_1, i2_1, 1);
final TestRecursiveObject o1_b = new TestRecursiveObject(i1_2, i2_2, 1);
final TestRecursiveObject o2 = new TestRecursiveObject(i3, i4, 2);
final TestRecursiveObject oNull = new TestRecursiveObject(null, null, 2);
-
+
assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_a).isEquals());
assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_b).isEquals());
-
+
assertFalse(new EqualsBuilder().setTestRecursive(true).append(o1_a, o2).isEquals());
-
+
assertTrue(new EqualsBuilder().setTestRecursive(true).append(oNull, oNull).isEquals());
assertFalse(new EqualsBuilder().setTestRecursive(true).append(o1_a, oNull).isEquals());
}
@@ -421,7 +421,7 @@ public class EqualsBuilderTest {
final TestRecursiveCycleObject o1_a = new TestRecursiveCycleObject(1);
final TestRecursiveCycleObject o1_b = new TestRecursiveCycleObject(1);
final TestRecursiveCycleObject o2 = new TestRecursiveCycleObject(2);
-
+
assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_a).isEquals());
assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_b).isEquals());
assertFalse(new EqualsBuilder().setTestRecursive(true).append(o1_a, o2).isEquals());
@@ -432,19 +432,19 @@ public class EqualsBuilderTest {
final TestRecursiveCycleObject o1_a = new TestRecursiveCycleObject(1);
final TestRecursiveCycleObject i1_a = new TestRecursiveCycleObject(o1_a, 100);
o1_a.setCycle(i1_a);
-
+
final TestRecursiveCycleObject o1_b = new TestRecursiveCycleObject(1);
final TestRecursiveCycleObject i1_b = new TestRecursiveCycleObject(o1_b, 100);
o1_b.setCycle(i1_b);
-
+
final TestRecursiveCycleObject o2 = new TestRecursiveCycleObject(2);
final TestRecursiveCycleObject i2 = new TestRecursiveCycleObject(o1_b, 200);
o2.setCycle(i2);
-
+
assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_a).isEquals());
assertTrue(new EqualsBuilder().setTestRecursive(true).append(o1_a, o1_b).isEquals());
assertFalse(new EqualsBuilder().setTestRecursive(true).append(o1_a, o2).isEquals());
-
+
assertTrue(EqualsBuilder.reflectionEquals(o1_a, o1_b, false, null, true));
assertFalse(EqualsBuilder.reflectionEquals(o1_a, o2, false, null, true));
}
@@ -530,7 +530,7 @@ public class EqualsBuilderTest {
equalsBuilder.reset();
assertTrue(equalsBuilder.isEquals());
}
-
+
@Test
public void testBoolean() {
final boolean o1 = true;
@@ -549,7 +549,7 @@ public class EqualsBuilderTest {
obj2[0] = new TestObject(4);
obj2[1] = new TestObject(5);
obj2[2] = null;
-
+
assertTrue(new EqualsBuilder().append(obj1, obj1).isEquals());
assertTrue(new EqualsBuilder().append(obj2, obj2).isEquals());
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
@@ -561,7 +561,7 @@ public class EqualsBuilderTest {
assertFalse(new EqualsBuilder().append(obj1, obj2).isEquals());
obj1[2] = null;
assertTrue(new EqualsBuilder().append(obj1, obj2).isEquals());
-
+
obj2 = null;
assertFalse(new EqualsBuilder().append(obj1, obj2).isEquals());
obj1 = null;
@@ -846,7 +846,7 @@ public class EqualsBuilderTest {
assertTrue(new EqualsBuilder().append(array1, array2).isEquals());
array1[1][1] = false;
assertFalse(new EqualsBuilder().append(array1, array2).isEquals());
-
+
// compare 1 dim to 2.
final boolean[] array3 = new boolean[]{true, true};
assertFalse(new EqualsBuilder().append(array1, array3).isEquals());
@@ -1052,7 +1052,7 @@ public class EqualsBuilderTest {
array1[1] = true;
assertFalse(new EqualsBuilder().append(obj1, obj2).isEquals());
}
-
+
public static class TestACanEqualB {
private final int a;
@@ -1114,7 +1114,7 @@ public class EqualsBuilderTest {
return this.b;
}
}
-
+
/**
* Tests two instances of classes that can be equal and that are not "related". The two classes are not subclasses
* of each other and do not share a parent aside from Object.
@@ -1140,7 +1140,7 @@ public class EqualsBuilderTest {
assertTrue(new EqualsBuilder().append(x, y).isEquals());
assertTrue(new EqualsBuilder().append(y, x).isEquals());
}
-
+
/**
* Test from http://issues.apache.org/bugzilla/show_bug.cgi?id=33067
*/
@@ -1193,7 +1193,7 @@ public class EqualsBuilderTest {
this.three = new TestObject(three);
}
}
-
+
/**
* Test cyclical object references which cause a StackOverflowException if
* not handled properly. s. LANG-606
@@ -1242,7 +1242,7 @@ public class EqualsBuilderTest {
return EqualsBuilder.reflectionEquals(this, obj);
}
}
-
+
@Test
public void testReflectionArrays() throws Exception {
@@ -1256,11 +1256,11 @@ public class EqualsBuilderTest {
assertFalse(EqualsBuilder.reflectionEquals(o1, o2));
assertTrue(EqualsBuilder.reflectionEquals(o1, o1));
assertTrue(EqualsBuilder.reflectionEquals(o1, o3));
-
+
final double[] d1 = { 0, 1 };
final double[] d2 = { 2, 3 };
final double[] d3 = { 0, 1 };
-
+
assertFalse(EqualsBuilder.reflectionEquals(d1, d2));
assertTrue(EqualsBuilder.reflectionEquals(d1, d1));
assertTrue(EqualsBuilder.reflectionEquals(d1, d3));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java
index aa61e02..f39d26a 100644
--- a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderAndEqualsBuilderTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -72,9 +72,9 @@ public class HashCodeBuilderAndEqualsBuilderTest {
}
/**
- * Asserts that if <code>lhs</code> equals <code>rhs</code>
+ * Asserts that if <code>lhs</code> equals <code>rhs</code>
* then their hash codes MUST be identical.
- *
+ *
* @param lhs The Left-Hand-Side of the equals test
* @param rhs The Right-Hand-Side of the equals test
* @param testTransients whether to test transient fields
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
index 633f5f5..4ded427 100644
--- a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -61,7 +61,7 @@ public class HashCodeBuilderTest {
public void testConstructorExEvenFirst() {
new HashCodeBuilder(2, 3);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testConstructorExEvenSecond() {
new HashCodeBuilder(3, 2);
@@ -195,7 +195,7 @@ public class HashCodeBuilderTest {
obj = new Object();
assertEquals(17 * 37 + obj.hashCode(), new HashCodeBuilder(17, 37).append(obj).toHashCode());
}
-
+
@Test
public void testObjectBuild() {
Object obj = null;
@@ -529,7 +529,7 @@ public class HashCodeBuilderTest {
final ReflectionTestCycleB b = new ReflectionTestCycleB();
a.b = b;
b.a = a;
-
+
// Used to caused:
// java.lang.StackOverflowError
// at java.lang.ClassLoader.getCallerClassLoader(Native Method)
@@ -559,7 +559,7 @@ public class HashCodeBuilderTest {
@Test
public void testToHashCodeEqualsHashCode() {
final HashCodeBuilder hcb = new HashCodeBuilder(17, 37).append(new Object()).append('a');
- assertEquals("hashCode() is no longer returning the same value as toHashCode() - see LANG-520",
+ assertEquals("hashCode() is no longer returning the same value as toHashCode() - see LANG-520",
hcb.toHashCode(), hcb.hashCode());
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
index c60dc05..6f76cfe 100644
--- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -224,7 +224,7 @@ public class JsonToStringStyleTest {
.append("age", p.age).append("smoker", p.smoker)
.toString());
}
-
+
@Test
public void testNestingPerson() {
final Person p = new Person(){
@@ -357,10 +357,10 @@ public class JsonToStringStyleTest {
} catch (final UnsupportedOperationException e) {
}
}
-
+
/**
* An object with nested object structures used to test {@link ToStringStyle.JsonToStringStyle}.
- *
+ *
*/
static class NestingPerson {
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
index 8454c5b..ca02df0 100644
--- a/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -33,7 +33,7 @@ public class MultiLineToStringStyleTest {
private final Integer base = Integer.valueOf(5);
private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
-
+
@Before
public void setUp() throws Exception {
ToStringBuilder.setDefaultStyle(ToStringStyle.MULTI_LINE_STYLE);
@@ -55,12 +55,12 @@ public class MultiLineToStringStyleTest {
public void testAppendSuper() {
assertEquals(baseStr + "[" + System.lineSeparator() + "]", new ToStringBuilder(base).appendSuper("Integer@8888[" + System.lineSeparator() + "]").toString());
assertEquals(baseStr + "[" + System.lineSeparator() + " <null>" + System.lineSeparator() + "]", new ToStringBuilder(base).appendSuper("Integer@8888[" + System.lineSeparator() + " <null>" + System.lineSeparator() + "]").toString());
-
+
assertEquals(baseStr + "[" + System.lineSeparator() + " a=hello" + System.lineSeparator() + "]", new ToStringBuilder(base).appendSuper("Integer@8888[" + System.lineSeparator() + "]").append("a", "hello").toString());
assertEquals(baseStr + "[" + System.lineSeparator() + " <null>" + System.lineSeparator() + " a=hello" + System.lineSeparator() + "]", new ToStringBuilder(base).appendSuper("Integer@8888[" + System.lineSeparator() + " <null>" + System.lineSeparator() + "]").append("a", "hello").toString());
assertEquals(baseStr + "[" + System.lineSeparator() + " a=hello" + System.lineSeparator() + "]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
}
-
+
@Test
public void testObject() {
final Integer i3 = Integer.valueOf(3);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
index 08c6382..cb08ae0 100644
--- a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -33,9 +33,9 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void simpleObject() {
final Transaction tx = new Transaction("2014.10.15", 100);
- final String expected = getClassPrefix(tx) + "[" + BR
- + " amount=100.0," + BR
- + " date=2014.10.15" + BR
+ final String expected = getClassPrefix(tx) + "[" + BR
+ + " amount=100.0," + BR
+ + " date=2014.10.15" + BR
+ "]";
assertEquals(expected, toString(tx));
}
@@ -45,12 +45,12 @@ public class MultilineRecursiveToStringStyleTest {
final Customer customer = new Customer("Douglas Adams");
final Bank bank = new Bank("ASF Bank");
customer.bank = bank;
- final String exp = getClassPrefix(customer) + "[" + BR
- + " name=Douglas Adams," + BR
- + " bank=" + getClassPrefix(bank) + "[" + BR
- + " name=ASF Bank" + BR
- + " ]," + BR
- + " accounts=<null>" + BR
+ final String exp = getClassPrefix(customer) + "[" + BR
+ + " name=Douglas Adams," + BR
+ + " bank=" + getClassPrefix(bank) + "[" + BR
+ + " name=ASF Bank" + BR
+ + " ]," + BR
+ + " accounts=<null>" + BR
+ "]";
assertEquals(exp, toString(customer));
}
@@ -62,18 +62,18 @@ public class MultilineRecursiveToStringStyleTest {
final Transaction tx2 = new Transaction("2014.10.15", 50);
acc.transactions.add(tx1);
acc.transactions.add(tx2);
- final String expected = getClassPrefix(acc) + "[" + BR
- + " owner=<null>," + BR
- + " transactions=" + getClassPrefix(acc.transactions) + "{" + BR
- + " " + getClassPrefix(tx1) + "[" + BR
- + " amount=100.0," + BR
- + " date=2014.10.14" + BR
- + " ]," + BR
+ final String expected = getClassPrefix(acc) + "[" + BR
+ + " owner=<null>," + BR
+ + " transactions=" + getClassPrefix(acc.transactions) + "{" + BR
+ + " " + getClassPrefix(tx1) + "[" + BR
+ + " amount=100.0," + BR
+ + " date=2014.10.14" + BR
+ + " ]," + BR
+ " " + getClassPrefix(tx2) + "[" + BR
- + " amount=50.0," + BR
- + " date=2014.10.15" + BR
- + " ]" + BR
- + " }" + BR
+ + " amount=50.0," + BR
+ + " date=2014.10.15" + BR
+ + " ]" + BR
+ + " }" + BR
+ "]";
assertEquals(expected, toString(acc));
}
@@ -81,13 +81,13 @@ public class MultilineRecursiveToStringStyleTest {
@Test
public void noArray() {
final WithArrays wa = new WithArrays();
- final String exp = getClassPrefix(wa) + "[" + BR
- + " boolArray=<null>," + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ + " boolArray=<null>," + BR
+ " charArray=<null>," + BR
- + " intArray=<null>," + BR
- + " doubleArray=<null>," + BR
- + " longArray=<null>," + BR
- + " stringArray=<null>" + BR
+ + " intArray=<null>," + BR
+ + " doubleArray=<null>," + BR
+ + " longArray=<null>," + BR
+ + " stringArray=<null>" + BR
+ "]";
assertEquals(exp, toString(wa));
}
@@ -96,17 +96,17 @@ public class MultilineRecursiveToStringStyleTest {
public void boolArray() {
final WithArrays wa = new WithArrays();
wa.boolArray = new boolean[] { true, false, true };
- final String exp = getClassPrefix(wa) + "[" + BR
- + " boolArray={" + BR
- + " true," + BR
- + " false," + BR
- + " true" + BR
- + " }," + BR
- + " charArray=<null>," + BR
- + " intArray=<null>," + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ + " boolArray={" + BR
+ + " true," + BR
+ + " false," + BR
+ + " true" + BR
+ + " }," + BR
+ + " charArray=<null>," + BR
+ + " intArray=<null>," + BR
+ " doubleArray=<null>," + BR
- + " longArray=<null>," + BR
- + " stringArray=<null>" + BR
+ + " longArray=<null>," + BR
+ + " stringArray=<null>" + BR
+ "]";
assertEquals(exp, toString(wa));
}
@@ -115,16 +115,16 @@ public class MultilineRecursiveToStringStyleTest {
public void charArray() {
final WithArrays wa = new WithArrays();
wa.charArray = new char[] { 'a', 'A' };
- final String exp = getClassPrefix(wa) + "[" + BR
- + " boolArray=<null>," + BR
- + " charArray={" + BR
- + " a," + BR
- + " A" + BR
- + " }," + BR
- + " intArray=<null>," + BR
- + " doubleArray=<null>," + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ + " boolArray=<null>," + BR
+ + " charArray={" + BR
+ + " a," + BR
+ + " A" + BR
+ + " }," + BR
+ + " intArray=<null>," + BR
+ + " doubleArray=<null>," + BR
+ " longArray=<null>," + BR
- + " stringArray=<null>" + BR
+ + " stringArray=<null>" + BR
+ "]";
assertEquals(exp, toString(wa));
}
@@ -133,16 +133,16 @@ public class MultilineRecursiveToStringStyleTest {
public void intArray() {
final WithArrays wa = new WithArrays();
wa.intArray = new int[] { 1, 2 };
- final String exp = getClassPrefix(wa) + "[" + BR
- + " boolArray=<null>," + BR
- + " charArray=<null>," + BR
- + " intArray={" + BR
- + " 1," + BR
- + " 2" + BR
- + " }," + BR
- + " doubleArray=<null>," + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ + " boolArray=<null>," + BR
+ + " charArray=<null>," + BR
+ + " intArray={" + BR
+ + " 1," + BR
+ + " 2" + BR
+ + " }," + BR
+ + " doubleArray=<null>," + BR
+ " longArray=<null>," + BR
- + " stringArray=<null>" + BR
+ + " stringArray=<null>" + BR
+ "]";
assertEquals(exp, toString(wa));
}
@@ -151,16 +151,16 @@ public class MultilineRecursiveToStringStyleTest {
public void doubleArray() {
final WithArrays wa = new WithArrays();
wa.doubleArray = new double[] { 1, 2 };
- final String exp = getClassPrefix(wa) + "[" + BR
- + " boolArray=<null>," + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ + " boolArray=<null>," + BR
+ " charArray=<null>," + BR
- + " intArray=<null>," + BR
- + " doubleArray={" + BR
- + " 1.0," + BR
- + " 2.0" + BR
+ + " intArray=<null>," + BR
+ + " doubleArray={" + BR
+ + " 1.0," + BR
+ + " 2.0" + BR
+ " }," + BR
- + " longArray=<null>," + BR
- + " stringArray=<null>" + BR
+ + " longArray=<null>," + BR
+ + " stringArray=<null>" + BR
+ "]";
assertEquals(exp, toString(wa));
}
@@ -169,16 +169,16 @@ public class MultilineRecursiveToStringStyleTest {
public void longArray() {
final WithArrays wa = new WithArrays();
wa.longArray = new long[] { 1L, 2L };
- final String exp = getClassPrefix(wa) + "[" + BR
- + " boolArray=<null>," + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ + " boolArray=<null>," + BR
+ " charArray=<null>," + BR
- + " intArray=<null>," + BR
- + " doubleArray=<null>," + BR
- + " longArray={" + BR
- + " 1," + BR
+ + " intArray=<null>," + BR
+ + " doubleArray=<null>," + BR
+ + " longArray={" + BR
+ + " 1," + BR
+ " 2" + BR
- + " }," + BR
- + " stringArray=<null>" + BR
+ + " }," + BR
+ + " stringArray=<null>" + BR
+ "]";
assertEquals(exp, toString(wa));
}
@@ -187,30 +187,30 @@ public class MultilineRecursiveToStringStyleTest {
public void stringArray() {
final WithArrays wa = new WithArrays();
wa.stringArray = new String[] { "a", "A" };
- final String exp = getClassPrefix(wa) + "[" + BR
- + " boolArray=<null>," + BR
+ final String exp = getClassPrefix(wa) + "[" + BR
+ + " boolArray=<null>," + BR
+ " charArray=<null>," + BR
- + " intArray=<null>," + BR
- + " doubleArray=<null>," + BR
- + " longArray=<null>," + BR
+ + " intArray=<null>," + BR
+ + " doubleArray=<null>," + BR
+ + " longArray=<null>," + BR
+ " stringArray={" + BR
- + " a," + BR
- + " A" + BR
- + " }" + BR
+ + " a," + BR
+ + " A" + BR
+ + " }" + BR
+ "]";
assertEquals(exp, toString(wa));
}
-
-
+
+
@Test
public void testLANG1319() throws Exception {
final String[] stringArray = {"1", "2"};
-
- final String exp = getClassPrefix(stringArray) + "[" + BR
- + " {" + BR
- + " 1," + BR
- + " 2" + BR
- + " }" + BR
+
+ final String exp = getClassPrefix(stringArray) + "[" + BR
+ + " {" + BR
+ + " 1," + BR
+ + " 2" + BR
+ + " }" + BR
+ "]";
assertEquals(exp, toString(stringArray));
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java
index 73184a5..4865b03 100644
--- a/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java
index d5388a9..defd998 100644
--- a/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -33,7 +33,7 @@ public class NoFieldNamesToStringStyleTest {
private final Integer base = Integer.valueOf(5);
private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
-
+
@Before
public void setUp() throws Exception {
ToStringBuilder.setDefaultStyle(ToStringStyle.NO_FIELD_NAMES_STYLE);
@@ -45,7 +45,7 @@ public class NoFieldNamesToStringStyleTest {
}
//----------------------------------------------------------------
-
+
@Test
public void testBlank() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).toString());
@@ -55,12 +55,12 @@ public class NoFieldNamesToStringStyleTest {
public void testAppendSuper() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).appendSuper("Integer@8888[]").toString());
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").toString());
-
+
assertEquals(baseStr + "[hello]", new ToStringBuilder(base).appendSuper("Integer@8888[]").append("a", "hello").toString());
assertEquals(baseStr + "[<null>,hello]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").append("a", "hello").toString());
assertEquals(baseStr + "[hello]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
}
-
+
@Test
public void testObject() {
final Integer i3 = Integer.valueOf(3);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
index dbf36c1..d46dd6d 100644
--- a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -32,7 +32,7 @@ public class RecursiveToStringStyleTest {
private final Integer base = Integer.valueOf(5);
private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
-
+
@Before
public void setUp() throws Exception {
ToStringBuilder.setDefaultStyle(new RecursiveToStringStyle());
@@ -44,7 +44,7 @@ public class RecursiveToStringStyleTest {
}
//----------------------------------------------------------------
-
+
@Test
public void testBlank() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).toString());
@@ -54,25 +54,25 @@ public class RecursiveToStringStyleTest {
public void testAppendSuper() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).appendSuper("Integer@8888[]").toString());
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").toString());
-
+
assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[]").append("a", "hello").toString());
assertEquals(baseStr + "[<null>,a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").append("a", "hello").toString());
assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
}
-
+
@Test
public void testObject() {
final Integer i3 = Integer.valueOf(3);
final Integer i4 = Integer.valueOf(4);
final ArrayList<Object> emptyList = new ArrayList<>();
-
+
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) null).toString());
assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
assertEquals(baseStr + "[a=<null>]", new ToStringBuilder(base).append("a", (Object) null).toString());
assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString());
assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString());
assertEquals(baseStr + "[a=<Integer>]", new ToStringBuilder(base).append("a", i3, false).toString());
- assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", emptyList, false).toString());
+ assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", emptyList, false).toString());
assertEquals(baseStr + "[a=java.util.ArrayList@" + Integer.toHexString(System.identityHashCode(emptyList)) + "{}]",
new ToStringBuilder(base).append("a", emptyList, true).toString());
assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString());
@@ -147,13 +147,13 @@ public class RecursiveToStringStyleTest {
* Test boolean field.
*/
boolean smoker;
-
+
/**
* Test Object field.
*/
Job job;
}
-
+
static class Job {
/**
* Test String field.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
----------------------------------------------------------------------
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 d5249d5..7cd899e 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
@@ -42,7 +42,7 @@ import org.junit.Test;
* <p>
* The tests on the non-thread-safe collections do not pass.
* </p>
- *
+ *
* @see <a href="https://issues.apache.org/jira/browse/LANG-762">[LANG-762] Handle or document ReflectionToStringBuilder
* and ToStringBuilder for collections that are not thread safe</a>
* @since 3.1
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java
index dd94c51..4250ddf 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -35,26 +35,26 @@ public class ReflectionToStringBuilderExcludeNullValuesTest {
this.testStringField = b;
}
}
-
+
private static final String INTEGER_FIELD_NAME = "testIntegerField";
private static final String STRING_FIELD_NAME = "testStringField";
private final TestFixture BOTH_NON_NULL = new TestFixture(0, "str");
private final TestFixture FIRST_NULL = new TestFixture(null, "str");
private final TestFixture SECOND_NULL = new TestFixture(0, null);
private final TestFixture BOTH_NULL = new TestFixture(null, null);
-
+
@Test
public void test_NonExclude(){
//normal case=
String toString = ReflectionToStringBuilder.toString(BOTH_NON_NULL, null, false, false, false, null);
assertTrue(toString.contains(INTEGER_FIELD_NAME));
assertTrue(toString.contains(STRING_FIELD_NAME));
-
+
//make one null
toString = ReflectionToStringBuilder.toString(FIRST_NULL, null, false, false, false, null);
assertTrue(toString.contains(INTEGER_FIELD_NAME));
assertTrue(toString.contains(STRING_FIELD_NAME));
-
+
//other one null
toString = ReflectionToStringBuilder.toString(SECOND_NULL, null, false, false, false, null);
assertTrue(toString.contains(INTEGER_FIELD_NAME));
@@ -65,31 +65,31 @@ public class ReflectionToStringBuilderExcludeNullValuesTest {
assertTrue(toString.contains(INTEGER_FIELD_NAME));
assertTrue(toString.contains(STRING_FIELD_NAME));
}
-
+
@Test
public void test_excludeNull(){
-
+
//test normal case
String toString = ReflectionToStringBuilder.toString(BOTH_NON_NULL, null, false, false, true, null);
assertTrue(toString.contains(INTEGER_FIELD_NAME));
assertTrue(toString.contains(STRING_FIELD_NAME));
-
+
//make one null
toString = ReflectionToStringBuilder.toString(FIRST_NULL, null, false, false, true, null);
assertFalse(toString.contains(INTEGER_FIELD_NAME));
assertTrue(toString.contains(STRING_FIELD_NAME));
-
+
//other one null
toString = ReflectionToStringBuilder.toString(SECOND_NULL, null, false, false, true, null);
assertTrue(toString.contains(INTEGER_FIELD_NAME));
assertFalse(toString.contains(STRING_FIELD_NAME));
-
+
//both null
toString = ReflectionToStringBuilder.toString(BOTH_NULL, null, false, false, true, null);
assertFalse(toString.contains(INTEGER_FIELD_NAME));
assertFalse(toString.contains(STRING_FIELD_NAME));
}
-
+
@Test
public void test_ConstructorOption(){
ReflectionToStringBuilder builder = new ReflectionToStringBuilder(BOTH_NON_NULL, null, null, null, false, false, true);
@@ -97,23 +97,23 @@ public class ReflectionToStringBuilderExcludeNullValuesTest {
String toString = builder.toString();
assertTrue(toString.contains(INTEGER_FIELD_NAME));
assertTrue(toString.contains(STRING_FIELD_NAME));
-
+
builder = new ReflectionToStringBuilder(FIRST_NULL, null, null, null, false, false, true);
toString = builder.toString();
assertFalse(toString.contains(INTEGER_FIELD_NAME));
assertTrue(toString.contains(STRING_FIELD_NAME));
-
+
builder = new ReflectionToStringBuilder(SECOND_NULL, null, null, null, false, false, true);
toString = builder.toString();
assertTrue(toString.contains(INTEGER_FIELD_NAME));
assertFalse(toString.contains(STRING_FIELD_NAME));
-
+
builder = new ReflectionToStringBuilder(BOTH_NULL, null, null, null, false, false, true);
toString = builder.toString();
assertFalse(toString.contains(INTEGER_FIELD_NAME));
assertFalse(toString.contains(STRING_FIELD_NAME));
}
-
+
@Test
public void test_ConstructorOptionNormal(){
ReflectionToStringBuilder builder = new ReflectionToStringBuilder(BOTH_NULL, null, null, null, false, false, false);
@@ -121,24 +121,24 @@ public class ReflectionToStringBuilderExcludeNullValuesTest {
String toString = builder.toString();
assertTrue(toString.contains(STRING_FIELD_NAME));
assertTrue(toString.contains(INTEGER_FIELD_NAME));
-
+
//regression test older constructors
ReflectionToStringBuilder oldBuilder = new ReflectionToStringBuilder(BOTH_NULL);
toString = oldBuilder.toString();
assertTrue(toString.contains(STRING_FIELD_NAME));
assertTrue(toString.contains(INTEGER_FIELD_NAME));
-
+
oldBuilder = new ReflectionToStringBuilder(BOTH_NULL, null, null, null, false, false);
toString = oldBuilder.toString();
assertTrue(toString.contains(STRING_FIELD_NAME));
assertTrue(toString.contains(INTEGER_FIELD_NAME));
-
+
oldBuilder = new ReflectionToStringBuilder(BOTH_NULL, null, null);
toString = oldBuilder.toString();
assertTrue(toString.contains(STRING_FIELD_NAME));
assertTrue(toString.contains(INTEGER_FIELD_NAME));
}
-
+
@Test
public void test_ConstructorOption_ExcludeNull(){
ReflectionToStringBuilder builder = new ReflectionToStringBuilder(BOTH_NULL, null, null, null, false, false, false);
@@ -147,12 +147,12 @@ public class ReflectionToStringBuilderExcludeNullValuesTest {
String toString = builder.toString();
assertFalse(toString.contains(STRING_FIELD_NAME));
assertFalse(toString.contains(INTEGER_FIELD_NAME));
-
+
builder = new ReflectionToStringBuilder(BOTH_NULL, null, null, null, false, false, true);
toString = builder.toString();
assertFalse(toString.contains(STRING_FIELD_NAME));
assertFalse(toString.contains(INTEGER_FIELD_NAME));
-
+
ReflectionToStringBuilder oldBuilder = new ReflectionToStringBuilder(BOTH_NULL);
oldBuilder.setExcludeNullValues(true);
assertTrue(oldBuilder.isExcludeNullValues());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
----------------------------------------------------------------------
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 c36d254..aa8909e 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeWithAnnotationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeWithAnnotationTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeWithAnnotationTest.java
index fb237a5..a28cbb1 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeWithAnnotationTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeWithAnnotationTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
index 8cb58e5..2cf2408 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -29,7 +29,7 @@ import org.junit.Test;
* The {@link ToStringStyle} class includes a registry to avoid infinite loops for objects with circular references. We
* want to make sure that we do not get concurrency exceptions accessing this registry.
* </p>
- *
+ *
* @see <a href="https://issues.apache.org/jira/browse/LANG-762">[LANG-762] Handle or document ReflectionToStringBuilder
* and ToStringBuilder for collections that are not thread safe</a>
* @since 3.1
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java
index e27e9f1..62b8bac 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -33,7 +33,7 @@ public class ShortPrefixToStringStyleTest {
private final Integer base = Integer.valueOf(5);
private final String baseStr = "Integer";
-
+
@Before
public void setUp() throws Exception {
ToStringBuilder.setDefaultStyle(ToStringStyle.SHORT_PREFIX_STYLE);
@@ -45,7 +45,7 @@ public class ShortPrefixToStringStyleTest {
}
//----------------------------------------------------------------
-
+
@Test
public void testBlank() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).toString());
@@ -55,12 +55,12 @@ public class ShortPrefixToStringStyleTest {
public void testAppendSuper() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).appendSuper("Integer@8888[]").toString());
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").toString());
-
+
assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[]").append("a", "hello").toString());
assertEquals(baseStr + "[<null>,a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").append("a", "hello").toString());
assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
}
-
+
@Test
public void testObject() {
final Integer i3 = Integer.valueOf(3);
@@ -125,5 +125,5 @@ public class ShortPrefixToStringStyleTest {
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append(array).toString());
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) array).toString());
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
index 1bf18db..63ea46b 100644
--- a/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -32,7 +32,7 @@ import org.junit.Test;
public class SimpleToStringStyleTest {
private final Integer base = Integer.valueOf(5);
-
+
@Before
public void setUp() throws Exception {
ToStringBuilder.setDefaultStyle(ToStringStyle.SIMPLE_STYLE);
@@ -44,7 +44,7 @@ public class SimpleToStringStyleTest {
}
//----------------------------------------------------------------
-
+
@Test
public void testBlank() {
assertEquals("", new ToStringBuilder(base).toString());
@@ -54,12 +54,12 @@ public class SimpleToStringStyleTest {
public void testAppendSuper() {
assertEquals("", new ToStringBuilder(base).appendSuper("").toString());
assertEquals("<null>", new ToStringBuilder(base).appendSuper("<null>").toString());
-
+
assertEquals("hello", new ToStringBuilder(base).appendSuper("").append("a", "hello").toString());
assertEquals("<null>,hello", new ToStringBuilder(base).appendSuper("<null>").append("a", "hello").toString());
assertEquals("hello", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
}
-
+
@Test
public void testObject() {
final Integer i3 = Integer.valueOf(3);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java
index 17b19d0..fb60bc3 100644
--- a/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -33,9 +33,9 @@ public class StandardToStringStyleTest {
private final Integer base = Integer.valueOf(5);
private final String baseStr = "Integer";
-
+
private static final StandardToStringStyle STYLE = new StandardToStringStyle();
-
+
static {
STYLE.setUseShortClassName(true);
STYLE.setUseIdentityHashCode(false);
@@ -48,7 +48,7 @@ public class StandardToStringStyleTest {
STYLE.setSummaryObjectStartText("%");
STYLE.setSummaryObjectEndText("%");
}
-
+
@Before
public void setUp() throws Exception {
ToStringBuilder.setDefaultStyle(STYLE);
@@ -60,7 +60,7 @@ public class StandardToStringStyleTest {
}
//----------------------------------------------------------------
-
+
@Test
public void testBlank() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).toString());
@@ -70,12 +70,12 @@ public class StandardToStringStyleTest {
public void testAppendSuper() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).appendSuper("Integer@8888[]").toString());
assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).appendSuper("Integer@8888[%NULL%]").toString());
-
+
assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[]").append("a", "hello").toString());
assertEquals(baseStr + "[%NULL%,a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[%NULL%]").append("a", "hello").toString());
assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
}
-
+
@Test
public void testObject() {
final Integer i3 = Integer.valueOf(3);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
index 8e32287..619b9f2 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
@@ -40,7 +40,7 @@ public class ToStringBuilderTest {
private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
/*
- * All tests should leave the registry empty.
+ * All tests should leave the registry empty.
*/
@After
public void after(){
@@ -839,7 +839,7 @@ public class ToStringBuilderTest {
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append(null, (boolean[]) null, false).toString());
assertEquals(baseStr + "[<size=4>]", new ToStringBuilder(base).append(null, array, false).toString());
}
-
+
@Test
public void testConstructToStringBuilder(){
ToStringBuilder stringBuilder1 = new ToStringBuilder(base, null, null);
@@ -870,7 +870,7 @@ public class ToStringBuilderTest {
assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString());
assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString());
}
-
+
@Test
public void testObjectBuild() {
final Integer i3 = Integer.valueOf(3);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java
----------------------------------------------------------------------
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 40dd273..83fa068 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java
@@ -40,7 +40,7 @@ import org.junit.Test;
* <p>
* This test passes but only tests one aspect of the issue.
* </p>
- *
+ *
* @see <a href="https://issues.apache.org/jira/browse/LANG-762">[LANG-762] Handle or document ReflectionToStringBuilder
* and ToStringBuilder for collections that are not thread safe</a>
* @since 3.1
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java
index 81a8b83..a2d9d34 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -117,7 +117,7 @@ public class ToStringStyleTest {
/**
* An object used to test {@link ToStringStyle}.
- *
+ *
*/
static class Person {
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java
index caad3b3..5d64378 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java
@@ -68,7 +68,7 @@ public class CallableBackgroundInitializerTest {
exec.shutdown();
exec.awaitTermination(1, TimeUnit.SECONDS);
}
-
+
}
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java b/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java
index a794018..df81478 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -28,54 +28,54 @@ import static org.junit.Assert.assertNull;
* JUnit tests for {@link CircuitBreakingException}.
*/
public class CircuitBreakingExceptionTest extends AbstractExceptionTest {
-
+
@Test(expected = CircuitBreakingException.class)
public void testThrowingInformativeException() throws Exception {
throw new CircuitBreakingException(EXCEPTION_MESSAGE, generateCause());
}
-
+
@Test(expected = CircuitBreakingException.class)
public void testThrowingExceptionWithMessage() throws Exception {
throw new CircuitBreakingException(EXCEPTION_MESSAGE);
}
-
+
@Test(expected = CircuitBreakingException.class)
public void testThrowingExceptionWithCause() throws Exception {
throw new CircuitBreakingException(generateCause());
}
-
+
@Test(expected = CircuitBreakingException.class)
public void testThrowingEmptyException() throws Exception {
throw new CircuitBreakingException();
}
-
+
@Test
public void testWithCauseAndMessage() throws Exception {
final Exception exception = new CircuitBreakingException(EXCEPTION_MESSAGE, generateCause());
assertNotNull(exception);
assertEquals(WRONG_EXCEPTION_MESSAGE, EXCEPTION_MESSAGE, exception.getMessage());
-
+
final Throwable cause = exception.getCause();
assertNotNull(cause);
assertEquals(WRONG_CAUSE_MESSAGE, CAUSE_MESSAGE, cause.getMessage());
}
-
+
@Test
public void testWithoutCause() throws Exception {
final Exception exception = new CircuitBreakingException(EXCEPTION_MESSAGE);
assertNotNull(exception);
assertEquals(WRONG_EXCEPTION_MESSAGE, EXCEPTION_MESSAGE, exception.getMessage());
-
+
final Throwable cause = exception.getCause();
assertNull(cause);
}
-
+
@Test
public void testWithoutMessage() throws Exception {
final Exception exception = new CircuitBreakingException(generateCause());
assertNotNull(exception);
assertNotNull(exception.getMessage());
-
+
final Throwable cause = exception.getCause();
assertNotNull(cause);
assertEquals(WRONG_CAUSE_MESSAGE, CAUSE_MESSAGE, cause.getMessage());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java b/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
index f5b74ff..ffa78d6 100644
--- a/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
+++ b/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
@@ -49,7 +49,7 @@ public class EventListenerSupportTest {
assertEquals(0, listeners.length);
assertEquals(VetoableChangeListener.class, listeners.getClass().getComponentType());
final VetoableChangeListener[] empty = listeners;
- //for fun, show that the same empty instance is used
+ //for fun, show that the same empty instance is used
assertSame(empty, listenerSupport.getListeners());
final VetoableChangeListener listener1 = EasyMock.createNiceMock(VetoableChangeListener.class);
@@ -117,7 +117,7 @@ public class EventListenerSupportTest {
assertEquals(0, listeners.length);
assertEquals(VetoableChangeListener.class, listeners.getClass().getComponentType());
final VetoableChangeListener[] empty = listeners;
- //for fun, show that the same empty instance is used
+ //for fun, show that the same empty instance is used
assertSame(empty, listenerSupport.getListeners());
final VetoableChangeListener listener1 = EasyMock.createNiceMock(VetoableChangeListener.class);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
----------------------------------------------------------------------
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 4c8d615..db54742 100644
--- a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
@@ -41,7 +41,7 @@ import org.junit.Test;
/**
* @since 3.0
*/
-public class EventUtilsTest
+public class EventUtilsTest
{
@Test
@@ -53,7 +53,7 @@ public class EventUtilsTest
assertTrue(Modifier.isPublic(EventUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(EventUtils.class.getModifiers()));
}
-
+
@Test
public void testAddEventListener()
{
[05/48] [lang] include checkstyle-suppressions.xml file in source
distribution
Posted by br...@apache.org.
include checkstyle-suppressions.xml file in source distribution
Now checkstyle can be successfully executed from the source distribution (e.g. as part of the site life-cylce).
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/670bb2e0
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/670bb2e0
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/670bb2e0
Branch: refs/heads/release
Commit: 670bb2e0a1e67894ac29bb1bc4287c40943f0205
Parents: 9f2fe9b
Author: pascalschumacher <pa...@gmx.net>
Authored: Thu May 25 14:00:38 2017 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu May 25 14:00:38 2017 +0200
----------------------------------------------------------------------
src/assembly/src.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/670bb2e0/src/assembly/src.xml
----------------------------------------------------------------------
diff --git a/src/assembly/src.xml b/src/assembly/src.xml
index e2d2af6..dc91e0e 100644
--- a/src/assembly/src.xml
+++ b/src/assembly/src.xml
@@ -26,6 +26,7 @@
<includes>
<include>.travis.yml</include>
<include>checkstyle.xml</include>
+ <include>checkstyle-suppressions.xml</include>
<include>findbugs-exclude-filter.xml</include>
<include>LICENSE.txt</include>
<include>NOTICE.txt</include>
[34/48] [lang] Prevent redundant modifiers
Posted by br...@apache.org.
Prevent redundant modifiers
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/3a818ed6
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/3a818ed6
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/3a818ed6
Branch: refs/heads/release
Commit: 3a818ed6a833f083a2db9bb6804c1bdb43b9b0ec
Parents: 8a8b8ec
Author: Benedikt Ritter <br...@apache.org>
Authored: Tue Jun 6 16:11:45 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Tue Jun 6 16:11:45 2017 +0200
----------------------------------------------------------------------
checkstyle-suppressions.xml | 1 +
checkstyle.xml | 1 +
.../org/apache/commons/lang3/ArchUtils.java | 22 ++--
.../org/apache/commons/lang3/EnumUtils.java | 2 +-
.../commons/lang3/SerializationUtils.java | 4 +-
.../org/apache/commons/lang3/builder/IDKey.java | 2 +-
.../lang3/builder/ReflectionDiffBuilder.java | 5 +-
.../builder/ReflectionToStringBuilder.java | 5 +-
.../concurrent/AbstractCircuitBreaker.java | 2 +-
.../lang3/concurrent/BackgroundInitializer.java | 2 +-
.../concurrent/EventCountCircuitBreaker.java | 2 +-
.../apache/commons/lang3/reflect/TypeUtils.java | 4 +-
.../lang3/text/ExtendedMessageFormat.java | 5 +-
.../text/translate/NumericEntityUnescaper.java | 4 +-
.../apache/commons/lang3/time/FormatCache.java | 2 +-
.../commons/lang3/AnnotationUtilsTest.java | 2 +-
.../apache/commons/lang3/ArrayUtilsAddTest.java | 16 +--
.../apache/commons/lang3/ArrayUtilsTest.java | 16 +--
.../apache/commons/lang3/CharSetUtilsTest.java | 102 +++++++++----------
.../apache/commons/lang3/ClassUtilsTest.java | 28 ++---
.../apache/commons/lang3/ObjectUtilsTest.java | 4 +-
.../lang3/StringUtilsEqualsIndexOfTest.java | 2 +-
.../apache/commons/lang3/StringUtilsTest.java | 18 ++--
.../apache/commons/lang3/ThreadUtilsTest.java | 4 +-
.../org/apache/commons/lang3/ValidateTest.java | 4 +-
.../lang3/builder/CompareToBuilderTest.java | 8 +-
.../commons/lang3/builder/DiffResultTest.java | 4 +-
.../lang3/builder/EqualsBuilderTest.java | 46 ++++-----
.../lang3/builder/HashCodeBuilderTest.java | 26 ++---
.../MultilineRecursiveToStringStyleTest.java | 6 +-
...ionToStringBuilderExcludeNullValuesTest.java | 2 +-
.../ReflectionToStringBuilderExcludeTest.java | 4 +-
...ringBuilderMutateInspectConcurrencyTest.java | 6 +-
.../lang3/builder/ToStringBuilderTest.java | 8 +-
.../concurrent/BackgroundInitializerTest.java | 4 +-
.../EventCountCircuitBreakerTest.java | 4 +-
.../lang3/concurrent/TimedSemaphoreTest.java | 10 +-
.../commons/lang3/event/EventUtilsTest.java | 6 +-
.../lang3/exception/ExceptionUtilsTest.java | 8 +-
.../commons/lang3/math/IEEE754rUtilsTest.java | 4 +-
.../commons/lang3/math/NumberUtilsTest.java | 45 ++++----
.../lang3/reflect/ConstructorUtilsTest.java | 2 +-
.../commons/lang3/reflect/MethodUtilsTest.java | 2 +-
.../commons/lang3/reflect/TypeUtilsTest.java | 2 +-
.../commons/lang3/reflect/testbed/Bar.java | 2 +-
.../commons/lang3/reflect/testbed/Foo.java | 2 +-
.../lang3/text/ExtendedMessageFormatTest.java | 2 +-
.../lang3/text/StrBuilderAppendInsertTest.java | 4 +-
.../commons/lang3/text/StrBuilderTest.java | 2 +-
.../commons/lang3/text/StrMatcherTest.java | 2 +-
.../commons/lang3/time/DateFormatUtilsTest.java | 2 +-
.../commons/lang3/time/DateUtilsTest.java | 4 +-
.../commons/lang3/time/FastDateParserTest.java | 4 +-
.../commons/lang3/time/FastDatePrinterTest.java | 4 +-
54 files changed, 237 insertions(+), 247 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/checkstyle-suppressions.xml
----------------------------------------------------------------------
diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
index 359c8dd..e4746a5 100644
--- a/checkstyle-suppressions.xml
+++ b/checkstyle-suppressions.xml
@@ -21,4 +21,5 @@ limitations under the License.
<suppress checks="JavadocPackage" files=".*[/\\]test[/\\].*"/>
<!-- exclude generated JMH classes from all checks -->
<suppress checks="[a-zA-Z0-9]*" files=".*[/\\]generated-test-sources[/\\].*"/>
+ <suppress checks="RedundantModifier" files="ConstructorUtilsTest" lines="0-99999"/>
</suppressions>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 2b76eb6..7d3d3a6 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -47,6 +47,7 @@ limitations under the License.
<property name="scope" value="public" />
</module>
<module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
<module name="UpperEll" />
</module>
</module>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/ArchUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ArchUtils.java b/src/main/java/org/apache/commons/lang3/ArchUtils.java
index c7e28d9..6895b68 100644
--- a/src/main/java/org/apache/commons/lang3/ArchUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArchUtils.java
@@ -39,7 +39,7 @@ public class ArchUtils {
init();
}
- private static final void init() {
+ private static void init() {
init_X86_32Bit();
init_X86_64Bit();
init_IA64_32Bit();
@@ -48,32 +48,32 @@ public class ArchUtils {
init_PPC_64Bit();
}
- private static final void init_X86_32Bit() {
+ private static void init_X86_32Bit() {
Processor processor = new Processor(Processor.Arch.BIT_32, Processor.Type.X86);
addProcessors(processor, "x86", "i386", "i486", "i586", "i686", "pentium");
}
- private static final void init_X86_64Bit() {
+ private static void init_X86_64Bit() {
Processor processor = new Processor(Processor.Arch.BIT_64, Processor.Type.X86);
addProcessors(processor, "x86_64", "amd64", "em64t", "universal");
}
- private static final void init_IA64_32Bit() {
+ private static void init_IA64_32Bit() {
Processor processor = new Processor(Processor.Arch.BIT_32, Processor.Type.IA_64);
addProcessors(processor, "ia64_32", "ia64n");
}
- private static final void init_IA64_64Bit() {
+ private static void init_IA64_64Bit() {
Processor processor = new Processor(Processor.Arch.BIT_64, Processor.Type.IA_64);
addProcessors(processor, "ia64", "ia64w");
}
- private static final void init_PPC_32Bit() {
+ private static void init_PPC_32Bit() {
Processor processor = new Processor(Processor.Arch.BIT_32, Processor.Type.PPC);
addProcessors(processor, "ppc", "power", "powerpc", "power_pc", "power_rs");
}
- private static final void init_PPC_64Bit() {
+ private static void init_PPC_64Bit() {
Processor processor = new Processor(Processor.Arch.BIT_64, Processor.Type.PPC);
addProcessors(processor, "ppc64", "power64", "powerpc64", "power_pc64", "power_rs64");
}
@@ -85,7 +85,7 @@ public class ArchUtils {
* @param processor The {@link Processor} to add.
* @throws IllegalStateException If the key already exists.
*/
- private static final void addProcessor(String key, Processor processor) throws IllegalStateException {
+ private static void addProcessor(String key, Processor processor) throws IllegalStateException {
if (!ARCH_TO_PROCESSOR.containsKey(key)) {
ARCH_TO_PROCESSOR.put(key, processor);
} else {
@@ -101,7 +101,7 @@ public class ArchUtils {
* @param processor The {@link Processor} to add.
* @throws IllegalStateException If the key already exists.
*/
- private static final void addProcessors(Processor processor, String... keys) throws IllegalStateException {
+ private static void addProcessors(Processor processor, String... keys) throws IllegalStateException {
for (String key : keys) {
addProcessor(key, processor);
}
@@ -117,7 +117,7 @@ public class ArchUtils {
*
* @return A {@link Processor} when supported, else <code>null</code>.
*/
- public static final Processor getProcessor() {
+ public static Processor getProcessor() {
return getProcessor(SystemUtils.OS_ARCH);
}
@@ -128,7 +128,7 @@ public class ArchUtils {
* @param value A {@link String} like a value returned by the os.arch System Property.
* @return A {@link Processor} when it exists, else <code>null</code>.
*/
- public static final Processor getProcessor(String value) {
+ public static Processor getProcessor(String value) {
return ARCH_TO_PROCESSOR.get(value);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/EnumUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/EnumUtils.java b/src/main/java/org/apache/commons/lang3/EnumUtils.java
index 84e93e2..ab062ad 100644
--- a/src/main/java/org/apache/commons/lang3/EnumUtils.java
+++ b/src/main/java/org/apache/commons/lang3/EnumUtils.java
@@ -201,7 +201,7 @@ public class EnumUtils {
@SafeVarargs
public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final E... values) {
Validate.noNullElements(values);
- return generateBitVector(enumClass, Arrays.<E> asList(values));
+ return generateBitVector(enumClass, Arrays.asList(values));
}
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/SerializationUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/SerializationUtils.java b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
index 5fca908..e62827a 100644
--- a/src/main/java/org/apache/commons/lang3/SerializationUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
@@ -220,7 +220,7 @@ public class SerializationUtils {
*/
public static <T> T deserialize(final byte[] objectData) {
Validate.isTrue(objectData != null, "The byte[] must not be null");
- return SerializationUtils.<T>deserialize(new ByteArrayInputStream(objectData));
+ return SerializationUtils.deserialize(new ByteArrayInputStream(objectData));
}
/**
@@ -261,7 +261,7 @@ public class SerializationUtils {
* @throws IOException if an I/O error occurs while reading stream header.
* @see java.io.ObjectInputStream
*/
- public ClassLoaderAwareObjectInputStream(final InputStream in, final ClassLoader classLoader) throws IOException {
+ ClassLoaderAwareObjectInputStream(final InputStream in, final ClassLoader classLoader) throws IOException {
super(in);
this.classLoader = classLoader;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/builder/IDKey.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/IDKey.java b/src/main/java/org/apache/commons/lang3/builder/IDKey.java
index 8eab0ea..426848a 100644
--- a/src/main/java/org/apache/commons/lang3/builder/IDKey.java
+++ b/src/main/java/org/apache/commons/lang3/builder/IDKey.java
@@ -34,7 +34,7 @@ final class IDKey {
* Constructor for IDKey
* @param _value The value
*/
- public IDKey(final Object _value) {
+ IDKey(final Object _value) {
// This is the Object hash code
id = System.identityHashCode(_value);
// There have been some cases (LANG-459) that return the
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
----------------------------------------------------------------------
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 887368e..e45360f 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
@@ -131,10 +131,7 @@ public class ReflectionDiffBuilder implements Builder<DiffResult> {
if (Modifier.isTransient(field.getModifiers())) {
return false;
}
- if (Modifier.isStatic(field.getModifiers())) {
- return false;
- }
- return true;
+ return !Modifier.isStatic(field.getModifiers());
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
index 3716bc1..12e410d 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
@@ -608,10 +608,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
// Reject fields from the getExcludeFieldNames list.
return false;
}
- if(field.isAnnotationPresent(ToStringExclude.class)) {
- return false;
- }
- return true;
+ return !field.isAnnotationPresent(ToStringExclude.class);
}
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java b/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java
index 6eeade0..0107924 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java
@@ -138,7 +138,7 @@ public abstract class AbstractCircuitBreaker<T> implements CircuitBreaker<T> {
* transitions. This is done to avoid complex if-conditions in the code of
* {@code CircuitBreaker}.
*/
- protected static enum State {
+ protected enum State {
CLOSED {
/**
* {@inheritDoc}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
index 25e5625..d424c21 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
@@ -310,7 +310,7 @@ public abstract class BackgroundInitializer<T> implements
*
* @param exec the {@code ExecutorService}
*/
- public InitializationTask(final ExecutorService exec) {
+ InitializationTask(final ExecutorService exec) {
execFinally = exec;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
----------------------------------------------------------------------
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 d33ff48..1cc9eeb 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
@@ -440,7 +440,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
* @param count the current count value
* @param intervalStart the start time of the check interval
*/
- public CheckIntervalData(final int count, final long intervalStart) {
+ CheckIntervalData(final int count, final long intervalStart) {
eventCount = count;
checkIntervalStart = intervalStart;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
index 3f568d1..54c810d 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
@@ -1365,7 +1365,7 @@ public class TypeUtils {
*/
public static Type unrollVariables(Map<TypeVariable<?>, Type> typeArguments, final Type type) {
if (typeArguments == null) {
- typeArguments = Collections.<TypeVariable<?>, Type> emptyMap();
+ typeArguments = Collections.emptyMap();
}
if (containsTypeVariables(type)) {
if (type instanceof TypeVariable<?>) {
@@ -1732,7 +1732,7 @@ public class TypeUtils {
* @since 3.2
*/
public static <T> Typed<T> wrap(final Class<T> type) {
- return TypeUtils.<T> wrap((Type) type);
+ return TypeUtils.wrap((Type) type);
}
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java b/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
index 6c9948b..573b013 100644
--- a/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
+++ b/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
@@ -280,10 +280,7 @@ public class ExtendedMessageFormat extends MessageFormat {
if (ObjectUtils.notEqual(toPattern, rhs.toPattern)) {
return false;
}
- if (ObjectUtils.notEqual(registry, rhs.registry)) {
- return false;
- }
- return true;
+ return !ObjectUtils.notEqual(registry, rhs.registry);
}
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java b/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
index d01a420..71209ad 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
@@ -35,7 +35,7 @@ import java.util.EnumSet;
@Deprecated
public class NumericEntityUnescaper extends CharSequenceTranslator {
- public static enum OPTION { semiColonRequired, semiColonOptional, errorIfNoSemiColon }
+ public enum OPTION { semiColonRequired, semiColonOptional, errorIfNoSemiColon }
// TODO?: Create an OptionsSet class to hide some of the conditional logic below
private final EnumSet<OPTION> options;
@@ -71,7 +71,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator {
* @return whether the option is set
*/
public boolean isSet(final OPTION option) {
- return options == null ? false : options.contains(option);
+ return options != null && options.contains(option);
}
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/main/java/org/apache/commons/lang3/time/FormatCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FormatCache.java b/src/main/java/org/apache/commons/lang3/time/FormatCache.java
index db371d2..23c08e6 100644
--- a/src/main/java/org/apache/commons/lang3/time/FormatCache.java
+++ b/src/main/java/org/apache/commons/lang3/time/FormatCache.java
@@ -230,7 +230,7 @@ abstract class FormatCache<F extends Format> {
* Constructs an instance of <code>MultipartKey</code> to hold the specified objects.
* @param keys the set of objects that make up the key. Each key may be null.
*/
- public MultipartKey(final Object... keys) {
+ MultipartKey(final Object... keys) {
this.keys = keys;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java b/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java
index 390b5f7..fc656ae 100644
--- a/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java
@@ -377,7 +377,7 @@ public class AnnotationUtilsTest {
Stooge[] stooges();
}
- public static enum Stooge {
+ public enum Stooge {
MOE, LARRY, CURLY, JOE, SHEMP
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
index dbbcdfd..a058427 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
@@ -285,7 +285,7 @@ public class ArrayUtilsAddTest {
// boolean
assertTrue( Arrays.equals( new boolean[] { true, false, false, true },
- ArrayUtils.addAll( new boolean[] { true, false }, new boolean[] { false, true } ) ) );
+ ArrayUtils.addAll( new boolean[] { true, false }, false, true) ) );
assertTrue( Arrays.equals( new boolean[] { false, true },
ArrayUtils.addAll( null, new boolean[] { false, true } ) ) );
@@ -295,7 +295,7 @@ public class ArrayUtilsAddTest {
// char
assertTrue( Arrays.equals( new char[] { 'a', 'b', 'c', 'd' },
- ArrayUtils.addAll( new char[] { 'a', 'b' }, new char[] { 'c', 'd' } ) ) );
+ ArrayUtils.addAll( new char[] { 'a', 'b' }, 'c', 'd') ) );
assertTrue( Arrays.equals( new char[] { 'c', 'd' },
ArrayUtils.addAll( null, new char[] { 'c', 'd' } ) ) );
@@ -305,7 +305,7 @@ public class ArrayUtilsAddTest {
// byte
assertTrue( Arrays.equals( new byte[] { (byte) 0, (byte) 1, (byte) 2, (byte) 3 },
- ArrayUtils.addAll( new byte[] { (byte) 0, (byte) 1 }, new byte[] { (byte) 2, (byte) 3 } ) ) );
+ ArrayUtils.addAll( new byte[] { (byte) 0, (byte) 1 }, (byte) 2, (byte) 3) ) );
assertTrue( Arrays.equals( new byte[] { (byte) 2, (byte) 3 },
ArrayUtils.addAll( null, new byte[] { (byte) 2, (byte) 3 } ) ) );
@@ -315,7 +315,7 @@ public class ArrayUtilsAddTest {
// short
assertTrue( Arrays.equals( new short[] { (short) 10, (short) 20, (short) 30, (short) 40 },
- ArrayUtils.addAll( new short[] { (short) 10, (short) 20 }, new short[] { (short) 30, (short) 40 } ) ) );
+ ArrayUtils.addAll( new short[] { (short) 10, (short) 20 }, (short) 30, (short) 40) ) );
assertTrue( Arrays.equals( new short[] { (short) 30, (short) 40 },
ArrayUtils.addAll( null, new short[] { (short) 30, (short) 40 } ) ) );
@@ -325,7 +325,7 @@ public class ArrayUtilsAddTest {
// int
assertTrue( Arrays.equals( new int[] { 1, 1000, -1000, -1 },
- ArrayUtils.addAll( new int[] { 1, 1000 }, new int[] { -1000, -1 } ) ) );
+ ArrayUtils.addAll( new int[] { 1, 1000 }, -1000, -1) ) );
assertTrue( Arrays.equals( new int[] { -1000, -1 },
ArrayUtils.addAll( null, new int[] { -1000, -1 } ) ) );
@@ -335,7 +335,7 @@ public class ArrayUtilsAddTest {
// long
assertTrue( Arrays.equals( new long[] { 1L, -1L, 1000L, -1000L },
- ArrayUtils.addAll( new long[] { 1L, -1L }, new long[] { 1000L, -1000L } ) ) );
+ ArrayUtils.addAll( new long[] { 1L, -1L }, 1000L, -1000L) ) );
assertTrue( Arrays.equals( new long[] { 1000L, -1000L },
ArrayUtils.addAll( null, new long[] { 1000L, -1000L } ) ) );
@@ -345,7 +345,7 @@ public class ArrayUtilsAddTest {
// float
assertTrue( Arrays.equals( new float[] { 10.5f, 10.1f, 1.6f, 0.01f },
- ArrayUtils.addAll( new float[] { 10.5f, 10.1f }, new float[] { 1.6f, 0.01f } ) ) );
+ ArrayUtils.addAll( new float[] { 10.5f, 10.1f }, 1.6f, 0.01f) ) );
assertTrue( Arrays.equals( new float[] { 1.6f, 0.01f },
ArrayUtils.addAll( null, new float[] { 1.6f, 0.01f } ) ) );
@@ -355,7 +355,7 @@ public class ArrayUtilsAddTest {
// double
assertTrue( Arrays.equals( new double[] { Math.PI, -Math.PI, 0, 9.99 },
- ArrayUtils.addAll( new double[] { Math.PI, -Math.PI }, new double[] { 0, 9.99 } ) ) );
+ ArrayUtils.addAll( new double[] { Math.PI, -Math.PI }, 0, 9.99) ) );
assertTrue( Arrays.equals( new double[] { 0, 9.99 },
ArrayUtils.addAll( null, new double[] { 0, 9.99 } ) ) );
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index cffae29..bce9576 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -4740,49 +4740,49 @@ public class ArrayUtilsTest {
final Object[] emptyObjectArray = new Object[0];
final Object[] notEmptyObjectArray = new Object[] {"aValue"};
- assertEquals(0, ArrayUtils.getLength((Object[]) null));
+ assertEquals(0, ArrayUtils.getLength(null));
assertEquals(0, ArrayUtils.getLength(emptyObjectArray));
assertEquals(1, ArrayUtils.getLength(notEmptyObjectArray));
final int[] emptyIntArray = new int[] {};
final int[] notEmptyIntArray = new int[] { 1 };
- assertEquals(0, ArrayUtils.getLength((int[]) null));
+ assertEquals(0, ArrayUtils.getLength(null));
assertEquals(0, ArrayUtils.getLength(emptyIntArray));
assertEquals(1, ArrayUtils.getLength(notEmptyIntArray));
final short[] emptyShortArray = new short[] {};
final short[] notEmptyShortArray = new short[] { 1 };
- assertEquals(0, ArrayUtils.getLength((short[]) null));
+ assertEquals(0, ArrayUtils.getLength(null));
assertEquals(0, ArrayUtils.getLength(emptyShortArray));
assertEquals(1, ArrayUtils.getLength(notEmptyShortArray));
final char[] emptyCharArray = new char[] {};
final char[] notEmptyCharArray = new char[] { 1 };
- assertEquals(0, ArrayUtils.getLength((char[]) null));
+ assertEquals(0, ArrayUtils.getLength(null));
assertEquals(0, ArrayUtils.getLength(emptyCharArray));
assertEquals(1, ArrayUtils.getLength(notEmptyCharArray));
final byte[] emptyByteArray = new byte[] {};
final byte[] notEmptyByteArray = new byte[] { 1 };
- assertEquals(0, ArrayUtils.getLength((byte[]) null));
+ assertEquals(0, ArrayUtils.getLength(null));
assertEquals(0, ArrayUtils.getLength(emptyByteArray));
assertEquals(1, ArrayUtils.getLength(notEmptyByteArray));
final double[] emptyDoubleArray = new double[] {};
final double[] notEmptyDoubleArray = new double[] { 1.0 };
- assertEquals(0, ArrayUtils.getLength((double[]) null));
+ assertEquals(0, ArrayUtils.getLength(null));
assertEquals(0, ArrayUtils.getLength(emptyDoubleArray));
assertEquals(1, ArrayUtils.getLength(notEmptyDoubleArray));
final float[] emptyFloatArray = new float[] {};
final float[] notEmptyFloatArray = new float[] { 1.0F };
- assertEquals(0, ArrayUtils.getLength((float[]) null));
+ assertEquals(0, ArrayUtils.getLength(null));
assertEquals(0, ArrayUtils.getLength(emptyFloatArray));
assertEquals(1, ArrayUtils.getLength(notEmptyFloatArray));
final boolean[] emptyBooleanArray = new boolean[] {};
final boolean[] notEmptyBooleanArray = new boolean[] { true };
- assertEquals(0, ArrayUtils.getLength((boolean[]) null));
+ assertEquals(0, ArrayUtils.getLength(null));
assertEquals(0, ArrayUtils.getLength(emptyBooleanArray));
assertEquals(1, ArrayUtils.getLength(notEmptyBooleanArray));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java
index 829ff6c..e070816 100644
--- a/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java
@@ -68,19 +68,19 @@ public class CharSetUtilsTest {
assertEquals(null, CharSetUtils.squeeze(null, new String[] {"el"}));
assertEquals("", CharSetUtils.squeeze("", (String[]) null));
- assertEquals("", CharSetUtils.squeeze("", new String[0]));
+ assertEquals("", CharSetUtils.squeeze(""));
assertEquals("", CharSetUtils.squeeze("", new String[] {null}));
- assertEquals("", CharSetUtils.squeeze("", new String[] {"a-e"}));
+ assertEquals("", CharSetUtils.squeeze("", "a-e"));
assertEquals("hello", CharSetUtils.squeeze("hello", (String[]) null));
- assertEquals("hello", CharSetUtils.squeeze("hello", new String[0]));
+ assertEquals("hello", CharSetUtils.squeeze("hello"));
assertEquals("hello", CharSetUtils.squeeze("hello", new String[] {null}));
- assertEquals("hello", CharSetUtils.squeeze("hello", new String[] {"a-e"}));
+ assertEquals("hello", CharSetUtils.squeeze("hello", "a-e"));
- assertEquals("helo", CharSetUtils.squeeze("hello", new String[] { "el" }));
- assertEquals("hello", CharSetUtils.squeeze("hello", new String[] { "e" }));
- assertEquals("fofof", CharSetUtils.squeeze("fooffooff", new String[] { "of" }));
- assertEquals("fof", CharSetUtils.squeeze("fooooff", new String[] { "fo" }));
+ assertEquals("helo", CharSetUtils.squeeze("hello", "el"));
+ assertEquals("hello", CharSetUtils.squeeze("hello", "e"));
+ assertEquals("fofof", CharSetUtils.squeeze("fooffooff", "of"));
+ assertEquals("fof", CharSetUtils.squeeze("fooooff", "fo"));
}
//-----------------------------------------------------------------------
@@ -102,25 +102,25 @@ public class CharSetUtilsTest {
@Test
public void testContainsAny_StringStringarray() {
assertFalse(CharSetUtils.containsAny(null, (String[]) null));
- assertFalse(CharSetUtils.containsAny(null, new String[0]));
+ assertFalse(CharSetUtils.containsAny(null));
assertFalse(CharSetUtils.containsAny(null, new String[] {null}));
- assertFalse(CharSetUtils.containsAny(null, new String[] {"a-e"}));
+ assertFalse(CharSetUtils.containsAny(null, "a-e"));
assertFalse(CharSetUtils.containsAny("", (String[]) null));
- assertFalse(CharSetUtils.containsAny("", new String[0]));
+ assertFalse(CharSetUtils.containsAny(""));
assertFalse(CharSetUtils.containsAny("", new String[] {null}));
- assertFalse(CharSetUtils.containsAny("", new String[] {"a-e"}));
+ assertFalse(CharSetUtils.containsAny("", "a-e"));
assertFalse(CharSetUtils.containsAny("hello", (String[]) null));
- assertFalse(CharSetUtils.containsAny("hello", new String[0]));
+ assertFalse(CharSetUtils.containsAny("hello"));
assertFalse(CharSetUtils.containsAny("hello", new String[] {null}));
- assertTrue(CharSetUtils.containsAny("hello", new String[] {"a-e"}));
+ assertTrue(CharSetUtils.containsAny("hello", "a-e"));
- assertTrue(CharSetUtils.containsAny("hello", new String[] { "el" }));
- assertFalse(CharSetUtils.containsAny("hello", new String[] { "x" }));
- assertTrue(CharSetUtils.containsAny("hello", new String[] { "e-i" }));
- assertTrue(CharSetUtils.containsAny("hello", new String[] { "a-z" }));
- assertFalse(CharSetUtils.containsAny("hello", new String[] { "" }));
+ assertTrue(CharSetUtils.containsAny("hello", "el"));
+ assertFalse(CharSetUtils.containsAny("hello", "x"));
+ assertTrue(CharSetUtils.containsAny("hello", "e-i"));
+ assertTrue(CharSetUtils.containsAny("hello", "a-z"));
+ assertFalse(CharSetUtils.containsAny("hello", ""));
}
//-----------------------------------------------------------------------
@@ -142,25 +142,25 @@ public class CharSetUtilsTest {
@Test
public void testCount_StringStringarray() {
assertEquals(0, CharSetUtils.count(null, (String[]) null));
- assertEquals(0, CharSetUtils.count(null, new String[0]));
+ assertEquals(0, CharSetUtils.count(null));
assertEquals(0, CharSetUtils.count(null, new String[] {null}));
- assertEquals(0, CharSetUtils.count(null, new String[] {"a-e"}));
+ assertEquals(0, CharSetUtils.count(null, "a-e"));
assertEquals(0, CharSetUtils.count("", (String[]) null));
- assertEquals(0, CharSetUtils.count("", new String[0]));
+ assertEquals(0, CharSetUtils.count(""));
assertEquals(0, CharSetUtils.count("", new String[] {null}));
- assertEquals(0, CharSetUtils.count("", new String[] {"a-e"}));
+ assertEquals(0, CharSetUtils.count("", "a-e"));
assertEquals(0, CharSetUtils.count("hello", (String[]) null));
- assertEquals(0, CharSetUtils.count("hello", new String[0]));
+ assertEquals(0, CharSetUtils.count("hello"));
assertEquals(0, CharSetUtils.count("hello", new String[] {null}));
- assertEquals(1, CharSetUtils.count("hello", new String[] {"a-e"}));
+ assertEquals(1, CharSetUtils.count("hello", "a-e"));
- assertEquals(3, CharSetUtils.count("hello", new String[] { "el" }));
- assertEquals(0, CharSetUtils.count("hello", new String[] { "x" }));
- assertEquals(2, CharSetUtils.count("hello", new String[] { "e-i" }));
- assertEquals(5, CharSetUtils.count("hello", new String[] { "a-z" }));
- assertEquals(0, CharSetUtils.count("hello", new String[] { "" }));
+ assertEquals(3, CharSetUtils.count("hello", "el"));
+ assertEquals(0, CharSetUtils.count("hello", "x"));
+ assertEquals(2, CharSetUtils.count("hello", "e-i"));
+ assertEquals(5, CharSetUtils.count("hello", "a-z"));
+ assertEquals(0, CharSetUtils.count("hello", ""));
}
//-----------------------------------------------------------------------
@@ -189,21 +189,21 @@ public class CharSetUtilsTest {
assertEquals(null, CharSetUtils.keep(null, new String[] {"a-e"}));
assertEquals("", CharSetUtils.keep("", (String[]) null));
- assertEquals("", CharSetUtils.keep("", new String[0]));
+ assertEquals("", CharSetUtils.keep(""));
assertEquals("", CharSetUtils.keep("", new String[] {null}));
- assertEquals("", CharSetUtils.keep("", new String[] {"a-e"}));
+ assertEquals("", CharSetUtils.keep("", "a-e"));
assertEquals("", CharSetUtils.keep("hello", (String[]) null));
- assertEquals("", CharSetUtils.keep("hello", new String[0]));
+ assertEquals("", CharSetUtils.keep("hello"));
assertEquals("", CharSetUtils.keep("hello", new String[] {null}));
- assertEquals("e", CharSetUtils.keep("hello", new String[] {"a-e"}));
-
- assertEquals("e", CharSetUtils.keep("hello", new String[] { "a-e" }));
- assertEquals("ell", CharSetUtils.keep("hello", new String[] { "el" }));
- assertEquals("hello", CharSetUtils.keep("hello", new String[] { "elho" }));
- assertEquals("hello", CharSetUtils.keep("hello", new String[] { "a-z" }));
- assertEquals("----", CharSetUtils.keep("----", new String[] { "-" }));
- assertEquals("ll", CharSetUtils.keep("hello", new String[] { "l" }));
+ assertEquals("e", CharSetUtils.keep("hello", "a-e"));
+
+ assertEquals("e", CharSetUtils.keep("hello", "a-e"));
+ assertEquals("ell", CharSetUtils.keep("hello", "el"));
+ assertEquals("hello", CharSetUtils.keep("hello", "elho"));
+ assertEquals("hello", CharSetUtils.keep("hello", "a-z"));
+ assertEquals("----", CharSetUtils.keep("----", "-"));
+ assertEquals("ll", CharSetUtils.keep("hello", "l"));
}
//-----------------------------------------------------------------------
@@ -231,22 +231,22 @@ public class CharSetUtilsTest {
assertEquals(null, CharSetUtils.delete(null, new String[] {"el"}));
assertEquals("", CharSetUtils.delete("", (String[]) null));
- assertEquals("", CharSetUtils.delete("", new String[0]));
+ assertEquals("", CharSetUtils.delete(""));
assertEquals("", CharSetUtils.delete("", new String[] {null}));
- assertEquals("", CharSetUtils.delete("", new String[] {"a-e"}));
+ assertEquals("", CharSetUtils.delete("", "a-e"));
assertEquals("hello", CharSetUtils.delete("hello", (String[]) null));
- assertEquals("hello", CharSetUtils.delete("hello", new String[0]));
+ assertEquals("hello", CharSetUtils.delete("hello"));
assertEquals("hello", CharSetUtils.delete("hello", new String[] {null}));
- assertEquals("hello", CharSetUtils.delete("hello", new String[] {"xyz"}));
+ assertEquals("hello", CharSetUtils.delete("hello", "xyz"));
- assertEquals("ho", CharSetUtils.delete("hello", new String[] { "el" }));
- assertEquals("", CharSetUtils.delete("hello", new String[] { "elho" }));
- assertEquals("hello", CharSetUtils.delete("hello", new String[] { "" }));
+ assertEquals("ho", CharSetUtils.delete("hello", "el"));
+ assertEquals("", CharSetUtils.delete("hello", "elho"));
+ assertEquals("hello", CharSetUtils.delete("hello", ""));
assertEquals("hello", CharSetUtils.delete("hello", ""));
- assertEquals("", CharSetUtils.delete("hello", new String[] { "a-z" }));
- assertEquals("", CharSetUtils.delete("----", new String[] { "-" }));
- assertEquals("heo", CharSetUtils.delete("hello", new String[] { "l" }));
+ assertEquals("", CharSetUtils.delete("hello", "a-z"));
+ assertEquals("", CharSetUtils.delete("----", "-"));
+ assertEquals("heo", CharSetUtils.delete("hello", "l"));
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
index a31c78c..524140f 100644
--- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
@@ -281,17 +281,17 @@ public class ClassUtilsTest {
assertEquals(null, ClassUtils.getAllInterfaces(null));
}
- private static interface IA {
+ private interface IA {
}
- private static interface IB {
+ private interface IB {
}
- private static interface IC extends ID, IE {
+ private interface IC extends ID, IE {
}
- private static interface ID {
+ private interface ID {
}
- private static interface IE extends IF {
+ private interface IE extends IF {
}
- private static interface IF {
+ private interface IF {
}
private static class CX implements IB, IA, IE {
}
@@ -378,7 +378,7 @@ public class ClassUtilsTest {
assertTrue(ClassUtils.isAssignable(null, array0));
assertTrue(ClassUtils.isAssignable(array0, array0));
assertTrue(ClassUtils.isAssignable(array0, (Class<?>[]) null)); // explicit cast to avoid warning
- assertTrue(ClassUtils.isAssignable((Class[]) null, (Class<?>[]) null)); // explicit cast to avoid warning
+ assertTrue(ClassUtils.isAssignable(null, (Class<?>[]) null)); // explicit cast to avoid warning
assertFalse(ClassUtils.isAssignable(array1, array1s));
assertTrue(ClassUtils.isAssignable(array1s, array1s));
@@ -1096,9 +1096,9 @@ public class ClassUtilsTest {
public void testShowJavaBug() throws Exception {
// Tests with Collections$UnmodifiableSet
final Set<?> set = Collections.unmodifiableSet(new HashSet<>());
- final Method isEmptyMethod = set.getClass().getMethod("isEmpty", new Class[0]);
+ final Method isEmptyMethod = set.getClass().getMethod("isEmpty");
try {
- isEmptyMethod.invoke(set, new Object[0]);
+ isEmptyMethod.invoke(set);
fail("Failed to throw IllegalAccessException as expected");
} catch(final IllegalAccessException iae) {
// expected
@@ -1109,17 +1109,17 @@ public class ClassUtilsTest {
public void testGetPublicMethod() throws Exception {
// Tests with Collections$UnmodifiableSet
final Set<?> set = Collections.unmodifiableSet(new HashSet<>());
- final Method isEmptyMethod = ClassUtils.getPublicMethod(set.getClass(), "isEmpty", new Class[0]);
+ final Method isEmptyMethod = ClassUtils.getPublicMethod(set.getClass(), "isEmpty");
assertTrue(Modifier.isPublic(isEmptyMethod.getDeclaringClass().getModifiers()));
try {
- isEmptyMethod.invoke(set, new Object[0]);
+ isEmptyMethod.invoke(set);
} catch(final java.lang.IllegalAccessException iae) {
fail("Should not have thrown IllegalAccessException");
}
// Tests with a public Class
- final Method toStringMethod = ClassUtils.getPublicMethod(Object.class, "toString", new Class[0]);
+ final Method toStringMethod = ClassUtils.getPublicMethod(Object.class, "toString");
assertEquals(Object.class.getMethod("toString", new Class[0]), toStringMethod);
}
@@ -1136,10 +1136,10 @@ public class ClassUtilsTest {
assertSame(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.toClass(ArrayUtils.EMPTY_OBJECT_ARRAY));
assertTrue(Arrays.equals(new Class[] { String.class, Integer.class, Double.class },
- ClassUtils.toClass(new Object[] { "Test", Integer.valueOf(1), Double.valueOf(99d) })));
+ ClassUtils.toClass("Test", Integer.valueOf(1), Double.valueOf(99d))));
assertTrue(Arrays.equals(new Class[] { String.class, null, Double.class },
- ClassUtils.toClass(new Object[] { "Test", null, Double.valueOf(99d) })));
+ ClassUtils.toClass("Test", null, Double.valueOf(99d))));
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index c1d6dcc..d6547f6 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -77,7 +77,7 @@ public class ObjectUtilsTest {
assertSame(Boolean.TRUE, ObjectUtils.firstNonNull(Boolean.TRUE));
// Explicitly pass in an empty array of Object type to ensure compiler doesn't complain of unchecked generic array creation
- assertNull(ObjectUtils.firstNonNull(new Object[0]));
+ assertNull(ObjectUtils.firstNonNull());
// Cast to Object in line below ensures compiler doesn't complain of unchecked generic array creation
assertNull(ObjectUtils.firstNonNull(null, null));
@@ -631,7 +631,7 @@ public class ObjectUtilsTest {
*
* @param value
*/
- public NonComparableCharSequence(final String value) {
+ NonComparableCharSequence(final String value) {
super();
Validate.notNull(value);
this.value = value;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
index 22cf9aa..a9904e7 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
@@ -59,7 +59,7 @@ public class StringUtilsEqualsIndexOfTest {
private static class CustomCharSequence implements CharSequence {
private final CharSequence seq;
- public CustomCharSequence(final CharSequence seq) {
+ CustomCharSequence(final CharSequence seq) {
this.seq = seq;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 5cda0af..aa9ec73 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -243,14 +243,14 @@ public class StringUtilsTest {
// assertNull(StringUtils.join(null)); // generates warning
assertNull(StringUtils.join((Object[]) null)); // equivalent explicit cast
// test additional varargs calls
- assertEquals("", StringUtils.join(new Object[0])); // empty array
+ assertEquals("", StringUtils.join()); // empty array
assertEquals("", StringUtils.join((Object) null)); // => new Object[]{null}
assertEquals("", StringUtils.join(EMPTY_ARRAY_LIST));
assertEquals("", StringUtils.join(NULL_ARRAY_LIST));
assertEquals("null", StringUtils.join(NULL_TO_STRING_LIST));
- assertEquals("abc", StringUtils.join(new String[]{"a", "b", "c"}));
- assertEquals("a", StringUtils.join(new String[]{null, "a", ""}));
+ assertEquals("abc", StringUtils.join("a", "b", "c"));
+ assertEquals("a", StringUtils.join(null, "a", ""));
assertEquals("foo", StringUtils.join(MIXED_ARRAY_LIST));
assertEquals("foo2", StringUtils.join(MIXED_TYPE_LIST));
}
@@ -422,12 +422,12 @@ public class StringUtilsTest {
@Test
public void testJoinWith() {
- assertEquals("", StringUtils.joinWith(",", new Object[0])); // empty array
+ assertEquals("", StringUtils.joinWith(",")); // empty array
assertEquals("", StringUtils.joinWith(",", (Object[]) NULL_ARRAY_LIST));
assertEquals("null", StringUtils.joinWith(",", NULL_TO_STRING_LIST)); //toString method prints 'null'
- assertEquals("a,b,c", StringUtils.joinWith(",", new Object[]{"a", "b", "c"}));
- assertEquals(",a,", StringUtils.joinWith(",", new Object[]{null, "a", ""}));
+ assertEquals("a,b,c", StringUtils.joinWith(",", "a", "b", "c"));
+ assertEquals(",a,", StringUtils.joinWith(",", null, "a", ""));
assertEquals("ab", StringUtils.joinWith(null, "a", "b"));
}
@@ -1553,7 +1553,7 @@ public class StringUtilsTest {
assertEquals("abcabcabc", StringUtils.repeat("abc", 3));
final String str = StringUtils.repeat("a", 10000); // bigger than pad limit
assertEquals(10000, str.length());
- assertTrue(StringUtils.containsOnly(str, new char[]{'a'}));
+ assertTrue(StringUtils.containsOnly(str, 'a'));
}
@Test
@@ -1680,7 +1680,7 @@ public class StringUtilsTest {
assertEquals("abcxx", StringUtils.rightPad("abc", 5, 'x'));
final String str = StringUtils.rightPad("aaa", 10000, 'a'); // bigger than pad length
assertEquals(10000, str.length());
- assertTrue(StringUtils.containsOnly(str, new char[]{'a'}));
+ assertTrue(StringUtils.containsOnly(str, 'a'));
}
@Test
@@ -1716,7 +1716,7 @@ public class StringUtilsTest {
assertEquals("abc", StringUtils.leftPad("abc", 2, ' '));
final String str = StringUtils.leftPad("aaa", 10000, 'a'); // bigger than pad length
assertEquals(10000, str.length());
- assertTrue(StringUtils.containsOnly(str, new char[]{'a'}));
+ assertTrue(StringUtils.containsOnly(str, 'a'));
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java b/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java
index b0ad310..63b1165 100644
--- a/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java
@@ -337,11 +337,11 @@ public class ThreadUtilsTest {
private static class TestThread extends Thread {
private final CountDownLatch latch = new CountDownLatch(1);
- public TestThread(final String name) {
+ TestThread(final String name) {
super(name);
}
- public TestThread(final ThreadGroup group, final String name) {
+ TestThread(final ThreadGroup group, final String name) {
super(group, name);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/ValidateTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ValidateTest.java b/src/test/java/org/apache/commons/lang3/ValidateTest.java
index 33b4fff..958c6d3 100644
--- a/src/test/java/org/apache/commons/lang3/ValidateTest.java
+++ b/src/test/java/org/apache/commons/lang3/ValidateTest.java
@@ -721,7 +721,7 @@ public class ValidateTest {
assertEquals("Broken: ", ex.getMessage());
}
- final List<String> strColl = Arrays.asList(new String[] {"Hi"});
+ final List<String> strColl = Arrays.asList("Hi");
final List<String> test = Validate.validIndex(strColl, 0, "Message");
assertSame(strColl, test);
}
@@ -746,7 +746,7 @@ public class ValidateTest {
assertEquals("The validated collection index is invalid: 2", ex.getMessage());
}
- final List<String> strColl = Arrays.asList(new String[] {"Hi"});
+ final List<String> strColl = Arrays.asList("Hi");
final List<String> test = Validate.validIndex(strColl, 0);
assertSame(strColl, test);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
----------------------------------------------------------------------
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 33deaa8..350b567 100644
--- a/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
@@ -32,7 +32,7 @@ public class CompareToBuilderTest {
static class TestObject implements Comparable<TestObject> {
private int a;
- public TestObject(final int a) {
+ TestObject(final int a) {
this.a = a;
}
@Override
@@ -67,10 +67,10 @@ public class CompareToBuilderTest {
static class TestSubObject extends TestObject {
private int b;
- public TestSubObject() {
+ TestSubObject() {
super(0);
}
- public TestSubObject(final int a, final int b) {
+ TestSubObject(final int a, final int b) {
super(a);
this.b = b;
}
@@ -90,7 +90,7 @@ public class CompareToBuilderTest {
static class TestTransientSubObject extends TestObject {
@SuppressWarnings("unused")
private transient int t;
- public TestTransientSubObject(final int a, final int t) {
+ TestTransientSubObject(final int a, final int t) {
super(a);
this.t = t;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/DiffResultTest.java
----------------------------------------------------------------------
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 e18a7da..a267a1b 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DiffResultTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DiffResultTest.java
@@ -36,11 +36,11 @@ public class DiffResultTest {
private static class SimpleClass implements Diffable<SimpleClass> {
private final boolean booleanField;
- public SimpleClass(final boolean booleanField) {
+ SimpleClass(final boolean booleanField) {
this.booleanField = booleanField;
}
- public static String getFieldName() {
+ static String getFieldName() {
return "booleanField";
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
----------------------------------------------------------------------
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 0e0f5f4..8be9b98 100644
--- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
@@ -34,9 +34,9 @@ public class EqualsBuilderTest {
static class TestObject {
private int a;
- public TestObject() {
+ TestObject() {
}
- public TestObject(final int a) {
+ TestObject(final int a) {
this.a = a;
}
@Override
@@ -67,10 +67,10 @@ public class EqualsBuilderTest {
static class TestSubObject extends TestObject {
private int b;
- public TestSubObject() {
+ TestSubObject() {
super(0);
}
- public TestSubObject(final int a, final int b) {
+ TestSubObject(final int a, final int b) {
super(a);
this.b = b;
}
@@ -101,7 +101,7 @@ public class EqualsBuilderTest {
}
static class TestEmptySubObject extends TestObject {
- public TestEmptySubObject(final int a) {
+ TestEmptySubObject(final int a) {
super(a);
}
}
@@ -109,7 +109,7 @@ public class EqualsBuilderTest {
static class TestTSubObject extends TestObject {
@SuppressWarnings("unused")
private transient int t;
- public TestTSubObject(final int a, final int t) {
+ TestTSubObject(final int a, final int t) {
super(a);
this.t = t;
}
@@ -118,7 +118,7 @@ public class EqualsBuilderTest {
static class TestTTSubObject extends TestTSubObject {
@SuppressWarnings("unused")
private transient int tt;
- public TestTTSubObject(final int a, final int t, final int tt) {
+ TestTTSubObject(final int a, final int t, final int tt) {
super(a, t);
this.tt = tt;
}
@@ -127,7 +127,7 @@ public class EqualsBuilderTest {
static class TestTTLeafObject extends TestTTSubObject {
@SuppressWarnings("unused")
private final int leafValue;
- public TestTTLeafObject(final int a, final int t, final int tt, final int leafValue) {
+ TestTTLeafObject(final int a, final int t, final int tt, final int leafValue) {
super(a, t, tt);
this.leafValue = leafValue;
}
@@ -135,7 +135,7 @@ public class EqualsBuilderTest {
static class TestTSubObject2 extends TestObject {
private transient int t;
- public TestTSubObject2(final int a, final int t) {
+ TestTSubObject2(final int a, final int t) {
super(a);
}
public int getT() {
@@ -151,7 +151,7 @@ public class EqualsBuilderTest {
private final TestRecursiveInnerObject b;
private int z;
- public TestRecursiveObject(final TestRecursiveInnerObject a,
+ TestRecursiveObject(final TestRecursiveInnerObject a,
final TestRecursiveInnerObject b, final int z) {
this.a = a;
this.b = b;
@@ -173,7 +173,7 @@ public class EqualsBuilderTest {
static class TestRecursiveInnerObject {
private final int n;
- public TestRecursiveInnerObject(final int n) {
+ TestRecursiveInnerObject(final int n) {
this.n = n;
}
@@ -185,12 +185,12 @@ public class EqualsBuilderTest {
static class TestRecursiveCycleObject {
private TestRecursiveCycleObject cycle;
private final int n;
- public TestRecursiveCycleObject(final int n) {
+ TestRecursiveCycleObject(final int n) {
this.n = n;
this.cycle = this;
}
- public TestRecursiveCycleObject(final TestRecursiveCycleObject cycle, final int n) {
+ TestRecursiveCycleObject(final TestRecursiveCycleObject cycle, final int n) {
this.n = n;
this.cycle = cycle;
}
@@ -1164,19 +1164,19 @@ public class EqualsBuilderTest {
// doesn't barf on null, empty array, or non-existent field, but still tests as not equal
assertFalse(EqualsBuilder.reflectionEquals(x1, x2, (String[]) null));
- assertFalse(EqualsBuilder.reflectionEquals(x1, x2, new String[] {}));
- assertFalse(EqualsBuilder.reflectionEquals(x1, x2, new String[] {"xxx"}));
+ assertFalse(EqualsBuilder.reflectionEquals(x1, x2));
+ assertFalse(EqualsBuilder.reflectionEquals(x1, x2, "xxx"));
// not equal if only one of the differing fields excluded
- assertFalse(EqualsBuilder.reflectionEquals(x1, x2, new String[] {"two"}));
- assertFalse(EqualsBuilder.reflectionEquals(x1, x2, new String[] {"three"}));
+ assertFalse(EqualsBuilder.reflectionEquals(x1, x2, "two"));
+ assertFalse(EqualsBuilder.reflectionEquals(x1, x2, "three"));
// equal if both differing fields excluded
- assertTrue(EqualsBuilder.reflectionEquals(x1, x2, new String[] {"two", "three"}));
+ assertTrue(EqualsBuilder.reflectionEquals(x1, x2, "two", "three"));
// still equal as long as both differing fields are among excluded
- assertTrue(EqualsBuilder.reflectionEquals(x1, x2, new String[] {"one", "two", "three"}));
- assertTrue(EqualsBuilder.reflectionEquals(x1, x2, new String[] {"one", "two", "three", "xxx"}));
+ assertTrue(EqualsBuilder.reflectionEquals(x1, x2, "one", "two", "three"));
+ assertTrue(EqualsBuilder.reflectionEquals(x1, x2, "one", "two", "three", "xxx"));
}
static class TestObjectWithMultipleFields {
@@ -1187,7 +1187,7 @@ public class EqualsBuilderTest {
@SuppressWarnings("unused")
private final TestObject three;
- public TestObjectWithMultipleFields(final int one, final int two, final int three) {
+ TestObjectWithMultipleFields(final int one, final int two, final int three) {
this.one = new TestObject(one);
this.two = new TestObject(two);
this.three = new TestObject(three);
@@ -1229,7 +1229,7 @@ public class EqualsBuilderTest {
@SuppressWarnings("unused")
private final TestObject one;
- public TestObjectReference(final int one) {
+ TestObjectReference(final int one) {
this.one = new TestObject(one);
}
@@ -1271,7 +1271,7 @@ public class EqualsBuilderTest {
private final int a;
private final int b;
- public TestObjectEqualsExclude(final int a, final int b) {
+ TestObjectEqualsExclude(final int a, final int b) {
this.a = a;
this.b = b;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
index 03b166a..3e00cd0 100644
--- a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
@@ -75,7 +75,7 @@ public class HashCodeBuilderTest {
static class TestObject {
private int a;
- public TestObject(final int a) {
+ TestObject(final int a) {
this.a = a;
}
@@ -111,11 +111,11 @@ public class HashCodeBuilderTest {
@SuppressWarnings("unused")
private transient int t;
- public TestSubObject() {
+ TestSubObject() {
super(0);
}
- public TestSubObject(final int a, final int b, final int t) {
+ TestSubObject(final int a, final int b, final int t) {
super(a);
this.b = b;
this.t = t;
@@ -491,16 +491,16 @@ public class HashCodeBuilderTest {
assertEquals(((17 * 37 + 1) * 37 + 2) * 37 + 3, HashCodeBuilder.reflectionHashCode(x));
assertEquals(((17 * 37 + 1) * 37 + 2) * 37 + 3, HashCodeBuilder.reflectionHashCode(x, (String[]) null));
- assertEquals(((17 * 37 + 1) * 37 + 2) * 37 + 3, HashCodeBuilder.reflectionHashCode(x, new String[]{}));
- assertEquals(((17 * 37 + 1) * 37 + 2) * 37 + 3, HashCodeBuilder.reflectionHashCode(x, new String[]{"xxx"}));
+ assertEquals(((17 * 37 + 1) * 37 + 2) * 37 + 3, HashCodeBuilder.reflectionHashCode(x));
+ assertEquals(((17 * 37 + 1) * 37 + 2) * 37 + 3, HashCodeBuilder.reflectionHashCode(x, "xxx"));
- assertEquals((17 * 37 + 1) * 37 + 3, HashCodeBuilder.reflectionHashCode(x, new String[]{"two"}));
- assertEquals((17 * 37 + 1) * 37 + 2, HashCodeBuilder.reflectionHashCode(x, new String[]{"three"}));
+ assertEquals((17 * 37 + 1) * 37 + 3, HashCodeBuilder.reflectionHashCode(x, "two"));
+ assertEquals((17 * 37 + 1) * 37 + 2, HashCodeBuilder.reflectionHashCode(x, "three"));
- assertEquals(17 * 37 + 1, HashCodeBuilder.reflectionHashCode(x, new String[]{"two", "three"}));
+ assertEquals(17 * 37 + 1, HashCodeBuilder.reflectionHashCode(x, "two", "three"));
- assertEquals(17, HashCodeBuilder.reflectionHashCode(x, new String[]{"one", "two", "three"}));
- assertEquals(17, HashCodeBuilder.reflectionHashCode(x, new String[]{"one", "two", "three", "xxx"}));
+ assertEquals(17, HashCodeBuilder.reflectionHashCode(x, "one", "two", "three"));
+ assertEquals(17, HashCodeBuilder.reflectionHashCode(x, "one", "two", "three", "xxx"));
}
static class TestObjectWithMultipleFields {
@@ -513,7 +513,7 @@ public class HashCodeBuilderTest {
@SuppressWarnings("unused")
private int three = 0;
- public TestObjectWithMultipleFields(final int one, final int two, final int three) {
+ TestObjectWithMultipleFields(final int one, final int two, final int three) {
this.one = one;
this.two = two;
this.three = three;
@@ -568,7 +568,7 @@ public class HashCodeBuilderTest {
private final int a;
private final int b;
- public TestObjectHashCodeExclude(final int a, final int b) {
+ TestObjectHashCodeExclude(final int a, final int b) {
this.a = a;
this.b = b;
}
@@ -588,7 +588,7 @@ public class HashCodeBuilderTest {
@HashCodeExclude
private final int b;
- public TestObjectHashCodeExclude2(final int a, final int b) {
+ TestObjectHashCodeExclude2(final int a, final int b) {
this.a = a;
this.b = b;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
index cb08ae0..372e2d8 100644
--- a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
@@ -235,7 +235,7 @@ public class MultilineRecursiveToStringStyleTest {
static class Bank {
String name;
- public Bank(final String name) {
+ Bank(final String name) {
this.name = name;
}
}
@@ -245,7 +245,7 @@ public class MultilineRecursiveToStringStyleTest {
Bank bank;
List<Account> accounts;
- public Customer(final String name) {
+ Customer(final String name) {
this.name = name;
}
}
@@ -267,7 +267,7 @@ public class MultilineRecursiveToStringStyleTest {
double amount;
String date;
- public Transaction(final String datum, final double betrag) {
+ Transaction(final String datum, final double betrag) {
this.date = datum;
this.amount = betrag;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java
index 4250ddf..914700a 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeNullValuesTest.java
@@ -30,7 +30,7 @@ public class ReflectionToStringBuilderExcludeNullValuesTest {
@SuppressWarnings("unused")
private String testStringField;
- public TestFixture(Integer a, String b) {
+ TestFixture(Integer a, String b) {
this.testIntegerField = a;
this.testStringField = b;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
----------------------------------------------------------------------
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 aa8909e..005f4b8 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
@@ -54,7 +54,7 @@ public class ReflectionToStringBuilderExcludeTest {
@Test
public void test_toStringExcludeArray() {
- final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{SECRET_FIELD});
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), SECRET_FIELD);
this.validateSecretFieldAbsent(toString);
}
@@ -66,7 +66,7 @@ public class ReflectionToStringBuilderExcludeTest {
@Test
public void test_toStringExcludeArrayWithNulls() {
- final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{null, null});
+ final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), null, null);
this.validateSecretFieldPresent(toString);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
index 85ab700..34788e0 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
@@ -41,7 +41,7 @@ public class ReflectionToStringBuilderMutateInspectConcurrencyTest {
private final Random random = new Random();
private final int N = 100;
- public TestFixture() {
+ TestFixture() {
synchronized (this) {
for (int i = 0; i < N; i++) {
listField.add(Integer.valueOf(i));
@@ -62,7 +62,7 @@ public class ReflectionToStringBuilderMutateInspectConcurrencyTest {
private final TestFixture testFixture;
private final Random random = new Random();
- public MutatingClient(final TestFixture testFixture) {
+ MutatingClient(final TestFixture testFixture) {
this.testFixture = testFixture;
}
@@ -79,7 +79,7 @@ public class ReflectionToStringBuilderMutateInspectConcurrencyTest {
class InspectingClient implements Runnable {
private final TestFixture testFixture;
- public InspectingClient(final TestFixture testFixture) {
+ InspectingClient(final TestFixture testFixture) {
this.testFixture = testFixture;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
index 619b9f2..1e805be 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
@@ -472,10 +472,10 @@ public class ToStringBuilderTest {
static class SimpleReflectionTestFixture {
Object o;
- public SimpleReflectionTestFixture() {
+ SimpleReflectionTestFixture() {
}
- public SimpleReflectionTestFixture(final Object o) {
+ SimpleReflectionTestFixture(final Object o) {
this.o = o;
}
@@ -489,7 +489,7 @@ public class ToStringBuilderTest {
@SuppressWarnings("unused")
private final SelfInstanceVarReflectionTestFixture typeIsSelf;
- public SelfInstanceVarReflectionTestFixture() {
+ SelfInstanceVarReflectionTestFixture() {
this.typeIsSelf = this;
}
@@ -504,7 +504,7 @@ public class ToStringBuilderTest {
private final SelfInstanceTwoVarsReflectionTestFixture typeIsSelf;
private final String otherType = "The Other Type";
- public SelfInstanceTwoVarsReflectionTestFixture() {
+ SelfInstanceTwoVarsReflectionTestFixture() {
this.typeIsSelf = this;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
index f7d3261..739ff51 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
@@ -297,11 +297,11 @@ public class BackgroundInitializerTest {
/** The number of invocations of initialize(). */
volatile int initializeCalls;
- public BackgroundInitializerTestImpl() {
+ BackgroundInitializerTestImpl() {
super();
}
- public BackgroundInitializerTestImpl(final ExecutorService exec) {
+ BackgroundInitializerTestImpl(final ExecutorService exec) {
super(exec);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
----------------------------------------------------------------------
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 ab80b13..5a92fd5 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
@@ -330,7 +330,7 @@ public class EventCountCircuitBreakerTest {
/** The current time in nanoseconds. */
private long currentTime;
- public EventCountCircuitBreakerTestImpl(final int openingThreshold, final long openingInterval,
+ EventCountCircuitBreakerTestImpl(final int openingThreshold, final long openingInterval,
final TimeUnit openingUnit, final int closingThreshold, final long closingInterval,
final TimeUnit closingUnit) {
super(openingThreshold, openingInterval, openingUnit, closingThreshold,
@@ -374,7 +374,7 @@ public class EventCountCircuitBreakerTest {
*
* @param source the expected event source
*/
- public ChangeListener(final Object source) {
+ ChangeListener(final Object source) {
expectedSource = source;
changedValues = new ArrayList<>();
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
index 2724910..37a8772 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
@@ -434,12 +434,12 @@ public class TimedSemaphoreTest {
/** Counter for the endOfPeriod() invocations. */
private int periodEnds;
- public TimedSemaphoreTestImpl(final long timePeriod, final TimeUnit timeUnit,
+ TimedSemaphoreTestImpl(final long timePeriod, final TimeUnit timeUnit,
final int limit) {
super(timePeriod, timeUnit, limit);
}
- public TimedSemaphoreTestImpl(final ScheduledExecutorService service,
+ TimedSemaphoreTestImpl(final ScheduledExecutorService service,
final long timePeriod, final TimeUnit timeUnit, final int limit) {
super(service, timePeriod, timeUnit, limit);
}
@@ -449,7 +449,7 @@ public class TimedSemaphoreTest {
*
* @return the endOfPeriod() invocations
*/
- public int getPeriodEnds() {
+ int getPeriodEnds() {
synchronized (this) {
return periodEnds;
}
@@ -504,7 +504,7 @@ public class TimedSemaphoreTest {
/** The number of invocations of the latch. */
private final int latchCount;
- public SemaphoreThread(final TimedSemaphore b, final CountDownLatch l, final int c, final int lc) {
+ SemaphoreThread(final TimedSemaphore b, final CountDownLatch l, final int c, final int lc) {
semaphore = b;
latch = l;
count = c;
@@ -546,7 +546,7 @@ public class TimedSemaphoreTest {
/** Flag whether a permit could be acquired. */
private boolean acquired;
- public TryAcquireThread(final TimedSemaphore s, final CountDownLatch l) {
+ TryAcquireThread(final TimedSemaphore s, final CountDownLatch l) {
semaphore = s;
latch = l;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
----------------------------------------------------------------------
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 db54742..a6e2555 100644
--- a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
@@ -160,11 +160,11 @@ public class EventUtilsTest
assertEquals(1, counter.getCount());
}
- public static interface MultipleEventListener
+ public interface MultipleEventListener
{
- public void event1(PropertyChangeEvent e);
+ void event1(PropertyChangeEvent e);
- public void event2(PropertyChangeEvent e);
+ void event2(PropertyChangeEvent e);
}
public static class EventCounter
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
----------------------------------------------------------------------
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 00ec843..d319e2e 100644
--- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
@@ -489,12 +489,12 @@ public class ExceptionUtilsTest {
private Throwable cause;
- public ExceptionWithCause(final String str, final Throwable cause) {
+ ExceptionWithCause(final String str, final Throwable cause) {
super(str);
setCause(cause);
}
- public ExceptionWithCause(final Throwable cause) {
+ ExceptionWithCause(final Throwable cause) {
super();
setCause(cause);
}
@@ -528,8 +528,8 @@ public class ExceptionUtilsTest {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
- public NestableException() { super(); }
- public NestableException(final Throwable t) { super(t); }
+ NestableException() { super(); }
+ NestableException(final Throwable t) { super(t); }
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java
index 026c0f7..fcd79b6 100644
--- a/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java
@@ -61,7 +61,7 @@ public class IEEE754rUtilsTest {
} catch(final IllegalArgumentException iae) { /* expected */ }
try {
- IEEE754rUtils.min(new float[0]);
+ IEEE754rUtils.min();
fail("IllegalArgumentException expected for empty input");
} catch(final IllegalArgumentException iae) { /* expected */ }
@@ -71,7 +71,7 @@ public class IEEE754rUtilsTest {
} catch(final IllegalArgumentException iae) { /* expected */ }
try {
- IEEE754rUtils.max(new float[0]);
+ IEEE754rUtils.max();
fail("IllegalArgumentException expected for empty input");
} catch(final IllegalArgumentException iae) { /* expected */ }
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
index 3a53c1e..31ca174 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -565,15 +565,15 @@ public class NumberUtilsTest {
assertEquals(
"min(int[]) failed for array length 1",
5,
- NumberUtils.min(new int[] { 5 }));
+ NumberUtils.min(5));
assertEquals(
"min(int[]) failed for array length 2",
6,
- NumberUtils.min(new int[] { 6, 9 }));
+ NumberUtils.min(6, 9));
- assertEquals(-10, NumberUtils.min(new int[] { -10, -5, 0, 5, 10 }));
- assertEquals(-10, NumberUtils.min(new int[] { -5, 0, -10, 5, 10 }));
+ assertEquals(-10, NumberUtils.min(-10, -5, 0, 5, 10));
+ assertEquals(-10, NumberUtils.min(-5, 0, -10, 5, 10));
}
@Test(expected = IllegalArgumentException.class)
@@ -609,7 +609,7 @@ public class NumberUtilsTest {
@Test(expected = IllegalArgumentException.class)
public void testMinByte_emptyArray() {
- NumberUtils.min(new byte[0]);
+ NumberUtils.min();
}
@Test
@@ -643,19 +643,19 @@ public class NumberUtilsTest {
assertEquals(
"min(double[]) failed for array length 1",
5.12,
- NumberUtils.min(new double[] { 5.12 }),
+ NumberUtils.min(5.12),
0);
assertEquals(
"min(double[]) failed for array length 2",
6.23,
- NumberUtils.min(new double[] { 6.23, 9.34 }),
+ NumberUtils.min(6.23, 9.34),
0);
assertEquals(
"min(double[]) failed for array length 5",
-10.45,
- NumberUtils.min(new double[] { -10.45, -5.56, 0, 5.67, 10.78 }),
+ NumberUtils.min(-10.45, -5.56, 0, 5.67, 10.78),
0);
assertEquals(-10, NumberUtils.min(new double[] { -10, -5, 0, 5, 10 }), 0.0001);
assertEquals(-10, NumberUtils.min(new double[] { -5, 0, -10, 5, 10 }), 0.0001);
@@ -676,19 +676,19 @@ public class NumberUtilsTest {
assertEquals(
"min(float[]) failed for array length 1",
5.9f,
- NumberUtils.min(new float[] { 5.9f }),
+ NumberUtils.min(5.9f),
0);
assertEquals(
"min(float[]) failed for array length 2",
6.8f,
- NumberUtils.min(new float[] { 6.8f, 9.7f }),
+ NumberUtils.min(6.8f, 9.7f),
0);
assertEquals(
"min(float[]) failed for array length 5",
-10.6f,
- NumberUtils.min(new float[] { -10.6f, -5.5f, 0, 5.4f, 10.3f }),
+ NumberUtils.min(-10.6f, -5.5f, 0, 5.4f, 10.3f),
0);
assertEquals(-10, NumberUtils.min(new float[] { -10, -5, 0, 5, 10 }), 0.0001f);
assertEquals(-10, NumberUtils.min(new float[] { -5, 0, -10, 5, 10 }), 0.0001f);
@@ -739,19 +739,19 @@ public class NumberUtilsTest {
assertEquals(
"max(int[]) failed for array length 1",
5,
- NumberUtils.max(new int[] { 5 }));
+ NumberUtils.max(5));
assertEquals(
"max(int[]) failed for array length 2",
9,
- NumberUtils.max(new int[] { 6, 9 }));
+ NumberUtils.max(6, 9));
assertEquals(
"max(int[]) failed for array length 5",
10,
- NumberUtils.max(new int[] { -10, -5, 0, 5, 10 }));
- assertEquals(10, NumberUtils.max(new int[] { -10, -5, 0, 5, 10 }));
- assertEquals(10, NumberUtils.max(new int[] { -5, 0, 10, 5, -10 }));
+ NumberUtils.max(-10, -5, 0, 5, 10));
+ assertEquals(10, NumberUtils.max(-10, -5, 0, 5, 10));
+ assertEquals(10, NumberUtils.max(-5, 0, 10, 5, -10));
}
@Test(expected = IllegalArgumentException.class)
@@ -791,7 +791,7 @@ public class NumberUtilsTest {
@Test(expected = IllegalArgumentException.class)
public void testMaxByte_emptyArray() {
- NumberUtils.max(new byte[0]);
+ NumberUtils.max();
}
@Test
@@ -873,19 +873,19 @@ public class NumberUtilsTest {
assertEquals(
"max(float[]) failed for array length 1",
5.1f,
- NumberUtils.max(new float[] { 5.1f }),
+ NumberUtils.max(5.1f),
0);
assertEquals(
"max(float[]) failed for array length 2",
9.2f,
- NumberUtils.max(new float[] { 6.3f, 9.2f }),
+ NumberUtils.max(6.3f, 9.2f),
0);
assertEquals(
"max(float[]) failed for float length 5",
10.4f,
- NumberUtils.max(new float[] { -10.5f, -5.6f, 0, 5.7f, 10.4f }),
+ NumberUtils.max(-10.5f, -5.6f, 0, 5.7f, 10.4f),
0);
assertEquals(10, NumberUtils.max(new float[] { -10, -5, 0, 5, 10 }), 0.0001f);
assertEquals(10, NumberUtils.max(new float[] { -5, 0, 10, 5, -10 }), 0.0001f);
@@ -1445,10 +1445,7 @@ public class NumberUtilsTest {
private boolean checkCreateNumber(final String val) {
try {
final Object obj = NumberUtils.createNumber(val);
- if (obj == null) {
- return false;
- }
- return true;
+ return obj != null;
} catch (final NumberFormatException e) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java
index c14625d..9cd39c4 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java
@@ -101,7 +101,7 @@ public class ConstructorUtilsTest {
}
}
- private static class PrivateClass {
+ static class PrivateClass {
@SuppressWarnings("unused")
public PrivateClass() {
}
[21/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index a5f7e1a..c1d6dcc 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -75,13 +75,13 @@ public class ObjectUtilsTest {
assertEquals("123", firstNonNullGenerics);
assertEquals("123", ObjectUtils.firstNonNull("123", null, "456", null));
assertSame(Boolean.TRUE, ObjectUtils.firstNonNull(Boolean.TRUE));
-
+
// Explicitly pass in an empty array of Object type to ensure compiler doesn't complain of unchecked generic array creation
assertNull(ObjectUtils.firstNonNull(new Object[0]));
-
+
// Cast to Object in line below ensures compiler doesn't complain of unchecked generic array creation
assertNull(ObjectUtils.firstNonNull(null, null));
-
+
assertNull(ObjectUtils.firstNonNull((Object) null));
assertNull(ObjectUtils.firstNonNull((Object[]) null));
}
@@ -159,13 +159,13 @@ public class ObjectUtilsTest {
public void testHashCodeMulti_multiple_likeList() {
final List<Object> list0 = new ArrayList<>(Arrays.asList(new Object[0]));
assertEquals(list0.hashCode(), ObjectUtils.hashCodeMulti());
-
+
final List<Object> list1 = new ArrayList<Object>(Arrays.asList("a"));
assertEquals(list1.hashCode(), ObjectUtils.hashCodeMulti("a"));
-
+
final List<Object> list2 = new ArrayList<Object>(Arrays.asList("a", "b"));
assertEquals(list2.hashCode(), ObjectUtils.hashCodeMulti("a", "b"));
-
+
final List<Object> list3 = new ArrayList<Object>(Arrays.asList("a", "b", "c"));
assertEquals(list3.hashCode(), ObjectUtils.hashCodeMulti("a", "b", "c"));
}
@@ -190,7 +190,7 @@ public class ObjectUtilsTest {
} catch(final NullPointerException npe) {
}
}
-
+
@Test
public void testIdentityToStringStringBuilder() {
assertEquals(null, ObjectUtils.identityToString(null));
@@ -199,9 +199,9 @@ public class ObjectUtilsTest {
ObjectUtils.identityToString(FOO));
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());
@@ -211,14 +211,14 @@ public class ObjectUtilsTest {
fail("NullPointerException expected");
} catch(final NullPointerException npe) {
}
-
+
try {
ObjectUtils.identityToString(new StringBuilder(), null);
fail("NullPointerException expected");
} catch(final NullPointerException npe) {
}
}
-
+
@Test
public void testIdentityToStringStrBuilder() {
final Integer i = Integer.valueOf(102);
@@ -233,14 +233,14 @@ public class ObjectUtilsTest {
fail("NullPointerException expected");
} catch(final NullPointerException npe) {
}
-
+
try {
ObjectUtils.identityToString(new StrBuilder(), null);
fail("NullPointerException expected");
} catch(final NullPointerException npe) {
}
}
-
+
@Test
public void testIdentityToStringAppendable() {
final Integer i = Integer.valueOf(121);
@@ -253,7 +253,7 @@ public class ObjectUtilsTest {
} catch(final IOException ex) {
fail("IOException unexpected");
}
-
+
try {
ObjectUtils.identityToString((Appendable)null, "tmp");
fail("NullPointerException expected");
@@ -298,12 +298,12 @@ public class ObjectUtilsTest {
final Date nonNullComparable1 = calendar.getTime();
final Date nonNullComparable2 = calendar.getTime();
final String[] nullArray = null;
-
+
calendar.set( Calendar.YEAR, calendar.get( Calendar.YEAR ) -1 );
final Date minComparable = calendar.getTime();
-
+
assertNotSame( nonNullComparable1, nonNullComparable2 );
-
+
assertNull(ObjectUtils.max( (String) null ) );
assertNull(ObjectUtils.max( nullArray ) );
assertSame( nonNullComparable1, ObjectUtils.max( null, nonNullComparable1 ) );
@@ -324,12 +324,12 @@ public class ObjectUtilsTest {
final Date nonNullComparable1 = calendar.getTime();
final Date nonNullComparable2 = calendar.getTime();
final String[] nullArray = null;
-
+
calendar.set( Calendar.YEAR, calendar.get( Calendar.YEAR ) -1 );
final Date minComparable = calendar.getTime();
-
+
assertNotSame( nonNullComparable1, nonNullComparable2 );
-
+
assertNull(ObjectUtils.min( (String) null ) );
assertNull(ObjectUtils.min( nullArray ) );
assertSame( nonNullComparable1, ObjectUtils.min( null, nonNullComparable1 ) );
@@ -358,7 +358,7 @@ public class ObjectUtilsTest {
assertEquals("Null one false", -1, ObjectUtils.compare(nullValue, one));
assertEquals("Null one true", 1, ObjectUtils.compare(nullValue, one, true));
-
+
assertEquals("one Null false", 1, ObjectUtils.compare(one, nullValue));
assertEquals("one Null true", -1, ObjectUtils.compare(one, nullValue, true));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
index 68d10d2..d3ed631 100644
--- a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -50,7 +50,7 @@ public class RandomStringUtilsTest {
assertTrue(Modifier.isPublic(RandomStringUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(RandomStringUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
/**
* Test the implementation
@@ -62,12 +62,12 @@ public class RandomStringUtilsTest {
String r2 = RandomStringUtils.random(50);
assertEquals("random(50) length", 50, r2.length());
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
r1 = RandomStringUtils.randomAscii(50);
assertEquals("randomAscii(50) length", 50, r1.length());
for(int i = 0; i < r1.length(); i++) {
assertTrue("char between 32 and 127", r1.charAt(i) >= 32 && r1.charAt(i) <= 127);
- }
+ }
r2 = RandomStringUtils.randomAscii(50);
assertTrue("!r1.equals(r2)", !r1.equals(r2));
@@ -78,7 +78,7 @@ public class RandomStringUtilsTest {
}
r2 = RandomStringUtils.randomAlphabetic(50);
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
r1 = RandomStringUtils.randomAlphanumeric(50);
assertEquals("randomAlphanumeric(50)", 50, r1.length());
for(int i = 0; i < r1.length(); i++) {
@@ -86,7 +86,7 @@ public class RandomStringUtilsTest {
}
r2 = RandomStringUtils.randomAlphabetic(50);
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
r1 = RandomStringUtils.randomGraph(50);
assertEquals("randomGraph(50) length", 50, r1.length());
for(int i = 0; i < r1.length(); i++) {
@@ -94,7 +94,7 @@ public class RandomStringUtilsTest {
}
r2 = RandomStringUtils.randomGraph(50);
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
r1 = RandomStringUtils.randomNumeric(50);
assertEquals("randomNumeric(50)", 50, r1.length());
for(int i = 0; i < r1.length(); i++) {
@@ -102,7 +102,7 @@ public class RandomStringUtilsTest {
}
r2 = RandomStringUtils.randomNumeric(50);
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
r1 = RandomStringUtils.randomPrint(50);
assertEquals("randomPrint(50) length", 50, r1.length());
for(int i = 0; i < r1.length(); i++) {
@@ -110,7 +110,7 @@ public class RandomStringUtilsTest {
}
r2 = RandomStringUtils.randomPrint(50);
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
String set = "abcdefg";
r1 = RandomStringUtils.random(50, set);
assertEquals("random(50, \"abcdefg\")", 50, r1.length());
@@ -119,13 +119,13 @@ public class RandomStringUtilsTest {
}
r2 = RandomStringUtils.random(50, set);
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
r1 = RandomStringUtils.random(50, (String) null);
assertEquals("random(50) length", 50, r1.length());
r2 = RandomStringUtils.random(50, (String) null);
assertEquals("random(50) length", 50, r2.length());
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
set = "stuvwxyz";
r1 = RandomStringUtils.random(50, set.toCharArray());
assertEquals("random(50, \"stuvwxyz\")", 50, r1.length());
@@ -134,7 +134,7 @@ public class RandomStringUtilsTest {
}
r2 = RandomStringUtils.random(50, set);
assertTrue("!r1.equals(r2)", !r1.equals(r2));
-
+
r1 = RandomStringUtils.random(50, (char[]) null);
assertEquals("random(50) length", 50, r1.length());
r2 = RandomStringUtils.random(50, (char[]) null);
@@ -216,11 +216,11 @@ public class RandomStringUtilsTest {
fail();
} catch (final IllegalArgumentException ex) {}
}
-
+
/**
* Make sure boundary alphanumeric characters are generated by randomAlphaNumeric
* This test will fail randomly with probability = 6 * (61/62)**1000 ~ 5.2E-7
- */
+ */
@Test
public void testRandomAlphaNumeric() {
final char[] testChars = {'a', 'z', 'A', 'Z', '0', '9'};
@@ -235,16 +235,16 @@ public class RandomStringUtilsTest {
}
for (int i = 0; i < testChars.length; i++) {
if (!found[i]) {
- fail("alphanumeric character not generated in 1000 attempts: "
+ fail("alphanumeric character not generated in 1000 attempts: "
+ testChars[i] +" -- repeated failures indicate a problem ");
}
}
}
-
+
/**
* Make sure '0' and '9' are generated by randomNumeric
* This test will fail randomly with probability = 2 * (9/10)**1000 ~ 3.5E-46
- */
+ */
@Test
public void testRandomNumeric() {
final char[] testChars = {'0','9'};
@@ -259,16 +259,16 @@ public class RandomStringUtilsTest {
}
for (int i = 0; i < testChars.length; i++) {
if (!found[i]) {
- fail("digit not generated in 1000 attempts: "
+ fail("digit not generated in 1000 attempts: "
+ testChars[i] +" -- repeated failures indicate a problem ");
}
- }
+ }
}
-
+
/**
* Make sure boundary alpha characters are generated by randomAlphabetic
* This test will fail randomly with probability = 4 * (51/52)**1000 ~ 1.58E-8
- */
+ */
@Test
public void testRandomAlphabetic() {
final char[] testChars = {'a', 'z', 'A', 'Z'};
@@ -283,16 +283,16 @@ public class RandomStringUtilsTest {
}
for (int i = 0; i < testChars.length; i++) {
if (!found[i]) {
- fail("alphanumeric character not generated in 1000 attempts: "
+ fail("alphanumeric character not generated in 1000 attempts: "
+ testChars[i] +" -- repeated failures indicate a problem ");
}
}
}
-
+
/**
* Make sure 32 and 127 are generated by randomNumeric
* This test will fail randomly with probability = 2*(95/96)**1000 ~ 5.7E-5
- */
+ */
@Test
public void testRandomAscii() {
final char[] testChars = {(char) 32, (char) 126};
@@ -307,11 +307,11 @@ public class RandomStringUtilsTest {
}
for (int i = 0; i < testChars.length; i++) {
if (!found[i]) {
- fail("ascii character not generated in 1000 attempts: "
- + (int) testChars[i] +
+ fail("ascii character not generated in 1000 attempts: "
+ + (int) testChars[i] +
" -- repeated failures indicate a problem");
}
- }
+ }
}
@Test
@@ -463,8 +463,8 @@ public class RandomStringUtilsTest {
assertThat("min generated, may fail randomly rarely", minCreatedLength, is(expectedMinLengthInclusive));
assertThat("max generated, may fail randomly rarely", maxCreatedLength, is(expectedMaxLengthExclusive - 1));
}
-
- /**
+
+ /**
* Test homogeneity of random strings generated --
* i.e., test that characters show up with expected frequencies
* in generated strings. Will fail randomly about 1 in 1000 times.
@@ -487,12 +487,12 @@ public class RandomStringUtilsTest {
default: {fail("generated character not in set");}
}
}
- }
+ }
// Perform chi-square test with df = 3-1 = 2, testing at .001 level
assertTrue("test homogeneity -- will fail about 1 in 1000 times",
- chiSquare(expected,counts) < 13.82);
+ chiSquare(expected,counts) < 13.82);
}
-
+
/**
* Computes Chi-Square statistic given observed and expected counts
* @param observed array of observed frequency counts
@@ -506,7 +506,7 @@ public class RandomStringUtilsTest {
sumSq += dev * dev / expected[i];
}
return sumSq;
- }
+ }
/**
* Checks if the string got by {@link RandomStringUtils#random(int)}
@@ -534,20 +534,20 @@ public class RandomStringUtilsTest {
// just to be complete
assertEquals(orig, copy);
}
-
-
+
+
/**
* Test for LANG-1286. Creates situation where old code would
* overflow a char and result in a code point outside the specified
* range.
- *
+ *
* @throws Exception
*/
@Test
public void testCharOverflow() throws Exception {
int start = Character.MAX_VALUE;
int end = Integer.MAX_VALUE;
-
+
@SuppressWarnings("serial")
Random fixedRandom = new Random() {
@Override
@@ -556,7 +556,7 @@ public class RandomStringUtilsTest {
return super.nextInt(n - 1) + 1;
}
};
-
+
String result = RandomStringUtils.random(2, start, end, false, false, null, fixedRandom);
int c = result.codePointAt(0);
assertTrue(String.format("Character '%d' not in range [%d,%d).", c, start, end), c >= start && c < end);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
index ddbaab1..3f9604f 100644
--- a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
@@ -125,7 +125,7 @@ public class RandomUtilsTest {
public void testNextIntMinimalRange() {
assertEquals(42, RandomUtils.nextInt(42, 42));
}
-
+
/**
* Tests next int range.
*/
@@ -144,23 +144,23 @@ public class RandomUtilsTest {
assertTrue(randomResult > 0);
assertTrue(randomResult < Integer.MAX_VALUE);
}
-
+
/**
* Test next double range with minimal range.
*/
@Test
public void testNextDoubleMinimalRange() {
assertEquals(42.1, RandomUtils.nextDouble(42.1, 42.1), DELTA);
- }
-
+ }
+
/**
* Test next float range with minimal range.
*/
@Test
public void testNextFloatMinimalRange() {
assertEquals(42.1f, RandomUtils.nextFloat(42.1f, 42.1f), DELTA);
- }
-
+ }
+
/**
* Tests next double range.
*/
@@ -179,7 +179,7 @@ public class RandomUtilsTest {
assertTrue(randomResult > 0);
assertTrue(randomResult < Double.MAX_VALUE);
}
-
+
/**
* Tests next float range.
*/
@@ -206,7 +206,7 @@ public class RandomUtilsTest {
public void testNextLongMinimalRange() {
assertEquals(42L, RandomUtils.nextLong(42L, 42L));
}
-
+
/**
* Tests next long range.
*/
@@ -225,7 +225,7 @@ public class RandomUtilsTest {
assertTrue(randomResult > 0);
assertTrue(randomResult < Long.MAX_VALUE);
}
-
+
/**
* Tests extreme range.
*/
@@ -234,7 +234,7 @@ public class RandomUtilsTest {
final int result = RandomUtils.nextInt(0, Integer.MAX_VALUE);
assertTrue(result >= 0 && result < Integer.MAX_VALUE);
}
-
+
/**
* Tests extreme range.
*/
@@ -242,8 +242,8 @@ public class RandomUtilsTest {
public void testExtremeRangeLong() {
final long result = RandomUtils.nextLong(0, Long.MAX_VALUE);
assertTrue(result >= 0 && result < Long.MAX_VALUE);
- }
-
+ }
+
/**
* Tests extreme range.
*/
@@ -251,8 +251,8 @@ public class RandomUtilsTest {
public void testExtremeRangeFloat() {
final float result = RandomUtils.nextFloat(0, Float.MAX_VALUE);
assertTrue(result >= 0f && result <= Float.MAX_VALUE);
- }
-
+ }
+
/**
* Tests extreme range.
*/
@@ -260,5 +260,5 @@ public class RandomUtilsTest {
public void testExtremeRangeDouble() {
final double result = RandomUtils.nextDouble(0, Double.MAX_VALUE);
assertTrue(result >= 0 && result <= Double.MAX_VALUE);
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/RangeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/RangeTest.java b/src/test/java/org/apache/commons/lang3/RangeTest.java
index 03ed509..a8d7e1b 100644
--- a/src/test/java/org/apache/commons/lang3/RangeTest.java
+++ b/src/test/java/org/apache/commons/lang3/RangeTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
index caa648b..d9a5bde 100644
--- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -47,7 +47,7 @@ public class SerializationUtilsTest {
static final String CLASS_NOT_FOUND_MESSAGE = "ClassNotFoundSerialization.readObject fake exception";
protected static final String SERIALIZE_IO_EXCEPTION_MESSAGE = "Anonymous OutputStream I/O exception";
-
+
private String iString;
private Integer iInteger;
private HashMap<Object, Object> iMap;
@@ -72,29 +72,29 @@ public class SerializationUtilsTest {
assertTrue(Modifier.isPublic(SerializationUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(SerializationUtils.class.getModifiers()));
}
-
+
@Test
public void testException() {
SerializationException serEx;
final Exception ex = new Exception();
-
+
serEx = new SerializationException();
assertSame(null, serEx.getMessage());
assertSame(null, serEx.getCause());
-
+
serEx = new SerializationException("Message");
assertSame("Message", serEx.getMessage());
assertSame(null, serEx.getCause());
-
+
serEx = new SerializationException(ex);
assertEquals("java.lang.Exception", serEx.getMessage());
assertSame(ex, serEx.getCause());
-
+
serEx = new SerializationException("Message", ex);
assertSame("Message", serEx.getMessage());
assertSame(ex, serEx.getCause());
}
-
+
//-----------------------------------------------------------------------
@Test
@@ -166,7 +166,7 @@ public class SerializationUtilsTest {
}
fail();
}
-
+
@Test
public void testSerializeIOException() throws Exception {
// forces an IOException when the ObjectOutputStream is created, to test not closing the stream
@@ -268,13 +268,13 @@ public class SerializationUtilsTest {
assertEquals("java.lang.ClassNotFoundException: " + CLASS_NOT_FOUND_MESSAGE, se.getMessage());
}
}
-
- @Test
+
+ @Test
public void testRoundtrip() {
final HashMap<Object, Object> newMap = SerializationUtils.roundtrip(iMap);
assertEquals(iMap, newMap);
}
-
+
//-----------------------------------------------------------------------
@Test
@@ -408,7 +408,7 @@ public class SerializationUtilsTest {
}
fail();
}
-
+
@Test
public void testPrimitiveTypeClassSerialization() {
final Class<?>[] primitiveTypes = { byte.class, short.class, int.class, long.class, float.class, double.class,
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
index df188a6..47e4fce 100644
--- a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -51,7 +51,7 @@ public class StringEscapeUtilsTest {
assertTrue(Modifier.isPublic(StringEscapeUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(StringEscapeUtils.class.getModifiers()));
}
-
+
@Test
public void testEscapeJava() throws IOException {
assertEquals(null, StringEscapeUtils.escapeJava(null));
@@ -69,7 +69,7 @@ public class StringEscapeUtilsTest {
fail();
} catch (final IllegalArgumentException ex) {
}
-
+
assertEscapeJava("empty string", "", "");
assertEscapeJava(FOO, FOO);
assertEscapeJava("tab", "\\t", "\t");
@@ -106,7 +106,7 @@ public class StringEscapeUtilsTest {
*/
assertEquals(expected, actual);
}
-
+
private void assertEscapeJava(final String escaped, final String original) throws IOException {
assertEscapeJava(null, escaped, original);
}
@@ -143,7 +143,7 @@ public class StringEscapeUtilsTest {
fail();
} catch (final RuntimeException ex) {
}
-
+
assertUnescapeJava("", "");
assertUnescapeJava("test", "test");
assertUnescapeJava("\ntest\b", "\\ntest\\b");
@@ -194,9 +194,9 @@ public class StringEscapeUtilsTest {
fail();
} catch (final IllegalArgumentException ex) {
}
-
+
assertEquals("He didn\\'t say, \\\"stop!\\\"", StringEscapeUtils.escapeEcmaScript("He didn't say, \"stop!\""));
- assertEquals("document.getElementById(\\\"test\\\").value = \\'<script>alert(\\'aaa\\');<\\/script>\\';",
+ assertEquals("document.getElementById(\\\"test\\\").value = \\'<script>alert(\\'aaa\\');<\\/script>\\';",
StringEscapeUtils.escapeEcmaScript("document.getElementById(\"test\").value = '<script>alert('aaa');</script>';"));
}
@@ -265,7 +265,7 @@ public class StringEscapeUtilsTest {
final String expected = element[2];
final String original = element[1];
assertEquals(message, expected, StringEscapeUtils.unescapeHtml4(original));
-
+
final StringWriter sw = new StringWriter();
try {
StringEscapeUtils.UNESCAPE_HTML4.translate(original, sw);
@@ -276,9 +276,9 @@ public class StringEscapeUtilsTest {
}
// \u00E7 is a cedilla (c with wiggle under)
// note that the test string must be 7-bit-clean (Unicode escaped) or else it will compile incorrectly
- // on some locales
+ // on some locales
assertEquals("funny chars pass through OK", "Fran\u00E7ais", StringEscapeUtils.unescapeHtml4("Fran\u00E7ais"));
-
+
assertEquals("Hello&;World", StringEscapeUtils.unescapeHtml4("Hello&;World"));
assertEquals("Hello&#;World", StringEscapeUtils.unescapeHtml4("Hello&#;World"));
assertEquals("Hello&# ;World", StringEscapeUtils.unescapeHtml4("Hello&# ;World"));
@@ -287,7 +287,7 @@ public class StringEscapeUtilsTest {
@Test
public void testUnescapeHexCharsHtml() {
- // Simple easy to grok test
+ // Simple easy to grok test
assertEquals("hex number unescape", "\u0080\u009F", StringEscapeUtils.unescapeHtml4("€Ÿ"));
assertEquals("hex number unescape", "\u0080\u009F", StringEscapeUtils.unescapeHtml4("€Ÿ"));
// Test all Character values:
@@ -350,7 +350,7 @@ public class StringEscapeUtilsTest {
}
assertEquals("XML was unescaped incorrectly", "<abc>", sw.toString() );
}
-
+
@Test
public void testEscapeXml10() throws Exception {
assertEquals("a<b>c"d'e&f", StringEscapeUtils.escapeXml10("a<b>c\"d'e&f"));
@@ -365,7 +365,7 @@ public class StringEscapeUtilsTest {
assertEquals("XML 1.0 should escape #x7f-#x84 | #x86 - #x9f, for XML 1.1 compatibility",
"a\u007e„\u0085†Ÿ\u00a0b", StringEscapeUtils.escapeXml10("a\u007e\u007f\u0084\u0085\u0086\u009f\u00a0b"));
}
-
+
@Test
public void testEscapeXml11() throws Exception {
assertEquals("a<b>c"d'e&f", StringEscapeUtils.escapeXml11("a<b>c\"d'e&f"));
@@ -384,7 +384,7 @@ public class StringEscapeUtilsTest {
}
/**
- * Tests Supplementary characters.
+ * Tests Supplementary characters.
* <p>
* From http://www.w3.org/International/questions/qa-escapes
* </p>
@@ -400,7 +400,7 @@ public class StringEscapeUtilsTest {
*/
@Test
public void testEscapeXmlSupplementaryCharacters() {
- final CharSequenceTranslator escapeXml =
+ final CharSequenceTranslator escapeXml =
StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );
assertEquals("Supplementary character must be represented using a single escape", "𣎴",
@@ -409,7 +409,7 @@ public class StringEscapeUtilsTest {
assertEquals("Supplementary characters mixed with basic characters should be encoded correctly", "a b c 𣎴",
escapeXml.translate("a b c \uD84C\uDFB4"));
}
-
+
@Test
public void testEscapeXmlAllCharacters() {
// http://www.w3.org/TR/xml/#charsets says:
@@ -427,7 +427,7 @@ public class StringEscapeUtilsTest {
assertEquals("Hello World! Ain't this great?", escapeXml.translate("Hello World! Ain't this great?"));
assertEquals("", escapeXml.translate("\u000E\u000F\u0018\u0019"));
}
-
+
/**
* Reverse of the above.
*
@@ -441,7 +441,7 @@ public class StringEscapeUtilsTest {
assertEquals("Supplementary characters mixed with basic characters should be decoded correctly", "a b c \uD84C\uDFB4",
StringEscapeUtils.unescapeXml("a b c 𣎴") );
}
-
+
// Tests issue #38569
// http://issues.apache.org/bugzilla/show_bug.cgi?id=38569
@Test
@@ -583,7 +583,7 @@ public class StringEscapeUtilsTest {
/**
* Tests https://issues.apache.org/jira/browse/LANG-708
- *
+ *
* @throws IOException
* if an I/O error occurs
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
index 6fedb92..5cc635f 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
@@ -211,7 +211,7 @@ public class StringUtilsContainsTest {
assertFalse(StringUtils.containsAny(CharU20000, CharU20001));
assertFalse(StringUtils.containsAny(CharU20001, CharU20000));
}
-
+
@Test
public void testContainsAny_StringStringArray() {
assertFalse(StringUtils.containsAny(null, (String[]) null));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
index 8e88f6e..8e872c3 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
index 91c0451..22cf9aa 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
@@ -294,7 +294,7 @@ public class StringUtilsEqualsIndexOfTest {
assertEquals(2, StringUtils.indexOf("aabaabaa", 'b', -1));
assertEquals(5, StringUtils.indexOf(new StringBuilder("aabaabaa"), 'b', 3));
-
+
//LANG-1300 tests go here
final int CODE_POINT = 0x2070E;
StringBuilder builder = new StringBuilder();
@@ -545,7 +545,7 @@ public class StringUtilsEqualsIndexOfTest {
assertEquals(0, StringUtils.lastIndexOf("aabaabaa", 'a', 0));
assertEquals(2, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b', 2));
-
+
//LANG-1300 addition test
final int CODE_POINT = 0x2070E;
StringBuilder builder = new StringBuilder();
@@ -784,7 +784,7 @@ public class StringUtilsEqualsIndexOfTest {
@Test
public void testLANG1193() {
- assertEquals(0, StringUtils.ordinalIndexOf("abc", "ab", 1));
+ assertEquals(0, StringUtils.ordinalIndexOf("abc", "ab", 1));
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java
index 6932afb..4160f1a 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -127,7 +127,7 @@ public class StringUtilsIsTest {
assertTrue(StringUtils.isAsciiPrintable("=?iso-8859-1?Q?G=FClc=FC?="));
assertFalse(StringUtils.isAsciiPrintable("G\u00fclc\u00fc"));
}
-
+
@Test
public void testIsNumeric() {
assertFalse(StringUtils.isNumeric(null));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java
index ec72c0d..2eb5ddb 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -99,7 +99,7 @@ public class StringUtilsStartsEndsWithTest {
assertTrue("StringUtils.startsWithAny(abcxyz, StringBuilder(xyz), StringBuffer(abc))", StringUtils.startsWithAny("abcxyz", new StringBuilder("xyz"), new StringBuffer("abc")));
assertTrue("StringUtils.startsWithAny(StringBuffer(abcxyz), StringBuilder(xyz), StringBuffer(abc))", StringUtils.startsWithAny(new StringBuffer("abcxyz"), new StringBuilder("xyz"), new StringBuffer("abc")));
}
-
+
/**
* Test StringUtils.endsWith()
@@ -183,7 +183,7 @@ public class StringUtilsStartsEndsWithTest {
/*
* Type null of the last argument to method endsWithAny(CharSequence, CharSequence...)
- * doesn't exactly match the vararg parameter type.
+ * doesn't exactly match the vararg parameter type.
* Cast to CharSequence[] to confirm the non-varargs invocation,
* or pass individual arguments of type CharSequence for a varargs invocation.
*
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java
index f6986ee..66d03f3 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -39,7 +39,7 @@ public class StringUtilsSubstringTest {
assertEquals(null, StringUtils.substring(null, 0));
assertEquals("", StringUtils.substring("", 0));
assertEquals("", StringUtils.substring("", 2));
-
+
assertEquals("", StringUtils.substring(SENTENCE, 80));
assertEquals(BAZ, StringUtils.substring(SENTENCE, 8));
assertEquals(BAZ, StringUtils.substring(SENTENCE, -3));
@@ -54,7 +54,7 @@ public class StringUtilsSubstringTest {
assertEquals("", StringUtils.substring("abc", 3));
assertEquals("", StringUtils.substring("abc", 4));
}
-
+
@Test
public void testSubstring_StringIntInt() {
assertEquals(null, StringUtils.substring(null, 0, 0));
@@ -62,7 +62,7 @@ public class StringUtilsSubstringTest {
assertEquals("", StringUtils.substring("", 0, 0));
assertEquals("", StringUtils.substring("", 1, 2));
assertEquals("", StringUtils.substring("", -2, -1));
-
+
assertEquals("", StringUtils.substring(SENTENCE, 8, 6));
assertEquals(FOO, StringUtils.substring(SENTENCE, 0, 3));
assertEquals("o", StringUtils.substring(SENTENCE, -9, 3));
@@ -72,50 +72,50 @@ public class StringUtilsSubstringTest {
assertEquals("", StringUtils.substring(SENTENCE, 2, 2));
assertEquals("b",StringUtils.substring("abc", -2, -1));
}
-
+
@Test
public void testLeft_String() {
assertSame(null, StringUtils.left(null, -1));
assertSame(null, StringUtils.left(null, 0));
assertSame(null, StringUtils.left(null, 2));
-
+
assertEquals("", StringUtils.left("", -1));
assertEquals("", StringUtils.left("", 0));
assertEquals("", StringUtils.left("", 2));
-
+
assertEquals("", StringUtils.left(FOOBAR, -1));
assertEquals("", StringUtils.left(FOOBAR, 0));
assertEquals(FOO, StringUtils.left(FOOBAR, 3));
assertSame(FOOBAR, StringUtils.left(FOOBAR, 80));
}
-
+
@Test
public void testRight_String() {
assertSame(null, StringUtils.right(null, -1));
assertSame(null, StringUtils.right(null, 0));
assertSame(null, StringUtils.right(null, 2));
-
+
assertEquals("", StringUtils.right("", -1));
assertEquals("", StringUtils.right("", 0));
assertEquals("", StringUtils.right("", 2));
-
+
assertEquals("", StringUtils.right(FOOBAR, -1));
assertEquals("", StringUtils.right(FOOBAR, 0));
assertEquals(BAR, StringUtils.right(FOOBAR, 3));
assertSame(FOOBAR, StringUtils.right(FOOBAR, 80));
}
-
+
@Test
public void testMid_String() {
assertSame(null, StringUtils.mid(null, -1, 0));
assertSame(null, StringUtils.mid(null, 0, -1));
assertSame(null, StringUtils.mid(null, 3, 0));
assertSame(null, StringUtils.mid(null, 3, 2));
-
+
assertEquals("", StringUtils.mid("", 0, -1));
assertEquals("", StringUtils.mid("", 0, 0));
assertEquals("", StringUtils.mid("", 0, 2));
-
+
assertEquals("", StringUtils.mid(FOOBAR, 3, -1));
assertEquals("", StringUtils.mid(FOOBAR, 3, 0));
assertEquals("b", StringUtils.mid(FOOBAR, 3, 1));
@@ -126,7 +126,7 @@ public class StringUtilsSubstringTest {
assertEquals("", StringUtils.mid(FOOBAR, 9, 3));
assertEquals(FOO, StringUtils.mid(FOOBAR, -1, 3));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testSubstringBefore_StringString() {
@@ -138,7 +138,7 @@ public class StringUtilsSubstringTest {
assertEquals("", StringUtils.substringBefore("", null));
assertEquals("", StringUtils.substringBefore("", ""));
assertEquals("", StringUtils.substringBefore("", "XX"));
-
+
assertEquals("foo", StringUtils.substringBefore("foo", null));
assertEquals("foo", StringUtils.substringBefore("foo", "b"));
assertEquals("f", StringUtils.substringBefore("foot", "o"));
@@ -147,18 +147,18 @@ public class StringUtilsSubstringTest {
assertEquals("ab", StringUtils.substringBefore("abc", "c"));
assertEquals("", StringUtils.substringBefore("abc", ""));
}
-
+
@Test
public void testSubstringAfter_StringString() {
assertEquals("barXXbaz", StringUtils.substringAfter("fooXXbarXXbaz", "XX"));
-
+
assertEquals(null, StringUtils.substringAfter(null, null));
assertEquals(null, StringUtils.substringAfter(null, ""));
assertEquals(null, StringUtils.substringAfter(null, "XX"));
assertEquals("", StringUtils.substringAfter("", null));
assertEquals("", StringUtils.substringAfter("", ""));
assertEquals("", StringUtils.substringAfter("", "XX"));
-
+
assertEquals("", StringUtils.substringAfter("foo", null));
assertEquals("ot", StringUtils.substringAfter("foot", "o"));
assertEquals("bc", StringUtils.substringAfter("abc", "a"));
@@ -191,7 +191,7 @@ public class StringUtilsSubstringTest {
assertEquals("a", StringUtils.substringBeforeLast("a", ""));
assertEquals("", StringUtils.substringBeforeLast("a", "a"));
}
-
+
@Test
public void testSubstringAfterLast_StringString() {
assertEquals("baz", StringUtils.substringAfterLast("fooXXbarXXbaz", "XX"));
@@ -211,8 +211,8 @@ public class StringUtilsSubstringTest {
assertEquals("", StringUtils.substringAfterLast("abc", "c"));
assertEquals("", StringUtils.substringAfterLast("", "d"));
assertEquals("", StringUtils.substringAfterLast("abc", ""));
- }
-
+ }
+
//-----------------------------------------------------------------------
@Test
public void testSubstringBetween_StringString() {
@@ -227,7 +227,7 @@ public class StringUtilsSubstringTest {
assertEquals("bc", StringUtils.substringBetween("abcabca", "a"));
assertEquals("bar", StringUtils.substringBetween("\nbar\n", "\n"));
}
-
+
@Test
public void testSubstringBetween_StringStringString() {
assertEquals(null, StringUtils.substringBetween(null, "", ""));
@@ -312,11 +312,11 @@ public class StringUtilsSubstringTest {
assertEquals(0, StringUtils.countMatches("x", ""));
assertEquals(0, StringUtils.countMatches("", ""));
- assertEquals(3,
+ assertEquals(3,
StringUtils.countMatches("one long someone sentence of one", "one"));
- assertEquals(0,
+ assertEquals(0,
StringUtils.countMatches("one long someone sentence of one", "two"));
- assertEquals(4,
+ assertEquals(4,
StringUtils.countMatches("oooooooooooo", "ooo"));
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 2b49669..5cda0af 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -3204,7 +3204,7 @@ public class StringUtilsTest {
assertNull(StringUtils.unwrap(null, null));
assertNull(StringUtils.unwrap(null, '\0'));
assertNull(StringUtils.unwrap(null, '1'));
-
+
assertEquals("abc", StringUtils.unwrap("abc", null));
assertEquals("abc", StringUtils.unwrap("\'abc\'", '\''));
assertEquals("abc", StringUtils.unwrap("AabcA", 'A'));
@@ -3214,18 +3214,18 @@ public class StringUtilsTest {
assertEquals("A#", StringUtils.unwrap("A#", '#'));
assertEquals("ABA", StringUtils.unwrap("AABAA", 'A'));
}
-
+
@Test
public void testToCodePoints() throws Exception {
final int orphanedHighSurrogate = 0xD801;
final int orphanedLowSurrogate = 0xDC00;
final int supplementary = 0x2070E;
-
- final int[] codePoints = {'a', orphanedHighSurrogate, 'b','c', supplementary,
+
+ final int[] codePoints = {'a', orphanedHighSurrogate, 'b','c', supplementary,
'd', orphanedLowSurrogate, 'e'};
final String s = new String(codePoints, 0, codePoints.length);
assertArrayEquals(codePoints, StringUtils.toCodePoints(s));
-
+
assertNull(StringUtils.toCodePoints(null));
assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, StringUtils.toCodePoints(""));
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java
index 1a558f5..d9fdb74 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -74,10 +74,10 @@ public class StringUtilsTrimStripTest {
assertEquals("", StringUtils.strip(""));
assertEquals("", StringUtils.strip(" "));
assertEquals("abc", StringUtils.strip(" abc "));
- assertEquals(StringUtilsTest.NON_WHITESPACE,
+ assertEquals(StringUtilsTest.NON_WHITESPACE,
StringUtils.strip(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE));
}
-
+
@Test
public void testStripToNull_String() {
assertEquals(null, StringUtils.stripToNull(null));
@@ -85,10 +85,10 @@ public class StringUtilsTrimStripTest {
assertEquals(null, StringUtils.stripToNull(" "));
assertEquals(null, StringUtils.stripToNull(StringUtilsTest.WHITESPACE));
assertEquals("ab c", StringUtils.stripToNull(" ab c "));
- assertEquals(StringUtilsTest.NON_WHITESPACE,
+ assertEquals(StringUtilsTest.NON_WHITESPACE,
StringUtils.stripToNull(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE));
}
-
+
@Test
public void testStripToEmpty_String() {
assertEquals("", StringUtils.stripToEmpty(null));
@@ -96,10 +96,10 @@ public class StringUtilsTrimStripTest {
assertEquals("", StringUtils.stripToEmpty(" "));
assertEquals("", StringUtils.stripToEmpty(StringUtilsTest.WHITESPACE));
assertEquals("ab c", StringUtils.stripToEmpty(" ab c "));
- assertEquals(StringUtilsTest.NON_WHITESPACE,
+ assertEquals(StringUtilsTest.NON_WHITESPACE,
StringUtils.stripToEmpty(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE));
}
-
+
@Test
public void testStrip_StringString() {
// null strip
@@ -107,7 +107,7 @@ public class StringUtilsTrimStripTest {
assertEquals("", StringUtils.strip("", null));
assertEquals("", StringUtils.strip(" ", null));
assertEquals("abc", StringUtils.strip(" abc ", null));
- assertEquals(StringUtilsTest.NON_WHITESPACE,
+ assertEquals(StringUtilsTest.NON_WHITESPACE,
StringUtils.strip(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE, null));
// "" strip
@@ -116,13 +116,13 @@ public class StringUtilsTrimStripTest {
assertEquals(" ", StringUtils.strip(" ", ""));
assertEquals(" abc ", StringUtils.strip(" abc ", ""));
assertEquals(StringUtilsTest.WHITESPACE, StringUtils.strip(StringUtilsTest.WHITESPACE, ""));
-
+
// " " strip
assertEquals(null, StringUtils.strip(null, " "));
assertEquals("", StringUtils.strip("", " "));
assertEquals("", StringUtils.strip(" ", " "));
assertEquals("abc", StringUtils.strip(" abc ", " "));
-
+
// "ab" strip
assertEquals(null, StringUtils.strip(null, "ab"));
assertEquals("", StringUtils.strip("", "ab"));
@@ -131,7 +131,7 @@ public class StringUtilsTrimStripTest {
assertEquals("c", StringUtils.strip("abcabab", "ab"));
assertEquals(StringUtilsTest.WHITESPACE, StringUtils.strip(StringUtilsTest.WHITESPACE, ""));
}
-
+
@Test
public void testStripStart_StringString() {
// null stripStart
@@ -139,7 +139,7 @@ public class StringUtilsTrimStripTest {
assertEquals("", StringUtils.stripStart("", null));
assertEquals("", StringUtils.stripStart(" ", null));
assertEquals("abc ", StringUtils.stripStart(" abc ", null));
- assertEquals(StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE,
+ assertEquals(StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE,
StringUtils.stripStart(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE, null));
// "" stripStart
@@ -148,13 +148,13 @@ public class StringUtilsTrimStripTest {
assertEquals(" ", StringUtils.stripStart(" ", ""));
assertEquals(" abc ", StringUtils.stripStart(" abc ", ""));
assertEquals(StringUtilsTest.WHITESPACE, StringUtils.stripStart(StringUtilsTest.WHITESPACE, ""));
-
+
// " " stripStart
assertEquals(null, StringUtils.stripStart(null, " "));
assertEquals("", StringUtils.stripStart("", " "));
assertEquals("", StringUtils.stripStart(" ", " "));
assertEquals("abc ", StringUtils.stripStart(" abc ", " "));
-
+
// "ab" stripStart
assertEquals(null, StringUtils.stripStart(null, "ab"));
assertEquals("", StringUtils.stripStart("", "ab"));
@@ -163,7 +163,7 @@ public class StringUtilsTrimStripTest {
assertEquals("cabab", StringUtils.stripStart("abcabab", "ab"));
assertEquals(StringUtilsTest.WHITESPACE, StringUtils.stripStart(StringUtilsTest.WHITESPACE, ""));
}
-
+
@Test
public void testStripEnd_StringString() {
// null stripEnd
@@ -171,7 +171,7 @@ public class StringUtilsTrimStripTest {
assertEquals("", StringUtils.stripEnd("", null));
assertEquals("", StringUtils.stripEnd(" ", null));
assertEquals(" abc", StringUtils.stripEnd(" abc ", null));
- assertEquals(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE,
+ assertEquals(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE,
StringUtils.stripEnd(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE, null));
// "" stripEnd
@@ -180,13 +180,13 @@ public class StringUtilsTrimStripTest {
assertEquals(" ", StringUtils.stripEnd(" ", ""));
assertEquals(" abc ", StringUtils.stripEnd(" abc ", ""));
assertEquals(StringUtilsTest.WHITESPACE, StringUtils.stripEnd(StringUtilsTest.WHITESPACE, ""));
-
+
// " " stripEnd
assertEquals(null, StringUtils.stripEnd(null, " "));
assertEquals("", StringUtils.stripEnd("", " "));
assertEquals("", StringUtils.stripEnd(" ", " "));
assertEquals(" abc", StringUtils.stripEnd(" abc ", " "));
-
+
// "ab" stripEnd
assertEquals(null, StringUtils.stripEnd(null, "ab"));
assertEquals("", StringUtils.stripEnd("", "ab"));
@@ -211,7 +211,7 @@ public class StringUtilsTrimStripTest {
assertArrayEquals(empty, StringUtils.stripAll(empty));
assertArrayEquals(foo, StringUtils.stripAll(fooSpace));
-
+
assertNull(StringUtils.stripAll(null, null));
assertArrayEquals(foo, StringUtils.stripAll(fooSpace, null));
assertArrayEquals(foo, StringUtils.stripAll(fooDots, "."));
@@ -222,11 +222,11 @@ public class StringUtilsTrimStripTest {
final String cue = "\u00C7\u00FA\u00EA";
assertEquals( "Failed to strip accents from " + cue, "Cue", StringUtils.stripAccents(cue));
- final String lots = "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C7\u00C8\u00C9" +
- "\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D1\u00D2\u00D3" +
+ final String lots = "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C7\u00C8\u00C9" +
+ "\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D1\u00D2\u00D3" +
"\u00D4\u00D5\u00D6\u00D9\u00DA\u00DB\u00DC\u00DD";
- assertEquals( "Failed to strip accents from " + lots,
- "AAAAAACEEEEIIIINOOOOOUUUUY",
+ assertEquals( "Failed to strip accents from " + lots,
+ "AAAAAACEEEEIIIINOOOOOUUUUY",
StringUtils.stripAccents(lots));
assertNull( "Failed null safety", StringUtils.stripAccents(null) );
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
index cc1d492..3d9d024 100644
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -43,7 +43,7 @@ import org.junit.Test;
/**
* Unit tests {@link org.apache.commons.lang3.SystemUtils}.
- *
+ *
* Only limited testing can be performed.
*/
public class SystemUtilsTest {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
----------------------------------------------------------------------
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 4ce0a1f..33deaa8 100644
--- a/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -95,7 +95,7 @@ public class CompareToBuilderTest {
this.t = t;
}
}
-
+
@Test
public void testReflectionCompare() {
final TestObject o1 = new TestObject(4);
@@ -124,16 +124,16 @@ public class CompareToBuilderTest {
public void testReflectionHierarchyCompare() {
testReflectionHierarchyCompare(false, null);
}
-
+
@Test
public void testReflectionHierarchyCompareExcludeFields() {
final String[] excludeFields = new String[] { "b" };
testReflectionHierarchyCompare(true, excludeFields);
-
+
TestSubObject x;
TestSubObject y;
TestSubObject z;
-
+
x = new TestSubObject(1, 1);
y = new TestSubObject(2, 1);
z = new TestSubObject(3, 1);
@@ -144,7 +144,7 @@ public class CompareToBuilderTest {
z = new TestSubObject(3, 1);
assertXYZCompareOrder(x, y, z, true, excludeFields);
}
-
+
@Test
public void testReflectionHierarchyCompareTransients() {
testReflectionHierarchyCompare(true, null);
@@ -157,27 +157,27 @@ public class CompareToBuilderTest {
y = new TestTransientSubObject(2, 2);
z = new TestTransientSubObject(3, 3);
assertXYZCompareOrder(x, y, z, true, null);
-
+
x = new TestTransientSubObject(1, 1);
y = new TestTransientSubObject(1, 2);
z = new TestTransientSubObject(1, 3);
- assertXYZCompareOrder(x, y, z, true, null);
+ assertXYZCompareOrder(x, y, z, true, null);
}
-
+
private void assertXYZCompareOrder(final Object x, final Object y, final Object z, final boolean testTransients, final String[] excludeFields) {
assertTrue(0 == CompareToBuilder.reflectionCompare(x, x, testTransients, null, excludeFields));
assertTrue(0 == CompareToBuilder.reflectionCompare(y, y, testTransients, null, excludeFields));
assertTrue(0 == CompareToBuilder.reflectionCompare(z, z, testTransients, null, excludeFields));
-
+
assertTrue(0 > CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields));
assertTrue(0 > CompareToBuilder.reflectionCompare(x, z, testTransients, null, excludeFields));
assertTrue(0 > CompareToBuilder.reflectionCompare(y, z, testTransients, null, excludeFields));
-
+
assertTrue(0 < CompareToBuilder.reflectionCompare(y, x, testTransients, null, excludeFields));
assertTrue(0 < CompareToBuilder.reflectionCompare(z, x, testTransients, null, excludeFields));
assertTrue(0 < CompareToBuilder.reflectionCompare(z, y, testTransients, null, excludeFields));
}
-
+
private void testReflectionHierarchyCompare(final boolean testTransients, final String[] excludeFields) {
final TestObject to1 = new TestObject(1);
final TestObject to2 = new TestObject(2);
@@ -185,26 +185,26 @@ public class CompareToBuilderTest {
final TestSubObject tso1 = new TestSubObject(1, 1);
final TestSubObject tso2 = new TestSubObject(2, 2);
final TestSubObject tso3 = new TestSubObject(3, 3);
-
+
assertReflectionCompareContract(to1, to1, to1, false, excludeFields);
assertReflectionCompareContract(to1, to2, to3, false, excludeFields);
assertReflectionCompareContract(tso1, tso1, tso1, false, excludeFields);
assertReflectionCompareContract(tso1, tso2, tso3, false, excludeFields);
assertReflectionCompareContract("1", "2", "3", false, excludeFields);
-
+
assertTrue(0 != CompareToBuilder.reflectionCompare(tso1, new TestSubObject(1, 0), testTransients));
assertTrue(0 != CompareToBuilder.reflectionCompare(tso1, new TestSubObject(0, 1), testTransients));
// root class
assertXYZCompareOrder(to1, to2, to3, true, null);
- // subclass
- assertXYZCompareOrder(tso1, tso2, tso3, true, null);
+ // subclass
+ assertXYZCompareOrder(tso1, tso2, tso3, true, null);
}
/**
* See "Effective Java" under "Consider Implementing Comparable".
- *
- * @param x an object to compare
+ *
+ * @param x an object to compare
* @param y an object to compare
* @param z an object to compare
* @param testTransients Whether to include transients in the comparison
@@ -214,26 +214,26 @@ public class CompareToBuilderTest {
// signum
assertTrue(reflectionCompareSignum(x, y, testTransients, excludeFields) == -reflectionCompareSignum(y, x, testTransients, excludeFields));
-
+
// transitive
- if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) > 0
+ if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) > 0
&& CompareToBuilder.reflectionCompare(y, z, testTransients, null, excludeFields) > 0){
assertTrue(CompareToBuilder.reflectionCompare(x, z, testTransients, null, excludeFields) > 0);
}
-
+
// un-named
if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) == 0) {
assertTrue(reflectionCompareSignum(x, z, testTransients, excludeFields) == -reflectionCompareSignum(y, z, testTransients, excludeFields));
}
-
+
// strongly recommended but not strictly required
assertTrue(CompareToBuilder.reflectionCompare(x, y, testTransients) ==0 == EqualsBuilder.reflectionEquals(x, y, testTransients));
}
-
+
/**
* Returns the signum of the result of comparing x and y with
* <code>CompareToBuilder.reflectionCompare</code>
- *
+ *
* @param lhs The "left-hand-side" of the comparison.
* @param rhs The "right-hand-side" of the comparison.
* @param testTransients Whether to include transients in the comparison
@@ -243,7 +243,7 @@ public class CompareToBuilderTest {
private int reflectionCompareSignum(final Object lhs, final Object rhs, final boolean testTransients, final String[] excludeFields) {
return BigInteger.valueOf(CompareToBuilder.reflectionCompare(lhs, rhs, testTransients)).signum();
}
-
+
@Test
public void testAppendSuper() {
final TestObject o1 = new TestObject(4);
@@ -251,14 +251,14 @@ public class CompareToBuilderTest {
assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o1).toComparison() == 0);
assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().appendSuper(0).append(o2, o1).toComparison() > 0);
-
+
assertTrue(new CompareToBuilder().appendSuper(-1).append(o1, o1).toComparison() < 0);
assertTrue(new CompareToBuilder().appendSuper(-1).append(o1, o2).toComparison() < 0);
-
+
assertTrue(new CompareToBuilder().appendSuper(1).append(o1, o1).toComparison() > 0);
assertTrue(new CompareToBuilder().appendSuper(1).append(o1, o2).toComparison() > 0);
}
-
+
@Test
public void testObject() {
final TestObject o1 = new TestObject(4);
@@ -268,12 +268,12 @@ public class CompareToBuilderTest {
o2.setA(5);
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
-
+
assertTrue(new CompareToBuilder().append(o1, null).toComparison() > 0);
assertTrue(new CompareToBuilder().append((Object) null, null).toComparison() == 0);
assertTrue(new CompareToBuilder().append(null, o1).toComparison() < 0);
}
-
+
@Test
public void testObjectBuild() {
final TestObject o1 = new TestObject(4);
@@ -283,7 +283,7 @@ public class CompareToBuilderTest {
o2.setA(5);
assertTrue(new CompareToBuilder().append(o1, o2).build().intValue() < 0);
assertTrue(new CompareToBuilder().append(o2, o1).build().intValue() > 0);
-
+
assertTrue(new CompareToBuilder().append(o1, null).build().intValue() > 0);
assertEquals(Integer.valueOf(0), new CompareToBuilder().append((Object) null, null).build());
assertTrue(new CompareToBuilder().append(null, o1).build().intValue() < 0);
@@ -308,12 +308,12 @@ public class CompareToBuilderTest {
o2 = "FREDA";
assertTrue(new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1, String.CASE_INSENSITIVE_ORDER).toComparison() > 0);
-
+
assertTrue(new CompareToBuilder().append(o1, null, String.CASE_INSENSITIVE_ORDER).toComparison() > 0);
assertTrue(new CompareToBuilder().append(null, null, String.CASE_INSENSITIVE_ORDER).toComparison() == 0);
assertTrue(new CompareToBuilder().append(null, o1, String.CASE_INSENSITIVE_ORDER).toComparison() < 0);
}
-
+
@Test
public void testObjectComparatorNull() {
final String o1 = "Fred";
@@ -323,7 +323,7 @@ public class CompareToBuilderTest {
o2 = "Zebra";
assertTrue(new CompareToBuilder().append(o1, o2, null).toComparison() < 0);
assertTrue(new CompareToBuilder().append(o2, o1, null).toComparison() > 0);
-
+
assertTrue(new CompareToBuilder().append(o1, null, null).toComparison() > 0);
assertTrue(new CompareToBuilder().append(null, null, null).toComparison() == 0);
assertTrue(new CompareToBuilder().append(null, o1, null).toComparison() < 0);
@@ -458,12 +458,12 @@ public class CompareToBuilderTest {
obj3[0] = new TestObject(4);
obj3[1] = new TestObject(5);
obj3[2] = new TestObject(6);
-
+
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
-
+
obj1[1] = new TestObject(7);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() > 0);
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
@@ -485,7 +485,7 @@ public class CompareToBuilderTest {
obj3[0] = 5L;
obj3[1] = 6L;
obj3[2] = 7L;
-
+
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -703,7 +703,7 @@ public class CompareToBuilderTest {
}
array3[1][2] = 100;
array3[1][2] = 100;
-
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -727,7 +727,7 @@ public class CompareToBuilderTest {
}
array3[1][2] = 100;
array3[1][2] = 100;
-
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -751,7 +751,7 @@ public class CompareToBuilderTest {
}
array3[1][2] = 100;
array3[1][2] = 100;
-
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -775,7 +775,7 @@ public class CompareToBuilderTest {
}
array3[1][2] = 100;
array3[1][2] = 100;
-
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -799,7 +799,7 @@ public class CompareToBuilderTest {
}
array3[1][2] = 100;
array3[1][2] = 100;
-
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -808,7 +808,7 @@ public class CompareToBuilderTest {
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() > 0);
assertTrue(new CompareToBuilder().append(array2, array1).toComparison() < 0);
}
-
+
@Test
public void testMultiFloatArray() {
final float[][] array1 = new float[2][2];
@@ -823,7 +823,7 @@ public class CompareToBuilderTest {
}
array3[1][2] = 100;
array3[1][2] = 100;
-
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -847,7 +847,7 @@ public class CompareToBuilderTest {
}
array3[1][2] = 100;
array3[1][2] = 100;
-
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -871,7 +871,7 @@ public class CompareToBuilderTest {
}
array3[1][2] = false;
array3[1][2] = false;
-
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -898,8 +898,8 @@ public class CompareToBuilderTest {
}
array3[1][2] = 100;
array3[1][2] = 100;
-
-
+
+
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
@@ -947,11 +947,11 @@ public class CompareToBuilderTest {
array3[0] = new TestObject(4);
array3[1] = new TestObject(5);
array3[2] = new TestObject(6);
-
+
final Object obj1 = array1;
final Object obj2 = array2;
final Object obj3 = array3;
-
+
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
@@ -1161,5 +1161,5 @@ public class CompareToBuilderTest {
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() > 0);
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java
index b8fd1f1..6bc9223 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -33,7 +33,7 @@ public class DefaultToStringStyleTest {
private final Integer base = Integer.valueOf(5);
private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
-
+
@Before
public void setUp() throws Exception {
ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE);
@@ -45,7 +45,7 @@ public class DefaultToStringStyleTest {
}
//----------------------------------------------------------------
-
+
@Test
public void testBlank() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).toString());
@@ -55,12 +55,12 @@ public class DefaultToStringStyleTest {
public void testAppendSuper() {
assertEquals(baseStr + "[]", new ToStringBuilder(base).appendSuper("Integer@8888[]").toString());
assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").toString());
-
+
assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[]").append("a", "hello").toString());
assertEquals(baseStr + "[<null>,a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").append("a", "hello").toString());
assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
}
-
+
@Test
public void testObject() {
final Integer i3 = Integer.valueOf(3);
[18/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java
index d7efefd..9cf711e 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableIntTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
/**
* JUnit tests.
- *
+ *
* @see MutableInt
*/
public class MutableIntTest {
@@ -33,9 +33,9 @@ public class MutableIntTest {
@Test
public void testConstructors() {
assertEquals(0, new MutableInt().intValue());
-
+
assertEquals(1, new MutableInt(1).intValue());
-
+
assertEquals(2, new MutableInt(Integer.valueOf(2)).intValue());
assertEquals(3, new MutableInt(new MutableLong(3)).intValue());
@@ -53,15 +53,15 @@ public class MutableIntTest {
final MutableInt mutNum = new MutableInt(0);
assertEquals(0, new MutableInt().intValue());
assertEquals(Integer.valueOf(0), new MutableInt().getValue());
-
+
mutNum.setValue(1);
assertEquals(1, mutNum.intValue());
assertEquals(Integer.valueOf(1), mutNum.getValue());
-
+
mutNum.setValue(Integer.valueOf(2));
assertEquals(2, mutNum.intValue());
assertEquals(Integer.valueOf(2), mutNum.getValue());
-
+
mutNum.setValue(new MutableLong(3));
assertEquals(3, mutNum.intValue());
assertEquals(Integer.valueOf(3), mutNum.getValue());
@@ -128,7 +128,7 @@ public class MutableIntTest {
@Test
public void testPrimitiveValues() {
final MutableInt mutNum = new MutableInt(1);
-
+
assertEquals( (byte) 1, mutNum.byteValue() );
assertEquals( (short) 1, mutNum.shortValue() );
assertEquals( 1.0F, mutNum.floatValue(), 0 );
@@ -146,7 +146,7 @@ public class MutableIntTest {
public void testIncrement() {
final MutableInt mutNum = new MutableInt(1);
mutNum.increment();
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -175,7 +175,7 @@ public class MutableIntTest {
public void testDecrement() {
final MutableInt mutNum = new MutableInt(1);
mutNum.decrement();
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
@@ -204,7 +204,7 @@ public class MutableIntTest {
public void testAddValuePrimitive() {
final MutableInt mutNum = new MutableInt(1);
mutNum.add(1);
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -213,7 +213,7 @@ public class MutableIntTest {
public void testAddValueObject() {
final MutableInt mutNum = new MutableInt(1);
mutNum.add(Integer.valueOf(1));
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -258,7 +258,7 @@ public class MutableIntTest {
public void testSubtractValuePrimitive() {
final MutableInt mutNum = new MutableInt(1);
mutNum.subtract(1);
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
@@ -267,7 +267,7 @@ public class MutableIntTest {
public void testSubtractValueObject() {
final MutableInt mutNum = new MutableInt(1);
mutNum.subtract(Integer.valueOf(1));
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java
index c65c789..1ec522e 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableLongTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
/**
* JUnit tests.
- *
+ *
* @see MutableLong
*/
public class MutableLongTest {
@@ -33,9 +33,9 @@ public class MutableLongTest {
@Test
public void testConstructors() {
assertEquals(0, new MutableLong().longValue());
-
+
assertEquals(1, new MutableLong(1).longValue());
-
+
assertEquals(2, new MutableLong(Long.valueOf(2)).longValue());
assertEquals(3, new MutableLong(new MutableLong(3)).longValue());
@@ -53,15 +53,15 @@ public class MutableLongTest {
final MutableLong mutNum = new MutableLong(0);
assertEquals(0, new MutableLong().longValue());
assertEquals(Long.valueOf(0), new MutableLong().getValue());
-
+
mutNum.setValue(1);
assertEquals(1, mutNum.longValue());
assertEquals(Long.valueOf(1), mutNum.getValue());
-
+
mutNum.setValue(Long.valueOf(2));
assertEquals(2, mutNum.longValue());
assertEquals(Long.valueOf(2), mutNum.getValue());
-
+
mutNum.setValue(new MutableLong(3));
assertEquals(3, mutNum.longValue());
assertEquals(Long.valueOf(3), mutNum.getValue());
@@ -140,7 +140,7 @@ public class MutableLongTest {
public void testIncrement() {
final MutableLong mutNum = new MutableLong(1);
mutNum.increment();
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -169,7 +169,7 @@ public class MutableLongTest {
public void testDecrement() {
final MutableLong mutNum = new MutableLong(1);
mutNum.decrement();
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
@@ -198,7 +198,7 @@ public class MutableLongTest {
public void testAddValuePrimitive() {
final MutableLong mutNum = new MutableLong(1);
mutNum.add(1);
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -207,7 +207,7 @@ public class MutableLongTest {
public void testAddValueObject() {
final MutableLong mutNum = new MutableLong(1);
mutNum.add(Long.valueOf(1));
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -252,7 +252,7 @@ public class MutableLongTest {
public void testSubtractValuePrimitive() {
final MutableLong mutNum = new MutableLong(1);
mutNum.subtract(1);
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
@@ -261,7 +261,7 @@ public class MutableLongTest {
public void testSubtractValueObject() {
final MutableLong mutNum = new MutableLong(1);
mutNum.subtract(Long.valueOf(1));
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java
index 7e0047b..5050477 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -26,7 +26,7 @@ import org.junit.Test;
/**
* JUnit tests.
- *
+ *
* @see MutableShort
*/
public class MutableObjectTest {
@@ -35,7 +35,7 @@ public class MutableObjectTest {
@Test
public void testConstructors() {
assertEquals(null, new MutableObject<String>().getValue());
-
+
final Integer i = Integer.valueOf(6);
assertSame(i, new MutableObject<>(i).getValue());
assertSame("HI", new MutableObject<>("HI").getValue());
@@ -46,10 +46,10 @@ public class MutableObjectTest {
public void testGetSet() {
final MutableObject<String> mutNum = new MutableObject<>();
assertEquals(null, new MutableObject<>().getValue());
-
+
mutNum.setValue("HELLO");
assertSame("HELLO", mutNum.getValue());
-
+
mutNum.setValue(null);
assertSame(null, mutNum.getValue());
}
@@ -70,7 +70,7 @@ public class MutableObjectTest {
assertTrue(mutNumC.equals(mutNumC));
assertFalse(mutNumA.equals(mutNumD));
assertTrue(mutNumD.equals(mutNumD));
-
+
assertFalse(mutNumA.equals(null));
assertFalse(mutNumA.equals(new Object()));
assertFalse(mutNumA.equals("0"));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java
index 2b91b79..fe926ff 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableShortTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -25,7 +25,7 @@ import static org.junit.Assert.fail;
/**
* JUnit tests.
- *
+ *
* @see MutableShort
*/
public class MutableShortTest {
@@ -34,9 +34,9 @@ public class MutableShortTest {
@Test
public void testConstructors() {
assertEquals((short) 0, new MutableShort().shortValue());
-
+
assertEquals((short) 1, new MutableShort((short) 1).shortValue());
-
+
assertEquals((short) 2, new MutableShort(Short.valueOf((short) 2)).shortValue());
assertEquals((short) 3, new MutableShort(new MutableShort((short) 3)).shortValue());
@@ -53,15 +53,15 @@ public class MutableShortTest {
final MutableShort mutNum = new MutableShort((short) 0);
assertEquals((short) 0, new MutableShort().shortValue());
assertEquals(Short.valueOf((short) 0), new MutableShort().getValue());
-
+
mutNum.setValue((short) 1);
assertEquals((short) 1, mutNum.shortValue());
assertEquals(Short.valueOf((short) 1), mutNum.getValue());
-
+
mutNum.setValue(Short.valueOf((short) 2));
assertEquals((short) 2, mutNum.shortValue());
assertEquals(Short.valueOf((short) 2), mutNum.getValue());
-
+
mutNum.setValue(new MutableShort((short) 3));
assertEquals((short) 3, mutNum.shortValue());
assertEquals(Short.valueOf((short) 3), mutNum.getValue());
@@ -117,7 +117,7 @@ public class MutableShortTest {
@Test
public void testPrimitiveValues() {
final MutableShort mutNum = new MutableShort( (short) 1 );
-
+
assertEquals( 1.0F, mutNum.floatValue(), 0 );
assertEquals( 1.0, mutNum.doubleValue(), 0 );
assertEquals( (byte) 1, mutNum.byteValue() );
@@ -136,7 +136,7 @@ public class MutableShortTest {
public void testIncrement() {
final MutableShort mutNum = new MutableShort((short) 1);
mutNum.increment();
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -165,7 +165,7 @@ public class MutableShortTest {
public void testDecrement() {
final MutableShort mutNum = new MutableShort((short) 1);
mutNum.decrement();
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
@@ -194,7 +194,7 @@ public class MutableShortTest {
public void testAddValuePrimitive() {
final MutableShort mutNum = new MutableShort((short) 1);
mutNum.add((short) 1);
-
+
assertEquals((short) 2, mutNum.shortValue());
}
@@ -202,7 +202,7 @@ public class MutableShortTest {
public void testAddValueObject() {
final MutableShort mutNum = new MutableShort((short) 1);
mutNum.add(Short.valueOf((short) 1));
-
+
assertEquals((short) 2, mutNum.shortValue());
}
@@ -246,7 +246,7 @@ public class MutableShortTest {
public void testSubtractValuePrimitive() {
final MutableShort mutNum = new MutableShort((short) 1);
mutNum.subtract((short) 1);
-
+
assertEquals((short) 0, mutNum.shortValue());
}
@@ -254,7 +254,7 @@ public class MutableShortTest {
public void testSubtractValueObject() {
final MutableShort mutNum = new MutableShort((short) 1);
mutNum.subtract(Short.valueOf((short) 1));
-
+
assertEquals((short) 0, mutNum.shortValue());
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
----------------------------------------------------------------------
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 3b7ca3c..16a3f59 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
@@ -1332,7 +1332,7 @@ public class FieldUtilsTest {
assertFalse(Modifier.isFinal(field.getModifiers()));
assertFalse(field.isAccessible());
}
-
+
@Test
public void testRemoveFinalModifierWithAccess() throws Exception {
final Field field = StaticContainer.class.getDeclaredField("IMMUTABLE_PRIVATE_2");
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
index 16069e9..b3cef7a 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
@@ -685,14 +685,14 @@ public class TypeUtilsTest<B> {
stringComparableType));
Assert.assertEquals("java.lang.Comparable<java.lang.String>", stringComparableType.toString());
}
-
+
@Test
public void testParameterizeWithOwner() throws Exception {
final Type owner = TypeUtils.parameterize(TypeUtilsTest.class, String.class);
final ParameterizedType dat2Type = TypeUtils.parameterizeWithOwner(owner, That.class, String.class, String.class);
Assert.assertTrue(TypeUtils.equals(getClass().getField("dat2").getGenericType(), dat2Type));
}
-
+
@Test
public void testWildcardType() throws Exception {
final WildcardType simpleWildcard = TypeUtils.wildcardType().withUpperBounds(String.class).build();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/test/SystemDefaults.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/test/SystemDefaults.java b/src/test/java/org/apache/commons/lang3/test/SystemDefaults.java
index e5893a2..0bb0912 100644
--- a/src/test/java/org/apache/commons/lang3/test/SystemDefaults.java
+++ b/src/test/java/org/apache/commons/lang3/test/SystemDefaults.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
index 398341c..cc26fa4 100644
--- a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
+++ b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitch.java
@@ -5,9 +5,9 @@
* 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.
@@ -26,12 +26,12 @@ import org.junit.runners.model.Statement;
/**
* Test Rule used with {@link SystemDefaults} annotation that sets and restores the system default Locale and TimeZone.
- *
+ *
* <p>
* Set up tests to use alternate system default Locale and/or TimeZone by creating an instance of this rule
- * and annotating the test method with {@link SystemDefaults}
+ * and annotating the test method with {@link SystemDefaults}
* </p>
- *
+ *
* <pre>
* public class SystemDefaultsDependentTest {
*
@@ -48,7 +48,7 @@ import org.junit.runners.model.Statement;
* public void testWithSimplifiedChinaDefaultLocale() {
* // Locale.getDefault() will return Locale.CHINA until the end of this test method
* }
- *
+ *
* {@literal @}Test
* {@literal @}SystemDefaults(timezone="America/New_York")
* public void testWithNorthAmericaEasternTimeZone() {
@@ -58,7 +58,7 @@ import org.junit.runners.model.Statement;
* </pre>
*/
public class SystemDefaultsSwitch implements TestRule {
-
+
@Override
public Statement apply(final Statement stmt, final Description description) {
final SystemDefaults defaults = description.getAnnotation(SystemDefaults.class);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java
index d85d6ab..f2cd6f5 100644
--- a/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java
+++ b/src/test/java/org/apache/commons/lang3/test/SystemDefaultsSwitchTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java b/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java
index 78202ff..f3b6cf7 100644
--- a/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/CompositeFormatTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -34,7 +34,7 @@ import java.util.Locale;
public class CompositeFormatTest {
/**
- * Ensures that the parse/format separation is correctly maintained.
+ * Ensures that the parse/format separation is correctly maintained.
*/
@Test
public void testCompositeFormat() {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
index f8916f6..41468a9 100644
--- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -93,12 +93,12 @@ public class ExtendedMessageFormatTest {
*/
@Test
public void testEscapedBraces_LANG_948() {
- // message without placeholder because braces are escaped by quotes
+ // message without placeholder because braces are escaped by quotes
final String pattern = "Message without placeholders '{}'";
final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, registry);
assertEquals("Message without placeholders {}", emf.format(new Object[] {"DUMMY"}));
- // message with placeholder because quotes are escaped by quotes
+ // message with placeholder because quotes are escaped by quotes
final String pattern2 = "Message with placeholder ''{0}''";
final ExtendedMessageFormat emf2 = new ExtendedMessageFormat(pattern2, registry);
assertEquals("Message with placeholder 'DUMMY'", emf2.format(new Object[] {"DUMMY"}));
@@ -313,7 +313,7 @@ public class ExtendedMessageFormatTest {
other = new OtherExtendedMessageFormat(pattern, Locale.US, fmtRegistry);
assertFalse("class, equals()", emf.equals(other));
assertTrue("class, hashcode()", emf.hashCode() == other.hashCode()); // same hashcode
-
+
// Different pattern
other = new ExtendedMessageFormat("X" + pattern, Locale.US, fmtRegistry);
assertFalse("pattern, equals()", emf.equals(other));
@@ -471,7 +471,7 @@ public class ExtendedMessageFormatTest {
final Map<String, ? extends FormatFactory> registry) {
super(pattern, locale, registry);
}
-
+
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java b/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
index dbb38e2..ed86721 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -51,7 +51,7 @@ public class StrBuilderAppendInsertTest {
StrBuilder sb = new StrBuilder("---");
sb.appendNewLine().append("+++");
assertEquals("---" + SEP + "+++", sb.toString());
-
+
sb = new StrBuilder("---");
sb.setNewLineText("#").appendNewLine().setNewLineText(null).appendNewLine();
assertEquals("---#" + SEP, sb.toString());
@@ -117,7 +117,7 @@ public class StrBuilderAppendInsertTest {
sb.append(new StringBuilder("bld")); // Check it supports StringBuilder
assertEquals("foobazyesSeqbld", sb.toString());
}
-
+
//-----------------------------------------------------------------------
@Test
public void testAppend_StringBuilder() {
@@ -216,7 +216,7 @@ public class StrBuilderAppendInsertTest {
sb.append( (CharSequence)"abcbardef", 4, 3);
assertEquals("foobarard", sb.toString());
}
-
+
//-----------------------------------------------------------------------
@Test
public void testAppend_StringBuilder_int_int() {
@@ -826,7 +826,7 @@ public class StrBuilderAppendInsertTest {
final StrBuilder sb = new StrBuilder();
sb.appendln(true);
assertEquals("true" + SEP, sb.toString());
-
+
sb.clear();
sb.appendln(false);
assertEquals("false" + SEP, sb.toString());
@@ -838,15 +838,15 @@ public class StrBuilderAppendInsertTest {
final StrBuilder sb = new StrBuilder();
sb.appendln(0);
assertEquals("0" + SEP, sb.toString());
-
+
sb.clear();
sb.appendln(1L);
assertEquals("1" + SEP, sb.toString());
-
+
sb.clear();
sb.appendln(2.3f);
assertEquals("2.3" + SEP, sb.toString());
-
+
sb.clear();
sb.appendln(4.5d);
assertEquals("4.5" + SEP, sb.toString());
@@ -1201,7 +1201,7 @@ public class StrBuilderAppendInsertTest {
sb.appendSeparator(",");
assertEquals("foo,", sb.toString());
}
-
+
//-----------------------------------------------------------------------
@Test
public void testAppendSeparator_String_String() {
@@ -1213,11 +1213,11 @@ public class StrBuilderAppendInsertTest {
assertEquals("", sb.toString());
sb.appendSeparator(standardSeparator, null);
assertEquals("", sb.toString());
- sb.appendSeparator(standardSeparator, startSeparator);
+ sb.appendSeparator(standardSeparator, startSeparator);
assertEquals(startSeparator, sb.toString());
- sb.appendSeparator(null, null);
+ sb.appendSeparator(null, null);
assertEquals(startSeparator, sb.toString());
- sb.appendSeparator(null, startSeparator);
+ sb.appendSeparator(null, startSeparator);
assertEquals(startSeparator, sb.toString());
sb.append(foo);
assertEquals(startSeparator + foo, sb.toString());
@@ -1260,7 +1260,7 @@ public class StrBuilderAppendInsertTest {
assertEquals("foo", sb.toString());
sb.appendSeparator(",", 1);
assertEquals("foo,", sb.toString());
-
+
sb.appendSeparator(",", -1); // no effect
assertEquals("foo,", sb.toString());
}
@@ -1275,7 +1275,7 @@ public class StrBuilderAppendInsertTest {
assertEquals("foo", sb.toString());
sb.appendSeparator(',', 1);
assertEquals("foo,", sb.toString());
-
+
sb.appendSeparator(',', -1); // no effect
assertEquals("foo,", sb.toString());
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java b/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
index 09af460..ea684b6 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -305,7 +305,7 @@ public class StrBuilderTest {
public void testLength() {
final StrBuilder sb = new StrBuilder();
assertEquals(0, sb.length());
-
+
sb.append("Hello");
assertEquals(5, sb.length());
}
@@ -334,7 +334,7 @@ public class StrBuilderTest {
public void testCapacity() {
final StrBuilder sb = new StrBuilder();
assertEquals(sb.buffer.length, sb.capacity());
-
+
sb.append("HelloWorldHelloWorldHelloWorldHelloWorld");
assertEquals(sb.buffer.length, sb.capacity());
}
@@ -344,10 +344,10 @@ public class StrBuilderTest {
final StrBuilder sb = new StrBuilder();
sb.ensureCapacity(2);
assertTrue(sb.capacity() >= 2);
-
+
sb.ensureCapacity(-1);
assertTrue(sb.capacity() >= 0);
-
+
sb.append("HelloWorld");
sb.ensureCapacity(40);
assertTrue(sb.capacity() >= 40);
@@ -358,7 +358,7 @@ public class StrBuilderTest {
final StrBuilder sb = new StrBuilder();
sb.minimizeCapacity();
assertEquals(0, sb.capacity());
-
+
sb.append("HelloWorld");
sb.minimizeCapacity();
assertEquals(10, sb.capacity());
@@ -369,7 +369,7 @@ public class StrBuilderTest {
public void testSize() {
final StrBuilder sb = new StrBuilder();
assertEquals(0, sb.size());
-
+
sb.append("Hello");
assertEquals(5, sb.size());
}
@@ -378,10 +378,10 @@ public class StrBuilderTest {
public void testIsEmpty() {
final StrBuilder sb = new StrBuilder();
assertTrue(sb.isEmpty());
-
+
sb.append("Hello");
assertFalse(sb.isEmpty());
-
+
sb.clear();
assertTrue(sb.isEmpty());
}
@@ -463,8 +463,8 @@ public class StrBuilderTest {
public void testDeleteCharAt() {
final StrBuilder sb = new StrBuilder("abc");
sb.deleteCharAt(0);
- assertEquals("bc", sb.toString());
-
+ assertEquals("bc", sb.toString());
+
try {
sb.deleteCharAt(1000);
fail("Expected IndexOutOfBoundsException");
@@ -524,26 +524,26 @@ public class StrBuilderTest {
@Test
public void testGetChars ( ) {
final StrBuilder sb = new StrBuilder();
-
+
char[] input = new char[10];
char[] a = sb.getChars(input);
assertSame (input, a);
assertTrue(Arrays.equals(new char[10], a));
-
+
sb.append("junit");
a = sb.getChars(input);
assertSame(input, a);
assertTrue(Arrays.equals(new char[] {'j','u','n','i','t',0,0,0,0,0},a));
-
+
a = sb.getChars(null);
assertNotSame(input,a);
assertEquals(5,a.length);
assertTrue(Arrays.equals("junit".toCharArray(),a));
-
+
input = new char[5];
a = sb.getChars(input);
assertSame(input, a);
-
+
input = new char[4];
a = sb.getChars(input);
assertNotSame(input, a);
@@ -552,37 +552,37 @@ public class StrBuilderTest {
@Test
public void testGetCharsIntIntCharArrayInt( ) {
final StrBuilder sb = new StrBuilder();
-
+
sb.append("junit");
char[] a = new char[5];
sb.getChars(0,5,a,0);
assertTrue(Arrays.equals(new char[] {'j','u','n','i','t'},a));
-
+
a = new char[5];
sb.getChars(0,2,a,3);
assertTrue(Arrays.equals(new char[] {0,0,0,'j','u'},a));
-
+
try {
sb.getChars(-1,0,a,0);
fail("no exception");
}
catch (final IndexOutOfBoundsException e) {
}
-
+
try {
sb.getChars(0,-1,a,0);
fail("no exception");
}
catch (final IndexOutOfBoundsException e) {
}
-
+
try {
sb.getChars(0,20,a,0);
fail("no exception");
}
catch (final IndexOutOfBoundsException e) {
}
-
+
try {
sb.getChars(4,2,a,0);
fail("no exception");
@@ -596,14 +596,14 @@ public class StrBuilderTest {
public void testDeleteIntInt() {
StrBuilder sb = new StrBuilder("abc");
sb.delete(0, 1);
- assertEquals("bc", sb.toString());
+ assertEquals("bc", sb.toString());
sb.delete(1, 2);
assertEquals("b", sb.toString());
sb.delete(0, 1);
- assertEquals("", sb.toString());
+ assertEquals("", sb.toString());
sb.delete(0, 1000);
- assertEquals("", sb.toString());
-
+ assertEquals("", sb.toString());
+
try {
sb.delete(1, 2);
fail("Expected IndexOutOfBoundsException");
@@ -612,7 +612,7 @@ public class StrBuilderTest {
sb.delete(-1, 1);
fail("Expected IndexOutOfBoundsException");
} catch (final IndexOutOfBoundsException e) {}
-
+
sb = new StrBuilder("anything");
try {
sb.delete(2, 1);
@@ -663,7 +663,7 @@ public class StrBuilderTest {
assertEquals("abcbccba", sb.toString());
sb.deleteAll("");
assertEquals("abcbccba", sb.toString());
-
+
sb.deleteAll("X");
assertEquals("abcbccba", sb.toString());
sb.deleteAll("a");
@@ -759,7 +759,7 @@ public class StrBuilderTest {
assertEquals("btext", sb.toString());
sb.replace(0, 1000, "text");
assertEquals("text", sb.toString());
-
+
sb = new StrBuilder("atext");
sb.replace(1, 1, "ny");
assertEquals("anytext", sb.toString());
@@ -767,7 +767,7 @@ public class StrBuilderTest {
sb.replace(2, 1, "anything");
fail("Expected IndexOutOfBoundsException");
} catch (final IndexOutOfBoundsException e) {}
-
+
sb = new StrBuilder();
try {
sb.replace(1, 2, "anything");
@@ -823,7 +823,7 @@ public class StrBuilderTest {
assertEquals("abcbccba", sb.toString());
sb.replaceAll("", "anything");
assertEquals("abcbccba", sb.toString());
-
+
sb.replaceAll("x", "y");
assertEquals("abcbccba", sb.toString());
sb.replaceAll("a", "d");
@@ -832,11 +832,11 @@ public class StrBuilderTest {
assertEquals("bcbccb", sb.toString());
sb.replaceAll("cb", "-");
assertEquals("b-c-", sb.toString());
-
+
sb = new StrBuilder("abcba");
sb.replaceAll("b", "xbx");
assertEquals("axbxcxbxa", sb.toString());
-
+
sb = new StrBuilder("bb");
sb.replaceAll("b", "xbx");
assertEquals("xbxxbx", sb.toString());
@@ -853,7 +853,7 @@ public class StrBuilderTest {
assertEquals("abcbccba", sb.toString());
sb.replaceFirst("", "anything");
assertEquals("abcbccba", sb.toString());
-
+
sb.replaceFirst("x", "y");
assertEquals("abcbccba", sb.toString());
sb.replaceFirst("a", "d");
@@ -862,11 +862,11 @@ public class StrBuilderTest {
assertEquals("bcbccba", sb.toString());
sb.replaceFirst("cb", "-");
assertEquals("b-ccba", sb.toString());
-
+
sb = new StrBuilder("abcba");
sb.replaceFirst("b", "xbx");
assertEquals("axbxcba", sb.toString());
-
+
sb = new StrBuilder("bb");
sb.replaceFirst("b", "xbx");
assertEquals("xbxb", sb.toString());
@@ -884,7 +884,7 @@ public class StrBuilderTest {
assertEquals("abcbccba", sb.toString());
sb.replaceAll(StrMatcher.noneMatcher(), "anything");
assertEquals("abcbccba", sb.toString());
-
+
sb.replaceAll(StrMatcher.charMatcher('x'), "y");
assertEquals("abcbccba", sb.toString());
sb.replaceAll(StrMatcher.charMatcher('a'), "d");
@@ -893,15 +893,15 @@ public class StrBuilderTest {
assertEquals("bcbccb", sb.toString());
sb.replaceAll(StrMatcher.stringMatcher("cb"), "-");
assertEquals("b-c-", sb.toString());
-
+
sb = new StrBuilder("abcba");
sb.replaceAll(StrMatcher.charMatcher('b'), "xbx");
assertEquals("axbxcxbxa", sb.toString());
-
+
sb = new StrBuilder("bb");
sb.replaceAll(StrMatcher.charMatcher('b'), "xbx");
assertEquals("xbxxbx", sb.toString());
-
+
sb = new StrBuilder("A1-A2A3-A4");
sb.replaceAll(A_NUMBER_MATCHER, "***");
assertEquals("***-******-***", sb.toString());
@@ -922,7 +922,7 @@ public class StrBuilderTest {
assertEquals("abcbccba", sb.toString());
sb.replaceFirst(StrMatcher.noneMatcher(), "anything");
assertEquals("abcbccba", sb.toString());
-
+
sb.replaceFirst(StrMatcher.charMatcher('x'), "y");
assertEquals("abcbccba", sb.toString());
sb.replaceFirst(StrMatcher.charMatcher('a'), "d");
@@ -931,15 +931,15 @@ public class StrBuilderTest {
assertEquals("bcbccba", sb.toString());
sb.replaceFirst(StrMatcher.stringMatcher("cb"), "-");
assertEquals("b-ccba", sb.toString());
-
+
sb = new StrBuilder("abcba");
sb.replaceFirst(StrMatcher.charMatcher('b'), "xbx");
assertEquals("axbxcba", sb.toString());
-
+
sb = new StrBuilder("bb");
sb.replaceFirst(StrMatcher.charMatcher('b'), "xbx");
assertEquals("xbxb", sb.toString());
-
+
sb = new StrBuilder("A1-A2A3-A4");
sb.replaceFirst(A_NUMBER_MATCHER, "***");
assertEquals("***-A2A3-A4", sb.toString());
@@ -951,17 +951,17 @@ public class StrBuilderTest {
StrBuilder sb = new StrBuilder("abcbccba");
sb.replace(null, "x", 0, sb.length(), -1);
assertEquals("abcbccba", sb.toString());
-
+
sb.replace(StrMatcher.charMatcher('a'), "x", 0, sb.length(), -1);
assertEquals("xbcbccbx", sb.toString());
-
+
sb.replace(StrMatcher.stringMatcher("cb"), "x", 0, sb.length(), -1);
assertEquals("xbxcxx", sb.toString());
-
+
sb = new StrBuilder("A1-A2A3-A4");
sb.replace(A_NUMBER_MATCHER, "***", 0, sb.length(), -1);
assertEquals("***-******-***", sb.toString());
-
+
sb = new StrBuilder();
sb.replace(A_NUMBER_MATCHER, "***", 0, sb.length(), -1);
assertEquals("", sb.toString());
@@ -972,19 +972,19 @@ public class StrBuilderTest {
StrBuilder sb = new StrBuilder("abcbccba");
sb.replace(StrMatcher.stringMatcher("cb"), "cb", 0, sb.length(), -1);
assertEquals("abcbccba", sb.toString());
-
+
sb = new StrBuilder("abcbccba");
sb.replace(StrMatcher.stringMatcher("cb"), "-", 0, sb.length(), -1);
assertEquals("ab-c-a", sb.toString());
-
+
sb = new StrBuilder("abcbccba");
sb.replace(StrMatcher.stringMatcher("cb"), "+++", 0, sb.length(), -1);
assertEquals("ab+++c+++a", sb.toString());
-
+
sb = new StrBuilder("abcbccba");
sb.replace(StrMatcher.stringMatcher("cb"), "", 0, sb.length(), -1);
assertEquals("abca", sb.toString());
-
+
sb = new StrBuilder("abcbccba");
sb.replace(StrMatcher.stringMatcher("cb"), null, 0, sb.length(), -1);
assertEquals("abca", sb.toString());
@@ -995,54 +995,54 @@ public class StrBuilderTest {
StrBuilder sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, sb.length(), -1);
assertEquals("-x--y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 1, sb.length(), -1);
assertEquals("aax--y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 2, sb.length(), -1);
assertEquals("aax--y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 3, sb.length(), -1);
assertEquals("aax--y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 4, sb.length(), -1);
assertEquals("aaxa-ay-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 5, sb.length(), -1);
assertEquals("aaxaa-y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 6, sb.length(), -1);
assertEquals("aaxaaaay-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 7, sb.length(), -1);
assertEquals("aaxaaaay-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 8, sb.length(), -1);
assertEquals("aaxaaaay-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 9, sb.length(), -1);
assertEquals("aaxaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 10, sb.length(), -1);
assertEquals("aaxaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
try {
sb.replace(StrMatcher.stringMatcher("aa"), "-", 11, sb.length(), -1);
fail();
} catch (final IndexOutOfBoundsException ex) {}
assertEquals("aaxaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
try {
sb.replace(StrMatcher.stringMatcher("aa"), "-", -1, sb.length(), -1);
@@ -1056,47 +1056,47 @@ public class StrBuilderTest {
StrBuilder sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 0, -1);
assertEquals("aaxaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 2, -1);
assertEquals("-xaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 3, -1);
assertEquals("-xaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 4, -1);
assertEquals("-xaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 5, -1);
assertEquals("-x-aayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 6, -1);
assertEquals("-x-aayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 7, -1);
assertEquals("-x--yaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 8, -1);
assertEquals("-x--yaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 9, -1);
assertEquals("-x--yaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 10, -1);
assertEquals("-x--y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 1000, -1);
assertEquals("-x--y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
try {
sb.replace(StrMatcher.stringMatcher("aa"), "-", 2, 1, -1);
@@ -1110,27 +1110,27 @@ public class StrBuilderTest {
StrBuilder sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 10, -1);
assertEquals("-x--y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 10, 0);
assertEquals("aaxaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 10, 1);
assertEquals("-xaaaayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 10, 2);
assertEquals("-x-aayaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 10, 3);
assertEquals("-x--yaa", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 10, 4);
assertEquals("-x--y-", sb.toString());
-
+
sb = new StrBuilder("aaxaaaayaa");
sb.replace(StrMatcher.stringMatcher("aa"), "-", 0, 10, 5);
assertEquals("-x--y-", sb.toString());
@@ -1141,7 +1141,7 @@ public class StrBuilderTest {
public void testReverse() {
final StrBuilder sb = new StrBuilder();
assertEquals("", sb.reverse().toString());
-
+
sb.clear().append(true);
assertEquals("eurt", sb.reverse().toString());
assertEquals("true", sb.reverse().toString());
@@ -1152,19 +1152,19 @@ public class StrBuilderTest {
public void testTrim() {
final StrBuilder sb = new StrBuilder();
assertEquals("", sb.reverse().toString());
-
+
sb.clear().append(" \u0000 ");
assertEquals("", sb.trim().toString());
-
+
sb.clear().append(" \u0000 a b c");
assertEquals("a b c", sb.trim().toString());
-
+
sb.clear().append("a b c \u0000 ");
assertEquals("a b c", sb.trim().toString());
-
+
sb.clear().append(" \u0000 a b c \u0000 ");
assertEquals("a b c", sb.trim().toString());
-
+
sb.clear().append("a b c");
assertEquals("a b c", sb.trim().toString());
}
@@ -1209,25 +1209,25 @@ public class StrBuilderTest {
sb.subSequence(-1, 5);
fail();
} catch (final IndexOutOfBoundsException e) {}
-
+
// End index is negative
try {
sb.subSequence(2, -1);
fail();
} catch (final IndexOutOfBoundsException e) {}
-
+
// End index greater than length()
try {
sb.subSequence(2, sb.length() + 1);
fail();
} catch (final IndexOutOfBoundsException e) {}
-
+
// Start index greater then end index
try {
sb.subSequence(3, 2);
fail();
} catch (final IndexOutOfBoundsException e) {}
-
+
// Normal cases
assertEquals ("hello", sb.subSequence(0, 5));
assertEquals ("hello goodbye".subSequence(0, 6), sb.subSequence(0, 6));
@@ -1246,30 +1246,30 @@ public class StrBuilderTest {
sb.substring(-1);
fail ();
} catch (final IndexOutOfBoundsException e) {}
-
+
try {
sb.substring(15);
fail ();
} catch (final IndexOutOfBoundsException e) {}
-
+
}
-
+
@Test
public void testSubstringIntInt() {
final StrBuilder sb = new StrBuilder ("hello goodbye");
assertEquals ("hello", sb.substring(0, 5));
assertEquals ("hello goodbye".substring(0, 6), sb.substring(0, 6));
-
+
assertEquals ("goodbye", sb.substring(6, 13));
assertEquals ("hello goodbye".substring(6,13), sb.substring(6, 13));
-
+
assertEquals ("goodbye", sb.substring(6, 20));
-
+
try {
sb.substring(-1, 5);
fail();
} catch (final IndexOutOfBoundsException e) {}
-
+
try {
sb.substring(15, 20);
fail();
@@ -1346,7 +1346,7 @@ public class StrBuilderTest {
public void testIndexOf_char() {
final StrBuilder sb = new StrBuilder("abab");
assertEquals(0, sb.indexOf('a'));
-
+
// should work like String#indexOf
assertEquals("abab".indexOf('a'), sb.indexOf('a'));
@@ -1381,14 +1381,14 @@ public class StrBuilderTest {
@Test
public void testLastIndexOf_char() {
final StrBuilder sb = new StrBuilder("abab");
-
+
assertEquals (2, sb.lastIndexOf('a'));
//should work like String#lastIndexOf
assertEquals ("abab".lastIndexOf('a'), sb.lastIndexOf('a'));
-
+
assertEquals(3, sb.lastIndexOf('b'));
assertEquals ("abab".lastIndexOf('b'), sb.lastIndexOf('b'));
-
+
assertEquals (-1, sb.lastIndexOf('z'));
}
@@ -1416,23 +1416,23 @@ public class StrBuilderTest {
@Test
public void testIndexOf_String() {
final StrBuilder sb = new StrBuilder("abab");
-
+
assertEquals(0, sb.indexOf("a"));
//should work like String#indexOf
assertEquals("abab".indexOf("a"), sb.indexOf("a"));
-
+
assertEquals(0, sb.indexOf("ab"));
//should work like String#indexOf
assertEquals("abab".indexOf("ab"), sb.indexOf("ab"));
-
+
assertEquals(1, sb.indexOf("b"));
assertEquals("abab".indexOf("b"), sb.indexOf("b"));
-
+
assertEquals(1, sb.indexOf("ba"));
assertEquals("abab".indexOf("ba"), sb.indexOf("ba"));
-
+
assertEquals(-1, sb.indexOf("z"));
-
+
assertEquals(-1, sb.indexOf((String) null));
}
@@ -1446,53 +1446,53 @@ public class StrBuilderTest {
assertEquals(-1, sb.indexOf("a", 3));
assertEquals(-1, sb.indexOf("a", 4));
assertEquals(-1, sb.indexOf("a", 5));
-
+
assertEquals(-1, sb.indexOf("abcdef", 0));
assertEquals(0, sb.indexOf("", 0));
assertEquals(1, sb.indexOf("", 1));
-
+
//should work like String#indexOf
assertEquals ("abab".indexOf("a", 1), sb.indexOf("a", 1));
-
+
assertEquals(2, sb.indexOf("ab", 1));
//should work like String#indexOf
assertEquals("abab".indexOf("ab", 1), sb.indexOf("ab", 1));
-
+
assertEquals(3, sb.indexOf("b", 2));
assertEquals("abab".indexOf("b", 2), sb.indexOf("b", 2));
-
+
assertEquals(1, sb.indexOf("ba", 1));
assertEquals("abab".indexOf("ba", 2), sb.indexOf("ba", 2));
-
+
assertEquals(-1, sb.indexOf("z", 2));
-
+
sb = new StrBuilder("xyzabc");
assertEquals(2, sb.indexOf("za", 0));
assertEquals(-1, sb.indexOf("za", 3));
-
+
assertEquals(-1, sb.indexOf((String) null, 2));
}
@Test
public void testLastIndexOf_String() {
final StrBuilder sb = new StrBuilder("abab");
-
+
assertEquals(2, sb.lastIndexOf("a"));
//should work like String#lastIndexOf
assertEquals("abab".lastIndexOf("a"), sb.lastIndexOf("a"));
-
+
assertEquals(2, sb.lastIndexOf("ab"));
//should work like String#lastIndexOf
assertEquals("abab".lastIndexOf("ab"), sb.lastIndexOf("ab"));
-
+
assertEquals(3, sb.lastIndexOf("b"));
assertEquals("abab".lastIndexOf("b"), sb.lastIndexOf("b"));
-
+
assertEquals(1, sb.lastIndexOf("ba"));
assertEquals("abab".lastIndexOf("ba"), sb.lastIndexOf("ba"));
-
+
assertEquals(-1, sb.lastIndexOf("z"));
-
+
assertEquals(-1, sb.lastIndexOf((String) null));
}
@@ -1506,30 +1506,30 @@ public class StrBuilderTest {
assertEquals(2, sb.lastIndexOf("a", 3));
assertEquals(2, sb.lastIndexOf("a", 4));
assertEquals(2, sb.lastIndexOf("a", 5));
-
+
assertEquals(-1, sb.lastIndexOf("abcdef", 3));
assertEquals("abab".lastIndexOf("", 3), sb.lastIndexOf("", 3));
assertEquals("abab".lastIndexOf("", 1), sb.lastIndexOf("", 1));
-
+
//should work like String#lastIndexOf
assertEquals("abab".lastIndexOf("a", 1), sb.lastIndexOf("a", 1));
-
+
assertEquals(0, sb.lastIndexOf("ab", 1));
//should work like String#lastIndexOf
assertEquals("abab".lastIndexOf("ab", 1), sb.lastIndexOf("ab", 1));
-
+
assertEquals(1, sb.lastIndexOf("b", 2));
assertEquals("abab".lastIndexOf("b", 2), sb.lastIndexOf("b", 2));
-
+
assertEquals(1, sb.lastIndexOf("ba", 2));
assertEquals("abab".lastIndexOf("ba", 2), sb.lastIndexOf("ba", 2));
-
+
assertEquals(-1, sb.lastIndexOf("z", 2));
-
+
sb = new StrBuilder("xyzabc");
assertEquals(2, sb.lastIndexOf("za", sb.length()));
assertEquals(-1, sb.lastIndexOf("za", 1));
-
+
assertEquals(-1, sb.lastIndexOf((String) null, 2));
}
@@ -1539,7 +1539,7 @@ public class StrBuilderTest {
final StrBuilder sb = new StrBuilder();
assertEquals(-1, sb.indexOf((StrMatcher) null));
assertEquals(-1, sb.indexOf(StrMatcher.charMatcher('a')));
-
+
sb.append("ab bd");
assertEquals(0, sb.indexOf(StrMatcher.charMatcher('a')));
assertEquals(1, sb.indexOf(StrMatcher.charMatcher('b')));
@@ -1547,7 +1547,7 @@ public class StrBuilderTest {
assertEquals(4, sb.indexOf(StrMatcher.charMatcher('d')));
assertEquals(-1, sb.indexOf(StrMatcher.noneMatcher()));
assertEquals(-1, sb.indexOf((StrMatcher) null));
-
+
sb.append(" A1 junction");
assertEquals(6, sb.indexOf(A_NUMBER_MATCHER));
}
@@ -1558,13 +1558,13 @@ public class StrBuilderTest {
assertEquals(-1, sb.indexOf((StrMatcher) null, 2));
assertEquals(-1, sb.indexOf(StrMatcher.charMatcher('a'), 2));
assertEquals(-1, sb.indexOf(StrMatcher.charMatcher('a'), 0));
-
+
sb.append("ab bd");
assertEquals(0, sb.indexOf(StrMatcher.charMatcher('a'), -2));
assertEquals(0, sb.indexOf(StrMatcher.charMatcher('a'), 0));
assertEquals(-1, sb.indexOf(StrMatcher.charMatcher('a'), 2));
assertEquals(-1, sb.indexOf(StrMatcher.charMatcher('a'), 20));
-
+
assertEquals(1, sb.indexOf(StrMatcher.charMatcher('b'), -1));
assertEquals(1, sb.indexOf(StrMatcher.charMatcher('b'), 0));
assertEquals(1, sb.indexOf(StrMatcher.charMatcher('b'), 1));
@@ -1573,16 +1573,16 @@ public class StrBuilderTest {
assertEquals(-1, sb.indexOf(StrMatcher.charMatcher('b'), 4));
assertEquals(-1, sb.indexOf(StrMatcher.charMatcher('b'), 5));
assertEquals(-1, sb.indexOf(StrMatcher.charMatcher('b'), 6));
-
+
assertEquals(2, sb.indexOf(StrMatcher.spaceMatcher(), -2));
assertEquals(2, sb.indexOf(StrMatcher.spaceMatcher(), 0));
assertEquals(2, sb.indexOf(StrMatcher.spaceMatcher(), 2));
assertEquals(-1, sb.indexOf(StrMatcher.spaceMatcher(), 4));
assertEquals(-1, sb.indexOf(StrMatcher.spaceMatcher(), 20));
-
+
assertEquals(-1, sb.indexOf(StrMatcher.noneMatcher(), 0));
assertEquals(-1, sb.indexOf((StrMatcher) null, 0));
-
+
sb.append(" A1 junction with A2");
assertEquals(6, sb.indexOf(A_NUMBER_MATCHER, 5));
assertEquals(6, sb.indexOf(A_NUMBER_MATCHER, 6));
@@ -1597,7 +1597,7 @@ public class StrBuilderTest {
final StrBuilder sb = new StrBuilder();
assertEquals(-1, sb.lastIndexOf((StrMatcher) null));
assertEquals(-1, sb.lastIndexOf(StrMatcher.charMatcher('a')));
-
+
sb.append("ab bd");
assertEquals(0, sb.lastIndexOf(StrMatcher.charMatcher('a')));
assertEquals(3, sb.lastIndexOf(StrMatcher.charMatcher('b')));
@@ -1605,7 +1605,7 @@ public class StrBuilderTest {
assertEquals(4, sb.lastIndexOf(StrMatcher.charMatcher('d')));
assertEquals(-1, sb.lastIndexOf(StrMatcher.noneMatcher()));
assertEquals(-1, sb.lastIndexOf((StrMatcher) null));
-
+
sb.append(" A1 junction");
assertEquals(6, sb.lastIndexOf(A_NUMBER_MATCHER));
}
@@ -1617,13 +1617,13 @@ public class StrBuilderTest {
assertEquals(-1, sb.lastIndexOf(StrMatcher.charMatcher('a'), 2));
assertEquals(-1, sb.lastIndexOf(StrMatcher.charMatcher('a'), 0));
assertEquals(-1, sb.lastIndexOf(StrMatcher.charMatcher('a'), -1));
-
+
sb.append("ab bd");
assertEquals(-1, sb.lastIndexOf(StrMatcher.charMatcher('a'), -2));
assertEquals(0, sb.lastIndexOf(StrMatcher.charMatcher('a'), 0));
assertEquals(0, sb.lastIndexOf(StrMatcher.charMatcher('a'), 2));
assertEquals(0, sb.lastIndexOf(StrMatcher.charMatcher('a'), 20));
-
+
assertEquals(-1, sb.lastIndexOf(StrMatcher.charMatcher('b'), -1));
assertEquals(-1, sb.lastIndexOf(StrMatcher.charMatcher('b'), 0));
assertEquals(1, sb.lastIndexOf(StrMatcher.charMatcher('b'), 1));
@@ -1632,16 +1632,16 @@ public class StrBuilderTest {
assertEquals(3, sb.lastIndexOf(StrMatcher.charMatcher('b'), 4));
assertEquals(3, sb.lastIndexOf(StrMatcher.charMatcher('b'), 5));
assertEquals(3, sb.lastIndexOf(StrMatcher.charMatcher('b'), 6));
-
+
assertEquals(-1, sb.lastIndexOf(StrMatcher.spaceMatcher(), -2));
assertEquals(-1, sb.lastIndexOf(StrMatcher.spaceMatcher(), 0));
assertEquals(2, sb.lastIndexOf(StrMatcher.spaceMatcher(), 2));
assertEquals(2, sb.lastIndexOf(StrMatcher.spaceMatcher(), 4));
assertEquals(2, sb.lastIndexOf(StrMatcher.spaceMatcher(), 20));
-
+
assertEquals(-1, sb.lastIndexOf(StrMatcher.noneMatcher(), 0));
assertEquals(-1, sb.lastIndexOf((StrMatcher) null, 0));
-
+
sb.append(" A1 junction with A2");
assertEquals(-1, sb.lastIndexOf(A_NUMBER_MATCHER, 5));
assertEquals(-1, sb.lastIndexOf(A_NUMBER_MATCHER, 6)); // A matches, 1 is outside bounds
@@ -1671,13 +1671,13 @@ public class StrBuilderTest {
final StrBuilder b = new StrBuilder();
b.append("a b ");
final StrTokenizer t = b.asTokenizer();
-
+
final String[] tokens1 = t.getTokenArray();
assertEquals(2, tokens1.length);
assertEquals("a", tokens1[0]);
assertEquals("b", tokens1[1]);
assertEquals(2, t.size());
-
+
b.append("c d ");
final String[] tokens2 = t.getTokenArray();
assertEquals(2, tokens2.length);
@@ -1686,7 +1686,7 @@ public class StrBuilderTest {
assertEquals(2, t.size());
assertEquals("a", t.next());
assertEquals("b", t.next());
-
+
t.reset();
final String[] tokens3 = t.getTokenArray();
assertEquals(4, tokens3.length);
@@ -1699,7 +1699,7 @@ public class StrBuilderTest {
assertEquals("b", t.next());
assertEquals("c", t.next());
assertEquals("d", t.next());
-
+
assertEquals("a b c d ", t.getContent());
}
@@ -1712,12 +1712,12 @@ public class StrBuilderTest {
final char[] buf = new char[40];
assertEquals(9, reader.read(buf));
assertEquals("some text", new String(buf, 0, 9));
-
+
assertEquals(-1, reader.read());
assertFalse(reader.ready());
assertEquals(0, reader.skip(2));
assertEquals(0, reader.skip(-1));
-
+
assertTrue(reader.markSupported());
reader = sb.asReader();
assertEquals('s', reader.read());
@@ -1734,11 +1734,11 @@ public class StrBuilderTest {
assertEquals('e', array[2]);
assertEquals(2, reader.skip(2));
assertEquals(' ', reader.read());
-
+
assertTrue(reader.ready());
reader.close();
assertTrue(reader.ready());
-
+
reader = sb.asReader();
array = new char[3];
try {
@@ -1761,15 +1761,15 @@ public class StrBuilderTest {
reader.read(array, Integer.MAX_VALUE, Integer.MAX_VALUE);
fail();
} catch (final IndexOutOfBoundsException ex) {}
-
+
assertEquals(0, reader.read(array, 0, 0));
assertEquals(0, array[0]);
assertEquals(0, array[1]);
assertEquals(0, array[2]);
-
+
reader.skip(9);
assertEquals(-1, reader.read(array, 0, 1));
-
+
reader.reset();
array = new char[30];
assertEquals(9, reader.read(array, 0, 30));
@@ -1780,31 +1780,31 @@ public class StrBuilderTest {
public void testAsWriter() throws Exception {
final StrBuilder sb = new StrBuilder("base");
final Writer writer = sb.asWriter();
-
+
writer.write('l');
assertEquals("basel", sb.toString());
-
+
writer.write(new char[] {'i', 'n'});
assertEquals("baselin", sb.toString());
-
+
writer.write(new char[] {'n', 'e', 'r'}, 1, 2);
assertEquals("baseliner", sb.toString());
-
+
writer.write(" rout");
assertEquals("baseliner rout", sb.toString());
-
+
writer.write("ping that server", 1, 3);
assertEquals("baseliner routing", sb.toString());
-
+
writer.flush(); // no effect
assertEquals("baseliner routing", sb.toString());
-
+
writer.close(); // no effect
assertEquals("baseliner routing", sb.toString());
-
+
writer.write(" hi"); // works after close
assertEquals("baseliner routing hi", sb.toString());
-
+
sb.setLength(4); // mix and match
writer.write('d');
assertEquals("based", sb.toString());
@@ -1818,18 +1818,18 @@ public class StrBuilderTest {
assertTrue(sb1.equalsIgnoreCase(sb1));
assertTrue(sb1.equalsIgnoreCase(sb2));
assertTrue(sb2.equalsIgnoreCase(sb2));
-
+
sb1.append("abc");
assertFalse(sb1.equalsIgnoreCase(sb2));
-
+
sb2.append("ABC");
assertTrue(sb1.equalsIgnoreCase(sb2));
-
+
sb2.clear().append("abc");
assertTrue(sb1.equalsIgnoreCase(sb2));
assertTrue(sb1.equalsIgnoreCase(sb1));
assertTrue(sb2.equalsIgnoreCase(sb2));
-
+
sb2.clear().append("aBc");
assertTrue(sb1.equalsIgnoreCase(sb2));
}
@@ -1843,19 +1843,19 @@ public class StrBuilderTest {
assertTrue(sb1.equals(sb1));
assertTrue(sb2.equals(sb2));
assertTrue(sb1.equals((Object) sb2));
-
+
sb1.append("abc");
assertFalse(sb1.equals(sb2));
assertFalse(sb1.equals((Object) sb2));
-
+
sb2.append("ABC");
assertFalse(sb1.equals(sb2));
assertFalse(sb1.equals((Object) sb2));
-
+
sb2.clear().append("abc");
assertTrue(sb1.equals(sb2));
assertTrue(sb1.equals((Object) sb2));
-
+
assertFalse(sb1.equals(Integer.valueOf(1)));
assertFalse(sb1.equals("abc"));
}
@@ -1875,7 +1875,7 @@ public class StrBuilderTest {
final int hc1b = sb.hashCode();
assertEquals(0, hc1a);
assertEquals(hc1a, hc1b);
-
+
sb.append("abc");
final int hc2a = sb.hashCode();
final int hc2b = sb.hashCode();
@@ -1895,7 +1895,7 @@ public class StrBuilderTest {
public void testToStringBuffer() {
final StrBuilder sb = new StrBuilder();
assertEquals(new StringBuffer().toString(), sb.toStringBuffer().toString());
-
+
sb.append("junit");
assertEquals(new StringBuffer("junit").toString(), sb.toStringBuffer().toString());
}
@@ -1905,7 +1905,7 @@ public class StrBuilderTest {
public void testToStringBuilder() {
final StrBuilder sb = new StrBuilder();
assertEquals(new StringBuilder().toString(), sb.toStringBuilder().toString());
-
+
sb.append("junit");
assertEquals(new StringBuilder("junit").toString(), sb.toStringBuilder().toString());
}
@@ -1915,7 +1915,7 @@ public class StrBuilderTest {
public void testLang294() {
final StrBuilder sb = new StrBuilder("\n%BLAH%\nDo more stuff\neven more stuff\n%BLAH%\n");
sb.deleteAll("\n%BLAH%");
- assertEquals("\nDo more stuff\neven more stuff\n", sb.toString());
+ assertEquals("\nDo more stuff\neven more stuff\n", sb.toString());
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java b/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
index 1b286eb..c26f22e 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java b/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
index d9afde2..7325b7a 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -506,7 +506,7 @@ public class StrTokenizerTest {
final StrTokenizer tok = new StrTokenizer(input);
final String[] array = tok.getTokenArray();
final List<?> list = tok.getTokenList();
-
+
assertEquals(Arrays.asList(array), list);
assertEquals(3, list.size());
}
@@ -555,7 +555,7 @@ public class StrTokenizerTest {
tok = new StrTokenizer(input.toCharArray());
assertEquals(input, tok.getContent());
-
+
tok = new StrTokenizer();
assertEquals(null, tok.getContent());
}
@@ -623,7 +623,7 @@ public class StrTokenizerTest {
assertEquals("b", tokenizer.nextToken());
assertEquals("a", clonedTokenizer.nextToken());
}
-
+
// -----------------------------------------------------------------------
@Test
public void testConstructor_String() {
@@ -631,10 +631,10 @@ public class StrTokenizerTest {
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer("");
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer((String) null);
assertFalse(tok.hasNext());
}
@@ -647,10 +647,10 @@ public class StrTokenizerTest {
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer("", ' ');
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer((String) null, ' ');
assertFalse(tok.hasNext());
}
@@ -664,10 +664,10 @@ public class StrTokenizerTest {
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer("", ' ', '"');
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer((String) null, ' ', '"');
assertFalse(tok.hasNext());
}
@@ -679,10 +679,10 @@ public class StrTokenizerTest {
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer(new char[0]);
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer((char[]) null);
assertFalse(tok.hasNext());
}
@@ -695,10 +695,10 @@ public class StrTokenizerTest {
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer(new char[0], ' ');
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer((char[]) null, ' ');
assertFalse(tok.hasNext());
}
@@ -712,10 +712,10 @@ public class StrTokenizerTest {
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer(new char[0], ' ', '"');
assertFalse(tok.hasNext());
-
+
tok = new StrTokenizer((char[]) null, ' ', '"');
assertFalse(tok.hasNext());
}
@@ -728,7 +728,7 @@ public class StrTokenizerTest {
assertEquals("b", tok.next());
assertEquals("c", tok.next());
assertFalse(tok.hasNext());
-
+
tok.reset();
assertEquals("a", tok.next());
assertEquals("b", tok.next());
@@ -744,7 +744,7 @@ public class StrTokenizerTest {
assertEquals("d", tok.next());
assertEquals("e", tok.next());
assertFalse(tok.hasNext());
-
+
tok.reset((String) null);
assertFalse(tok.hasNext());
}
@@ -753,12 +753,12 @@ public class StrTokenizerTest {
@Test
public void testReset_charArray() {
final StrTokenizer tok = new StrTokenizer("x x x");
-
+
final char[] array = new char[] {'a', 'b', 'c'};
tok.reset(array);
assertEquals("abc", tok.next());
assertFalse(tok.hasNext());
-
+
tok.reset((char[]) null);
assertFalse(tok.hasNext());
}
@@ -810,7 +810,7 @@ public class StrTokenizerTest {
fail();
} catch (final NoSuchElementException ex) {}
assertTrue(tkn.hasNext());
-
+
assertEquals("a", tkn.next());
try {
tkn.remove();
@@ -826,15 +826,15 @@ public class StrTokenizerTest {
} catch (final UnsupportedOperationException ex) {}
assertTrue(tkn.hasPrevious());
assertTrue(tkn.hasNext());
-
+
assertEquals("b", tkn.next());
assertTrue(tkn.hasPrevious());
assertTrue(tkn.hasNext());
-
+
assertEquals("c", tkn.next());
assertTrue(tkn.hasPrevious());
assertFalse(tkn.hasNext());
-
+
try {
tkn.next();
fail();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
index 370e754..32cf99a 100644
--- a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -42,32 +42,32 @@ public class WordUtilsTest {
assertTrue(Modifier.isPublic(WordUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(WordUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testWrap_StringInt() {
assertEquals(null, WordUtils.wrap(null, 20));
assertEquals(null, WordUtils.wrap(null, -1));
-
+
assertEquals("", WordUtils.wrap("", 20));
assertEquals("", WordUtils.wrap("", -1));
-
+
// normal
final String systemNewLine = System.lineSeparator();
String input = "Here is one line of text that is going to be wrapped after 20 columns.";
- String expected = "Here is one line of" + systemNewLine + "text that is going"
+ String expected = "Here is one line of" + systemNewLine + "text that is going"
+ systemNewLine + "to be wrapped after" + systemNewLine + "20 columns.";
assertEquals(expected, WordUtils.wrap(input, 20));
-
+
// long word at end
input = "Click here to jump to the commons website - http://commons.apache.org";
- expected = "Click here to jump" + systemNewLine + "to the commons" + systemNewLine
+ expected = "Click here to jump" + systemNewLine + "to the commons" + systemNewLine
+ "website -" + systemNewLine + "http://commons.apache.org";
assertEquals(expected, WordUtils.wrap(input, 20));
-
+
// long word in middle
input = "Click here, http://commons.apache.org, to jump to the commons website";
- expected = "Click here," + systemNewLine + "http://commons.apache.org," + systemNewLine
+ expected = "Click here," + systemNewLine + "http://commons.apache.org," + systemNewLine
+ "to jump to the" + systemNewLine + "commons website";
assertEquals(expected, WordUtils.wrap(input, 20));
@@ -77,7 +77,7 @@ public class WordUtilsTest {
expected = "word1 " + systemNewLine + "word2 " + systemNewLine + "word3";
assertEquals(expected, WordUtils.wrap(input, 7));
}
-
+
@Test
public void testWrap_StringIntStringBoolean() {
assertEquals(null, WordUtils.wrap(null, 20, "\n", false));
@@ -86,14 +86,14 @@ public class WordUtilsTest {
assertEquals(null, WordUtils.wrap(null, 20, null, false));
assertEquals(null, WordUtils.wrap(null, -1, null, true));
assertEquals(null, WordUtils.wrap(null, -1, null, false));
-
+
assertEquals("", WordUtils.wrap("", 20, "\n", false));
assertEquals("", WordUtils.wrap("", 20, "\n", true));
assertEquals("", WordUtils.wrap("", 20, null, false));
assertEquals("", WordUtils.wrap("", 20, null, true));
assertEquals("", WordUtils.wrap("", -1, null, false));
assertEquals("", WordUtils.wrap("", -1, null, true));
-
+
// normal
String input = "Here is one line of text that is going to be wrapped after 20 columns.";
String expected = "Here is one line of\ntext that is going\nto be wrapped after\n20 columns.";
@@ -117,7 +117,7 @@ public class WordUtilsTest {
// system newline char
final String systemNewLine = System.lineSeparator();
input = "Here is one line of text that is going to be wrapped after 20 columns.";
- expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine
+ expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine
+ "to be wrapped after" + systemNewLine + "20 columns.";
assertEquals(expected, WordUtils.wrap(input, 20, null, false));
assertEquals(expected, WordUtils.wrap(input, 20, null, true));
@@ -127,26 +127,26 @@ public class WordUtilsTest {
expected = "Here: is one line\nof text that is \ngoing to be \nwrapped after 20 \ncolumns.";
assertEquals(expected, WordUtils.wrap(input, 20, "\n", false));
assertEquals(expected, WordUtils.wrap(input, 20, "\n", true));
-
+
// with tab
input = "Here is\tone line of text that is going to be wrapped after 20 columns.";
expected = "Here is\tone line of\ntext that is going\nto be wrapped after\n20 columns.";
assertEquals(expected, WordUtils.wrap(input, 20, "\n", false));
assertEquals(expected, WordUtils.wrap(input, 20, "\n", true));
-
+
// with tab at wrapColumn
input = "Here is one line of\ttext that is going to be wrapped after 20 columns.";
expected = "Here is one line\nof\ttext that is\ngoing to be wrapped\nafter 20 columns.";
assertEquals(expected, WordUtils.wrap(input, 20, "\n", false));
assertEquals(expected, WordUtils.wrap(input, 20, "\n", true));
-
+
// difference because of long word
input = "Click here to jump to the commons website - http://commons.apache.org";
expected = "Click here to jump\nto the commons\nwebsite -\nhttp://commons.apache.org";
assertEquals(expected, WordUtils.wrap(input, 20, "\n", false));
expected = "Click here to jump\nto the commons\nwebsite -\nhttp://commons.apach\ne.org";
assertEquals(expected, WordUtils.wrap(input, 20, "\n", true));
-
+
// difference because of long word in middle
input = "Click here, http://commons.apache.org, to jump to the commons website";
expected = "Click here,\nhttp://commons.apache.org,\nto jump to the\ncommons website";
@@ -187,7 +187,7 @@ public class WordUtilsTest {
assertEquals(null, WordUtils.capitalize(null));
assertEquals("", WordUtils.capitalize(""));
assertEquals(" ", WordUtils.capitalize(" "));
-
+
assertEquals("I", WordUtils.capitalize("I") );
assertEquals("I", WordUtils.capitalize("i") );
assertEquals("I Am Here 123", WordUtils.capitalize("i am here 123") );
@@ -195,13 +195,13 @@ public class WordUtilsTest {
assertEquals("I Am HERE 123", WordUtils.capitalize("i am HERE 123") );
assertEquals("I AM HERE 123", WordUtils.capitalize("I AM HERE 123") );
}
-
+
@Test
public void testCapitalizeWithDelimiters_String() {
assertEquals(null, WordUtils.capitalize(null, null));
assertEquals("", WordUtils.capitalize("", new char[0]));
assertEquals(" ", WordUtils.capitalize(" ", new char[0]));
-
+
char[] chars = new char[] { '-', '+', ' ', '@' };
assertEquals("I", WordUtils.capitalize("I", chars) );
assertEquals("I", WordUtils.capitalize("i", chars) );
@@ -219,7 +219,7 @@ public class WordUtilsTest {
assertEquals(null, WordUtils.capitalizeFully(null));
assertEquals("", WordUtils.capitalizeFully(""));
assertEquals(" ", WordUtils.capitalizeFully(" "));
-
+
assertEquals("I", WordUtils.capitalizeFully("I") );
assertEquals("I", WordUtils.capitalizeFully("i") );
assertEquals("I Am Here 123", WordUtils.capitalizeFully("i am here 123") );
@@ -227,13 +227,13 @@ public class WordUtilsTest {
assertEquals("I Am Here 123", WordUtils.capitalizeFully("i am HERE 123") );
assertEquals("I Am Here 123", WordUtils.capitalizeFully("I AM HERE 123") );
}
-
+
@Test
public void testCapitalizeFullyWithDelimiters_String() {
assertEquals(null, WordUtils.capitalizeFully(null, null));
assertEquals("", WordUtils.capitalizeFully("", new char[0]));
assertEquals(" ", WordUtils.capitalizeFully(" ", new char[0]));
-
+
char[] chars = new char[] { '-', '+', ' ', '@' };
assertEquals("I", WordUtils.capitalizeFully("I", chars) );
assertEquals("I", WordUtils.capitalizeFully("i", chars) );
@@ -271,7 +271,7 @@ public class WordUtilsTest {
assertEquals(null, WordUtils.uncapitalize(null));
assertEquals("", WordUtils.uncapitalize(""));
assertEquals(" ", WordUtils.uncapitalize(" "));
-
+
assertEquals("i", WordUtils.uncapitalize("I") );
assertEquals("i", WordUtils.uncapitalize("i") );
assertEquals("i am here 123", WordUtils.uncapitalize("i am here 123") );
@@ -279,13 +279,13 @@ public class WordUtilsTest {
assertEquals("i am hERE 123", WordUtils.uncapitalize("i am HERE 123") );
assertEquals("i aM hERE 123", WordUtils.uncapitalize("I AM HERE 123") );
}
-
+
@Test
public void testUncapitalizeWithDelimiters_String() {
assertEquals(null, WordUtils.uncapitalize(null, null));
assertEquals("", WordUtils.uncapitalize("", new char[0]));
assertEquals(" ", WordUtils.uncapitalize(" ", new char[0]));
-
+
char[] chars = new char[] { '-', '+', ' ', '@' };
assertEquals("i", WordUtils.uncapitalize("I", chars) );
assertEquals("i", WordUtils.uncapitalize("i", chars) );
@@ -330,7 +330,7 @@ public class WordUtilsTest {
assertEquals("BJ.L", WordUtils.initials(" Ben John . Lee", array));
assertEquals("KO", WordUtils.initials("Kay O'Murphy", array));
assertEquals("iah1", WordUtils.initials("i am here 123", array));
-
+
array = new char[0];
assertEquals(null, WordUtils.initials(null, array));
assertEquals("", WordUtils.initials("", array));
@@ -344,7 +344,7 @@ public class WordUtilsTest {
assertEquals("", WordUtils.initials(" Ben John . Lee", array));
assertEquals("", WordUtils.initials("Kay O'Murphy", array));
assertEquals("", WordUtils.initials("i am here 123", array));
-
+
array = " ".toCharArray();
assertEquals(null, WordUtils.initials(null, array));
assertEquals("", WordUtils.initials("", array));
@@ -358,7 +358,7 @@ public class WordUtilsTest {
assertEquals("BJ.L", WordUtils.initials(" Ben John . Lee", array));
assertEquals("KO", WordUtils.initials("Kay O'Murphy", array));
assertEquals("iah1", WordUtils.initials("i am here 123", array));
-
+
array = " .".toCharArray();
assertEquals(null, WordUtils.initials(null, array));
assertEquals("", WordUtils.initials("", array));
@@ -371,7 +371,7 @@ public class WordUtilsTest {
assertEquals("BJL", WordUtils.initials(" Ben John . Lee", array));
assertEquals("KO", WordUtils.initials("Kay O'Murphy", array));
assertEquals("iah1", WordUtils.initials("i am here 123", array));
-
+
array = " .'".toCharArray();
assertEquals(null, WordUtils.initials(null, array));
assertEquals("", WordUtils.initials("", array));
@@ -384,7 +384,7 @@ public class WordUtilsTest {
assertEquals("BJL", WordUtils.initials(" Ben John . Lee", array));
assertEquals("KOM", WordUtils.initials("Kay O'Murphy", array));
assertEquals("iah1", WordUtils.initials("i am here 123", array));
-
+
array = "SIJo1".toCharArray();
assertEquals(null, WordUtils.initials(null, array));
assertEquals("", WordUtils.initials("", array));
@@ -405,7 +405,7 @@ public class WordUtilsTest {
assertEquals(null, WordUtils.swapCase(null));
assertEquals("", WordUtils.swapCase(""));
assertEquals(" ", WordUtils.swapCase(" "));
-
+
assertEquals("i", WordUtils.swapCase("I") );
assertEquals("I", WordUtils.swapCase("i") );
assertEquals("I AM HERE 123", WordUtils.swapCase("i am here 123") );
@@ -417,7 +417,7 @@ public class WordUtilsTest {
final String expect = "tHIS sTRING CONTAINS A tITLEcASE CHARACTER: \u01C9";
assertEquals(expect, WordUtils.swapCase(test));
}
-
+
@Test
public void testLANG1292() throws Exception {
// Prior to fix, this was throwing StringIndexOutOfBoundsException
[33/48] [lang] Prevent redundant modifiers
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
index 15d7cd7..5c1989b 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
@@ -59,7 +59,7 @@ import org.junit.Test;
*/
public class MethodUtilsTest {
- private static interface PrivateInterface {}
+ private interface PrivateInterface {}
static class TestBeanWithInterfaces implements PrivateInterface {
public String foo() {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
index b3cef7a..1b88147 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
@@ -811,7 +811,7 @@ class AAAClass extends AAClass<String> {
//raw types, where used, are used purposely
class AClass extends AAClass<String>.BBClass<Number> {
- public AClass(final AAClass<String> enclosingInstance) {
+ AClass(final AAClass<String> enclosingInstance) {
enclosingInstance.super();
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/reflect/testbed/Bar.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/reflect/testbed/Bar.java b/src/test/java/org/apache/commons/lang3/reflect/testbed/Bar.java
index 105dd1d..8ac873d 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/testbed/Bar.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/testbed/Bar.java
@@ -19,7 +19,7 @@ package org.apache.commons.lang3.reflect.testbed;
/**
*/
public interface Bar {
- public static final String VALUE = "bar";
+ String VALUE = "bar";
void doIt();
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/reflect/testbed/Foo.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/reflect/testbed/Foo.java b/src/test/java/org/apache/commons/lang3/reflect/testbed/Foo.java
index be24ac6..f07a433 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/testbed/Foo.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/testbed/Foo.java
@@ -19,7 +19,7 @@ package org.apache.commons.lang3.reflect.testbed;
/**
*/
public interface Foo {
- public static final String VALUE = "foo";
+ String VALUE = "foo";
@Annotated
void doIt();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
index 41468a9..cdc53f7 100644
--- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
@@ -467,7 +467,7 @@ public class ExtendedMessageFormatTest {
private static class OtherExtendedMessageFormat extends ExtendedMessageFormat {
private static final long serialVersionUID = 1L;
- public OtherExtendedMessageFormat(final String pattern, final Locale locale,
+ OtherExtendedMessageFormat(final String pattern, final Locale locale,
final Map<String, ? extends FormatFactory> registry) {
super(pattern, locale, registry);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java b/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
index ed86721..60d9937 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
@@ -1061,11 +1061,11 @@ public class StrBuilderAppendInsertTest {
assertEquals("", sb.toString());
sb.clear();
- sb.appendAll(new Object[0]);
+ sb.appendAll();
assertEquals("", sb.toString());
sb.clear();
- sb.appendAll(new Object[]{"foo", "bar", "baz"});
+ sb.appendAll("foo", "bar", "baz");
assertEquals("foobarbaz", sb.toString());
sb.clear();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java b/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
index ea684b6..09486ef 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
@@ -170,7 +170,7 @@ public class StrBuilderTest {
private final CharBuffer src;
- public MockReadable(final String src) {
+ MockReadable(final String src) {
this.src = CharBuffer.wrap(src);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java b/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
index c26f22e..24dd953 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
@@ -182,7 +182,7 @@ public class StrMatcherTest {
assertEquals(0, matcher.isMatch(BUFFER2, 3));
assertEquals(1, matcher.isMatch(BUFFER2, 4));
assertEquals(0, matcher.isMatch(BUFFER2, 5));
- assertSame(StrMatcher.noneMatcher(), StrMatcher.charSetMatcher(new char[0]));
+ assertSame(StrMatcher.noneMatcher(), StrMatcher.charSetMatcher());
assertSame(StrMatcher.noneMatcher(), StrMatcher.charSetMatcher((char[]) null));
assertTrue(StrMatcher.charSetMatcher("a".toCharArray()) instanceof StrMatcher.CharMatcher);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
----------------------------------------------------------------------
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 f197974..a938caa 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
@@ -225,7 +225,7 @@ public class DateFormatUtilsTest {
public void testLang530() throws ParseException {
final Date d = new Date();
final String isoDateStr = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(d);
- final Date d2 = DateUtils.parseDate(isoDateStr, new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern() });
+ final Date d2 = DateUtils.parseDate(isoDateStr, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());
// the format loses milliseconds so have to reintroduce them
assertEquals("Date not equal to itself ISO formatted and parsed", d.getTime(), d2.getTime() + d.getTime() % 1000);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
index 77e1101..686c1a6 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
@@ -1282,7 +1282,7 @@ public class DateUtilsTest {
public void testLang530() throws ParseException {
final Date d = new Date();
final String isoDateStr = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(d);
- final Date d2 = DateUtils.parseDate(isoDateStr, new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern() });
+ final Date d2 = DateUtils.parseDate(isoDateStr, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());
// the format loses milliseconds so have to reintroduce them
assertEquals("Date not equal to itself ISO formatted and parsed", d.getTime(), d2.getTime() + d.getTime() % 1000);
}
@@ -1736,7 +1736,7 @@ public class DateUtilsTest {
@Test
public void testLANG799() throws ParseException {
- DateUtils.parseDateStrictly("09 abril 2008 23:55:38 GMT", new Locale("es"), new String[]{"dd MMM yyyy HH:mm:ss zzz"});
+ DateUtils.parseDateStrictly("09 abril 2008 23:55:38 GMT", new Locale("es"), "dd MMM yyyy HH:mm:ss zzz");
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
----------------------------------------------------------------------
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 c637f79..3289e5b 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
@@ -623,12 +623,12 @@ public class FastDateParserTest {
return cal;
}
- private static enum Expected1806 {
+ private enum Expected1806 {
India(INDIA, "+05", "+0530", "+05:30", true),
Greenwich(GMT, "Z", "Z", "Z", false),
NewYork(NEW_YORK, "-05", "-0500", "-05:00", false);
- private Expected1806(final TimeZone zone, final String one, final String two, final String three, final boolean hasHalfHourOffset) {
+ Expected1806(final TimeZone zone, final String one, final String two, final String three, final boolean hasHalfHourOffset) {
this.zone = zone;
this.one = one;
this.two = two;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3a818ed6/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
index 8d83726..ff9180c 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
@@ -293,11 +293,11 @@ public class FastDatePrinterTest {
getInstance("XXXX");
}
- private static enum Expected1806 {
+ private enum Expected1806 {
India(INDIA, "+05", "+0530", "+05:30"), Greenwich(GMT, "Z", "Z", "Z"), NewYork(
NEW_YORK, "-05", "-0500", "-05:00");
- private Expected1806(final TimeZone zone, final String one, final String two, final String three) {
+ Expected1806(final TimeZone zone, final String one, final String two, final String three) {
this.zone = zone;
this.one = one;
this.two = two;
[47/48] [lang] Update website for 3.6 release
Posted by br...@apache.org.
Update website for 3.6 release
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/a975a27e
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/a975a27e
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/a975a27e
Branch: refs/heads/release
Commit: a975a27eea5f936588a3fc1bce7fb45a6da12bfc
Parents: 841915d
Author: Benedikt Ritter <br...@apache.org>
Authored: Mon Apr 17 14:12:54 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Jun 8 10:00:26 2017 +0200
----------------------------------------------------------------------
README.md | 2 +-
RELEASE-NOTES.txt | 2 +-
pom.xml | 2 +-
src/changes/changes.xml | 6 +++---
src/site/xdoc/download_lang.xml | 2 +-
src/site/xdoc/index.xml | 10 +++++-----
src/site/xdoc/release-history.xml | 3 +++
7 files changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a975a27e/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index dd44aab..ae5aee2 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,7 @@ Alternatively you can pull it from the central Maven repositories:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.5</version>
+ <version>3.6</version>
</dependency>
```
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a975a27e/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 535fdc6..b5ec7d3 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -9,7 +9,7 @@ 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. Note that this has changed from Commons Lang 3.5, which
+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://git-wip-us.apache.org/repos/asf/commons-lang/blob/a975a27e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index be3c2cf..bdcfef5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -579,7 +579,7 @@
<commons.module.name>org.apache.commons.lang3</commons.module.name>
<!-- Current 3.x release series -->
<commons.release.version>3.6</commons.release.version>
- <commons.release.desc>(Java 6.0+)</commons.release.desc>
+ <commons.release.desc>(Java 7.0+)</commons.release.desc>
<!-- Previous 2.x release series -->
<commons.release.2.version>2.6</commons.release.2.version>
<commons.release.2.desc>(Requires Java 1.2 or later)</commons.release.2.desc>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a975a27e/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 56c2071..0ac4019 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,7 +45,7 @@ The <action> type attribute can be add,update,fix,remove.
</properties>
<body>
- <release version="3.6" date="2017-MM-DD" description="TBD">
+ <release version="3.6" date="2017-06-08" description="New features and bug fixes. Requires Java 7.">
<action issue="LANG-1338" type="update" dev="britter">Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility</action>
<action issue="LANG-1336" type="add" dev="britter" due-to="Beluga Behr">Add NUL Byte To CharUtils</action>
<action issue="LANG-1337" type="fix" dev="kinow">Fix test failures in IBM JDK 8 for ToStringBuilderTest</action>
@@ -95,8 +95,8 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1313" type="add" dev="pschumacher" due-to="Tomschi">Add ArchUtils - An utility class for the "os.arch" system property</action>
<action issue="LANG-1272" type="add" dev="ebourg">Add shuffle methods to ArrayUtils</action>
<action issue="LANG-1317" type="add" dev="pschumacher" due-to="Yasser Zamani">Add MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods</action>
- <action issue="LANG-1331" type="add" dev="ggregory">Add ImmutablePair.nullPair()</action>
- <action issue="LANG-1332" type="add" dev="ggregory">Add ImmutableTriple.nullTriple()</action>
+ <action issue="LANG-1331" type="add" dev="ggregory">Add ImmutablePair.nullPair()</action>
+ <action issue="LANG-1332" type="add" dev="ggregory">Add ImmutableTriple.nullTriple()</action>
</release>
<release version="3.5" date="2016-10-13" description="New features including Java 9 detection">
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a975a27e/src/site/xdoc/download_lang.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/download_lang.xml b/src/site/xdoc/download_lang.xml
index 3f752c8..55e00dd 100644
--- a/src/site/xdoc/download_lang.xml
+++ b/src/site/xdoc/download_lang.xml
@@ -111,7 +111,7 @@ limitations under the License.
</p>
</subsection>
</section>
- <section name="Apache Commons Lang 3.6 (Java 6.0+)">
+ <section name="Apache Commons Lang 3.6 (Java 7.0+)">
<subsection name="Binaries">
<table>
<tr>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a975a27e/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index e85850b..2d8b15e 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -50,7 +50,7 @@ and various <a href="project-reports.html">project reports</a> are provided.
The JavaDoc API documents are available online:
</p>
<ul>
-<li>The <a href="javadocs/api-3.5/index.html">current stable release 3.5</a> [Java 6.0+]</li>
+<li>The <a href="javadocs/api-3.6/index.html">current stable release 3.6</a> [Java 7.0+]</li>
<li>The <a href="javadocs/api-2.6/index.html">legacy release 2.6</a> [Java 1.2+]</li>
<li>Older releases - see the <a href="release-history.html">Release History</a> page</li>
</ul>
@@ -61,10 +61,10 @@ The <a href="source-repository.html">git repository</a> can be
</section>
<!-- ================================================== -->
<section name="Release Information">
-<p>The latest stable release of Lang is 3.5. You may: </p>
+<p>The latest stable release of Lang is 3.6. You may: </p>
<ul>
-<li>Download <a href="http://commons.apache.org/lang/download_lang.cgi">3.5</a></li>
-<li>Read the <a href="release-notes/RELEASE-NOTES-3.5.txt">3.5 release notes</a></li>
+<li>Download <a href="http://commons.apache.org/lang/download_lang.cgi">3.6</a></li>
+<li>Read the <a href="release-notes/RELEASE-NOTES-3.6.txt">3.6 release notes</a></li>
<li>Examine the <a href="article3_0.html">2.x to 3.0 upgrade notes</a></li>
<li>Compare major versions via the <a href="lang2-lang3-clirr-report.html">Lang2 to Lang3 Clirr report</a></li>
</ul>
@@ -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.5</version>
+ <version>3.6</version>
</dependency>
</pre>
</p>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a975a27e/src/site/xdoc/release-history.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/release-history.xml b/src/site/xdoc/release-history.xml
index 8a805e1..57ba62d 100644
--- a/src/site/xdoc/release-history.xml
+++ b/src/site/xdoc/release-history.xml
@@ -32,6 +32,9 @@ limitations under the License.
<th>Version</th><th>Release date</th><th>Required Java Version</th><th>Javadoc</th><th>Release notes</th>
</tr>
<tr>
+ <td>3.6</td><td>2016-04-17</td><td>7.0</td><td><a href="javadocs/api-3.6/">api-3.6</a></td><td><a href="release-notes/RELEASE-NOTES-3.6.txt">release notes for 3.6</a></td>
+ </tr>
+ <tr>
<td>3.5</td><td>2016-10-02</td><td>6.0</td><td><a href="javadocs/api-3.5/">api-3.5</a></td><td><a href="release-notes/RELEASE-NOTES-3.5.txt">release notes for 3.5</a></td>
</tr>
<tr>
[02/48] [lang] Remove wildcard static import
Posted by br...@apache.org.
Remove wildcard static import
My last commit accidentally added a wildcard to a static import. This
commit reverses that.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/53def501
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/53def501
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/53def501
Branch: refs/heads/release
Commit: 53def501409cd1f9e20ac43edba6f2949bb366c8
Parents: 7587431
Author: duncan <du...@wortharead.com>
Authored: Fri May 19 21:52:27 2017 +0100
Committer: duncan <du...@wortharead.com>
Committed: Fri May 19 21:52:27 2017 +0100
----------------------------------------------------------------------
.../commons/lang3/builder/MultilineRecursiveToStringStyleTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/53def501/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
index e3a87f6..08c6382 100644
--- a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
@@ -17,7 +17,7 @@
package org.apache.commons.lang3.builder;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
[26/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
index 8db6ca4..3f568d1 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
@@ -56,7 +56,7 @@ public class TypeUtils {
*/
private WildcardTypeBuilder() {
}
-
+
private Type[] upperBounds;
private Type[] lowerBounds;
@@ -91,7 +91,7 @@ public class TypeUtils {
/**
* GenericArrayType implementation class.
- * @since 3.2
+ * @since 3.2
*/
private static final class GenericArrayTypeImpl implements GenericArrayType {
private final Type componentType;
@@ -141,7 +141,7 @@ public class TypeUtils {
/**
* ParameterizedType implementation class.
- * @since 3.2
+ * @since 3.2
*/
private static final class ParameterizedTypeImpl implements ParameterizedType {
private final Class<?> raw;
@@ -217,7 +217,7 @@ public class TypeUtils {
/**
* WildcardType implementation class.
- * @since 3.2
+ * @since 3.2
*/
private static final class WildcardTypeImpl implements WildcardType {
private static final Type[] EMPTY_BOUNDS = new Type[0];
@@ -1400,7 +1400,7 @@ public class TypeUtils {
/**
* Local helper method to unroll variables in a type bounds array.
- *
+ *
* @param typeArguments assignments {@link Map}
* @param bounds in which to expand variables
* @return {@code bounds} with any variables reassigned
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/reflect/Typed.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/reflect/Typed.java b/src/main/java/org/apache/commons/lang3/reflect/Typed.java
index 4841f5c..b21b51b 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/Typed.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/Typed.java
@@ -27,7 +27,7 @@ public interface Typed<T> {
/**
* Get the {@link Type} represented by this entity.
- *
+ *
* @return Type
*/
Type getType();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java b/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java
index bac62ec..f365969 100644
--- a/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java
+++ b/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java
@@ -5,9 +5,9 @@
* 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.
@@ -34,7 +34,7 @@ public class CompositeFormat extends Format {
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = -4329119827877627683L;
@@ -47,7 +47,7 @@ public class CompositeFormat extends Format {
/**
* Create a format that points its parseObject method to one implementation
* and its format method to another.
- *
+ *
* @param parser implementation
* @param formatter implementation
*/
@@ -58,7 +58,7 @@ public class CompositeFormat extends Format {
/**
* Uses the formatter Format instance.
- *
+ *
* @param obj the object to format
* @param toAppendTo the {@link StringBuffer} to append to
* @param pos the FieldPosition to use (or ignore).
@@ -73,7 +73,7 @@ public class CompositeFormat extends Format {
/**
* Uses the parser Format instance.
- *
+ *
* @param source the String source
* @param pos the ParsePosition containing the position to parse from, will
* be updated according to parsing success (index) or failure
@@ -88,7 +88,7 @@ public class CompositeFormat extends Format {
/**
* Provides access to the parser Format implementation.
- *
+ *
* @return parser Format implementation
*/
public Format getParser() {
@@ -97,7 +97,7 @@ public class CompositeFormat extends Format {
/**
* Provides access to the parser Format implementation.
- *
+ *
* @return formatter Format implementation
*/
public Format getFormatter() {
@@ -106,7 +106,7 @@ public class CompositeFormat extends Format {
/**
* Utility method to parse and then reformat a String.
- *
+ *
* @param input String to reformat
* @return A reformatted String
* @throws ParseException thrown by parseObject(String) call
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java b/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
index 75e53a0..6c9948b 100644
--- a/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
+++ b/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
@@ -477,7 +477,7 @@ public class ExtendedMessageFormat extends MessageFormat {
*/
private StringBuilder appendQuotedString(final String pattern, final ParsePosition pos,
final StringBuilder appendTo) {
- assert pattern.toCharArray()[pos.getIndex()] == QUOTE :
+ assert pattern.toCharArray()[pos.getIndex()] == QUOTE :
"Quoted string must start with quote character";
// handle quote character at the beginning of the string
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/FormatFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/FormatFactory.java b/src/main/java/org/apache/commons/lang3/text/FormatFactory.java
index b6e3583..0a206d0 100644
--- a/src/main/java/org/apache/commons/lang3/text/FormatFactory.java
+++ b/src/main/java/org/apache/commons/lang3/text/FormatFactory.java
@@ -5,9 +5,9 @@
* 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.
@@ -21,7 +21,7 @@ import java.util.Locale;
/**
* Format factory.
- *
+ *
* @since 2.4
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/FormatFactory.html">
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java
----------------------------------------------------------------------
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 9fdf6ec..87cd84c 100644
--- a/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java
+++ b/src/main/java/org/apache/commons/lang3/text/FormattableUtils.java
@@ -27,11 +27,11 @@ import org.apache.commons.lang3.Validate;
/**
* <p>Provides utilities for working with the {@code Formattable} interface.</p>
- *
+ *
* <p>The {@link Formattable} interface provides basic control over formatting
* when using a {@code Formatter}. It is primarily concerned with numeric precision
* and padding, and is not designed to allow generalised alternate formats.</p>
- *
+ *
* @since Lang 3.0
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/FormattableUtils.html">
@@ -49,7 +49,7 @@ public class FormattableUtils {
* <p>{@code FormattableUtils} instances should NOT be constructed in
* standard programming. Instead, the methods of the class should be invoked
* statically.</p>
- *
+ *
* <p>This constructor is public to permit tools that require a JavaBean
* instance to operate.</p>
*/
@@ -61,7 +61,7 @@ public class FormattableUtils {
/**
* Get the default formatted representation of the specified
* {@code Formattable}.
- *
+ *
* @param formattable the instance to convert to a string, not null
* @return the resulting string, not null
*/
@@ -73,7 +73,7 @@ public class FormattableUtils {
* Handles the common {@code Formattable} operations of truncate-pad-append,
* with no ellipsis on precision overflow, and padding width underflow with
* spaces.
- *
+ *
* @param seq the string to handle, not null
* @param formatter the destination formatter, not null
* @param flags the flags for formatting, see {@code Formattable}
@@ -89,7 +89,7 @@ public class FormattableUtils {
/**
* Handles the common {@link Formattable} operations of truncate-pad-append,
* with no ellipsis on precision overflow.
- *
+ *
* @param seq the string to handle, not null
* @param formatter the destination formatter, not null
* @param flags the flags for formatting, see {@code Formattable}
@@ -106,7 +106,7 @@ public class FormattableUtils {
/**
* Handles the common {@link Formattable} operations of truncate-pad-append,
* padding width underflow with spaces.
- *
+ *
* @param seq the string to handle, not null
* @param formatter the destination formatter, not null
* @param flags the flags for formatting, see {@code Formattable}
@@ -123,7 +123,7 @@ public class FormattableUtils {
/**
* Handles the common {@link Formattable} operations of truncate-pad-append.
- *
+ *
* @param seq the string to handle, not null
* @param formatter the destination formatter, not null
* @param flags the flags for formatting, see {@code Formattable}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
index cb0bf9d..4e69cd5 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
@@ -5,9 +5,9 @@
* 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.
@@ -67,9 +67,9 @@ import org.apache.commons.lang3.builder.Builder;
* The biggest of these changes is that by default, null will not output the text
* 'null'. This can be controlled by a property, {@link #setNullText(String)}.
* <p>
- * Prior to 3.0, this class implemented Cloneable but did not implement the
- * clone method so could not be used. From 3.0 onwards it no longer implements
- * the interface.
+ * Prior to 3.0, this class implemented Cloneable but did not implement the
+ * clone method so could not be used. From 3.0 onwards it no longer implements
+ * the interface.
*
* @since 2.2
* @deprecated as of 3.6, use commons-text
@@ -86,7 +86,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 7628716375283629643L;
@@ -355,7 +355,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
//-----------------------------------------------------------------------
/**
* Copies the builder's character array into a new character array.
- *
+ *
* @return a new array that represents the contents of the builder
*/
public char[] toCharArray() {
@@ -369,7 +369,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/**
* Copies part of the builder's character array into a new character array.
- *
+ *
* @param startIndex the start index, inclusive, must be valid
* @param endIndex the end index, exclusive, must be valid except that
* if too large it is treated as end of string
@@ -390,7 +390,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/**
* Copies the character array into the specified array.
- *
+ *
* @param destination the destination array, null will cause an array to be created
* @return the input array, unless that was null or too small
*/
@@ -512,7 +512,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
if (obj instanceof CharSequence) {
return append((CharSequence) obj);
}
- return append(obj.toString());
+ return append(obj.toString());
}
/**
@@ -540,7 +540,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
if (seq instanceof CharBuffer) {
return append((CharBuffer) seq);
}
- return append(seq.toString());
+ return append(seq.toString());
}
/**
@@ -557,10 +557,10 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
public StrBuilder append(final CharSequence seq, final int startIndex, final int length) {
if (seq == null) {
return appendNull();
- }
+ }
return append(seq.toString(), startIndex, length);
}
-
+
/**
* Appends a string to this string builder.
* Appending null will call {@link #appendNull()}.
@@ -581,7 +581,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
return this;
}
-
+
/**
* Appends part of a string to this string builder.
@@ -750,7 +750,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
return this;
}
-
+
/**
* Appends part of a StringBuilder to this string builder.
* Appending null will call {@link #appendNull()}.
@@ -1327,7 +1327,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* </pre>
* Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}.
- *
+ *
* @param separator the separator to use, null means no separator
* @return this, to enable chaining
* @since 2.3
@@ -1340,7 +1340,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Appends one of both separators to the StrBuilder.
* If the builder is currently empty it will append the defaultIfEmpty-separator
* Otherwise it will append the standard-separator
- *
+ *
* Appending a null separator will have no effect.
* The separator is appended using {@link #append(String)}.
* <p>
@@ -1357,7 +1357,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* }
* selectClause.append(whereClause)
* </pre>
- *
+ *
* @param standard the separator if builder is not empty, null means no separator
* @param defaultIfEmpty the separator if builder is empty, null means no separator
* @return this, to enable chaining
@@ -1385,7 +1385,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* </pre>
* Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}.
- *
+ *
* @param separator the separator to use
* @return this, to enable chaining
* @since 2.3
@@ -1432,7 +1432,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* </pre>
* Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}.
- *
+ *
* @param separator the separator to use, null means no separator
* @param loopIndex the loop index
* @return this, to enable chaining
@@ -1460,7 +1460,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* </pre>
* Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}.
- *
+ *
* @param separator the separator to use
* @param loopIndex the loop index
* @return this, to enable chaining
@@ -1476,7 +1476,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
//-----------------------------------------------------------------------
/**
* Appends the pad character to the builder the specified number of times.
- *
+ *
* @param length the length to append, negative means no append
* @param padChar the character to append
* @return this, to enable chaining
@@ -1497,7 +1497,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* The <code>toString</code> of the object is used.
* If the object is larger than the length, the left hand side is lost.
* If the object is null, the null text value is used.
- *
+ *
* @param obj the object to append, null uses null text
* @param width the fixed field width, zero or negative has no effect
* @param padChar the pad character to use
@@ -1529,7 +1529,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Appends an object to the builder padding on the left to a fixed width.
* The <code>String.valueOf</code> of the <code>int</code> value is used.
* If the formatted value is larger than the length, the left hand side is lost.
- *
+ *
* @param value the value to append
* @param width the fixed field width, zero or negative has no effect
* @param padChar the pad character to use
@@ -1544,7 +1544,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* The <code>toString</code> of the object is used.
* If the object is larger than the length, the right hand side is lost.
* If the object is null, null text value is used.
- *
+ *
* @param obj the object to append, null uses null text
* @param width the fixed field width, zero or negative has no effect
* @param padChar the pad character to use
@@ -1576,7 +1576,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Appends an object to the builder padding on the right to a fixed length.
* The <code>String.valueOf</code> of the <code>int</code> value is used.
* If the object is larger than the length, the right hand side is lost.
- *
+ *
* @param value the value to append
* @param width the fixed field width, zero or negative has no effect
* @param padChar the pad character to use
@@ -2134,14 +2134,14 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
//-----------------------------------------------------------------------
/**
* Reverses the string builder placing each character in the opposite index.
- *
+ *
* @return this, to enable chaining
*/
public StrBuilder reverse() {
if (size == 0) {
return this;
}
-
+
final int half = size / 2;
final char[] buf = buffer;
for (int leftIdx = 0, rightIdx = size - 1; leftIdx < half; leftIdx++,rightIdx--) {
@@ -2186,7 +2186,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Checks whether this builder starts with the specified string.
* <p>
* Note that this method handles null input quietly, unlike String.
- *
+ *
* @param str the string to search for, null returns false
* @return true if the builder starts with the string
*/
@@ -2213,7 +2213,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Checks whether this builder ends with the specified string.
* <p>
* Note that this method handles null input quietly, unlike String.
- *
+ *
* @param str the string to search for, null returns false
* @return true if the builder ends with the string
*/
@@ -2258,7 +2258,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/**
* Extracts a portion of this string builder as a string.
- *
+ *
* @param start the start index, inclusive, must be valid
* @return the new string
* @throws IndexOutOfBoundsException if the index is invalid
@@ -2273,7 +2273,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Note: This method treats an endIndex greater than the length of the
* builder as equal to the length of the builder, and continues
* without error, unlike StringBuffer or String.
- *
+ *
* @param startIndex the start index, inclusive, must be valid
* @param endIndex the end index, exclusive, must be valid except
* that if too large it is treated as end of string
@@ -2293,7 +2293,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* the builder. If this many characters are not available, the whole
* builder is returned. Thus the returned string may be shorter than the
* length requested.
- *
+ *
* @param length the number of characters to extract, negative returns empty string
* @return the new string
*/
@@ -2315,7 +2315,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* the builder. If this many characters are not available, the whole
* builder is returned. Thus the returned string may be shorter than the
* length requested.
- *
+ *
* @param length the number of characters to extract, negative returns empty string
* @return the new string
*/
@@ -2340,7 +2340,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* If the length is negative, the empty string is returned.
* If insufficient characters are available in the builder, as much as possible is returned.
* Thus the returned string may be shorter than the length requested.
- *
+ *
* @param index the index to start at, negative means zero
* @param length the number of characters to extract, negative returns empty string
* @return the new string
@@ -2403,7 +2403,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
//-----------------------------------------------------------------------
/**
* Searches the string builder to find the first reference to the specified char.
- *
+ *
* @param ch the character to find
* @return the first index of the character, or -1 if not found
*/
@@ -2413,7 +2413,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/**
* Searches the string builder to find the first reference to the specified char.
- *
+ *
* @param ch the character to find
* @param startIndex the index to start at, invalid index rounded to edge
* @return the first index of the character, or -1 if not found
@@ -2436,7 +2436,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Searches the string builder to find the first reference to the specified string.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
- *
+ *
* @param str the string to find, null returns -1
* @return the first index of the string, or -1 if not found
*/
@@ -2449,7 +2449,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* string starting searching from the given index.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
- *
+ *
* @param str the string to find, null returns -1
* @param startIndex the index to start at, invalid index rounded to edge
* @return the first index of the string, or -1 if not found
@@ -2527,7 +2527,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
//-----------------------------------------------------------------------
/**
* Searches the string builder to find the last reference to the specified char.
- *
+ *
* @param ch the character to find
* @return the last index of the character, or -1 if not found
*/
@@ -2537,7 +2537,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/**
* Searches the string builder to find the last reference to the specified char.
- *
+ *
* @param ch the character to find
* @param startIndex the index to start at, invalid index rounded to edge
* @return the last index of the character, or -1 if not found
@@ -2559,7 +2559,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Searches the string builder to find the last reference to the specified string.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
- *
+ *
* @param str the string to find, null returns -1
* @return the last index of the string, or -1 if not found
*/
@@ -2572,7 +2572,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* string starting searching from the given index.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
- *
+ *
* @param str the string to find, null returns -1
* @param startIndex the index to start at, invalid index rounded to edge
* @return the last index of the string, or -1 if not found
@@ -2597,7 +2597,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
return i;
}
-
+
} else if (strLen == 0) {
return startIndex;
}
@@ -2887,7 +2887,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
//-----------------------------------------------------------------------
/**
* Validates parameters defining a range of the builder.
- *
+ *
* @param startIndex the start index, inclusive, must be valid
* @param endIndex the end index, exclusive, must be valid except
* that if too large it is treated as end of string
@@ -2909,7 +2909,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/**
* Validates parameters defining a single index in the builder.
- *
+ *
* @param index the index, must be valid
* @throws IndexOutOfBoundsException if the index is invalid
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/StrMatcher.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/StrMatcher.java b/src/main/java/org/apache/commons/lang3/text/StrMatcher.java
index 0cfcd6f..60e0d45 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrMatcher.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrMatcher.java
@@ -5,9 +5,9 @@
* 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.
@@ -378,7 +378,7 @@ public abstract class StrMatcher {
}
return len;
}
-
+
@Override
public String toString() {
return super.toString() + ' ' + Arrays.toString(chars);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java b/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
index 68f8811..db5ed0a 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
@@ -1209,7 +1209,7 @@ public class StrSubstitutor {
/**
* Returns the flag controlling whether escapes are preserved during
* substitution.
- *
+ *
* @return the preserve escape flag
* @since 3.5
*/
@@ -1225,7 +1225,7 @@ public class StrSubstitutor {
* character is removed during substitution (e.g.
* <code>$${this-is-escaped}</code> becomes
* <code>${this-is-escaped}</code>). The default value is <b>false</b>
- *
+ *
* @param preserveEscapes true if escapes are to be preserved
* @since 3.5
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
----------------------------------------------------------------------
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 8d56b1d..f9fb6dc 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
@@ -135,7 +135,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
/**
* Returns a clone of <code>CSV_TOKENIZER_PROTOTYPE</code>.
- *
+ *
* @return a clone of <code>CSV_TOKENIZER_PROTOTYPE</code>.
*/
private static StrTokenizer getCSVClone() {
@@ -187,7 +187,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
/**
* Returns a clone of <code>TSV_TOKENIZER_PROTOTYPE</code>.
- *
+ *
* @return a clone of <code>TSV_TOKENIZER_PROTOTYPE</code>.
*/
private static StrTokenizer getTSVClone() {
@@ -629,7 +629,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* <code>StrTokenizer</code> will always pass a zero offset and a count
* equal to the length of the array to this method, however a subclass
* may pass other values, or even an entirely different array.
- *
+ *
* @param srcChars the character array being tokenized, may be null
* @param offset the start position within the character array, must be valid
* @param count the number of characters to tokenize, must be valid
@@ -642,12 +642,12 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
final StrBuilder buf = new StrBuilder();
final List<String> tokenList = new ArrayList<>();
int pos = offset;
-
+
// loop around the entire buffer
while (pos >= 0 && pos < count) {
// find next token
pos = readNextToken(srcChars, pos, count, buf, tokenList);
-
+
// handle case where end of string is a delimiter
if (pos >= count) {
addToken(tokenList, StringUtils.EMPTY);
@@ -699,20 +699,20 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
}
start += removeLen;
}
-
+
// handle reaching end
if (start >= len) {
addToken(tokenList, StringUtils.EMPTY);
return -1;
}
-
+
// handle empty token
final int delimLen = getDelimiterMatcher().isMatch(srcChars, start, start, len);
if (delimLen > 0) {
addToken(tokenList, StringUtils.EMPTY);
return start + delimLen;
}
-
+
// handle found token
final int quoteLen = getQuoteMatcher().isMatch(srcChars, start, start, len);
if (quoteLen > 0) {
@@ -735,7 +735,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* immediately after the delimiter, or if end of string found,
* then the length of string
*/
- private int readWithQuotes(final char[] srcChars, final int start, final int len, final StrBuilder workArea,
+ private int readWithQuotes(final char[] srcChars, final int start, final int len, final StrBuilder workArea,
final List<String> tokenList, final int quoteStart, final int quoteLen) {
// Loop until we've found the end of the quoted
// string or the end of the input
@@ -743,14 +743,14 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
int pos = start;
boolean quoting = quoteLen > 0;
int trimStart = 0;
-
+
while (pos < len) {
// quoting mode can occur several times throughout a string
// we must switch between quoting and non-quoting until we
// encounter a non-quoted delimiter, or end of string
if (quoting) {
// In quoting mode
-
+
// If we've found a quote character, see if it's
// followed by a second quote. If so, then we need
// to actually put the quote character into the token
@@ -763,20 +763,20 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
trimStart = workArea.size();
continue;
}
-
+
// end of quoting
quoting = false;
pos += quoteLen;
continue;
}
-
+
// copy regular character from inside quotes
workArea.append(srcChars[pos++]);
trimStart = workArea.size();
-
+
} else {
// Not in quoting mode
-
+
// check for delimiter, and thus end of token
final int delimLen = getDelimiterMatcher().isMatch(srcChars, pos, start, len);
if (delimLen > 0) {
@@ -784,21 +784,21 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
addToken(tokenList, workArea.substring(0, trimStart));
return pos + delimLen;
}
-
+
// check for quote, and thus back into quoting mode
if (quoteLen > 0 && isQuote(srcChars, pos, len, quoteStart, quoteLen)) {
quoting = true;
pos += quoteLen;
continue;
}
-
+
// check for ignored (outside quotes), and ignore
final int ignoredLen = getIgnoredMatcher().isMatch(srcChars, pos, start, len);
if (ignoredLen > 0) {
pos += ignoredLen;
continue;
}
-
+
// check for trimmed character
// don't yet know if its at the end, so copy to workArea
// use trimStart to keep track of trim at the end
@@ -808,13 +808,13 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
pos += trimmedLen;
continue;
}
-
+
// copy regular character from outside quotes
workArea.append(srcChars[pos++]);
trimStart = workArea.size();
}
}
-
+
// return condition when end of string found
addToken(tokenList, workArea.substring(0, trimStart));
return -1;
@@ -1071,7 +1071,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* Creates a new instance of this Tokenizer. The new instance is reset so
* that it will be at the start of the token list.
* If a {@link CloneNotSupportedException} is caught, return <code>null</code>.
- *
+ *
* @return a new instance of this Tokenizer which has been reset.
*/
@Override
@@ -1086,7 +1086,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
/**
* Creates a new instance of this Tokenizer. The new instance is reset so that
* it will be at the start of the token list.
- *
+ *
* @return a new instance of this Tokenizer which has been reset.
* @throws CloneNotSupportedException if there is a problem cloning
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/WordUtils.java
----------------------------------------------------------------------
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 66ce445..fef20d0 100644
--- a/src/main/java/org/apache/commons/lang3/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,11 +24,11 @@ import org.apache.commons.lang3.StringUtils;
/**
* <p>Operations on Strings that contain words.</p>
- *
+ *
* <p>This class tries to handle <code>null</code> input gracefully.
* An exception will not be thrown for a <code>null</code> input.
* Each method documents its behaviour in more detail.</p>
- *
+ *
* @since 2.0
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/WordUtils.html">
@@ -53,10 +53,10 @@ public class WordUtils {
//--------------------------------------------------------------------------
/**
* <p>Wraps a single line of text, identifying words by <code>' '</code>.</p>
- *
+ *
* <p>New lines will be separated by the system property line separator.
* Very long words, such as URLs will <i>not</i> be wrapped.</p>
- *
+ *
* <p>Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.</p>
*
@@ -102,10 +102,10 @@ public class WordUtils {
public static String wrap(final String str, final int wrapLength) {
return wrap(str, wrapLength, null, false);
}
-
+
/**
* <p>Wraps a single line of text, identifying words by <code>' '</code>.</p>
- *
+ *
* <p>Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.</p>
*
@@ -170,7 +170,7 @@ public class WordUtils {
*
* @param str the String to be word wrapped, may be null
* @param wrapLength the column to wrap the words at, less than 1 is treated as 1
- * @param newLineStr the string to insert for a new line,
+ * @param newLineStr the string to insert for a new line,
* <code>null</code> uses the system property line separator
* @param wrapLongWords true if long words (such as URLs) should be wrapped
* @return a line with newlines inserted, <code>null</code> if null input
@@ -348,8 +348,8 @@ public class WordUtils {
//-----------------------------------------------------------------------
/**
* <p>Capitalizes all the whitespace separated words in a String.
- * Only the first character of each word is changed. To convert the
- * rest of each word to lowercase at the same time,
+ * Only the first character of each word is changed. To convert the
+ * rest of each word to lowercase at the same time,
* use {@link #capitalizeFully(String)}.</p>
*
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.
@@ -362,7 +362,7 @@ public class WordUtils {
* WordUtils.capitalize("") = ""
* WordUtils.capitalize("i am FINE") = "I Am FINE"
* </pre>
- *
+ *
* @param str the String to capitalize, may be null
* @return capitalized String, <code>null</code> if null String input
* @see #uncapitalize(String)
@@ -374,8 +374,8 @@ public class WordUtils {
/**
* <p>Capitalizes all the delimiter separated words in a String.
- * Only the first character of each word is changed. To convert the
- * rest of each word to lowercase at the same time,
+ * Only the first character of each word is changed. To convert the
+ * rest of each word to lowercase at the same time,
* use {@link #capitalizeFully(String, char[])}.</p>
*
* <p>The delimiters represent a set of characters understood to separate words.
@@ -393,7 +393,7 @@ public class WordUtils {
* WordUtils.capitalize("i am fine", null) = "I Am Fine"
* WordUtils.capitalize("i aM.fine", {'.'}) = "I aM.Fine"
* </pre>
- *
+ *
* @param str the String to capitalize, may be null
* @param delimiters set of characters to determine capitalization, null means whitespace
* @return capitalized String, <code>null</code> if null String input
@@ -422,8 +422,8 @@ public class WordUtils {
//-----------------------------------------------------------------------
/**
- * <p>Converts all the whitespace separated words in a String into capitalized words,
- * that is each word is made up of a titlecase character and then a series of
+ * <p>Converts all the whitespace separated words in a String into capitalized words,
+ * that is each word is made up of a titlecase character and then a series of
* lowercase characters. </p>
*
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.
@@ -436,7 +436,7 @@ public class WordUtils {
* WordUtils.capitalizeFully("") = ""
* WordUtils.capitalizeFully("i am FINE") = "I Am Fine"
* </pre>
- *
+ *
* @param str the String to capitalize, may be null
* @return capitalized String, <code>null</code> if null String input
*/
@@ -445,8 +445,8 @@ public class WordUtils {
}
/**
- * <p>Converts all the delimiter separated words in a String into capitalized words,
- * that is each word is made up of a titlecase character and then a series of
+ * <p>Converts all the delimiter separated words in a String into capitalized words,
+ * that is each word is made up of a titlecase character and then a series of
* lowercase characters. </p>
*
* <p>The delimiters represent a set of characters understood to separate words.
@@ -464,7 +464,7 @@ public class WordUtils {
* WordUtils.capitalizeFully(*, new char[0]) = *
* WordUtils.capitalizeFully("i aM.fine", {'.'}) = "I am.Fine"
* </pre>
- *
+ *
* @param str the String to capitalize, may be null
* @param delimiters set of characters to determine capitalization, null means whitespace
* @return capitalized String, <code>null</code> if null String input
@@ -492,7 +492,7 @@ public class WordUtils {
* WordUtils.uncapitalize("") = ""
* WordUtils.uncapitalize("I Am FINE") = "i am fINE"
* </pre>
- *
+ *
* @param str the String to uncapitalize, may be null
* @return uncapitalized String, <code>null</code> if null String input
* @see #capitalize(String)
@@ -519,7 +519,7 @@ public class WordUtils {
* WordUtils.uncapitalize(*, new char[0]) = *
* WordUtils.uncapitalize("I AM.FINE", {'.'}) = "i AM.fINE"
* </pre>
- *
+ *
* @param str the String to uncapitalize, may be null
* @param delimiters set of characters to determine uncapitalization, null means whitespace
* @return uncapitalized String, <code>null</code> if null String input
@@ -548,23 +548,23 @@ public class WordUtils {
//-----------------------------------------------------------------------
/**
* <p>Swaps the case of a String using a word based algorithm.</p>
- *
+ *
* <ul>
* <li>Upper case character converts to Lower case</li>
* <li>Title case character converts to Lower case</li>
* <li>Lower case character after Whitespace or at start converts to Title case</li>
* <li>Other Lower case character converts to Upper case</li>
* </ul>
- *
+ *
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.
* A <code>null</code> input String returns <code>null</code>.</p>
- *
+ *
* <pre>
* StringUtils.swapCase(null) = null
* StringUtils.swapCase("") = ""
* StringUtils.swapCase("The dog has a BONE") = "tHE DOG HAS A bone"
* </pre>
- *
+ *
* @param str the String to swap case, may be null
* @return the changed String, <code>null</code> if null String input
*/
@@ -601,7 +601,7 @@ public class WordUtils {
//-----------------------------------------------------------------------
/**
* <p>Extracts the initial characters from each word in the String.</p>
- *
+ *
* <p>All first characters after whitespace are returned as a new string.
* Their case is not changed.</p>
*
@@ -626,7 +626,7 @@ public class WordUtils {
/**
* <p>Extracts the initial characters from each word in the String.</p>
- *
+ *
* <p>All first characters after the defined delimiters are returned as a new string.
* Their case is not changed.</p>
*
@@ -643,7 +643,7 @@ public class WordUtils {
* WordUtils.initials("Ben J.Lee", [' ','.']) = "BJL"
* WordUtils.initials(*, new char[0]) = ""
* </pre>
- *
+ *
* @param str the String to get initials from, may be null
* @param delimiters set of characters to determine words, null means whitespace
* @return String of initial characters, <code>null</code> if null String input
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java b/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java
index 6f4519c..86b22bb 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/AggregateTranslator.java
@@ -5,9 +5,9 @@
* 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.
@@ -22,9 +22,9 @@ import java.io.Writer;
import org.apache.commons.lang3.ArrayUtils;
/**
- * Executes a sequence of translators one after the other. Execution ends whenever
+ * Executes a sequence of translators one after the other. Execution ends whenever
* the first translator consumes codepoints from the input.
- *
+ *
* @since 3.0
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/AggregateTranslator.html">
@@ -36,7 +36,7 @@ public class AggregateTranslator extends CharSequenceTranslator {
private final CharSequenceTranslator[] translators;
/**
- * Specify the translators to be used at creation time.
+ * Specify the translators to be used at creation time.
*
* @param translators CharSequenceTranslator array to aggregate
*/
@@ -45,8 +45,8 @@ public class AggregateTranslator extends CharSequenceTranslator {
}
/**
- * The first translator to consume codepoints from the input is the 'winner'.
- * Execution stops with the number of consumed codepoints being returned.
+ * The first translator to consume codepoints from the input is the 'winner'.
+ * Execution stops with the number of consumed codepoints being returned.
* {@inheritDoc}
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
----------------------------------------------------------------------
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 17fb8ac..e79ebe6 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
@@ -5,9 +5,9 @@
* 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.
@@ -22,10 +22,10 @@ import java.io.Writer;
import java.util.Locale;
/**
- * An API for translating text.
- * Its core use is to escape and unescape text. Because escaping and unescaping
+ * An API for translating text.
+ * Its core use is to escape and unescape text. Because escaping and unescaping
* is completely contextual, the API does not present two separate signatures.
- *
+ *
* @since 3.0
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/translate/CharSequenceTranslator.html">
@@ -37,10 +37,10 @@ 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'};
/**
- * Translate a set of codepoints, represented by an int index into a CharSequence,
- * into another set of codepoints. The number of codepoints consumed must be returned,
- * and the only IOExceptions thrown must be from interacting with the Writer so that
- * the top level API may reliably ignore StringWriter IOExceptions.
+ * Translate a set of codepoints, represented by an int index into a CharSequence,
+ * into another set of codepoints. The number of codepoints consumed must be returned,
+ * and the only IOExceptions thrown must be from interacting with the Writer so that
+ * the top level API may reliably ignore StringWriter IOExceptions.
*
* @param input CharSequence that is being translated
* @param index int representing the current point of translation
@@ -51,7 +51,7 @@ public abstract class CharSequenceTranslator {
public abstract int translate(CharSequence input, int index, Writer out) throws IOException;
/**
- * Helper for non-Writer usage.
+ * Helper for non-Writer usage.
* @param input CharSequence to be translated
* @return String output of translation
*/
@@ -70,8 +70,8 @@ public abstract class CharSequenceTranslator {
}
/**
- * Translate an input onto a Writer. This is intentionally final as its algorithm is
- * tightly coupled with the abstract method of this class.
+ * Translate an input onto a Writer. This is intentionally final as its algorithm is
+ * tightly coupled with the abstract method of this class.
*
* @param input CharSequence that is being translated
* @param out Writer to translate the text to
@@ -112,7 +112,7 @@ public abstract class CharSequenceTranslator {
}
/**
- * Helper method to create a merger of this translator with another set of
+ * Helper method to create a merger of this translator with another set of
* translators. Useful in customizing the standard functionality.
*
* @param translators CharSequenceTranslator array of translators to merge with this one
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java b/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java
index 92ed505..003dd77 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/CodePointTranslator.java
@@ -5,9 +5,9 @@
* 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.
@@ -20,9 +20,9 @@ import java.io.IOException;
import java.io.Writer;
/**
- * Helper subclass to CharSequenceTranslator to allow for translations that
+ * Helper subclass to CharSequenceTranslator to allow for translations that
* will replace up to one character at a time.
- *
+ *
* @since 3.0
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/translate/CodePointTranslator.html">
@@ -32,19 +32,19 @@ import java.io.Writer;
public abstract class CodePointTranslator extends CharSequenceTranslator {
/**
- * Implementation of translate that maps onto the abstract translate(int, Writer) method.
+ * Implementation of translate that maps onto the abstract translate(int, Writer) method.
* {@inheritDoc}
*/
@Override
public final int translate(final CharSequence input, final int index, final Writer out) throws IOException {
final int codepoint = Character.codePointAt(input, index);
final boolean consumed = translate(codepoint, out);
- return consumed ? 1 : 0;
+ return consumed ? 1 : 0;
}
/**
- * Translate the specified codepoint into another.
- *
+ * Translate the specified codepoint into another.
+ *
* @param codepoint int character input to translate
* @param out Writer to optionally push the translated output to
* @return boolean as to whether translation occurred or not
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java b/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java
index d02a057..150cfaf 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/JavaUnicodeEscaper.java
@@ -18,7 +18,7 @@ package org.apache.commons.lang3.text.translate;
/**
* Translates codepoints to their Unicode escaped value suitable for Java source.
- *
+ *
* @since 3.2
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/translate/UnicodeEscaper.html">
@@ -31,7 +31,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
* <p>
* Constructs a <code>JavaUnicodeEscaper</code> above the specified value (exclusive).
* </p>
- *
+ *
* @param codepoint
* above which to escape
* @return the newly created {@code UnicodeEscaper} instance
@@ -44,7 +44,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
* <p>
* Constructs a <code>JavaUnicodeEscaper</code> below the specified value (exclusive).
* </p>
- *
+ *
* @param codepoint
* below which to escape
* @return the newly created {@code UnicodeEscaper} instance
@@ -57,7 +57,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
* <p>
* Constructs a <code>JavaUnicodeEscaper</code> between the specified values (inclusive).
* </p>
- *
+ *
* @param codepointLow
* above which to escape
* @param codepointHigh
@@ -72,7 +72,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
* <p>
* Constructs a <code>JavaUnicodeEscaper</code> outside of the specified values (exclusive).
* </p>
- *
+ *
* @param codepointLow
* below which to escape
* @param codepointHigh
@@ -89,7 +89,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
* other constructors/builders. The <code>below</code> and <code>above</code> boundaries are inclusive when
* <code>between</code> is <code>true</code> and exclusive when it is <code>false</code>.
* </p>
- *
+ *
* @param below
* int value representing the lowest codepoint boundary
* @param above
@@ -103,7 +103,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
/**
* Converts the given codepoint to a hex string of the form {@code "\\uXXXX\\uXXXX"}
- *
+ *
* @param codepoint
* a Unicode code point
* @return the hex string for the given codepoint
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java b/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
index e00983e..5e80154 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java b/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
index bfb5f85..d01a420 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
@@ -5,9 +5,9 @@
* 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.
@@ -22,11 +22,11 @@ import java.util.Arrays;
import java.util.EnumSet;
/**
- * Translate XML numeric entities of the form &#[xX]?\d+;? to
+ * Translate XML numeric entities of the form &#[xX]?\d+;? to
* the specific codepoint.
*
* Note that the semi-colon is optional.
- *
+ *
* @since 3.0
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/translate/NumericEntityUnescaper.html">
@@ -43,8 +43,8 @@ public class NumericEntityUnescaper extends CharSequenceTranslator {
/**
* Create a UnicodeUnescaper.
*
- * The constructor takes a list of options, only one type of which is currently
- * available (whether to allow, error or ignore the semi-colon on the end of a
+ * The constructor takes a list of options, only one type of which is currently
+ * available (whether to allow, error or ignore the semi-colon on the end of a
* numeric entity to being missing).
*
* For example, to support numeric entities without a ';':
@@ -52,7 +52,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator {
* and to throw an IllegalArgumentException when they're missing:
* new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon)
*
- * Note that the default behaviour is to ignore them.
+ * Note that the default behaviour is to ignore them.
*
* @param options to apply to this unescaper
*/
@@ -70,7 +70,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator {
* @param option to check state of
* @return whether the option is set
*/
- public boolean isSet(final OPTION option) {
+ public boolean isSet(final OPTION option) {
return options == null ? false : options.contains(option);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java b/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java
index 5a27d50..e8ac357 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/OctalUnescaper.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,9 +24,9 @@ import java.io.Writer;
*
* For example, "\45" should go back to being the specific value (a %).
*
- * Note that this currently only supports the viable range of octal for Java; namely
+ * Note that this currently only supports the viable range of octal for Java; namely
* 1 to 377. This is because parsing Java is the main use case.
- *
+ *
* @since 3.0
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/translate/OctalUnescaper.html">
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java b/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java
index b7ee38f..5771d15 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/UnicodeEscaper.java
@@ -129,7 +129,7 @@ public class UnicodeEscaper extends CodePointTranslator {
/**
* Converts the given codepoint to a hex string of the form {@code "\\uXXXX"}
- *
+ *
* @param codepoint
* a Unicode code point
* @return the hex string for the given codepoint
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java b/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java
index 0f2fd25..52d8df4 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java
@@ -5,9 +5,9 @@
* 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.
@@ -20,10 +20,10 @@ import java.io.IOException;
import java.io.Writer;
/**
- * Translates escaped Unicode values of the form \\u+\d\d\d\d back to
- * Unicode. It supports multiple 'u' characters and will work with or
+ * Translates escaped Unicode values of the form \\u+\d\d\d\d back to
+ * Unicode. It supports multiple 'u' characters and will work with or
* without the +.
- *
+ *
* @since 3.0
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/translate/UnicodeUnescaper.html">
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemover.java b/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemover.java
index 39249c3..0115422 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemover.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemover.java
@@ -21,7 +21,7 @@ import java.io.Writer;
/**
* Helper subclass to CharSequenceTranslator to remove unpaired surrogates.
- *
+ *
* @deprecated as of 3.6, use commons-text
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.html">
* UnicodeUnpairedSurrogateRemover</a> instead
@@ -29,7 +29,7 @@ import java.io.Writer;
@Deprecated
public class UnicodeUnpairedSurrogateRemover extends CodePointTranslator {
/**
- * Implementation of translate that throws out unpaired surrogates.
+ * Implementation of translate that throws out unpaired surrogates.
* {@inheritDoc}
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java b/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java
index 3f78753..09d2c52 100644
--- a/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -27,7 +27,7 @@ import java.util.TimeZone;
* <p>Formatting is performed using the thread-safe
* {@link org.apache.commons.lang3.time.FastDateFormat} class.</p>
*
- * <p>Note that the JDK has a bug wherein calling Calendar.get(int) will
+ * <p>Note that the JDK has a bug wherein calling Calendar.get(int) will
* override any previously called Calendar.clear() calls. See LANG-755.</p>
*
* @since 2.0
@@ -206,7 +206,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern using the UTC time zone.</p>
- *
+ *
* @param millis the date to format expressed in milliseconds
* @param pattern the pattern to use to format the date, not null
* @return the formatted date
@@ -217,7 +217,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern using the UTC time zone.</p>
- *
+ *
* @param date the date to format, not null
* @param pattern the pattern to use to format the date, not null
* @return the formatted date
@@ -225,10 +225,10 @@ public class DateFormatUtils {
public static String formatUTC(final Date date, final String pattern) {
return format(date, pattern, UTC_TIME_ZONE, null);
}
-
+
/**
* <p>Formats a date/time into a specific pattern using the UTC time zone.</p>
- *
+ *
* @param millis the date to format expressed in milliseconds
* @param pattern the pattern to use to format the date, not null
* @param locale the locale to use, may be <code>null</code>
@@ -240,7 +240,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern using the UTC time zone.</p>
- *
+ *
* @param date the date to format, not null
* @param pattern the pattern to use to format the date, not null
* @param locale the locale to use, may be <code>null</code>
@@ -249,10 +249,10 @@ public class DateFormatUtils {
public static String formatUTC(final Date date, final String pattern, final Locale locale) {
return format(date, pattern, UTC_TIME_ZONE, locale);
}
-
+
/**
* <p>Formats a date/time into a specific pattern.</p>
- *
+ *
* @param millis the date to format expressed in milliseconds
* @param pattern the pattern to use to format the date, not null
* @return the formatted date
@@ -263,7 +263,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern.</p>
- *
+ *
* @param date the date to format, not null
* @param pattern the pattern to use to format the date, not null
* @return the formatted date
@@ -274,7 +274,7 @@ public class DateFormatUtils {
/**
* <p>Formats a calendar into a specific pattern.</p>
- *
+ *
* @param calendar the calendar to format, not null
* @param pattern the pattern to use to format the calendar, not null
* @return the formatted calendar
@@ -284,10 +284,10 @@ public class DateFormatUtils {
public static String format(final Calendar calendar, final String pattern) {
return format(calendar, pattern, null, null);
}
-
+
/**
* <p>Formats a date/time into a specific pattern in a time zone.</p>
- *
+ *
* @param millis the time expressed in milliseconds
* @param pattern the pattern to use to format the date, not null
* @param timeZone the time zone to use, may be <code>null</code>
@@ -299,7 +299,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern in a time zone.</p>
- *
+ *
* @param date the date to format, not null
* @param pattern the pattern to use to format the date, not null
* @param timeZone the time zone to use, may be <code>null</code>
@@ -311,7 +311,7 @@ public class DateFormatUtils {
/**
* <p>Formats a calendar into a specific pattern in a time zone.</p>
- *
+ *
* @param calendar the calendar to format, not null
* @param pattern the pattern to use to format the calendar, not null
* @param timeZone the time zone to use, may be <code>null</code>
@@ -325,7 +325,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern in a locale.</p>
- *
+ *
* @param millis the date to format expressed in milliseconds
* @param pattern the pattern to use to format the date, not null
* @param locale the locale to use, may be <code>null</code>
@@ -337,7 +337,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern in a locale.</p>
- *
+ *
* @param date the date to format, not null
* @param pattern the pattern to use to format the date, not null
* @param locale the locale to use, may be <code>null</code>
@@ -349,7 +349,7 @@ public class DateFormatUtils {
/**
* <p>Formats a calendar into a specific pattern in a locale.</p>
- *
+ *
* @param calendar the calendar to format, not null
* @param pattern the pattern to use to format the calendar, not null
* @param locale the locale to use, may be <code>null</code>
@@ -363,7 +363,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern in a time zone and locale.</p>
- *
+ *
* @param millis the date to format expressed in milliseconds
* @param pattern the pattern to use to format the date, not null
* @param timeZone the time zone to use, may be <code>null</code>
@@ -376,7 +376,7 @@ public class DateFormatUtils {
/**
* <p>Formats a date/time into a specific pattern in a time zone and locale.</p>
- *
+ *
* @param date the date to format, not null
* @param pattern the pattern to use to format the date, not null, not null
* @param timeZone the time zone to use, may be <code>null</code>
@@ -390,7 +390,7 @@ public class DateFormatUtils {
/**
* <p>Formats a calendar into a specific pattern in a time zone and locale.</p>
- *
+ *
* @param calendar the calendar to format, not null
* @param pattern the pattern to use to format the calendar, not null
* @param timeZone the time zone to use, may be <code>null</code>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/DateParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/DateParser.java b/src/main/java/org/apache/commons/lang3/time/DateParser.java
index 3702603..2836e9e 100644
--- a/src/main/java/org/apache/commons/lang3/time/DateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/DateParser.java
@@ -30,30 +30,30 @@ import java.util.TimeZone;
* <p>
* Warning: Since binary compatible methods may be added to this interface in any
* release, developers are not expected to implement this interface.
- *
+ *
* @since 3.2
*/
public interface DateParser {
/**
- * Equivalent to DateFormat.parse(String).
- *
- * See {@link java.text.DateFormat#parse(String)} for more information.
- * @param source A <code>String</code> whose beginning should be parsed.
+ * Equivalent to DateFormat.parse(String).
+ *
+ * See {@link java.text.DateFormat#parse(String)} for more information.
+ * @param source A <code>String</code> whose beginning should be parsed.
* @return A <code>Date</code> parsed from the string
* @throws ParseException if the beginning of the specified string cannot be parsed.
*/
Date parse(String source) throws ParseException;
/**
- * Equivalent to DateFormat.parse(String, ParsePosition).
- *
- * See {@link java.text.DateFormat#parse(String, ParsePosition)} for more information.
- *
+ * Equivalent to DateFormat.parse(String, ParsePosition).
+ *
+ * See {@link java.text.DateFormat#parse(String, ParsePosition)} for more information.
+ *
* @param source A <code>String</code>, part of which should be parsed.
- * @param pos A <code>ParsePosition</code> object with index and error index information
- * as described above.
- * @return A <code>Date</code> parsed from the string. In case of error, returns null.
+ * @param pos A <code>ParsePosition</code> object with index and error index information
+ * as described above.
+ * @return A <code>Date</code> parsed from the string. In case of error, returns null.
* @throws NullPointerException if text or pos is null.
*/
Date parse(String source, ParsePosition pos);
@@ -70,7 +70,7 @@ public interface DateParser {
* @return true, if source has been parsed (pos parsePosition is updated); otherwise false (and pos errorIndex is updated)
* @throws IllegalArgumentException when Calendar has been set to be not lenient, and a parsed field is
* out of range.
- *
+ *
* @since 3.5
*/
boolean parse(String source, ParsePosition pos, Calendar calendar);
@@ -79,7 +79,7 @@ public interface DateParser {
//-----------------------------------------------------------------------
/**
* <p>Gets the pattern used by this parser.</p>
- *
+ *
* @return the pattern, {@link java.text.SimpleDateFormat} compatible
*/
String getPattern();
@@ -88,40 +88,40 @@ public interface DateParser {
* <p>
* Gets the time zone used by this parser.
* </p>
- *
+ *
* <p>
* The default {@link TimeZone} used to create a {@link Date} when the {@link TimeZone} is not specified by
* the format pattern.
* </p>
- *
+ *
* @return the time zone
*/
TimeZone getTimeZone();
/**
* <p>Gets the locale used by this parser.</p>
- *
+ *
* @return the locale
*/
Locale getLocale();
/**
* Parses text from a string to produce a Date.
- *
+ *
* @param source A <code>String</code> whose beginning should be parsed.
* @return a <code>java.util.Date</code> object
* @throws ParseException if the beginning of the specified string cannot be parsed.
- * @see java.text.DateFormat#parseObject(String)
+ * @see java.text.DateFormat#parseObject(String)
*/
Object parseObject(String source) throws ParseException;
/**
* Parses a date/time string according to the given parse position.
- *
+ *
* @param source A <code>String</code> whose beginning should be parsed.
* @param pos the parse position
* @return a <code>java.util.Date</code> object
- * @see java.text.DateFormat#parseObject(String, ParsePosition)
+ * @see java.text.DateFormat#parseObject(String, ParsePosition)
*/
Object parseObject(String source, ParsePosition pos);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/DatePrinter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/DatePrinter.java b/src/main/java/org/apache/commons/lang3/time/DatePrinter.java
index 342405a..eebcbee 100644
--- a/src/main/java/org/apache/commons/lang3/time/DatePrinter.java
+++ b/src/main/java/org/apache/commons/lang3/time/DatePrinter.java
@@ -23,13 +23,13 @@ import java.util.Locale;
import java.util.TimeZone;
/**
- * DatePrinter is the "missing" interface for the format methods of
+ * DatePrinter is the "missing" interface for the format methods of
* {@link java.text.DateFormat}. You can obtain an object implementing this
* interface by using one of the FastDateFormat factory methods.
* <p>
* Warning: Since binary compatible methods may be added to this interface in any
* release, developers are not expected to implement this interface.
- *
+ *
* @since 3.2
*/
public interface DatePrinter {
[27/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
----------------------------------------------------------------------
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 0d512fe..1175f5d 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -30,7 +30,7 @@ import org.apache.commons.lang3.Validate;
* @since 2.0
*/
public class NumberUtils {
-
+
/** Reusable Long constant for zero. */
public static final Long LONG_ZERO = Long.valueOf(0L);
/** Reusable Long constant for one. */
@@ -222,7 +222,7 @@ public class NumberUtils {
public static float toFloat(final String str, final float defaultValue) {
if (str == null) {
return defaultValue;
- }
+ }
try {
return Float.parseFloat(str);
} catch (final NumberFormatException nfe) {
@@ -425,7 +425,7 @@ public class NumberUtils {
* prefix is more than 8 - or BigInteger if there are more than 16 digits.
* </p>
* <p>Then, the value is examined for a type qualifier on the end, i.e. one of
- * <code>'f','F','d','D','l','L'</code>. If it is found, it starts
+ * <code>'f','F','d','D','l','L'</code>. If it is found, it starts
* trying to create successively larger types from the type specified
* until one is found that can represent the value.</p>
*
@@ -433,7 +433,7 @@ public class NumberUtils {
* and then try successively larger types from <code>Integer</code> to
* <code>BigInteger</code> and from <code>Float</code> to
* <code>BigDecimal</code>.</p>
- *
+ *
* <p>
* Integral values with a leading {@code 0} will be interpreted as octal; the returned number will
* be Integer, Long or BigDecimal as appropriate.
@@ -621,7 +621,7 @@ public class NumberUtils {
* <p>Utility method for {@link #createNumber(java.lang.String)}.</p>
*
* <p>Returns mantissa of the given number.</p>
- *
+ *
* @param str the string representation of the number
* @return mantissa of the given number
*/
@@ -633,7 +633,7 @@ public class NumberUtils {
* <p>Utility method for {@link #createNumber(java.lang.String)}.</p>
*
* <p>Returns mantissa of the given number.</p>
- *
+ *
* @param str the string representation of the number
* @param stopPos the position of the exponent or decimal point
* @return mantissa of the given number
@@ -649,7 +649,7 @@ public class NumberUtils {
* <p>Utility method for {@link #createNumber(java.lang.String)}.</p>
*
* <p>Returns <code>true</code> if s is <code>null</code>.</p>
- *
+ *
* @param str the String to check
* @return if it is all zeros or <code>null</code>
*/
@@ -670,7 +670,7 @@ public class NumberUtils {
* <p>Convert a <code>String</code> to a <code>Float</code>.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
- *
+ *
* @param str a <code>String</code> to convert, may be null
* @return converted <code>Float</code> (or null if the input is null)
* @throws NumberFormatException if the value cannot be converted
@@ -684,7 +684,7 @@ public class NumberUtils {
/**
* <p>Convert a <code>String</code> to a <code>Double</code>.</p>
- *
+ *
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
@@ -704,7 +704,7 @@ public class NumberUtils {
* N.B. a leading zero means octal; spaces are not trimmed.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
- *
+ *
* @param str a <code>String</code> to convert, may be null
* @return converted <code>Integer</code> (or null if the input is null)
* @throws NumberFormatException if the value cannot be converted
@@ -718,10 +718,10 @@ public class NumberUtils {
}
/**
- * <p>Convert a <code>String</code> to a <code>Long</code>;
+ * <p>Convert a <code>String</code> to a <code>Long</code>;
* since 3.1 it handles hex (0Xhhhh) and octal (0ddd) notations.
* N.B. a leading zero means octal; spaces are not trimmed.</p>
- *
+ *
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
@@ -740,7 +740,7 @@ public class NumberUtils {
* since 3.2 it handles hex (0x or #) and octal (0) notations.</p>
*
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
- *
+ *
* @param str a <code>String</code> to convert, may be null
* @return converted <code>BigInteger</code> (or null if the input is null)
* @throws NumberFormatException if the value cannot be converted
@@ -773,7 +773,7 @@ public class NumberUtils {
/**
* <p>Convert a <code>String</code> to a <code>BigDecimal</code>.</p>
- *
+ *
* <p>Returns <code>null</code> if the string is <code>null</code>.</p>
*
* @param str a <code>String</code> to convert, may be null
@@ -790,8 +790,8 @@ public class NumberUtils {
}
if (str.trim().startsWith("--")) {
// this is protection for poorness in java.lang.BigDecimal.
- // it accepts this as a legal value, but it does not appear
- // to be in specification of class. OS X Java parses it to
+ // it accepts this as a legal value, but it does not appear
+ // to be in specification of class. OS X Java parses it to
// a wrong value.
throw new NumberFormatException(str + " is not a valid number.");
}
@@ -802,7 +802,7 @@ public class NumberUtils {
//--------------------------------------------------------------------
/**
* <p>Returns the minimum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -812,7 +812,7 @@ public class NumberUtils {
public static long min(final long... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns min
long min = array[0];
for (int i = 1; i < array.length; i++) {
@@ -820,13 +820,13 @@ public class NumberUtils {
min = array[i];
}
}
-
+
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -836,7 +836,7 @@ public class NumberUtils {
public static int min(final int... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns min
int min = array[0];
for (int j = 1; j < array.length; j++) {
@@ -844,13 +844,13 @@ public class NumberUtils {
min = array[j];
}
}
-
+
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -860,7 +860,7 @@ public class NumberUtils {
public static short min(final short... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns min
short min = array[0];
for (int i = 1; i < array.length; i++) {
@@ -868,13 +868,13 @@ public class NumberUtils {
min = array[i];
}
}
-
+
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -884,7 +884,7 @@ public class NumberUtils {
public static byte min(final byte... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns min
byte min = array[0];
for (int i = 1; i < array.length; i++) {
@@ -892,13 +892,13 @@ public class NumberUtils {
min = array[i];
}
}
-
+
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -909,7 +909,7 @@ public class NumberUtils {
public static double min(final double... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns min
double min = array[0];
for (int i = 1; i < array.length; i++) {
@@ -920,13 +920,13 @@ public class NumberUtils {
min = array[i];
}
}
-
+
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -937,7 +937,7 @@ public class NumberUtils {
public static float min(final float... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns min
float min = array[0];
for (int i = 1; i < array.length; i++) {
@@ -948,7 +948,7 @@ public class NumberUtils {
min = array[i];
}
}
-
+
return min;
}
@@ -956,7 +956,7 @@ public class NumberUtils {
//--------------------------------------------------------------------
/**
* <p>Returns the maximum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -980,7 +980,7 @@ public class NumberUtils {
/**
* <p>Returns the maximum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -990,7 +990,7 @@ public class NumberUtils {
public static int max(final int... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns max
int max = array[0];
for (int j = 1; j < array.length; j++) {
@@ -998,13 +998,13 @@ public class NumberUtils {
max = array[j];
}
}
-
+
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -1014,7 +1014,7 @@ public class NumberUtils {
public static short max(final short... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns max
short max = array[0];
for (int i = 1; i < array.length; i++) {
@@ -1022,13 +1022,13 @@ public class NumberUtils {
max = array[i];
}
}
-
+
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -1038,7 +1038,7 @@ public class NumberUtils {
public static byte max(final byte... array) {
// Validates input
validateArray(array);
-
+
// Finds and returns max
byte max = array[0];
for (int i = 1; i < array.length; i++) {
@@ -1046,13 +1046,13 @@ public class NumberUtils {
max = array[i];
}
}
-
+
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -1074,13 +1074,13 @@ public class NumberUtils {
max = array[j];
}
}
-
+
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -1114,14 +1114,14 @@ public class NumberUtils {
*/
private static void validateArray(final Object array) {
Validate.isTrue(array != null, "The Array must not be null");
- Validate.isTrue(Array.getLength(array) != 0, "Array cannot be empty.");
+ Validate.isTrue(Array.getLength(array) != 0, "Array cannot be empty.");
}
-
+
// 3 param min
//-----------------------------------------------------------------------
/**
* <p>Gets the minimum of three <code>long</code> values.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1139,7 +1139,7 @@ public class NumberUtils {
/**
* <p>Gets the minimum of three <code>int</code> values.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1157,7 +1157,7 @@ public class NumberUtils {
/**
* <p>Gets the minimum of three <code>short</code> values.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1175,7 +1175,7 @@ public class NumberUtils {
/**
* <p>Gets the minimum of three <code>byte</code> values.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1193,10 +1193,10 @@ public class NumberUtils {
/**
* <p>Gets the minimum of three <code>double</code> values.</p>
- *
+ *
* <p>If any value is <code>NaN</code>, <code>NaN</code> is
* returned. Infinity is handled.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1209,7 +1209,7 @@ public class NumberUtils {
/**
* <p>Gets the minimum of three <code>float</code> values.</p>
- *
+ *
* <p>If any value is <code>NaN</code>, <code>NaN</code> is
* returned. Infinity is handled.</p>
*
@@ -1227,7 +1227,7 @@ public class NumberUtils {
//-----------------------------------------------------------------------
/**
* <p>Gets the maximum of three <code>long</code> values.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1245,7 +1245,7 @@ public class NumberUtils {
/**
* <p>Gets the maximum of three <code>int</code> values.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1263,7 +1263,7 @@ public class NumberUtils {
/**
* <p>Gets the maximum of three <code>short</code> values.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1281,7 +1281,7 @@ public class NumberUtils {
/**
* <p>Gets the maximum of three <code>byte</code> values.</p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -1299,7 +1299,7 @@ public class NumberUtils {
/**
* <p>Gets the maximum of three <code>double</code> values.</p>
- *
+ *
* <p>If any value is <code>NaN</code>, <code>NaN</code> is
* returned. Infinity is handled.</p>
*
@@ -1315,7 +1315,7 @@ public class NumberUtils {
/**
* <p>Gets the maximum of three <code>float</code> values.</p>
- *
+ *
* <p>If any value is <code>NaN</code>, <code>NaN</code> is
* returned. Infinity is handled.</p>
*
@@ -1432,7 +1432,7 @@ public class NumberUtils {
return false;
}
}
- return true;
+ return true;
}
}
sz--; // don't want to loop to the last char, check it afterwords
@@ -1447,7 +1447,7 @@ public class NumberUtils {
} else if (chars[i] == '.') {
if (hasDecPoint || hasExp) {
- // two decimal points or dec in exponent
+ // two decimal points or dec in exponent
return false;
}
hasDecPoint = true;
@@ -1512,7 +1512,7 @@ public class NumberUtils {
// found digit it to make sure weird stuff like '.' and '1E-' doesn't pass
return !allowSigns && foundDigit;
}
-
+
/**
* <p>Checks whether the given String is a parsable number.</p>
*
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/Mutable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/mutable/Mutable.java b/src/main/java/org/apache/commons/lang3/mutable/Mutable.java
index 301cac2..85f2bdc 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/Mutable.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/Mutable.java
@@ -5,9 +5,9 @@
* 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.
@@ -25,22 +25,22 @@ package org.apache.commons.lang3.mutable;
* A typical use case would be to enable a primitive or string to be passed to a method and allow that method to
* effectively change the value of the primitive/string. Another use case is to store a frequently changing primitive in
* a collection (for example a total in a map) without needing to create new Integer/Long wrapper objects.
- *
- * @param <T> the type to set and get
+ *
+ * @param <T> the type to set and get
* @since 2.1
*/
public interface Mutable<T> {
/**
* Gets the value of this mutable.
- *
+ *
* @return the stored value
*/
T getValue();
/**
* Sets the value of this mutable.
- *
+ *
* @param value
* the value to store
* @throws NullPointerException
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java b/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java
index 97781bf..1aec693 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,8 +24,8 @@ import org.apache.commons.lang3.BooleanUtils;
/**
* A mutable <code>boolean</code> wrapper.
* <p>
- * Note that as MutableBoolean does not extend Boolean, it is not treated by String.format as a Boolean parameter.
- *
+ * Note that as MutableBoolean does not extend Boolean, it is not treated by String.format as a Boolean parameter.
+ *
* @see Boolean
* @since 2.2
*/
@@ -33,7 +33,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = -4830728138360036487L;
@@ -50,7 +50,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Constructs a new MutableBoolean with the specified value.
- *
+ *
* @param value the initial value to store
*/
public MutableBoolean(final boolean value) {
@@ -60,7 +60,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Constructs a new MutableBoolean with the specified value.
- *
+ *
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
@@ -72,7 +72,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
//-----------------------------------------------------------------------
/**
* Gets the value as a Boolean instance.
- *
+ *
* @return the value as a Boolean, never null
*/
@Override
@@ -82,7 +82,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Sets the value.
- *
+ *
* @param value the value to set
*/
public void setValue(final boolean value) {
@@ -91,7 +91,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Sets the value to false.
- *
+ *
* @since 3.3
*/
public void setFalse() {
@@ -100,7 +100,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Sets the value to true.
- *
+ *
* @since 3.3
*/
public void setTrue() {
@@ -109,7 +109,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Sets the value from any Boolean instance.
- *
+ *
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
@@ -121,7 +121,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
//-----------------------------------------------------------------------
/**
* Checks if the current value is <code>true</code>.
- *
+ *
* @return <code>true</code> if the current value is <code>true</code>
* @since 2.5
*/
@@ -131,7 +131,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Checks if the current value is <code>false</code>.
- *
+ *
* @return <code>true</code> if the current value is <code>false</code>
* @since 2.5
*/
@@ -142,7 +142,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
//-----------------------------------------------------------------------
/**
* Returns the value of this MutableBoolean as a boolean.
- *
+ *
* @return the boolean value represented by this object.
*/
public boolean booleanValue() {
@@ -165,7 +165,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument is
* not <code>null</code> and is an <code>MutableBoolean</code> object that contains the same
* <code>boolean</code> value as this object.
- *
+ *
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@@ -179,7 +179,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Returns a suitable hash code for this mutable.
- *
+ *
* @return the hash code returned by <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code>
*/
@Override
@@ -190,7 +190,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
- *
+ *
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
* where false is less than true
@@ -203,7 +203,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
- *
+ *
* @return the mutable value as a string
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
----------------------------------------------------------------------
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 5ceb9bb..0d07749 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java
@@ -5,9 +5,9 @@
* 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.
@@ -21,8 +21,8 @@ import org.apache.commons.lang3.math.NumberUtils;
/**
* A mutable <code>byte</code> wrapper.
* <p>
- * Note that as MutableByte does not extend Byte, it is not treated by String.format as a Byte parameter.
- *
+ * Note that as MutableByte does not extend Byte, it is not treated by String.format as a Byte parameter.
+ *
* @see Byte
* @since 2.1
*/
@@ -30,7 +30,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = -1585823265L;
@@ -47,7 +47,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Constructs a new MutableByte with the specified value.
- *
+ *
* @param value the initial value to store
*/
public MutableByte(final byte value) {
@@ -57,7 +57,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Constructs a new MutableByte with the specified value.
- *
+ *
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
@@ -68,7 +68,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Constructs a new MutableByte parsing the given string.
- *
+ *
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a byte
* @since 2.5
@@ -81,7 +81,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
//-----------------------------------------------------------------------
/**
* Gets the value as a Byte instance.
- *
+ *
* @return the value as a Byte, never null
*/
@Override
@@ -91,7 +91,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Sets the value.
- *
+ *
* @param value the value to set
*/
public void setValue(final byte value) {
@@ -100,7 +100,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Sets the value from any Number instance.
- *
+ *
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
@@ -181,7 +181,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
//-----------------------------------------------------------------------
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
@@ -191,7 +191,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -202,7 +202,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
@@ -212,7 +212,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -344,7 +344,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument is
* not <code>null</code> and is a <code>MutableByte</code> object that contains the same <code>byte</code> value
* as this object.
- *
+ *
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@@ -358,7 +358,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Returns a suitable hash code for this mutable.
- *
+ *
* @return a suitable hash code
*/
@Override
@@ -369,7 +369,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
- *
+ *
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@@ -381,7 +381,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
- *
+ *
* @return the mutable value as a string
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
----------------------------------------------------------------------
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 cd89027..dd0ac0e 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java
@@ -5,9 +5,9 @@
* 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.
@@ -19,8 +19,8 @@ package org.apache.commons.lang3.mutable;
/**
* A mutable <code>double</code> wrapper.
* <p>
- * Note that as MutableDouble does not extend Double, it is not treated by String.format as a Double parameter.
- *
+ * Note that as MutableDouble does not extend Double, it is not treated by String.format as a Double parameter.
+ *
* @see Double
* @since 2.1
*/
@@ -28,7 +28,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 1587163916L;
@@ -45,7 +45,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Constructs a new MutableDouble with the specified value.
- *
+ *
* @param value the initial value to store
*/
public MutableDouble(final double value) {
@@ -55,7 +55,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Constructs a new MutableDouble with the specified value.
- *
+ *
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
@@ -66,7 +66,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Constructs a new MutableDouble parsing the given string.
- *
+ *
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a double
* @since 2.5
@@ -79,7 +79,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
//-----------------------------------------------------------------------
/**
* Gets the value as a Double instance.
- *
+ *
* @return the value as a Double, never null
*/
@Override
@@ -89,7 +89,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Sets the value.
- *
+ *
* @param value the value to set
*/
public void setValue(final double value) {
@@ -98,7 +98,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Sets the value from any Number instance.
- *
+ *
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
@@ -110,7 +110,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
//-----------------------------------------------------------------------
/**
* Checks whether the double value is the special NaN value.
- *
+ *
* @return true if NaN
*/
public boolean isNaN() {
@@ -119,7 +119,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Checks whether the double value is infinite.
- *
+ *
* @return true if infinite
*/
public boolean isInfinite() {
@@ -198,7 +198,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
//-----------------------------------------------------------------------
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add
* @since Commons Lang 2.2
*/
@@ -208,7 +208,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -219,7 +219,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
@@ -229,7 +229,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -356,11 +356,11 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
* <p>
* Note that in most cases, for two instances of class <code>Double</code>,<code>d1</code> and <code>d2</code>,
* the value of <code>d1.equals(d2)</code> is <code>true</code> if and only if <blockquote>
- *
+ *
* <pre>
* d1.doubleValue() == d2.doubleValue()
* </pre>
- *
+ *
* </blockquote>
* <p>
* also has the value <code>true</code>. However, there are two exceptions:
@@ -372,7 +372,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
* or vice versa, the <code>equal</code> test has the value <code>false</code>, even though
* <code>+0.0==-0.0</code> has the value <code>true</code>. This allows hashtables to operate properly.
* </ul>
- *
+ *
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@@ -384,7 +384,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Returns a suitable hash code for this mutable.
- *
+ *
* @return a suitable hash code
*/
@Override
@@ -396,7 +396,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
- *
+ *
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@@ -408,7 +408,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
- *
+ *
* @return the mutable value as a string
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
----------------------------------------------------------------------
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 6ed0980..eec7cf1 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java
@@ -5,9 +5,9 @@
* 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.
@@ -19,8 +19,8 @@ package org.apache.commons.lang3.mutable;
/**
* A mutable <code>float</code> wrapper.
* <p>
- * Note that as MutableFloat does not extend Float, it is not treated by String.format as a Float parameter.
- *
+ * Note that as MutableFloat does not extend Float, it is not treated by String.format as a Float parameter.
+ *
* @see Float
* @since 2.1
*/
@@ -28,7 +28,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 5787169186L;
@@ -45,7 +45,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Constructs a new MutableFloat with the specified value.
- *
+ *
* @param value the initial value to store
*/
public MutableFloat(final float value) {
@@ -55,7 +55,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Constructs a new MutableFloat with the specified value.
- *
+ *
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
@@ -66,7 +66,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Constructs a new MutableFloat parsing the given string.
- *
+ *
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a float
* @since 2.5
@@ -79,7 +79,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
//-----------------------------------------------------------------------
/**
* Gets the value as a Float instance.
- *
+ *
* @return the value as a Float, never null
*/
@Override
@@ -89,7 +89,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Sets the value.
- *
+ *
* @param value the value to set
*/
public void setValue(final float value) {
@@ -98,7 +98,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Sets the value from any Number instance.
- *
+ *
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
@@ -110,7 +110,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
//-----------------------------------------------------------------------
/**
* Checks whether the float value is the special NaN value.
- *
+ *
* @return true if NaN
*/
public boolean isNaN() {
@@ -119,7 +119,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Checks whether the float value is infinite.
- *
+ *
* @return true if infinite
*/
public boolean isInfinite() {
@@ -198,7 +198,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
//-----------------------------------------------------------------------
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
@@ -208,7 +208,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -219,7 +219,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract
* @since Commons Lang 2.2
*/
@@ -229,7 +229,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -356,11 +356,11 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
* <p>
* Note that in most cases, for two instances of class <code>Float</code>,<code>f1</code> and <code>f2</code>,
* the value of <code>f1.equals(f2)</code> is <code>true</code> if and only if <blockquote>
- *
+ *
* <pre>
* f1.floatValue() == f2.floatValue()
* </pre>
- *
+ *
* </blockquote>
* <p>
* also has the value <code>true</code>. However, there are two exceptions:
@@ -373,7 +373,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
* <code>0.0f==-0.0f</code> has the value <code>true</code>.
* </ul>
* This definition allows hashtables to operate properly.
- *
+ *
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
* @see java.lang.Float#floatToIntBits(float)
@@ -386,7 +386,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Returns a suitable hash code for this mutable.
- *
+ *
* @return a suitable hash code
*/
@Override
@@ -397,7 +397,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
- *
+ *
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@@ -409,7 +409,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
- *
+ *
* @return the mutable value as a string
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
----------------------------------------------------------------------
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 7311f00..6e022bd 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java
@@ -5,9 +5,9 @@
* 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.
@@ -21,8 +21,8 @@ import org.apache.commons.lang3.math.NumberUtils;
/**
* A mutable <code>int</code> wrapper.
* <p>
- * Note that as MutableInt does not extend Integer, it is not treated by String.format as an Integer parameter.
- *
+ * Note that as MutableInt does not extend Integer, it is not treated by String.format as an Integer parameter.
+ *
* @see Integer
* @since 2.1
*/
@@ -30,7 +30,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 512176391864L;
@@ -47,7 +47,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Constructs a new MutableInt with the specified value.
- *
+ *
* @param value the initial value to store
*/
public MutableInt(final int value) {
@@ -57,7 +57,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Constructs a new MutableInt with the specified value.
- *
+ *
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
@@ -68,7 +68,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Constructs a new MutableInt parsing the given string.
- *
+ *
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into an int
* @since 2.5
@@ -81,7 +81,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
//-----------------------------------------------------------------------
/**
* Gets the value as a Integer instance.
- *
+ *
* @return the value as a Integer, never null
*/
@Override
@@ -91,7 +91,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Sets the value.
- *
+ *
* @param value the value to set
*/
public void setValue(final int value) {
@@ -100,7 +100,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Sets the value from any Number instance.
- *
+ *
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
@@ -181,7 +181,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
//-----------------------------------------------------------------------
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
@@ -191,7 +191,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -202,7 +202,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
@@ -212,7 +212,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -334,7 +334,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument is
* not <code>null</code> and is a <code>MutableInt</code> object that contains the same <code>int</code> value
* as this object.
- *
+ *
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@@ -348,7 +348,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Returns a suitable hash code for this mutable.
- *
+ *
* @return a suitable hash code
*/
@Override
@@ -359,7 +359,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
- *
+ *
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@@ -371,7 +371,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
- *
+ *
* @return the mutable value as a string
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
----------------------------------------------------------------------
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 5b6254a..dbd32d5 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java
@@ -5,9 +5,9 @@
* 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.
@@ -21,8 +21,8 @@ import org.apache.commons.lang3.math.NumberUtils;
/**
* A mutable <code>long</code> wrapper.
* <p>
- * Note that as MutableLong does not extend Long, it is not treated by String.format as a Long parameter.
- *
+ * Note that as MutableLong does not extend Long, it is not treated by String.format as a Long parameter.
+ *
* @see Long
* @since 2.1
*/
@@ -30,7 +30,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 62986528375L;
@@ -47,7 +47,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Constructs a new MutableLong with the specified value.
- *
+ *
* @param value the initial value to store
*/
public MutableLong(final long value) {
@@ -57,7 +57,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Constructs a new MutableLong with the specified value.
- *
+ *
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
@@ -68,7 +68,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Constructs a new MutableLong parsing the given string.
- *
+ *
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a long
* @since 2.5
@@ -81,7 +81,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
//-----------------------------------------------------------------------
/**
* Gets the value as a Long instance.
- *
+ *
* @return the value as a Long, never null
*/
@Override
@@ -91,7 +91,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Sets the value.
- *
+ *
* @param value the value to set
*/
public void setValue(final long value) {
@@ -100,7 +100,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Sets the value from any Number instance.
- *
+ *
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
@@ -181,7 +181,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
//-----------------------------------------------------------------------
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
@@ -191,7 +191,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -202,7 +202,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
@@ -212,7 +212,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -334,7 +334,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument
* is not <code>null</code> and is a <code>MutableLong</code> object that contains the same <code>long</code>
* value as this object.
- *
+ *
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@@ -348,7 +348,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Returns a suitable hash code for this mutable.
- *
+ *
* @return a suitable hash code
*/
@Override
@@ -359,7 +359,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
- *
+ *
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@@ -371,7 +371,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
- *
+ *
* @return the mutable value as a string
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java b/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java
index 180cf3a..3c78bc1 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java
@@ -5,9 +5,9 @@
* 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.
@@ -21,15 +21,15 @@ import java.io.Serializable;
/**
* A mutable <code>Object</code> wrapper.
- *
- * @param <T> the type to set and get
+ *
+ * @param <T> the type to set and get
* @since 2.1
*/
public class MutableObject<T> implements Mutable<T>, Serializable {
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 86241875189L;
@@ -46,7 +46,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
/**
* Constructs a new MutableObject with the specified value.
- *
+ *
* @param value the initial value to store
*/
public MutableObject(final T value) {
@@ -57,7 +57,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
//-----------------------------------------------------------------------
/**
* Gets the value.
- *
+ *
* @return the value, may be null
*/
@Override
@@ -67,7 +67,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
/**
* Sets the value.
- *
+ *
* @param value the value to set
*/
@Override
@@ -82,7 +82,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
* is not <code>null</code> and is a <code>MutableObject</code> object that contains the same <code>T</code>
* value as this object.
* </p>
- *
+ *
* @param obj the object to compare with, <code>null</code> returns <code>false</code>
* @return <code>true</code> if the objects are the same;
* <code>true</code> if the objects have equivalent <code>value</code> fields;
@@ -105,7 +105,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
/**
* Returns the value's hash code or <code>0</code> if the value is <code>null</code>.
- *
+ *
* @return the value's hash code or <code>0</code> if the value is <code>null</code>.
*/
@Override
@@ -116,7 +116,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
- *
+ *
* @return the mutable value as a string
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
----------------------------------------------------------------------
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 01d604f..1cbd847 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java
@@ -5,9 +5,9 @@
* 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.
@@ -21,8 +21,8 @@ import org.apache.commons.lang3.math.NumberUtils;
/**
* A mutable <code>short</code> wrapper.
* <p>
- * Note that as MutableShort does not extend Short, it is not treated by String.format as a Short parameter.
- *
+ * Note that as MutableShort does not extend Short, it is not treated by String.format as a Short parameter.
+ *
* @see Short
* @since 2.1
*/
@@ -30,7 +30,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = -2135791679L;
@@ -47,7 +47,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Constructs a new MutableShort with the specified value.
- *
+ *
* @param value the initial value to store
*/
public MutableShort(final short value) {
@@ -57,7 +57,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Constructs a new MutableShort with the specified value.
- *
+ *
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
@@ -68,7 +68,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Constructs a new MutableShort parsing the given string.
- *
+ *
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a short
* @since 2.5
@@ -81,7 +81,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
//-----------------------------------------------------------------------
/**
* Gets the value as a Short instance.
- *
+ *
* @return the value as a Short, never null
*/
@Override
@@ -91,7 +91,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Sets the value.
- *
+ *
* @param value the value to set
*/
public void setValue(final short value) {
@@ -100,7 +100,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Sets the value from any Number instance.
- *
+ *
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
@@ -181,7 +181,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
//-----------------------------------------------------------------------
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
@@ -191,7 +191,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Adds a value to the value of this instance.
- *
+ *
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -202,7 +202,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
@@ -212,7 +212,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Subtracts a value from the value of this instance.
- *
+ *
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
@@ -344,7 +344,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument
* is not <code>null</code> and is a <code>MutableShort</code> object that contains the same <code>short</code>
* value as this object.
- *
+ *
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@@ -358,7 +358,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Returns a suitable hash code for this mutable.
- *
+ *
* @return a suitable hash code
*/
@Override
@@ -369,7 +369,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
- *
+ *
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@@ -381,7 +381,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
- *
+ *
* @return the mutable value as a string
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java b/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
index 0808fc7..b6fb70d 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
@@ -60,7 +60,7 @@ public class ConstructorUtils {
/**
* <p>Returns a new instance of the specified class inferring the right constructor
* from the types of the arguments.</p>
- *
+ *
* <p>This locates and calls a constructor.
* The constructor signature must match the argument types by assignment compatibility.</p>
*
@@ -87,7 +87,7 @@ public class ConstructorUtils {
/**
* <p>Returns a new instance of the specified class choosing the right constructor
* from the list of parameter types.</p>
- *
+ *
* <p>This locates and calls a constructor.
* The constructor signature must match the parameter types by assignment compatibility.</p>
*
@@ -184,7 +184,7 @@ public class ConstructorUtils {
//-----------------------------------------------------------------------
/**
* <p>Finds a constructor given a class and signature, checking accessibility.</p>
- *
+ *
* <p>This finds the constructor and ensures that it is accessible.
* The constructor signature must match the parameter types exactly.</p>
*
@@ -208,7 +208,7 @@ public class ConstructorUtils {
/**
* <p>Checks if the specified constructor is accessible.</p>
- *
+ *
* <p>This simply ensures that the constructor is accessible.</p>
*
* @param <T> the constructor type
@@ -225,7 +225,7 @@ public class ConstructorUtils {
/**
* <p>Finds an accessible constructor with compatible parameters.</p>
- *
+ *
* <p>This checks all the constructor and finds one with compatible parameters
* This requires that every parameter is assignable from the given parameter types.
* This is a more flexible search than the normal exact matching algorithm.</p>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
----------------------------------------------------------------------
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 8b4ac30..aa2287a 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
@@ -32,7 +32,7 @@ import java.util.List;
* <p>
* The ability is provided to break the scoping restrictions coded by the programmer. This can allow fields to be
* changed that shouldn't be. This facility should be used with care.
- *
+ *
* @since 2.5
*/
public class FieldUtils {
@@ -49,7 +49,7 @@ public class FieldUtils {
/**
* Gets an accessible {@link Field} by name respecting scope. Superclasses/interfaces will be considered.
- *
+ *
* @param cls
* the {@link Class} to reflect, must not be {@code null}
* @param fieldName
@@ -67,7 +67,7 @@ public class FieldUtils {
/**
* Gets an accessible {@link Field} by name, breaking scope if requested. Superclasses/interfaces will be
* considered.
- *
+ *
* @param cls
* the {@link Class} to reflect, must not be {@code null}
* @param fieldName
@@ -135,7 +135,7 @@ public class FieldUtils {
/**
* Gets an accessible {@link Field} by name respecting scope. Only the specified class will be considered.
- *
+ *
* @param cls
* the {@link Class} to reflect, must not be {@code null}
* @param fieldName
@@ -151,7 +151,7 @@ public class FieldUtils {
/**
* Gets an accessible {@link Field} by name, breaking scope if requested. Only the specified class will be
* considered.
- *
+ *
* @param cls
* the {@link Class} to reflect, must not be {@code null}
* @param fieldName
@@ -186,7 +186,7 @@ public class FieldUtils {
/**
* Gets all fields of the given class and its parents (if any).
- *
+ *
* @param cls
* the {@link Class} to query
* @return an array of Fields (possibly empty).
@@ -201,7 +201,7 @@ public class FieldUtils {
/**
* Gets all fields of the given class and its parents (if any).
- *
+ *
* @param cls
* the {@link Class} to query
* @return an array of Fields (possibly empty).
@@ -264,7 +264,7 @@ public class FieldUtils {
/**
* Reads an accessible {@code static} {@link Field}.
- *
+ *
* @param field
* to read
* @return the field value
@@ -279,7 +279,7 @@ public class FieldUtils {
/**
* Reads a static {@link Field}.
- *
+ *
* @param field
* to read
* @param forceAccess
@@ -299,7 +299,7 @@ public class FieldUtils {
/**
* Reads the named {@code public static} {@link Field}. Superclasses will be considered.
- *
+ *
* @param cls
* the {@link Class} to reflect, must not be {@code null}
* @param fieldName
@@ -317,7 +317,7 @@ public class FieldUtils {
/**
* Reads the named {@code static} {@link Field}. Superclasses will be considered.
- *
+ *
* @param cls
* the {@link Class} to reflect, must not be {@code null}
* @param fieldName
@@ -343,7 +343,7 @@ public class FieldUtils {
/**
* Gets the value of a {@code static} {@link Field} by name. The field must be {@code public}. Only the specified
* class will be considered.
- *
+ *
* @param cls
* the {@link Class} to reflect, must not be {@code null}
* @param fieldName
@@ -361,7 +361,7 @@ public class FieldUtils {
/**
* Gets the value of a {@code static} {@link Field} by name. Only the specified class will be considered.
- *
+ *
* @param cls
* the {@link Class} to reflect, must not be {@code null}
* @param fieldName
@@ -386,7 +386,7 @@ public class FieldUtils {
/**
* Reads an accessible {@link Field}.
- *
+ *
* @param field
* the field to use
* @param target
@@ -403,7 +403,7 @@ public class FieldUtils {
/**
* Reads a {@link Field}.
- *
+ *
* @param field
* the field to use
* @param target
@@ -429,7 +429,7 @@ public class FieldUtils {
/**
* Reads the named {@code public} {@link Field}. Superclasses will be considered.
- *
+ *
* @param target
* the object to reflect, must not be {@code null}
* @param fieldName
@@ -446,7 +446,7 @@ public class FieldUtils {
/**
* Reads the named {@link Field}. Superclasses will be considered.
- *
+ *
* @param target
* the object to reflect, must not be {@code null}
* @param fieldName
@@ -472,7 +472,7 @@ public class FieldUtils {
/**
* Reads the named {@code public} {@link Field}. Only the class of the specified object will be considered.
- *
+ *
* @param target
* the object to reflect, must not be {@code null}
* @param fieldName
@@ -489,7 +489,7 @@ public class FieldUtils {
/**
* Gets a {@link Field} value by name. Only the class of the specified object will be considered.
- *
+ *
* @param target
* the object to reflect, must not be {@code null}
* @param fieldName
@@ -515,7 +515,7 @@ public class FieldUtils {
/**
* Writes a {@code public static} {@link Field}.
- *
+ *
* @param field
* to write
* @param value
@@ -531,7 +531,7 @@ public class FieldUtils {
/**
* Writes a static {@link Field}.
- *
+ *
* @param field
* to write
* @param value
@@ -554,7 +554,7 @@ public class FieldUtils {
/**
* Writes a named {@code public static} {@link Field}. Superclasses will be considered.
- *
+ *
* @param cls
* {@link Class} on which the field is to be found
* @param fieldName
@@ -573,7 +573,7 @@ public class FieldUtils {
/**
* Writes a named {@code static} {@link Field}. Superclasses will be considered.
- *
+ *
* @param cls
* {@link Class} on which the field is to be found
* @param fieldName
@@ -600,7 +600,7 @@ public class FieldUtils {
/**
* Writes a named {@code public static} {@link Field}. Only the specified class will be considered.
- *
+ *
* @param cls
* {@link Class} on which the field is to be found
* @param fieldName
@@ -619,7 +619,7 @@ public class FieldUtils {
/**
* Writes a named {@code static} {@link Field}. Only the specified class will be considered.
- *
+ *
* @param cls
* {@link Class} on which the field is to be found
* @param fieldName
@@ -645,7 +645,7 @@ public class FieldUtils {
/**
* Writes an accessible {@link Field}.
- *
+ *
* @param field
* to write
* @param target
@@ -662,7 +662,7 @@ public class FieldUtils {
/**
* Writes a {@link Field}.
- *
+ *
* @param field
* to write
* @param target
@@ -691,7 +691,7 @@ public class FieldUtils {
/**
* Removes the final modifier from a {@link Field}.
- *
+ *
* @param field
* to remove the final modifier
* @throws IllegalArgumentException
@@ -704,7 +704,7 @@ public class FieldUtils {
/**
* Removes the final modifier from a {@link Field}.
- *
+ *
* @param field
* to remove the final modifier
* @param forceAccess
@@ -743,7 +743,7 @@ public class FieldUtils {
/**
* Writes a {@code public} {@link Field}. Superclasses will be considered.
- *
+ *
* @param target
* the object to reflect, must not be {@code null}
* @param fieldName
@@ -762,7 +762,7 @@ public class FieldUtils {
/**
* Writes a {@link Field}. Superclasses will be considered.
- *
+ *
* @param target
* the object to reflect, must not be {@code null}
* @param fieldName
@@ -791,7 +791,7 @@ public class FieldUtils {
/**
* Writes a {@code public} {@link Field}. Only the specified class will be considered.
- *
+ *
* @param target
* the object to reflect, must not be {@code null}
* @param fieldName
@@ -810,7 +810,7 @@ public class FieldUtils {
/**
* Writes a {@code public} {@link Field}. Only the specified class will be considered.
- *
+ *
* @param target
* the object to reflect, must not be {@code null}
* @param fieldName
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
index 2855410..17ed733 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
@@ -49,10 +49,10 @@ import org.apache.commons.lang3.Validate;
* Reflection locates these methods fine and correctly assigns them as {@code public}.
* However, an {@link IllegalAccessException} is thrown if the method is invoked.</p>
*
- * <p>{@link MethodUtils} contains a workaround for this situation.
+ * <p>{@link MethodUtils} contains a workaround for this situation.
* It will attempt to call {@link java.lang.reflect.AccessibleObject#setAccessible(boolean)} on this method.
* If this call succeeds, then the method can be invoked as normal.
- * This call will only succeed when the application has sufficient security privileges.
+ * This call will only succeed when the application has sufficient security privileges.
* If this call fails then the method may fail.</p>
*
* @since 2.5
@@ -87,14 +87,14 @@ public class MethodUtils {
* @throws NoSuchMethodException if there is no such accessible method
* @throws InvocationTargetException wraps an exception thrown by the method invoked
* @throws IllegalAccessException if the requested method is not accessible via reflection
- *
+ *
* @since 3.4
*/
public static Object invokeMethod(final Object object, final String methodName) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
return invokeMethod(object, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY, null);
}
-
+
/**
* <p>Invokes a named method without parameters.</p>
*
@@ -123,7 +123,7 @@ public class MethodUtils {
*
* <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p>
*
- * <p>This method supports calls to methods taking primitive parameters
+ * <p>This method supports calls to methods taking primitive parameters
* via passing in wrapping classes. So, for example, a {@code Boolean} object
* would match a {@code boolean} primitive.</p>
*
@@ -147,11 +147,11 @@ public class MethodUtils {
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeMethod(object, methodName, args, parameterTypes);
}
-
+
/**
* <p>Invokes a named method whose parameter type matches the object type.</p>
*
- * <p>This method supports calls to methods taking primitive parameters
+ * <p>This method supports calls to methods taking primitive parameters
* via passing in wrapping classes. So, for example, a {@code Boolean} object
* would match a {@code boolean} primitive.</p>
*
@@ -182,7 +182,7 @@ public class MethodUtils {
/**
* <p>Invokes a named method whose parameter type matches the object type.</p>
*
- * <p>This method supports calls to methods taking primitive parameters
+ * <p>This method supports calls to methods taking primitive parameters
* via passing in wrapping classes. So, for example, a {@code Boolean} object
* would match a {@code boolean} primitive.</p>
*
@@ -235,7 +235,7 @@ public class MethodUtils {
*
* <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p>
*
- * <p>This method supports calls to methods taking primitive parameters
+ * <p>This method supports calls to methods taking primitive parameters
* via passing in wrapping classes. So, for example, a {@code Boolean} object
* would match a {@code boolean} primitive.</p>
*
@@ -249,7 +249,7 @@ public class MethodUtils {
* @throws InvocationTargetException wraps an exception thrown by the method invoked
* @throws IllegalAccessException if the requested method is not accessible via reflection
*/
- public static Object invokeMethod(final Object object, final String methodName,
+ public static Object invokeMethod(final Object object, final String methodName,
final Object[] args, final Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
@@ -378,7 +378,7 @@ public class MethodUtils {
*
* <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p>
*
- * <p>This method supports calls to methods taking primitive parameters
+ * <p>This method supports calls to methods taking primitive parameters
* via passing in wrapping classes. So, for example, a {@code Boolean} class
* would match a {@code boolean} primitive.</p>
*
@@ -410,7 +410,7 @@ public class MethodUtils {
*
* <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p>
*
- * <p>This method supports calls to methods taking primitive parameters
+ * <p>This method supports calls to methods taking primitive parameters
* via passing in wrapping classes. So, for example, a {@code Boolean} class
* would match a {@code boolean} primitive.</p>
*
@@ -650,13 +650,13 @@ public class MethodUtils {
/**
* <p>Finds an accessible method that matches the given name and has compatible parameters.
- * Compatible parameters mean that every method parameter is assignable from
+ * Compatible parameters mean that every method parameter is assignable from
* the given parameters.
- * In other words, it finds a method with the given name
+ * In other words, it finds a method with the given name
* that will take the parameters given.</p>
*
- * <p>This method is used by
- * {@link
+ * <p>This method is used by
+ * {@link
* #invokeMethod(Object object, String methodName, Object[] args, Class[] parameterTypes)}.
* </p>
*
@@ -667,7 +667,7 @@ public class MethodUtils {
*
* @param cls find method in this class
* @param methodName find method with this name
- * @param parameterTypes find method with most compatible parameters
+ * @param parameterTypes find method with most compatible parameters
* @return The accessible method
*/
public static Method getMatchingAccessibleMethod(final Class<?> cls,
@@ -714,7 +714,7 @@ public class MethodUtils {
return bestMatch;
}
-
+
/**
* <p>Retrieves a method whether or not it's accessible. If no such method
* can be found, return {@code null}.</p>
@@ -722,7 +722,7 @@ public class MethodUtils {
* @param methodName The method that we wish to call
* @param parameterTypes Argument class types
* @return The method
- *
+ *
* @since 3.5
*/
public static Method getMatchingMethod(final Class<?> cls, final String methodName,
@@ -755,7 +755,7 @@ public class MethodUtils {
}
return inexactMatch;
}
-
+
/**
* <p>Returns the aggregate number of inheritance hops between assignable argument class types. Returns -1
* if the arguments aren't assignable. Fills a specific purpose for getMatchingMethod and is not generalized.</p>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java b/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java
index bead33f..db801fc 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java
@@ -106,7 +106,7 @@ public abstract class TypeLiteral<T> implements Typed<T> {
return TypeUtils.equals(value, other.value);
}
- @Override
+ @Override
public int hashCode() {
return 37 << 4 | value.hashCode();
}
[03/48] [lang] Deprecate CharEncoding and direct users to Java 7
classes
Posted by br...@apache.org.
Deprecate CharEncoding and direct users to Java 7 classes
Java 7 introduced java.nio.charset.StandardCharsets, which negates the
need for our CharEncoding method. Additionally, the constants in the
class now point to the constants defined in Java 7.
Fixes: LANG-1334
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/7c19a1ff
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/7c19a1ff
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/7c19a1ff
Branch: refs/heads/release
Commit: 7c19a1ff4c217f03c0be62baf1169d689f566825
Parents: 53def50
Author: duncan <du...@wortharead.com>
Authored: Mon May 22 13:16:29 2017 +0100
Committer: duncan <du...@wortharead.com>
Committed: Mon May 22 13:16:29 2017 +0100
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/CharEncoding.java | 19 +++++++++++++------
.../apache/commons/lang3/CharEncodingTest.java | 1 +
3 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7c19a1ff/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 9f52a9b..69b95d7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="3.6" date="2017-MM-DD" description="TBD">
+ <action issue="LANG-1334" type="update" dev="djones">Deprecate CharEncoding in favour of java.nio.charset.StandardCharsets</action>
<action issue="LANG-1319" type="fix" dev="djones">MultilineRecursiveToStringStyle StackOverflowError when object is an array</action>
<action issue="LANG-1325" type="add" dev="kinow" due-to="Arshad Basha">Increase test coverage of ToStringBuilder class to 100%</action>
<action issue="LANG-1307" type="add" dev="pschumacher" due-to="Arshad Basha">Add a method in StringUtils to extract only digits out of input string</action>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7c19a1ff/src/main/java/org/apache/commons/lang3/CharEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharEncoding.java b/src/main/java/org/apache/commons/lang3/CharEncoding.java
index 7fe9296..65dca33 100644
--- a/src/main/java/org/apache/commons/lang3/CharEncoding.java
+++ b/src/main/java/org/apache/commons/lang3/CharEncoding.java
@@ -19,6 +19,7 @@ package org.apache.commons.lang3;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.StandardCharsets;
/**
* <p>Character encoding names required of every implementation of the Java platform.</p>
@@ -32,7 +33,11 @@ import java.nio.charset.IllegalCharsetNameException;
*
* @see <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html">JRE character encoding names</a>
* @since 2.1
+ * @deprecated Java 7 introduced {@link StandardCharsets}, which defines these constants as
+ * {@link Charset} objects. Use {@link Charset#name()} to get the string values provided in this class.
+ * This class will be removed in a future release.
*/
+@Deprecated
public class CharEncoding {
/**
@@ -40,7 +45,7 @@ public class CharEncoding {
*
* <p>Every implementation of the Java platform is required to support this character encoding.</p>
*/
- public static final String ISO_8859_1 = "ISO-8859-1";
+ public static final String ISO_8859_1 = StandardCharsets.ISO_8859_1.name();
/**
* <p>Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block
@@ -48,7 +53,7 @@ public class CharEncoding {
*
* <p>Every implementation of the Java platform is required to support this character encoding.</p>
*/
- public static final String US_ASCII = "US-ASCII";
+ public static final String US_ASCII = StandardCharsets.US_ASCII.name();
/**
* <p>Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial
@@ -56,28 +61,28 @@ public class CharEncoding {
*
* <p>Every implementation of the Java platform is required to support this character encoding.</p>
*/
- public static final String UTF_16 = "UTF-16";
+ public static final String UTF_16 = StandardCharsets.UTF_16.name();
/**
* <p>Sixteen-bit Unicode Transformation Format, big-endian byte order.</p>
*
* <p>Every implementation of the Java platform is required to support this character encoding.</p>
*/
- public static final String UTF_16BE = "UTF-16BE";
+ public static final String UTF_16BE = StandardCharsets.UTF_16BE.name();
/**
* <p>Sixteen-bit Unicode Transformation Format, little-endian byte order.</p>
*
* <p>Every implementation of the Java platform is required to support this character encoding.</p>
*/
- public static final String UTF_16LE = "UTF-16LE";
+ public static final String UTF_16LE = StandardCharsets.UTF_16LE.name();
/**
* <p>Eight-bit Unicode Transformation Format.</p>
*
* <p>Every implementation of the Java platform is required to support this character encoding.</p>
*/
- public static final String UTF_8 = "UTF-8";
+ public static final String UTF_8 = StandardCharsets.UTF_8.name();
/**
* <p>Returns whether the named charset is supported.</p>
@@ -88,6 +93,8 @@ public class CharEncoding {
*
* @param name the name of the requested charset; may be either a canonical name or an alias, null returns false
* @return {@code true} if the charset is available in the current Java virtual machine
+ * @deprecated Please use {@link Charset#isSupported(String)} instead, although be aware that {@code null}
+ * values are not accepted by that method and an {@link IllegalCharsetNameException} may be thrown.
*/
public static boolean isSupported(final String name) {
if (name == null) {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7c19a1ff/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
index 4324c6f..9e8e540 100644
--- a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
@@ -27,6 +27,7 @@ import org.junit.Test;
*
* @see CharEncoding
*/
+@SuppressWarnings("deprecation")
public class CharEncodingTest {
private void assertSupportedEncoding(final String name) {
[39/48] [lang] Make the var a constant, and add comments
Posted by br...@apache.org.
Make the var a constant, and add comments
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c68285bb
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c68285bb
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c68285bb
Branch: refs/heads/release
Commit: c68285bb3392665827595ac408a5fad828b0351f
Parents: 0344ca3
Author: Bruno P. Kinoshita <ki...@apache.org>
Authored: Wed Jun 7 19:24:52 2017 +1200
Committer: Bruno P. Kinoshita <ki...@apache.org>
Committed: Wed Jun 7 19:24:52 2017 +1200
----------------------------------------------------------------------
.../org/apache/commons/lang3/builder/ToStringBuilderTest.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c68285bb/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
index c49426d..39dcd37 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
@@ -36,7 +36,8 @@ import org.junit.Test;
*/
public class ToStringBuilderTest {
- private final Integer arraylistInitialCapacity = Integer.valueOf(10);
+ // See LANG-1337 for more.
+ private static final int ARRAYLIST_INITIAL_CAPACITY = 10;
private final Integer base = Integer.valueOf(5);
private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
@@ -317,7 +318,8 @@ public class ToStringBuilderTest {
// representation different for IBM JDK 1.6.0, LANG-727
assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION));
assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0);
- final List<Object> list = new ArrayList<>(arraylistInitialCapacity);
+ // LANG-1337 without this, the generated string can differ depending on the JVM version/vendor
+ final List<Object> list = new ArrayList<>(ARRAYLIST_INITIAL_CAPACITY);
final String baseString = this.toBaseString(list);
final String expectedWithTransients = baseString + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]";
final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true);
[44/48] [lang] Fix duplicated maven-jar-plugin configuration
Posted by br...@apache.org.
Fix duplicated maven-jar-plugin configuration
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/b48043d1
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/b48043d1
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/b48043d1
Branch: refs/heads/release
Commit: b48043d18ea6cafa9f6404d897bab13a11b9a918
Parents: 82f1ca8
Author: Benedikt Ritter <br...@apache.org>
Authored: Thu Jun 8 10:00:12 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Jun 8 10:00:12 2017 +0200
----------------------------------------------------------------------
pom.xml | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/b48043d1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0459926..ac5beca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -661,6 +661,14 @@
</goals>
</execution>
</executions>
+ <!-- Temporary fix for LANG-1338, remove this after this has implemented in parent pom -->
+ <configuration>
+ <archive combine.children="append">
+ <manifestEntries>
+ <Automatic-Module-Name>org.apache.commons.lang3</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -690,19 +698,6 @@
<excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile>
</configuration>
</plugin>
-
- <!-- Temporary fix for LANG-1338, remove this after this has implemented in parent pom -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive combine.children="append">
- <manifestEntries>
- <Automatic-Module-Name>org.apache.commons.lang3</Automatic-Module-Name>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
</plugins>
</build>
[36/48] [lang] Make sure placement of curly braces is consistent
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index bce9576..cccccd7 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -40,7 +40,7 @@ import org.junit.Test;
* Unit tests {@link org.apache.commons.lang3.ArrayUtils}.
*/
@SuppressWarnings("deprecation") // deliberate use of deprecated code
-public class ArrayUtilsTest {
+public class ArrayUtilsTest {
//-----------------------------------------------------------------------
@Test
@@ -59,31 +59,31 @@ public class ArrayUtilsTest {
assertEquals("{}", ArrayUtils.toString(null));
assertEquals("{}", ArrayUtils.toString(new Object[0]));
assertEquals("{}", ArrayUtils.toString(new String[0]));
- assertEquals("{<null>}", ArrayUtils.toString(new String[] {null}));
- assertEquals("{pink,blue}", ArrayUtils.toString(new String[] {"pink","blue"}));
+ assertEquals("{<null>}", ArrayUtils.toString(new String[]{null}));
+ assertEquals("{pink,blue}", ArrayUtils.toString(new String[]{"pink", "blue"}));
assertEquals("<empty>", ArrayUtils.toString(null, "<empty>"));
assertEquals("{}", ArrayUtils.toString(new Object[0], "<empty>"));
assertEquals("{}", ArrayUtils.toString(new String[0], "<empty>"));
- assertEquals("{<null>}", ArrayUtils.toString(new String[] {null}, "<empty>"));
- assertEquals("{pink,blue}", ArrayUtils.toString(new String[] {"pink","blue"}, "<empty>"));
+ assertEquals("{<null>}", ArrayUtils.toString(new String[]{null}, "<empty>"));
+ assertEquals("{pink,blue}", ArrayUtils.toString(new String[]{"pink", "blue"}, "<empty>"));
}
//-----------------------------------------------------------------------
@Test
public void testHashCode() {
- final long[][] array1 = new long[][] {{2,5}, {4,5}};
- final long[][] array2 = new long[][] {{2,5}, {4,6}};
+ final long[][] array1 = new long[][]{{2, 5}, {4, 5}};
+ final long[][] array2 = new long[][]{{2, 5}, {4, 6}};
assertTrue(ArrayUtils.hashCode(array1) == ArrayUtils.hashCode(array1));
assertFalse(ArrayUtils.hashCode(array1) == ArrayUtils.hashCode(array2));
- final Object[] array3 = new Object[] {new String(new char[] {'A', 'B'})};
- final Object[] array4 = new Object[] {"AB"};
+ final Object[] array3 = new Object[]{new String(new char[]{'A', 'B'})};
+ final Object[] array4 = new Object[]{"AB"};
assertTrue(ArrayUtils.hashCode(array3) == ArrayUtils.hashCode(array3));
assertTrue(ArrayUtils.hashCode(array3) == ArrayUtils.hashCode(array4));
- final Object[] arrayA = new Object[] {new boolean[] {true, false}, new int[] {6, 7}};
- final Object[] arrayB = new Object[] {new boolean[] {true, false}, new int[] {6, 7}};
+ final Object[] arrayA = new Object[]{new boolean[]{true, false}, new int[]{6, 7}};
+ final Object[] arrayB = new Object[]{new boolean[]{true, false}, new int[]{6, 7}};
assertTrue(ArrayUtils.hashCode(arrayB) == ArrayUtils.hashCode(arrayA));
}
@@ -156,8 +156,7 @@ public class ArrayUtilsTest {
* Tests generic array creation with parameters of same type.
*/
@Test
- public void testArrayCreation()
- {
+ public void testArrayCreation() {
final String[] array = ArrayUtils.toArray("foo", "bar");
assertEquals(2, array.length);
assertEquals("foo", array[0]);
@@ -168,8 +167,7 @@ public class ArrayUtilsTest {
* Tests generic array creation with general return type.
*/
@Test
- public void testArrayCreationWithGeneralReturnType()
- {
+ public void testArrayCreationWithGeneralReturnType() {
final Object obj = ArrayUtils.toArray("foo", "bar");
assertTrue(obj instanceof String[]);
}
@@ -178,8 +176,7 @@ public class ArrayUtilsTest {
* Tests generic array creation with parameters of common base type.
*/
@Test
- public void testArrayCreationWithDifferentTypes()
- {
+ public void testArrayCreationWithDifferentTypes() {
final Number[] array = ArrayUtils.<Number>toArray(Integer.valueOf(42), Double.valueOf(Math.PI));
assertEquals(2, array.length);
assertEquals(Integer.valueOf(42), array[0]);
@@ -190,8 +187,7 @@ public class ArrayUtilsTest {
* Tests generic array creation with generic type.
*/
@Test
- public void testIndirectArrayCreation()
- {
+ public void testIndirectArrayCreation() {
final String[] array = toArrayPropagatingType("foo", "bar");
assertEquals(2, array.length);
assertEquals("foo", array[0]);
@@ -202,8 +198,7 @@ public class ArrayUtilsTest {
* Tests generic empty array creation with generic type.
*/
@Test
- public void testEmptyArrayCreation()
- {
+ public void testEmptyArrayCreation() {
final String[] array = ArrayUtils.<String>toArray();
assertEquals(0, array.length);
}
@@ -212,57 +207,62 @@ public class ArrayUtilsTest {
* Tests indirect generic empty array creation with generic type.
*/
@Test
- public void testIndirectEmptyArrayCreation()
- {
+ public void testIndirectEmptyArrayCreation() {
final String[] array = ArrayUtilsTest.<String>toArrayPropagatingType();
assertEquals(0, array.length);
}
@SafeVarargs
- private static <T> T[] toArrayPropagatingType(final T... items)
- {
+ private static <T> T[] toArrayPropagatingType(final T... items) {
return ArrayUtils.toArray(items);
}
//-----------------------------------------------------------------------
@Test
public void testToMap() {
- Map<?, ?> map = ArrayUtils.toMap(new String[][] {{"foo", "bar"}, {"hello", "world"}});
+ Map<?, ?> map = ArrayUtils.toMap(new String[][]{{"foo", "bar"}, {"hello", "world"}});
assertEquals("bar", map.get("foo"));
assertEquals("world", map.get("hello"));
assertEquals(null, ArrayUtils.toMap(null));
try {
- ArrayUtils.toMap(new String[][] {{"foo", "bar"}, {"short"}});
+ ArrayUtils.toMap(new String[][]{{"foo", "bar"}, {"short"}});
fail("exception expected");
- } catch (final IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {
+ }
try {
- ArrayUtils.toMap(new Object[] {new Object[] {"foo", "bar"}, "illegal type"});
+ ArrayUtils.toMap(new Object[]{new Object[]{"foo", "bar"}, "illegal type"});
fail("exception expected");
- } catch (final IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {
+ }
try {
- ArrayUtils.toMap(new Object[] {new Object[] {"foo", "bar"}, null});
+ ArrayUtils.toMap(new Object[]{new Object[]{"foo", "bar"}, null});
fail("exception expected");
- } catch (final IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {
+ }
- map = ArrayUtils.toMap(new Object[] {new Map.Entry<Object, Object>() {
+ map = ArrayUtils.toMap(new Object[]{new Map.Entry<Object, Object>() {
@Override
public Object getKey() {
return "foo";
}
+
@Override
public Object getValue() {
return "bar";
}
+
@Override
public Object setValue(final Object value) {
throw new UnsupportedOperationException();
}
+
@Override
public boolean equals(final Object o) {
throw new UnsupportedOperationException();
}
+
@Override
public int hashCode() {
throw new UnsupportedOperationException();
@@ -281,7 +281,7 @@ public class ArrayUtilsTest {
assertTrue(original1 != cloned1);
final StringBuilder builder = new StringBuilder("pick");
- original1 = new Object[] {builder, "a", new String[] {"stick"}};
+ original1 = new Object[]{builder, "a", new String[]{"stick"}};
cloned1 = ArrayUtils.clone(original1);
assertTrue(Arrays.equals(original1, cloned1));
assertTrue(original1 != cloned1);
@@ -293,7 +293,7 @@ public class ArrayUtilsTest {
@Test
public void testCloneBoolean() {
assertEquals(null, ArrayUtils.clone((boolean[]) null));
- final boolean[] original = new boolean[] {true, false};
+ final boolean[] original = new boolean[]{true, false};
final boolean[] cloned = ArrayUtils.clone(original);
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
@@ -302,7 +302,7 @@ public class ArrayUtilsTest {
@Test
public void testCloneLong() {
assertEquals(null, ArrayUtils.clone((long[]) null));
- final long[] original = new long[] {0L, 1L};
+ final long[] original = new long[]{0L, 1L};
final long[] cloned = ArrayUtils.clone(original);
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
@@ -311,7 +311,7 @@ public class ArrayUtilsTest {
@Test
public void testCloneInt() {
assertEquals(null, ArrayUtils.clone((int[]) null));
- final int[] original = new int[] {5, 8};
+ final int[] original = new int[]{5, 8};
final int[] cloned = ArrayUtils.clone(original);
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
@@ -320,7 +320,7 @@ public class ArrayUtilsTest {
@Test
public void testCloneShort() {
assertEquals(null, ArrayUtils.clone((short[]) null));
- final short[] original = new short[] {1, 4};
+ final short[] original = new short[]{1, 4};
final short[] cloned = ArrayUtils.clone(original);
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
@@ -329,7 +329,7 @@ public class ArrayUtilsTest {
@Test
public void testCloneChar() {
assertEquals(null, ArrayUtils.clone((char[]) null));
- final char[] original = new char[] {'a', '4'};
+ final char[] original = new char[]{'a', '4'};
final char[] cloned = ArrayUtils.clone(original);
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
@@ -338,7 +338,7 @@ public class ArrayUtilsTest {
@Test
public void testCloneByte() {
assertEquals(null, ArrayUtils.clone((byte[]) null));
- final byte[] original = new byte[] {1, 6};
+ final byte[] original = new byte[]{1, 6};
final byte[] cloned = ArrayUtils.clone(original);
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
@@ -347,7 +347,7 @@ public class ArrayUtilsTest {
@Test
public void testCloneDouble() {
assertEquals(null, ArrayUtils.clone((double[]) null));
- final double[] original = new double[] {2.4d, 5.7d};
+ final double[] original = new double[]{2.4d, 5.7d};
final double[] cloned = ArrayUtils.clone(original);
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
@@ -356,7 +356,7 @@ public class ArrayUtilsTest {
@Test
public void testCloneFloat() {
assertEquals(null, ArrayUtils.clone((float[]) null));
- final float[] original = new float[] {2.6f, 6.4f};
+ final float[] original = new float[]{2.6f, 6.4f};
final float[] cloned = ArrayUtils.clone(original);
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
@@ -364,7 +364,8 @@ public class ArrayUtilsTest {
//-----------------------------------------------------------------------
- private class TestClass{}
+ private class TestClass {
+ }
@Test
public void testNullToEmptyGenericNull() {
@@ -390,7 +391,7 @@ public class ArrayUtilsTest {
assertSame(input, output);
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected = IllegalArgumentException.class)
public void testNullToEmptyGenericNullType() {
final TestClass[] input = new TestClass[]{};
ArrayUtils.nullToEmpty(input, null);
@@ -411,7 +412,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyBoolean() {
- final boolean[] original = new boolean[] {true, false};
+ final boolean[] original = new boolean[]{true, false};
assertEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -430,7 +431,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyLong() {
- final long[] original = new long[] {1L, 2L};
+ final long[] original = new long[]{1L, 2L};
assertEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -449,7 +450,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyInt() {
- final int[] original = new int[] {1, 2};
+ final int[] original = new int[]{1, 2};
assertEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -468,7 +469,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyShort() {
- final short[] original = new short[] {1, 2};
+ final short[] original = new short[]{1, 2};
assertEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -487,7 +488,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyChar() {
- final char[] original = new char[] {'a', 'b'};
+ final char[] original = new char[]{'a', 'b'};
assertEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -506,7 +507,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyByte() {
- final byte[] original = new byte[] {0x0F, 0x0E};
+ final byte[] original = new byte[]{0x0F, 0x0E};
assertEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -525,7 +526,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyDouble() {
- final double[] original = new double[] {1L, 2L};
+ final double[] original = new double[]{1L, 2L};
assertEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -544,7 +545,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyFloat() {
- final float[] original = new float[] {2.6f, 3.8f};
+ final float[] original = new float[]{2.6f, 3.8f};
assertEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -563,7 +564,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyObject() {
- final Object[] original = new Object[] {Boolean.TRUE, Boolean.FALSE};
+ final Object[] original = new Object[]{Boolean.TRUE, Boolean.FALSE};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -582,7 +583,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyClass() {
- final Class<?>[] original = { Object.class, String.class };
+ final Class<?>[] original = {Object.class, String.class};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -601,7 +602,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyString() {
- final String[] original = new String[] {"abc", "def"};
+ final String[] original = new String[]{"abc", "def"};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -620,7 +621,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyBooleanObject() {
- final Boolean[] original = new Boolean[] {Boolean.TRUE, Boolean.FALSE};
+ final Boolean[] original = new Boolean[]{Boolean.TRUE, Boolean.FALSE};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -639,8 +640,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyLongObject() {
- @SuppressWarnings("boxing")
- final Long[] original = new Long[] {1L, 2L};
+ @SuppressWarnings("boxing") final Long[] original = new Long[]{1L, 2L};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -659,7 +659,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyIntObject() {
- final Integer[] original = new Integer[] {1, 2};
+ final Integer[] original = new Integer[]{1, 2};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -678,8 +678,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyShortObject() {
- @SuppressWarnings("boxing")
- final Short[] original = new Short[] {1, 2};
+ @SuppressWarnings("boxing") final Short[] original = new Short[]{1, 2};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -698,7 +697,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyCharObject() {
- final Character[] original = new Character[] {'a', 'b'};
+ final Character[] original = new Character[]{'a', 'b'};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -717,7 +716,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyByteObject() {
- final Byte[] original = new Byte[] {0x0F, 0x0E};
+ final Byte[] original = new Byte[]{0x0F, 0x0E};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -736,7 +735,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyDoubleObject() {
- final Double[] original = new Double[] {1D, 2D};
+ final Double[] original = new Double[]{1D, 2D};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -755,7 +754,7 @@ public class ArrayUtilsTest {
@Test
public void testNullToEmptyFloatObject() {
- final Float[] original = new Float[] {2.6f, 3.8f};
+ final Float[] original = new Float[]{2.6f, 3.8f};
assertArrayEquals(original, ArrayUtils.nullToEmpty(original));
}
@@ -764,671 +763,670 @@ public class ArrayUtilsTest {
@Test
public void testSubarrayObject() {
final Object[] nullArray = null;
- final Object[] objectArray = { "a", "b", "c", "d", "e", "f"};
+ final Object[] objectArray = {"a", "b", "c", "d", "e", "f"};
assertEquals("0 start, mid end", "abcd",
- StringUtils.join(ArrayUtils.subarray(objectArray, 0, 4)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, 0, 4)));
assertEquals("0 start, length end", "abcdef",
- StringUtils.join(ArrayUtils.subarray(objectArray, 0, objectArray.length)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, 0, objectArray.length)));
assertEquals("mid start, mid end", "bcd",
- StringUtils.join(ArrayUtils.subarray(objectArray, 1, 4)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, 1, 4)));
assertEquals("mid start, length end", "bcdef",
- StringUtils.join(ArrayUtils.subarray(objectArray, 1, objectArray.length)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, 1, objectArray.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", "",
- StringUtils.join(ArrayUtils.subarray(ArrayUtils.EMPTY_OBJECT_ARRAY, 1, 2)));
+ StringUtils.join(ArrayUtils.subarray(ArrayUtils.EMPTY_OBJECT_ARRAY, 1, 2)));
assertEquals("start > end", "",
- StringUtils.join(ArrayUtils.subarray(objectArray, 4, 2)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, 4, 2)));
assertEquals("start == end", "",
- StringUtils.join(ArrayUtils.subarray(objectArray, 3, 3)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, 3, 3)));
assertEquals("start undershoot, normal end", "abcd",
- StringUtils.join(ArrayUtils.subarray(objectArray, -2, 4)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, -2, 4)));
assertEquals("start overshoot, any end", "",
- StringUtils.join(ArrayUtils.subarray(objectArray, 33, 4)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, 33, 4)));
assertEquals("normal start, end overshoot", "cdef",
- StringUtils.join(ArrayUtils.subarray(objectArray, 2, 33)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, 2, 33)));
assertEquals("start undershoot, end overshoot", "abcdef",
- StringUtils.join(ArrayUtils.subarray(objectArray, -2, 12)));
+ StringUtils.join(ArrayUtils.subarray(objectArray, -2, 12)));
// array type tests
- final Date[] dateArray = { new java.sql.Date(new Date().getTime()),
- new Date(), new Date(), new Date(), new Date() };
+ final Date[] dateArray = {new java.sql.Date(new Date().getTime()),
+ new Date(), new Date(), new Date(), new Date()};
assertSame("Object type", Object.class,
- ArrayUtils.subarray(objectArray, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(objectArray, 2, 4).getClass().getComponentType());
assertSame("java.util.Date type", java.util.Date.class,
- ArrayUtils.subarray(dateArray, 1, 4).getClass().getComponentType());
+ ArrayUtils.subarray(dateArray, 1, 4).getClass().getComponentType());
assertNotSame("java.sql.Date type", java.sql.Date.class,
- ArrayUtils.subarray(dateArray, 1, 4).getClass().getComponentType());
+ ArrayUtils.subarray(dateArray, 1, 4).getClass().getComponentType());
try {
- @SuppressWarnings("unused")
- final
- java.sql.Date[] dummy = (java.sql.Date[])ArrayUtils.subarray(dateArray, 1,3);
+ @SuppressWarnings("unused") final java.sql.Date[] dummy = (java.sql.Date[]) ArrayUtils.subarray(dateArray, 1, 3);
fail("Invalid downcast");
- } catch (final ClassCastException e) {}
+ } catch (final ClassCastException e) {
+ }
}
@Test
public void testSubarrayLong() {
final long[] nullArray = null;
- final long[] array = { 999910, 999911, 999912, 999913, 999914, 999915 };
- final long[] leftSubarray = { 999910, 999911, 999912, 999913 };
- final long[] midSubarray = { 999911, 999912, 999913, 999914 };
- final long[] rightSubarray = { 999912, 999913, 999914, 999915 };
+ final long[] array = {999910, 999911, 999912, 999913, 999914, 999915};
+ final long[] leftSubarray = {999910, 999911, 999912, 999913};
+ final long[] midSubarray = {999911, 999912, 999913, 999914};
+ final long[] rightSubarray = {999912, 999913, 999914, 999915};
assertTrue("0 start, mid end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, 0, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, 0, 4)));
assertTrue("0 start, length end",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, 0, array.length)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, 0, array.length)));
assertTrue("mid start, mid end",
- ArrayUtils.isEquals(midSubarray,
- ArrayUtils.subarray(array, 1, 5)));
+ ArrayUtils.isEquals(midSubarray,
+ ArrayUtils.subarray(array, 1, 5)));
assertTrue("mid start, length end",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, array.length)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, array.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", ArrayUtils.EMPTY_LONG_ARRAY,
- ArrayUtils.subarray(ArrayUtils.EMPTY_LONG_ARRAY, 1, 2));
+ ArrayUtils.subarray(ArrayUtils.EMPTY_LONG_ARRAY, 1, 2));
assertEquals("start > end", ArrayUtils.EMPTY_LONG_ARRAY,
- ArrayUtils.subarray(array, 4, 2));
+ ArrayUtils.subarray(array, 4, 2));
assertEquals("start == end", ArrayUtils.EMPTY_LONG_ARRAY,
- ArrayUtils.subarray(array, 3, 3));
+ ArrayUtils.subarray(array, 3, 3));
assertTrue("start undershoot, normal end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, -2, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, -2, 4)));
assertEquals("start overshoot, any end",
- ArrayUtils.EMPTY_LONG_ARRAY,
+ ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.subarray(array, 33, 4));
assertTrue("normal start, end overshoot",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, 33)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, 33)));
assertTrue("start undershoot, end overshoot",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, -2, 12)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, -2, 12)));
// empty-return tests
assertSame("empty array, object test",
- ArrayUtils.EMPTY_LONG_ARRAY,
+ ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.subarray(ArrayUtils.EMPTY_LONG_ARRAY, 1, 2));
assertSame("start > end, object test",
- ArrayUtils.EMPTY_LONG_ARRAY,
+ ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.subarray(array, 4, 1));
assertSame("start == end, object test",
- ArrayUtils.EMPTY_LONG_ARRAY,
+ ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.subarray(array, 3, 3));
assertSame("start overshoot, any end, object test",
- ArrayUtils.EMPTY_LONG_ARRAY,
+ ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.subarray(array, 8733, 4));
// array type tests
assertSame("long type", long.class,
- ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
@Test
public void testSubarrayInt() {
final int[] nullArray = null;
- final int[] array = { 10, 11, 12, 13, 14, 15 };
- final int[] leftSubarray = { 10, 11, 12, 13 };
- final int[] midSubarray = { 11, 12, 13, 14 };
- final int[] rightSubarray = { 12, 13, 14, 15 };
+ final int[] array = {10, 11, 12, 13, 14, 15};
+ final int[] leftSubarray = {10, 11, 12, 13};
+ final int[] midSubarray = {11, 12, 13, 14};
+ final int[] rightSubarray = {12, 13, 14, 15};
assertTrue("0 start, mid end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, 0, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, 0, 4)));
assertTrue("0 start, length end",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, 0, array.length)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, 0, array.length)));
assertTrue("mid start, mid end",
- ArrayUtils.isEquals(midSubarray,
- ArrayUtils.subarray(array, 1, 5)));
+ ArrayUtils.isEquals(midSubarray,
+ ArrayUtils.subarray(array, 1, 5)));
assertTrue("mid start, length end",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, array.length)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, array.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", ArrayUtils.EMPTY_INT_ARRAY,
- ArrayUtils.subarray(ArrayUtils.EMPTY_INT_ARRAY, 1, 2));
+ ArrayUtils.subarray(ArrayUtils.EMPTY_INT_ARRAY, 1, 2));
assertEquals("start > end", ArrayUtils.EMPTY_INT_ARRAY,
- ArrayUtils.subarray(array, 4, 2));
+ ArrayUtils.subarray(array, 4, 2));
assertEquals("start == end", ArrayUtils.EMPTY_INT_ARRAY,
- ArrayUtils.subarray(array, 3, 3));
+ ArrayUtils.subarray(array, 3, 3));
assertTrue("start undershoot, normal end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, -2, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, -2, 4)));
assertEquals("start overshoot, any end",
- ArrayUtils.EMPTY_INT_ARRAY,
+ ArrayUtils.EMPTY_INT_ARRAY,
ArrayUtils.subarray(array, 33, 4));
assertTrue("normal start, end overshoot",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, 33)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, 33)));
assertTrue("start undershoot, end overshoot",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, -2, 12)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, -2, 12)));
// empty-return tests
assertSame("empty array, object test",
- ArrayUtils.EMPTY_INT_ARRAY,
+ ArrayUtils.EMPTY_INT_ARRAY,
ArrayUtils.subarray(ArrayUtils.EMPTY_INT_ARRAY, 1, 2));
assertSame("start > end, object test",
- ArrayUtils.EMPTY_INT_ARRAY,
+ ArrayUtils.EMPTY_INT_ARRAY,
ArrayUtils.subarray(array, 4, 1));
assertSame("start == end, object test",
- ArrayUtils.EMPTY_INT_ARRAY,
+ ArrayUtils.EMPTY_INT_ARRAY,
ArrayUtils.subarray(array, 3, 3));
assertSame("start overshoot, any end, object test",
- ArrayUtils.EMPTY_INT_ARRAY,
+ ArrayUtils.EMPTY_INT_ARRAY,
ArrayUtils.subarray(array, 8733, 4));
// array type tests
assertSame("int type", int.class,
- ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
@Test
public void testSubarrayShort() {
final short[] nullArray = null;
- final short[] array = { 10, 11, 12, 13, 14, 15 };
- final short[] leftSubarray = { 10, 11, 12, 13 };
- final short[] midSubarray = { 11, 12, 13, 14 };
- final short[] rightSubarray = { 12, 13, 14, 15 };
+ final short[] array = {10, 11, 12, 13, 14, 15};
+ final short[] leftSubarray = {10, 11, 12, 13};
+ final short[] midSubarray = {11, 12, 13, 14};
+ final short[] rightSubarray = {12, 13, 14, 15};
assertTrue("0 start, mid end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, 0, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, 0, 4)));
assertTrue("0 start, length end",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, 0, array.length)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, 0, array.length)));
assertTrue("mid start, mid end",
- ArrayUtils.isEquals(midSubarray,
- ArrayUtils.subarray(array, 1, 5)));
+ ArrayUtils.isEquals(midSubarray,
+ ArrayUtils.subarray(array, 1, 5)));
assertTrue("mid start, length end",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, array.length)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, array.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", ArrayUtils.EMPTY_SHORT_ARRAY,
- ArrayUtils.subarray(ArrayUtils.EMPTY_SHORT_ARRAY, 1, 2));
+ ArrayUtils.subarray(ArrayUtils.EMPTY_SHORT_ARRAY, 1, 2));
assertEquals("start > end", ArrayUtils.EMPTY_SHORT_ARRAY,
- ArrayUtils.subarray(array, 4, 2));
+ ArrayUtils.subarray(array, 4, 2));
assertEquals("start == end", ArrayUtils.EMPTY_SHORT_ARRAY,
- ArrayUtils.subarray(array, 3, 3));
+ ArrayUtils.subarray(array, 3, 3));
assertTrue("start undershoot, normal end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, -2, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, -2, 4)));
assertEquals("start overshoot, any end",
- ArrayUtils.EMPTY_SHORT_ARRAY,
+ ArrayUtils.EMPTY_SHORT_ARRAY,
ArrayUtils.subarray(array, 33, 4));
assertTrue("normal start, end overshoot",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, 33)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, 33)));
assertTrue("start undershoot, end overshoot",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, -2, 12)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, -2, 12)));
// empty-return tests
assertSame("empty array, object test",
- ArrayUtils.EMPTY_SHORT_ARRAY,
+ ArrayUtils.EMPTY_SHORT_ARRAY,
ArrayUtils.subarray(ArrayUtils.EMPTY_SHORT_ARRAY, 1, 2));
assertSame("start > end, object test",
- ArrayUtils.EMPTY_SHORT_ARRAY,
+ ArrayUtils.EMPTY_SHORT_ARRAY,
ArrayUtils.subarray(array, 4, 1));
assertSame("start == end, object test",
- ArrayUtils.EMPTY_SHORT_ARRAY,
+ ArrayUtils.EMPTY_SHORT_ARRAY,
ArrayUtils.subarray(array, 3, 3));
assertSame("start overshoot, any end, object test",
- ArrayUtils.EMPTY_SHORT_ARRAY,
+ ArrayUtils.EMPTY_SHORT_ARRAY,
ArrayUtils.subarray(array, 8733, 4));
// array type tests
assertSame("short type", short.class,
- ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
@Test
public void testSubarrChar() {
final char[] nullArray = null;
- final char[] array = { 'a', 'b', 'c', 'd', 'e', 'f' };
- final char[] leftSubarray = { 'a', 'b', 'c', 'd', };
- final char[] midSubarray = { 'b', 'c', 'd', 'e', };
- final char[] rightSubarray = { 'c', 'd', 'e', 'f', };
+ final char[] array = {'a', 'b', 'c', 'd', 'e', 'f'};
+ final char[] leftSubarray = {'a', 'b', 'c', 'd',};
+ final char[] midSubarray = {'b', 'c', 'd', 'e',};
+ final char[] rightSubarray = {'c', 'd', 'e', 'f',};
assertTrue("0 start, mid end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, 0, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, 0, 4)));
assertTrue("0 start, length end",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, 0, array.length)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, 0, array.length)));
assertTrue("mid start, mid end",
- ArrayUtils.isEquals(midSubarray,
- ArrayUtils.subarray(array, 1, 5)));
+ ArrayUtils.isEquals(midSubarray,
+ ArrayUtils.subarray(array, 1, 5)));
assertTrue("mid start, length end",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, array.length)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, array.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", ArrayUtils.EMPTY_CHAR_ARRAY,
- ArrayUtils.subarray(ArrayUtils.EMPTY_CHAR_ARRAY, 1, 2));
+ ArrayUtils.subarray(ArrayUtils.EMPTY_CHAR_ARRAY, 1, 2));
assertEquals("start > end", ArrayUtils.EMPTY_CHAR_ARRAY,
- ArrayUtils.subarray(array, 4, 2));
+ ArrayUtils.subarray(array, 4, 2));
assertEquals("start == end", ArrayUtils.EMPTY_CHAR_ARRAY,
- ArrayUtils.subarray(array, 3, 3));
+ ArrayUtils.subarray(array, 3, 3));
assertTrue("start undershoot, normal end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, -2, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, -2, 4)));
assertEquals("start overshoot, any end",
- ArrayUtils.EMPTY_CHAR_ARRAY,
+ ArrayUtils.EMPTY_CHAR_ARRAY,
ArrayUtils.subarray(array, 33, 4));
assertTrue("normal start, end overshoot",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, 33)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, 33)));
assertTrue("start undershoot, end overshoot",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, -2, 12)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, -2, 12)));
// empty-return tests
assertSame("empty array, object test",
- ArrayUtils.EMPTY_CHAR_ARRAY,
+ ArrayUtils.EMPTY_CHAR_ARRAY,
ArrayUtils.subarray(ArrayUtils.EMPTY_CHAR_ARRAY, 1, 2));
assertSame("start > end, object test",
- ArrayUtils.EMPTY_CHAR_ARRAY,
+ ArrayUtils.EMPTY_CHAR_ARRAY,
ArrayUtils.subarray(array, 4, 1));
assertSame("start == end, object test",
- ArrayUtils.EMPTY_CHAR_ARRAY,
+ ArrayUtils.EMPTY_CHAR_ARRAY,
ArrayUtils.subarray(array, 3, 3));
assertSame("start overshoot, any end, object test",
- ArrayUtils.EMPTY_CHAR_ARRAY,
+ ArrayUtils.EMPTY_CHAR_ARRAY,
ArrayUtils.subarray(array, 8733, 4));
// array type tests
assertSame("char type", char.class,
- ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
@Test
public void testSubarrayByte() {
final byte[] nullArray = null;
- final byte[] array = { 10, 11, 12, 13, 14, 15 };
- final byte[] leftSubarray = { 10, 11, 12, 13 };
- final byte[] midSubarray = { 11, 12, 13, 14 };
- final byte[] rightSubarray = { 12, 13, 14, 15 };
+ final byte[] array = {10, 11, 12, 13, 14, 15};
+ final byte[] leftSubarray = {10, 11, 12, 13};
+ final byte[] midSubarray = {11, 12, 13, 14};
+ final byte[] rightSubarray = {12, 13, 14, 15};
assertTrue("0 start, mid end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, 0, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, 0, 4)));
assertTrue("0 start, length end",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, 0, array.length)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, 0, array.length)));
assertTrue("mid start, mid end",
- ArrayUtils.isEquals(midSubarray,
- ArrayUtils.subarray(array, 1, 5)));
+ ArrayUtils.isEquals(midSubarray,
+ ArrayUtils.subarray(array, 1, 5)));
assertTrue("mid start, length end",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, array.length)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, array.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", ArrayUtils.EMPTY_BYTE_ARRAY,
- ArrayUtils.subarray(ArrayUtils.EMPTY_BYTE_ARRAY, 1, 2));
+ ArrayUtils.subarray(ArrayUtils.EMPTY_BYTE_ARRAY, 1, 2));
assertEquals("start > end", ArrayUtils.EMPTY_BYTE_ARRAY,
- ArrayUtils.subarray(array, 4, 2));
+ ArrayUtils.subarray(array, 4, 2));
assertEquals("start == end", ArrayUtils.EMPTY_BYTE_ARRAY,
- ArrayUtils.subarray(array, 3, 3));
+ ArrayUtils.subarray(array, 3, 3));
assertTrue("start undershoot, normal end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, -2, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, -2, 4)));
assertEquals("start overshoot, any end",
- ArrayUtils.EMPTY_BYTE_ARRAY,
+ ArrayUtils.EMPTY_BYTE_ARRAY,
ArrayUtils.subarray(array, 33, 4));
assertTrue("normal start, end overshoot",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, 33)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, 33)));
assertTrue("start undershoot, end overshoot",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, -2, 12)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, -2, 12)));
// empty-return tests
assertSame("empty array, object test",
- ArrayUtils.EMPTY_BYTE_ARRAY,
+ ArrayUtils.EMPTY_BYTE_ARRAY,
ArrayUtils.subarray(ArrayUtils.EMPTY_BYTE_ARRAY, 1, 2));
assertSame("start > end, object test",
- ArrayUtils.EMPTY_BYTE_ARRAY,
+ ArrayUtils.EMPTY_BYTE_ARRAY,
ArrayUtils.subarray(array, 4, 1));
assertSame("start == end, object test",
- ArrayUtils.EMPTY_BYTE_ARRAY,
+ ArrayUtils.EMPTY_BYTE_ARRAY,
ArrayUtils.subarray(array, 3, 3));
assertSame("start overshoot, any end, object test",
- ArrayUtils.EMPTY_BYTE_ARRAY,
+ ArrayUtils.EMPTY_BYTE_ARRAY,
ArrayUtils.subarray(array, 8733, 4));
// array type tests
assertSame("byte type", byte.class,
- ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
@Test
public void testSubarrayDouble() {
final double[] nullArray = null;
- final double[] array = { 10.123, 11.234, 12.345, 13.456, 14.567, 15.678 };
- final double[] leftSubarray = { 10.123, 11.234, 12.345, 13.456, };
- final double[] midSubarray = { 11.234, 12.345, 13.456, 14.567, };
- final double[] rightSubarray = { 12.345, 13.456, 14.567, 15.678 };
+ final double[] array = {10.123, 11.234, 12.345, 13.456, 14.567, 15.678};
+ final double[] leftSubarray = {10.123, 11.234, 12.345, 13.456,};
+ final double[] midSubarray = {11.234, 12.345, 13.456, 14.567,};
+ final double[] rightSubarray = {12.345, 13.456, 14.567, 15.678};
assertTrue("0 start, mid end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, 0, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, 0, 4)));
assertTrue("0 start, length end",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, 0, array.length)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, 0, array.length)));
assertTrue("mid start, mid end",
- ArrayUtils.isEquals(midSubarray,
- ArrayUtils.subarray(array, 1, 5)));
+ ArrayUtils.isEquals(midSubarray,
+ ArrayUtils.subarray(array, 1, 5)));
assertTrue("mid start, length end",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, array.length)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, array.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", ArrayUtils.EMPTY_DOUBLE_ARRAY,
- ArrayUtils.subarray(ArrayUtils.EMPTY_DOUBLE_ARRAY, 1, 2));
+ ArrayUtils.subarray(ArrayUtils.EMPTY_DOUBLE_ARRAY, 1, 2));
assertEquals("start > end", ArrayUtils.EMPTY_DOUBLE_ARRAY,
- ArrayUtils.subarray(array, 4, 2));
+ ArrayUtils.subarray(array, 4, 2));
assertEquals("start == end", ArrayUtils.EMPTY_DOUBLE_ARRAY,
- ArrayUtils.subarray(array, 3, 3));
+ ArrayUtils.subarray(array, 3, 3));
assertTrue("start undershoot, normal end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, -2, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, -2, 4)));
assertEquals("start overshoot, any end",
- ArrayUtils.EMPTY_DOUBLE_ARRAY,
+ ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.subarray(array, 33, 4));
assertTrue("normal start, end overshoot",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, 33)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, 33)));
assertTrue("start undershoot, end overshoot",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, -2, 12)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, -2, 12)));
// empty-return tests
assertSame("empty array, object test",
- ArrayUtils.EMPTY_DOUBLE_ARRAY,
+ ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.subarray(ArrayUtils.EMPTY_DOUBLE_ARRAY, 1, 2));
assertSame("start > end, object test",
- ArrayUtils.EMPTY_DOUBLE_ARRAY,
+ ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.subarray(array, 4, 1));
assertSame("start == end, object test",
- ArrayUtils.EMPTY_DOUBLE_ARRAY,
+ ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.subarray(array, 3, 3));
assertSame("start overshoot, any end, object test",
- ArrayUtils.EMPTY_DOUBLE_ARRAY,
+ ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.subarray(array, 8733, 4));
// array type tests
assertSame("double type", double.class,
- ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
@Test
public void testSubarrayFloat() {
final float[] nullArray = null;
- final float[] array = { 10, 11, 12, 13, 14, 15 };
- final float[] leftSubarray = { 10, 11, 12, 13 };
- final float[] midSubarray = { 11, 12, 13, 14 };
- final float[] rightSubarray = { 12, 13, 14, 15 };
+ final float[] array = {10, 11, 12, 13, 14, 15};
+ final float[] leftSubarray = {10, 11, 12, 13};
+ final float[] midSubarray = {11, 12, 13, 14};
+ final float[] rightSubarray = {12, 13, 14, 15};
assertTrue("0 start, mid end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, 0, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, 0, 4)));
assertTrue("0 start, length end",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, 0, array.length)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, 0, array.length)));
assertTrue("mid start, mid end",
- ArrayUtils.isEquals(midSubarray,
- ArrayUtils.subarray(array, 1, 5)));
+ ArrayUtils.isEquals(midSubarray,
+ ArrayUtils.subarray(array, 1, 5)));
assertTrue("mid start, length end",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, array.length)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, array.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", ArrayUtils.EMPTY_FLOAT_ARRAY,
- ArrayUtils.subarray(ArrayUtils.EMPTY_FLOAT_ARRAY, 1, 2));
+ ArrayUtils.subarray(ArrayUtils.EMPTY_FLOAT_ARRAY, 1, 2));
assertEquals("start > end", ArrayUtils.EMPTY_FLOAT_ARRAY,
- ArrayUtils.subarray(array, 4, 2));
+ ArrayUtils.subarray(array, 4, 2));
assertEquals("start == end", ArrayUtils.EMPTY_FLOAT_ARRAY,
- ArrayUtils.subarray(array, 3, 3));
+ ArrayUtils.subarray(array, 3, 3));
assertTrue("start undershoot, normal end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, -2, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, -2, 4)));
assertEquals("start overshoot, any end",
- ArrayUtils.EMPTY_FLOAT_ARRAY,
+ ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.subarray(array, 33, 4));
assertTrue("normal start, end overshoot",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, 33)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, 33)));
assertTrue("start undershoot, end overshoot",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, -2, 12)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, -2, 12)));
// empty-return tests
assertSame("empty array, object test",
- ArrayUtils.EMPTY_FLOAT_ARRAY,
+ ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.subarray(ArrayUtils.EMPTY_FLOAT_ARRAY, 1, 2));
assertSame("start > end, object test",
- ArrayUtils.EMPTY_FLOAT_ARRAY,
+ ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.subarray(array, 4, 1));
assertSame("start == end, object test",
- ArrayUtils.EMPTY_FLOAT_ARRAY,
+ ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.subarray(array, 3, 3));
assertSame("start overshoot, any end, object test",
- ArrayUtils.EMPTY_FLOAT_ARRAY,
+ ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.subarray(array, 8733, 4));
// array type tests
assertSame("float type", float.class,
- ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
@Test
public void testSubarrayBoolean() {
final boolean[] nullArray = null;
- final boolean[] array = { true, true, false, true, false, true };
- final boolean[] leftSubarray = { true, true, false, true };
- final boolean[] midSubarray = { true, false, true, false };
- final boolean[] rightSubarray = { false, true, false, true };
+ final boolean[] array = {true, true, false, true, false, true};
+ final boolean[] leftSubarray = {true, true, false, true};
+ final boolean[] midSubarray = {true, false, true, false};
+ final boolean[] rightSubarray = {false, true, false, true};
assertTrue("0 start, mid end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, 0, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, 0, 4)));
assertTrue("0 start, length end",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, 0, array.length)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, 0, array.length)));
assertTrue("mid start, mid end",
- ArrayUtils.isEquals(midSubarray,
- ArrayUtils.subarray(array, 1, 5)));
+ ArrayUtils.isEquals(midSubarray,
+ ArrayUtils.subarray(array, 1, 5)));
assertTrue("mid start, length end",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, array.length)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, array.length)));
assertNull("null input", ArrayUtils.subarray(nullArray, 0, 3));
assertEquals("empty array", ArrayUtils.EMPTY_BOOLEAN_ARRAY,
- ArrayUtils.subarray(ArrayUtils.EMPTY_BOOLEAN_ARRAY, 1, 2));
+ ArrayUtils.subarray(ArrayUtils.EMPTY_BOOLEAN_ARRAY, 1, 2));
assertEquals("start > end", ArrayUtils.EMPTY_BOOLEAN_ARRAY,
- ArrayUtils.subarray(array, 4, 2));
+ ArrayUtils.subarray(array, 4, 2));
assertEquals("start == end", ArrayUtils.EMPTY_BOOLEAN_ARRAY,
- ArrayUtils.subarray(array, 3, 3));
+ ArrayUtils.subarray(array, 3, 3));
assertTrue("start undershoot, normal end",
- ArrayUtils.isEquals(leftSubarray,
- ArrayUtils.subarray(array, -2, 4)));
+ ArrayUtils.isEquals(leftSubarray,
+ ArrayUtils.subarray(array, -2, 4)));
assertEquals("start overshoot, any end",
- ArrayUtils.EMPTY_BOOLEAN_ARRAY,
+ ArrayUtils.EMPTY_BOOLEAN_ARRAY,
ArrayUtils.subarray(array, 33, 4));
assertTrue("normal start, end overshoot",
- ArrayUtils.isEquals(rightSubarray,
- ArrayUtils.subarray(array, 2, 33)));
+ ArrayUtils.isEquals(rightSubarray,
+ ArrayUtils.subarray(array, 2, 33)));
assertTrue("start undershoot, end overshoot",
- ArrayUtils.isEquals(array,
- ArrayUtils.subarray(array, -2, 12)));
+ ArrayUtils.isEquals(array,
+ ArrayUtils.subarray(array, -2, 12)));
// empty-return tests
assertSame("empty array, object test",
- ArrayUtils.EMPTY_BOOLEAN_ARRAY,
+ ArrayUtils.EMPTY_BOOLEAN_ARRAY,
ArrayUtils.subarray(ArrayUtils.EMPTY_BOOLEAN_ARRAY, 1, 2));
assertSame("start > end, object test",
- ArrayUtils.EMPTY_BOOLEAN_ARRAY,
+ ArrayUtils.EMPTY_BOOLEAN_ARRAY,
ArrayUtils.subarray(array, 4, 1));
assertSame("start == end, object test",
- ArrayUtils.EMPTY_BOOLEAN_ARRAY,
+ ArrayUtils.EMPTY_BOOLEAN_ARRAY,
ArrayUtils.subarray(array, 3, 3));
assertSame("start overshoot, any end, object test",
- ArrayUtils.EMPTY_BOOLEAN_ARRAY,
+ ArrayUtils.EMPTY_BOOLEAN_ARRAY,
ArrayUtils.subarray(array, 8733, 4));
// array type tests
assertSame("boolean type", boolean.class,
- ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
+ ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
@@ -1437,8 +1435,8 @@ public class ArrayUtilsTest {
public void testSameLength() {
final Object[] nullArray = null;
final Object[] emptyArray = new Object[0];
- final Object[] oneArray = new Object[] {"pick"};
- final Object[] twoArray = new Object[] {"pick", "stick"};
+ final Object[] oneArray = new Object[]{"pick"};
+ final Object[] twoArray = new Object[]{"pick", "stick"};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1465,8 +1463,8 @@ public class ArrayUtilsTest {
public void testSameLengthBoolean() {
final boolean[] nullArray = null;
final boolean[] emptyArray = new boolean[0];
- final boolean[] oneArray = new boolean[] {true};
- final boolean[] twoArray = new boolean[] {true, false};
+ final boolean[] oneArray = new boolean[]{true};
+ final boolean[] twoArray = new boolean[]{true, false};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1493,8 +1491,8 @@ public class ArrayUtilsTest {
public void testSameLengthLong() {
final long[] nullArray = null;
final long[] emptyArray = new long[0];
- final long[] oneArray = new long[] {0L};
- final long[] twoArray = new long[] {0L, 76L};
+ final long[] oneArray = new long[]{0L};
+ final long[] twoArray = new long[]{0L, 76L};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1521,8 +1519,8 @@ public class ArrayUtilsTest {
public void testSameLengthInt() {
final int[] nullArray = null;
final int[] emptyArray = new int[0];
- final int[] oneArray = new int[] {4};
- final int[] twoArray = new int[] {5, 7};
+ final int[] oneArray = new int[]{4};
+ final int[] twoArray = new int[]{5, 7};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1549,8 +1547,8 @@ public class ArrayUtilsTest {
public void testSameLengthShort() {
final short[] nullArray = null;
final short[] emptyArray = new short[0];
- final short[] oneArray = new short[] {4};
- final short[] twoArray = new short[] {6, 8};
+ final short[] oneArray = new short[]{4};
+ final short[] twoArray = new short[]{6, 8};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1577,8 +1575,8 @@ public class ArrayUtilsTest {
public void testSameLengthChar() {
final char[] nullArray = null;
final char[] emptyArray = new char[0];
- final char[] oneArray = new char[] {'f'};
- final char[] twoArray = new char[] {'d', 't'};
+ final char[] oneArray = new char[]{'f'};
+ final char[] twoArray = new char[]{'d', 't'};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1605,8 +1603,8 @@ public class ArrayUtilsTest {
public void testSameLengthByte() {
final byte[] nullArray = null;
final byte[] emptyArray = new byte[0];
- final byte[] oneArray = new byte[] {3};
- final byte[] twoArray = new byte[] {4, 6};
+ final byte[] oneArray = new byte[]{3};
+ final byte[] twoArray = new byte[]{4, 6};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1633,8 +1631,8 @@ public class ArrayUtilsTest {
public void testSameLengthDouble() {
final double[] nullArray = null;
final double[] emptyArray = new double[0];
- final double[] oneArray = new double[] {1.3d};
- final double[] twoArray = new double[] {4.5d, 6.3d};
+ final double[] oneArray = new double[]{1.3d};
+ final double[] twoArray = new double[]{4.5d, 6.3d};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1661,8 +1659,8 @@ public class ArrayUtilsTest {
public void testSameLengthFloat() {
final float[] nullArray = null;
final float[] emptyArray = new float[0];
- final float[] oneArray = new float[] {2.5f};
- final float[] twoArray = new float[] {6.4f, 5.8f};
+ final float[] oneArray = new float[]{2.5f};
+ final float[] twoArray = new float[]{6.4f, 5.8f};
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
@@ -1691,15 +1689,18 @@ public class ArrayUtilsTest {
try {
ArrayUtils.isSameType(null, null);
fail();
- } catch (final IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {
+ }
try {
ArrayUtils.isSameType(null, new Object[0]);
fail();
- } catch (final IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {
+ }
try {
ArrayUtils.isSameType(new Object[0], null);
fail();
- } catch (final IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {
+ }
assertTrue(ArrayUtils.isSameType(new Object[0], new Object[0]));
assertFalse(ArrayUtils.isSameType(new String[0], new Object[0]));
@@ -1713,16 +1714,16 @@ public class ArrayUtilsTest {
public void testReverse() {
final StringBuffer str1 = new StringBuffer("pick");
final String str2 = "a";
- final String[] str3 = new String[] {"stick"};
+ final String[] str3 = new String[]{"stick"};
final String str4 = "up";
- Object[] array = new Object[] {str1, str2, str3};
+ Object[] array = new Object[]{str1, str2, str3};
ArrayUtils.reverse(array);
assertEquals(array[0], str3);
assertEquals(array[1], str2);
assertEquals(array[2], str1);
- array = new Object[] {str1, str2, str3, str4};
+ array = new Object[]{str1, str2, str3, str4};
ArrayUtils.reverse(array);
assertEquals(array[0], str4);
assertEquals(array[1], str3);
@@ -1736,7 +1737,7 @@ public class ArrayUtilsTest {
@Test
public void testReverseLong() {
- long[] array = new long[] {1L, 2L, 3L};
+ long[] array = new long[]{1L, 2L, 3L};
ArrayUtils.reverse(array);
assertEquals(array[0], 3L);
assertEquals(array[1], 2L);
@@ -1749,7 +1750,7 @@ public class ArrayUtilsTest {
@Test
public void testReverseInt() {
- int[] array = new int[] {1, 2, 3};
+ int[] array = new int[]{1, 2, 3};
ArrayUtils.reverse(array);
assertEquals(array[0], 3);
assertEquals(array[1], 2);
@@ -1762,7 +1763,7 @@ public class ArrayUtilsTest {
@Test
public void testReverseShort() {
- short[] array = new short[] {1, 2, 3};
+ short[] array = new short[]{1, 2, 3};
ArrayUtils.reverse(array);
assertEquals(array[0], 3);
assertEquals(array[1], 2);
@@ -1775,7 +1776,7 @@ public class ArrayUtilsTest {
@Test
public void testReverseChar() {
- char[] array = new char[] {'a', 'f', 'C'};
+ char[] array = new char[]{'a', 'f', 'C'};
ArrayUtils.reverse(array);
assertEquals(array[0], 'C');
assertEquals(array[1], 'f');
@@ -1788,7 +1789,7 @@ public class ArrayUtilsTest {
@Test
public void testReverseByte() {
- byte[] array = new byte[] {2, 3, 4};
+ byte[] array = new byte[]{2, 3, 4};
ArrayUtils.reverse(array);
assertEquals(array[0], 4);
assertEquals(array[1], 3);
@@ -1801,7 +1802,7 @@ public class ArrayUtilsTest {
@Test
public void testReverseDouble() {
- double[] array = new double[] {0.3d, 0.4d, 0.5d};
+ double[] array = new double[]{0.3d, 0.4d, 0.5d};
ArrayUtils.reverse(array);
assertEquals(array[0], 0.5d, 0.0d);
assertEquals(array[1], 0.4d, 0.0d);
@@ -1814,7 +1815,7 @@ public class ArrayUtilsTest {
@Test
public void testReverseFloat() {
- float[] array = new float[] {0.3f, 0.4f, 0.5f};
+ float[] array = new float[]{0.3f, 0.4f, 0.5f};
ArrayUtils.reverse(array);
assertEquals(array[0], 0.5f, 0.0f);
assertEquals(array[1], 0.4f, 0.0f);
@@ -1827,7 +1828,7 @@ public class ArrayUtilsTest {
@Test
public void testReverseBoolean() {
- boolean[] array = new boolean[] {false, false, true};
+ boolean[] array = new boolean[]{false, false, true};
ArrayUtils.reverse(array);
assertTrue(array[0]);
assertFalse(array[1]);
@@ -1840,26 +1841,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseBooleanRange() {
- boolean[] array = new boolean[] {false, false, true};
+ boolean[] array = new boolean[]{false, false, true};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertTrue(array[0]);
assertFalse(array[1]);
assertFalse(array[2]);
// a range
- array = new boolean[] {false, false, true};
+ array = new boolean[]{false, false, true};
ArrayUtils.reverse(array, 0, 2);
assertFalse(array[0]);
assertFalse(array[1]);
assertTrue(array[2]);
// a range with a negative start
- array = new boolean[] {false, false, true};
+ array = new boolean[]{false, false, true};
ArrayUtils.reverse(array, -1, 3);
assertTrue(array[0]);
assertFalse(array[1]);
assertFalse(array[2]);
// a range with a large stop index
- array = new boolean[] {false, false, true};
+ array = new boolean[]{false, false, true};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertTrue(array[0]);
assertFalse(array[1]);
@@ -1872,26 +1873,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseByteRange() {
- byte[] array = new byte[] {1, 2, 3};
+ byte[] array = new byte[]{1, 2, 3};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range
- array = new byte[] {1, 2, 3};
+ array = new byte[]{1, 2, 3};
ArrayUtils.reverse(array, 0, 2);
assertEquals(2, array[0]);
assertEquals(1, array[1]);
assertEquals(3, array[2]);
// a range with a negative start
- array = new byte[] {1, 2, 3};
+ array = new byte[]{1, 2, 3};
ArrayUtils.reverse(array, -1, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range with a large stop index
- array = new byte[] {1, 2, 3};
+ array = new byte[]{1, 2, 3};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -1904,26 +1905,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseCharRange() {
- char[] array = new char[] {1, 2, 3};
+ char[] array = new char[]{1, 2, 3};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.reverse(array, 0, 2);
assertEquals(2, array[0]);
assertEquals(1, array[1]);
assertEquals(3, array[2]);
// a range with a negative start
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.reverse(array, -1, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range with a large stop index
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -1936,26 +1937,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseDoubleRange() {
- double[] array = new double[] {1, 2, 3};
+ double[] array = new double[]{1, 2, 3};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
// a range
- array = new double[] {1, 2, 3};
+ array = new double[]{1, 2, 3};
ArrayUtils.reverse(array, 0, 2);
assertEquals(2, array[0], 0);
assertEquals(1, array[1], 0);
assertEquals(3, array[2], 0);
// a range with a negative start
- array = new double[] {1, 2, 3};
+ array = new double[]{1, 2, 3};
ArrayUtils.reverse(array, -1, 3);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
// a range with a large stop index
- array = new double[] {1, 2, 3};
+ array = new double[]{1, 2, 3};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
@@ -1968,26 +1969,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseFloatRange() {
- float[] array = new float[] {1, 2, 3};
+ float[] array = new float[]{1, 2, 3};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
// a range
- array = new float[] {1, 2, 3};
+ array = new float[]{1, 2, 3};
ArrayUtils.reverse(array, 0, 2);
assertEquals(2, array[0], 0);
assertEquals(1, array[1], 0);
assertEquals(3, array[2], 0);
// a range with a negative start
- array = new float[] {1, 2, 3};
+ array = new float[]{1, 2, 3};
ArrayUtils.reverse(array, -1, 3);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
// a range with a large stop index
- array = new float[] {1, 2, 3};
+ array = new float[]{1, 2, 3};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2000,26 +2001,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseIntRange() {
- int[] array = new int[] {1, 2, 3};
+ int[] array = new int[]{1, 2, 3};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.reverse(array, 0, 2);
assertEquals(2, array[0]);
assertEquals(1, array[1]);
assertEquals(3, array[2]);
// a range with a negative start
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.reverse(array, -1, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range with a large stop index
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -2032,26 +2033,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseLongRange() {
- long[] array = new long[] {1, 2, 3};
+ long[] array = new long[]{1, 2, 3};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range
- array = new long[] {1, 2, 3};
+ array = new long[]{1, 2, 3};
ArrayUtils.reverse(array, 0, 2);
assertEquals(2, array[0]);
assertEquals(1, array[1]);
assertEquals(3, array[2]);
// a range with a negative start
- array = new long[] {1, 2, 3};
+ array = new long[]{1, 2, 3};
ArrayUtils.reverse(array, -1, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range with a large stop index
- array = new long[] {1, 2, 3};
+ array = new long[]{1, 2, 3};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -2064,26 +2065,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseShortRange() {
- short[] array = new short[] {1, 2, 3};
+ short[] array = new short[]{1, 2, 3};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range
- array = new short[] {1, 2, 3};
+ array = new short[]{1, 2, 3};
ArrayUtils.reverse(array, 0, 2);
assertEquals(2, array[0]);
assertEquals(1, array[1]);
assertEquals(3, array[2]);
// a range with a negative start
- array = new short[] {1, 2, 3};
+ array = new short[]{1, 2, 3};
ArrayUtils.reverse(array, -1, 3);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
// a range with a large stop index
- array = new short[] {1, 2, 3};
+ array = new short[]{1, 2, 3};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -2096,26 +2097,26 @@ public class ArrayUtilsTest {
@Test
public void testReverseObjectRange() {
- String[] array = new String[] {"1", "2", "3"};
+ String[] array = new String[]{"1", "2", "3"};
// The whole array
ArrayUtils.reverse(array, 0, 3);
assertEquals("3", array[0]);
assertEquals("2", array[1]);
assertEquals("1", array[2]);
// a range
- array = new String[] {"1", "2", "3"};
+ array = new String[]{"1", "2", "3"};
ArrayUtils.reverse(array, 0, 2);
assertEquals("2", array[0]);
assertEquals("1", array[1]);
assertEquals("3", array[2]);
// a range with a negative start
- array = new String[] {"1", "2", "3"};
+ array = new String[]{"1", "2", "3"};
ArrayUtils.reverse(array, -1, 3);
assertEquals("3", array[0]);
assertEquals("2", array[1]);
assertEquals("1", array[2]);
// a range with a large stop index
- array = new String[] {"1", "2", "3"};
+ array = new String[]{"1", "2", "3"};
ArrayUtils.reverse(array, -1, array.length + 1000);
assertEquals("3", array[0]);
assertEquals("2", array[1]);
@@ -2129,53 +2130,53 @@ public class ArrayUtilsTest {
//-----------------------------------------------------------------------
@Test
public void testSwapChar() {
- char[] array = new char[] {1, 2, 3};
+ char[] array = new char[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2);
- assertArrayEquals(new char[] {3, 2, 1}, array);
+ assertArrayEquals(new char[]{3, 2, 1}, array);
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.swap(array, 0, 0);
- assertArrayEquals(new char[] {1, 2, 3}, array);
+ assertArrayEquals(new char[]{1, 2, 3}, array);
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.swap(array, 1, 0);
- assertArrayEquals(new char[] {2, 1, 3}, array);
+ assertArrayEquals(new char[]{2, 1, 3}, array);
}
@Test
public void testSwapCharRange() {
- char[] array = new char[] {1, 2, 3, 4};
+ char[] array = new char[]{1, 2, 3, 4};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(4, array[1]);
assertEquals(1, array[2]);
assertEquals(2, array[3]);
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.swap(array, 0, 3);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
- array = new char[] {1, 2, 3};
+ array = new char[]{1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2184,7 +2185,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapByte() {
- final byte[] array = new byte[] {1, 2, 3};
+ final byte[] array = new byte[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -2207,38 +2208,38 @@ public class ArrayUtilsTest {
@Test
public void testSwapByteRange() {
- byte[] array = new byte[] {1, 2, 3, 4};
+ byte[] array = new byte[]{1, 2, 3, 4};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(4, array[1]);
assertEquals(1, array[2]);
assertEquals(2, array[3]);
- array = new byte[] {1, 2, 3};
+ array = new byte[]{1, 2, 3};
ArrayUtils.swap(array, 0, 3);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
- array = new byte[] {1, 2, 3};
+ array = new byte[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
- array = new byte[] {1, 2, 3};
+ array = new byte[]{1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
- array = new byte[] {1, 2, 3};
+ array = new byte[]{1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
- array = new byte[] {1, 2, 3};
+ array = new byte[]{1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2247,7 +2248,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapFloat() {
- final float[] array = new float[] {1, 2, 3};
+ final float[] array = new float[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2270,38 +2271,38 @@ public class ArrayUtilsTest {
@Test
public void testSwapFloatRange() {
- float[] array = new float[] {1, 2, 3, 4};
+ float[] array = new float[]{1, 2, 3, 4};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(4, array[1], 0);
assertEquals(1, array[2], 0);
assertEquals(2, array[3], 0);
- array = new float[] {1, 2, 3};
+ array = new float[]{1, 2, 3};
ArrayUtils.swap(array, 0, 3);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
- array = new float[] {1, 2, 3};
+ array = new float[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
- array = new float[] {1, 2, 3};
+ array = new float[]{1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
- array = new float[] {1, 2, 3};
+ array = new float[]{1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
- array = new float[] {1, 2, 3};
+ array = new float[]{1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2310,7 +2311,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapDouble() {
- final double[] array = new double[] {1, 2, 3};
+ final double[] array = new double[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2333,38 +2334,38 @@ public class ArrayUtilsTest {
@Test
public void testSwapDoubleRange() {
- double[] array = new double[] {1, 2, 3, 4};
+ double[] array = new double[]{1, 2, 3, 4};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(4, array[1], 0);
assertEquals(1, array[2], 0);
assertEquals(2, array[3], 0);
- array = new double[] {1, 2, 3};
+ array = new double[]{1, 2, 3};
ArrayUtils.swap(array, 0, 3);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
- array = new double[] {1, 2, 3};
+ array = new double[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
- array = new double[] {1, 2, 3};
+ array = new double[]{1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
- array = new double[] {1, 2, 3};
+ array = new double[]{1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
- array = new double[] {1, 2, 3};
+ array = new double[]{1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
@@ -2373,7 +2374,7 @@ public class ArrayUtilsTest {
@Test
public void testSwapInt() {
- final int[] array = new int[] {1, 2, 3};
+ final int[] array = new int[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -2396,38 +2397,38 @@ public class ArrayUtilsTest {
@Test
public void testSwapIntRange() {
- int[] array = new int[] {1, 2, 3, 4};
+ int[] array = new int[]{1, 2, 3, 4};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(4, array[1]);
assertEquals(1, array[2]);
assertEquals(2, array[3]);
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.swap(array, 3, 0);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
@@ -2437,18 +2438,18 @@ public class ArrayUtilsTest {
@Test
public void testSwapIntExchangedOffsets() {
int[] array;
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.swap(array, 0, 1, 2);
- assertArrayEquals(new int[] {2, 3, 1}, array);
+ assertArrayEquals(new int[]{2, 3, 1}, array);
- array = new int[] {1, 2, 3};
+ array = new int[]{1, 2, 3};
ArrayUtils.swap(array, 1, 0, 2);
- assertArrayEquals(new int[] {2, 3, 1}, array);
+ assertArrayEquals(new int[]{2, 3, 1}, array);
}
@Test
public void testSwapShort() {
- final short[] array = new short[] {1, 2, 3};
+ final short[] array = new short[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
@@ -2471,38 +2472,38 @@ public class ArrayUtilsTest {
@Test
public void testSwapShortRange() {
- short[] array = new short[] {1, 2, 3, 4};
+ short[] array = new short[]{1, 2, 3, 4};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(4, array[1]);
assertEquals(1, array[2]);
assertEquals(2, array[3]);
- array = new short[] {1, 2, 3};
+ array = new short[]{1, 2, 3};
ArrayUtils.swap(array, 3, 0);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
- array = new short[] {1, 2, 3};
+ array = new short[]{1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
- array = new short[] {1, 2, 3};
+ array = new short[]{1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
- array = new short[] {1, 2, 3};
+ array = new short[]{1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
ass
<TRUNCATED>
[16/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java
index 970deb7..699bac7 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParser_MoreOrLessTest.java
@@ -28,15 +28,15 @@ import org.junit.Test;
public class FastDateParser_MoreOrLessTest {
private static final TimeZone NEW_YORK = TimeZone.getTimeZone("America/New_York");
-
+
@Test
public void testInputHasPrecedingCharacters() {
final FastDateParser parser = new FastDateParser("MM/dd", TimeZone.getDefault(), Locale.getDefault());
final ParsePosition parsePosition = new ParsePosition(0);
final Date date = parser.parse("A 3/23/61", parsePosition);
Assert.assertNull(date);
- Assert.assertEquals(0, parsePosition.getIndex());
- Assert.assertEquals(0, parsePosition.getErrorIndex());
+ Assert.assertEquals(0, parsePosition.getIndex());
+ Assert.assertEquals(0, parsePosition.getErrorIndex());
}
@Test
@@ -51,7 +51,7 @@ public class FastDateParser_MoreOrLessTest {
calendar.setTime(date);
Assert.assertEquals(1961, calendar.get(Calendar.YEAR));
Assert.assertEquals(2, calendar.get(Calendar.MONTH));
- Assert.assertEquals(23, calendar.get(Calendar.DATE));
+ Assert.assertEquals(23, calendar.get(Calendar.DATE));
}
@Test
@@ -64,9 +64,9 @@ public class FastDateParser_MoreOrLessTest {
final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Assert.assertEquals(2, calendar.get(Calendar.MONTH));
- Assert.assertEquals(23, calendar.get(Calendar.DATE));
+ Assert.assertEquals(23, calendar.get(Calendar.DATE));
}
-
+
@Test
public void testInputHasWrongCharacters() {
final FastDateParser parser = new FastDateParser("MM-dd-yyy", TimeZone.getDefault(), Locale.getDefault());
@@ -74,7 +74,7 @@ public class FastDateParser_MoreOrLessTest {
Assert.assertNull(parser.parse("03/23/1961", parsePosition));
Assert.assertEquals(2, parsePosition.getErrorIndex());
}
-
+
@Test
public void testInputHasLessCharacters() {
final FastDateParser parser = new FastDateParser("MM/dd/yyy", TimeZone.getDefault(), Locale.getDefault());
@@ -82,21 +82,21 @@ public class FastDateParser_MoreOrLessTest {
Assert.assertNull(parser.parse("03/23", parsePosition));
Assert.assertEquals(5, parsePosition.getErrorIndex());
}
-
+
@Test
public void testInputHasWrongTimeZone() {
final FastDateParser parser = new FastDateParser("mm:ss z", NEW_YORK, Locale.US);
-
+
final String input = "11:23 Pacific Standard Time";
final ParsePosition parsePosition = new ParsePosition(0);
Assert.assertNotNull(parser.parse(input, parsePosition));
Assert.assertEquals(input.length(), parsePosition.getIndex());
-
+
parsePosition.setIndex(0);
Assert.assertNull(parser.parse( "11:23 Pacific Standard ", parsePosition));
Assert.assertEquals(6, parsePosition.getErrorIndex());
}
-
+
@Test
public void testInputHasWrongDay() {
final FastDateParser parser = new FastDateParser("EEEE, MM/dd/yyy", NEW_YORK, Locale.US);
@@ -104,7 +104,7 @@ public class FastDateParser_MoreOrLessTest {
final ParsePosition parsePosition = new ParsePosition(0);
Assert.assertNotNull(parser.parse(input, parsePosition));
Assert.assertEquals(input.length(), parsePosition.getIndex());
-
+
parsePosition.setIndex(0);
Assert.assertNull(parser.parse( "Thorsday, 03/23/61", parsePosition));
Assert.assertEquals(0, parsePosition.getErrorIndex());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
index fa8836e..8d83726 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
@@ -42,7 +42,7 @@ import org.junit.Test;
* @since 3.0
*/
public class FastDatePrinterTest {
-
+
private static final String YYYY_MM_DD = "yyyy/MM/dd";
private static final TimeZone NEW_YORK = TimeZone.getTimeZone("America/New_York");
private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
@@ -226,36 +226,36 @@ public class FastDatePrinterTest {
assertEquals("fredag, week 53", fdf.format(d));
}
-
+
@Test
public void testEquals() {
final DatePrinter printer1= getInstance(YYYY_MM_DD);
final DatePrinter printer2= getInstance(YYYY_MM_DD);
assertEquals(printer1, printer2);
- assertEquals(printer1.hashCode(), printer2.hashCode());
+ assertEquals(printer1.hashCode(), printer2.hashCode());
assertFalse(printer1.equals(new Object()));
}
-
+
@Test
public void testToStringContainsName() {
final DatePrinter printer= getInstance(YYYY_MM_DD);
assertTrue(printer.toString().startsWith("FastDate"));
}
-
+
@Test
public void testPatternMatches() {
final DatePrinter printer= getInstance(YYYY_MM_DD);
assertEquals(YYYY_MM_DD, printer.getPattern());
}
-
+
@Test
public void testLocaleMatches() {
final DatePrinter printer= getInstance(YYYY_MM_DD, SWEDEN);
assertEquals(SWEDEN, printer.getLocale());
}
-
+
@Test
public void testTimeZoneMatches() {
final DatePrinter printer= getInstance(YYYY_MM_DD, NEW_YORK);
@@ -268,10 +268,10 @@ public class FastDatePrinterTest {
final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
final FastDateFormat noColonFormat = FastDateFormat.getInstance("Z");
assertEquals("+0000", noColonFormat.format(c));
-
+
final FastDateFormat isoFormat = FastDateFormat.getInstance("ZZ");
assertEquals("Z", isoFormat.format(c));
-
+
final FastDateFormat colonFormat = FastDateFormat.getInstance("ZZZ");
assertEquals("+00:00", colonFormat.format(c));
}
@@ -325,7 +325,7 @@ public class FastDatePrinterTest {
assertEquals(trial.three, printer.format(cal));
}
}
-
+
@Test
public void testLang1103() throws ParseException {
final Calendar cal = Calendar.getInstance(SWEDEN);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
index eefe2b3..645b680 100644
--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -41,10 +41,10 @@ public class StopWatchTest {
watch.stop();
final long time = watch.getTime();
assertEquals(time, watch.getTime());
-
+
assertTrue(time >= 500);
assertTrue(time < 700);
-
+
watch.reset();
assertEquals(0, watch.getTime());
}
@@ -54,13 +54,13 @@ public class StopWatchTest {
final StopWatch watch = StopWatch.createStarted();
assertTrue(watch.isStarted());
}
-
+
@Test
public void testStopWatchSimpleGet(){
final StopWatch watch = new StopWatch();
assertEquals(0, watch.getTime());
assertEquals("00:00:00.000", watch.toString());
-
+
watch.start();
try {Thread.sleep(500);} catch (final InterruptedException ex) {}
assertTrue(watch.getTime() < 2000);
@@ -95,14 +95,14 @@ public class StopWatchTest {
watch.stop();
final long totalTime = watch.getTime();
- assertEquals("Formatted split string not the correct length",
+ assertEquals("Formatted split string not the correct length",
splitStr.length(), 12);
assertTrue(splitTime >= 500);
assertTrue(splitTime < 700);
assertTrue(totalTime >= 1500);
assertTrue(totalTime < 1900);
}
-
+
@Test
public void testStopWatchSuspend(){
final StopWatch watch = new StopWatch();
@@ -115,7 +115,7 @@ public class StopWatchTest {
try {Thread.sleep(550);} catch (final InterruptedException ex) {}
watch.stop();
final long totalTime = watch.getTime();
-
+
assertTrue(suspendTime >= 500);
assertTrue(suspendTime < 700);
assertTrue(totalTime >= 1000);
@@ -275,7 +275,7 @@ public class StopWatchTest {
* Creates a suspended StopWatch object which appears to have elapsed
* for the requested amount of time in nanoseconds.
* <p>
- *
+ *
* <pre>
* // Create a mock StopWatch with a time of 2:59:01.999
* final long nanos = TimeUnit.HOURS.toNanos(2)
@@ -284,7 +284,7 @@ public class StopWatchTest {
* + TimeUnit.MILLISECONDS.toNanos(999);
* final StopWatch watch = createMockStopWatch(nanos);
* </pre>
- *
+ *
* @param nanos Time in nanoseconds to have elapsed on the stop watch
* @return StopWatch in a suspended state with the elapsed time
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java b/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java
index eaedef3..998ab1c 100644
--- a/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java
+++ b/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java
@@ -78,37 +78,37 @@ public class ImmutablePairTest {
public void testHashCode() throws Exception {
assertEquals(ImmutablePair.of(null, "foo").hashCode(), ImmutablePair.of(null, "foo").hashCode());
}
-
+
@Test
public void testNullPairEquals() {
assertEquals(ImmutablePair.nullPair(), ImmutablePair.nullPair());
}
-
+
@Test
public void testNullPairSame() {
assertSame(ImmutablePair.nullPair(), ImmutablePair.nullPair());
}
-
+
@Test
public void testNullPairLeft() {
assertNull(ImmutablePair.nullPair().getLeft());
}
-
+
@Test
public void testNullPairKey() {
assertNull(ImmutablePair.nullPair().getKey());
}
-
+
@Test
public void testNullPairRight() {
assertNull(ImmutablePair.nullPair().getRight());
}
-
+
@Test
public void testNullPairValue() {
assertNull(ImmutablePair.nullPair().getValue());
}
-
+
@Test
public void testNullPairTyped() {
// No compiler warnings
@@ -116,7 +116,7 @@ public class ImmutablePairTest {
ImmutablePair<String, String> pair = ImmutablePair.nullPair();
assertNotNull(pair);
}
-
+
@Test
public void testToString() throws Exception {
assertEquals("(null,null)", ImmutablePair.of(null, null).toString());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java b/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java
index 3be6660..d126d6e 100644
--- a/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java
+++ b/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java
@@ -91,27 +91,27 @@ public class ImmutableTripleTest {
public void testNullTripleEquals() {
assertEquals(ImmutableTriple.nullTriple(), ImmutableTriple.nullTriple());
}
-
+
@Test
public void testNullTripleSame() {
assertSame(ImmutableTriple.nullTriple(), ImmutableTriple.nullTriple());
}
-
+
@Test
public void testNullTripleLeft() {
assertNull(ImmutableTriple.nullTriple().getLeft());
}
-
+
@Test
public void testNullTripleMiddle() {
assertNull(ImmutableTriple.nullTriple().getMiddle());
}
-
+
@Test
public void testNullTripleRight() {
assertNull(ImmutableTriple.nullTriple().getRight());
}
-
+
@Test
public void testNullTripleTyped() {
// No compiler warnings
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java b/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java
index b8eed24..edd8fe9 100644
--- a/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java
+++ b/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java
@@ -49,7 +49,7 @@ public class MutablePairTest {
assertNull(pair.getLeft());
assertNull(pair.getRight());
}
-
+
@Test
public void testMutate() throws Exception {
final MutablePair<Integer, String> pair = new MutablePair<>(0, "foo");
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java b/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java
index dc18ddb..5ca0aae 100644
--- a/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java
+++ b/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java
@@ -52,7 +52,7 @@ public class MutableTripleTest {
assertNull(triple.getMiddle());
assertNull(triple.getRight());
}
-
+
@Test
public void testMutate() throws Exception {
final MutableTriple<Integer, String, Boolean> triple = new MutableTriple<>(0, "foo", Boolean.TRUE);
[25/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/DateUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/DateUtils.java b/src/main/java/org/apache/commons/lang3/time/DateUtils.java
index 7f3bc97..7e5e4f6 100644
--- a/src/main/java/org/apache/commons/lang3/time/DateUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/DateUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -31,7 +31,7 @@ import org.apache.commons.lang3.Validate;
/**
* <p>A suite of utilities surrounding the use of the
* {@link java.util.Calendar} and {@link java.util.Date} object.</p>
- *
+ *
* <p>DateUtils contains a lot of common methods considering manipulations
* of Dates or Calendars. Some methods require some extra explanation.
* The truncate, ceiling and round methods could be considered the Math.floor(),
@@ -43,8 +43,8 @@ import org.apache.commons.lang3.Validate;
* kind of date-field you want your result, for instance milliseconds or days.
* </p>
* <p>
- * Several methods are provided for adding to {@code Date} objects, of the form
- * {@code addXXX(Date date, int amount)}. It is important to note these methods
+ * Several methods are provided for adding to {@code Date} objects, of the form
+ * {@code addXXX(Date date, int amount)}. It is important to note these methods
* use a {@code Calendar} internally (with default timezone and locale) and may
* be affected by changes to daylight saving time (DST).
* </p>
@@ -85,7 +85,7 @@ public class DateUtils {
{Calendar.SECOND},
{Calendar.MINUTE},
{Calendar.HOUR_OF_DAY, Calendar.HOUR},
- {Calendar.DATE, Calendar.DAY_OF_MONTH, Calendar.AM_PM
+ {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},
@@ -125,14 +125,14 @@ public class DateUtils {
* Truncation.
*/
TRUNCATE,
-
+
/**
- * Rounding.
+ * Rounding.
*/
ROUND,
-
+
/**
- * Ceiling.
+ * Ceiling.
*/
CEILING
}
@@ -156,7 +156,7 @@ public class DateUtils {
* <p>28 Mar 2002 13:45 and 28 Mar 2002 06:01 would return true.
* 28 Mar 2002 13:45 and 12 Mar 2002 13:45 would return false.
* </p>
- *
+ *
* @param date1 the first date, not altered, not null
* @param date2 the second date, not altered, not null
* @return true if they represent the same day
@@ -180,7 +180,7 @@ public class DateUtils {
* <p>28 Mar 2002 13:45 and 28 Mar 2002 06:01 would return true.
* 28 Mar 2002 13:45 and 12 Mar 2002 13:45 would return false.
* </p>
- *
+ *
* @param cal1 the first calendar, not altered, not null
* @param cal2 the second calendar, not altered, not null
* @return true if they represent the same day
@@ -201,7 +201,7 @@ public class DateUtils {
* <p>Checks if two date objects represent the same instant in time.</p>
*
* <p>This method compares the long millisecond time of the two objects.</p>
- *
+ *
* @param date1 the first date, not altered, not null
* @param date2 the second date, not altered, not null
* @return true if they represent the same millisecond instant
@@ -219,7 +219,7 @@ public class DateUtils {
* <p>Checks if two calendar objects represent the same instant in time.</p>
*
* <p>This method compares the long millisecond time of the two objects.</p>
- *
+ *
* @param cal1 the first calendar, not altered, not null
* @param cal2 the second calendar, not altered, not null
* @return true if they represent the same millisecond instant
@@ -239,7 +239,7 @@ public class DateUtils {
*
* <p>This method compares the values of the fields of the two objects.
* In addition, both calendars must be the same of the same type.</p>
- *
+ *
* @param cal1 the first calendar, not altered, not null
* @param cal2 the second calendar, not altered, not null
* @return true if they represent the same millisecond instant
@@ -263,12 +263,12 @@ public class DateUtils {
//-----------------------------------------------------------------------
/**
* <p>Parses a string representing a date by trying a variety of different parsers.</p>
- *
+ *
* <p>The parse will try each parse pattern in turn.
* A parse is only deemed successful if it parses the whole of the input string.
* If no parse patterns match, a ParseException is thrown.</p>
* The parser will be lenient toward the parsed date.
- *
+ *
* @param str the date to parse, not null
* @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null
* @return the parsed date
@@ -278,17 +278,17 @@ public class DateUtils {
public static Date parseDate(final String str, final String... parsePatterns) throws ParseException {
return parseDate(str, null, parsePatterns);
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Parses a string representing a date by trying a variety of different parsers,
* using the default date format symbols for the given locale.</p>
- *
+ *
* <p>The parse will try each parse pattern in turn.
* A parse is only deemed successful if it parses the whole of the input string.
* If no parse patterns match, a ParseException is thrown.</p>
* The parser will be lenient toward the parsed date.
- *
+ *
* @param str the date to parse, not null
* @param locale the locale whose date format symbols should be used. If <code>null</code>,
* the system locale is used (as per {@link #parseDate(String, String...)}).
@@ -300,17 +300,17 @@ public class DateUtils {
*/
public static Date parseDate(final String str, final Locale locale, final String... parsePatterns) throws ParseException {
return parseDateWithLeniency(str, locale, parsePatterns, true);
- }
+ }
//-----------------------------------------------------------------------
/**
* <p>Parses a string representing a date by trying a variety of different parsers.</p>
- *
+ *
* <p>The parse will try each parse pattern in turn.
* A parse is only deemed successful if it parses the whole of the input string.
* If no parse patterns match, a ParseException is thrown.</p>
- * The parser parses strictly - it does not allow for dates such as "February 942, 1996".
- *
+ * The parser parses strictly - it does not allow for dates such as "February 942, 1996".
+ *
* @param str the date to parse, not null
* @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null
* @return the parsed date
@@ -325,12 +325,12 @@ public class DateUtils {
/**
* <p>Parses a string representing a date by trying a variety of different parsers,
* using the default date format symbols for the given locale..</p>
- *
+ *
* <p>The parse will try each parse pattern in turn.
* A parse is only deemed successful if it parses the whole of the input string.
* If no parse patterns match, a ParseException is thrown.</p>
- * The parser parses strictly - it does not allow for dates such as "February 942, 1996".
- *
+ * The parser parses strictly - it does not allow for dates such as "February 942, 1996".
+ *
* @param str the date to parse, not null
* @param locale the locale whose date format symbols should be used. If <code>null</code>,
* the system locale is used (as per {@link #parseDateStrictly(String, String...)}).
@@ -342,15 +342,15 @@ public class DateUtils {
*/
public static Date parseDateStrictly(final String str, final Locale locale, final String... parsePatterns) throws ParseException {
return parseDateWithLeniency(str, locale, parsePatterns, false);
- }
+ }
/**
* <p>Parses a string representing a date by trying a variety of different parsers.</p>
- *
+ *
* <p>The parse will try each parse pattern in turn.
* A parse is only deemed successful if it parses the whole of the input string.
* If no parse patterns match, a ParseException is thrown.</p>
- *
+ *
* @param str the date to parse, not null
* @param locale the locale to use when interpretting the pattern, can be null in which
* case the default system locale is used
@@ -519,7 +519,7 @@ public class DateUtils {
c.add(calendarField, amount);
return c.getTime();
}
-
+
//-----------------------------------------------------------------------
/**
* Sets the years field to a date returning a new object.
@@ -567,7 +567,7 @@ public class DateUtils {
//-----------------------------------------------------------------------
/**
- * Sets the hours field to a date returning a new object. Hours range
+ * Sets the hours field to a date returning a new object. Hours range
* from 0-23.
* The original {@code Date} is unchanged.
*
@@ -595,7 +595,7 @@ public class DateUtils {
public static Date setMinutes(final Date date, final int amount) {
return set(date, Calendar.MINUTE, amount);
}
-
+
//-----------------------------------------------------------------------
/**
* Sets the seconds field to a date returning a new object.
@@ -624,11 +624,11 @@ public class DateUtils {
*/
public static Date setMilliseconds(final Date date, final int amount) {
return set(date, Calendar.MILLISECOND, amount);
- }
-
+ }
+
//-----------------------------------------------------------------------
/**
- * Sets the specified field to a date returning a new object.
+ * Sets the specified field to a date returning a new object.
* This does not use a lenient calendar.
* The original {@code Date} is unchanged.
*
@@ -647,12 +647,12 @@ public class DateUtils {
c.setTime(date);
c.set(calendarField, amount);
return c.getTime();
- }
+ }
//-----------------------------------------------------------------------
/**
- * Converts a {@code Date} into a {@code Calendar}.
- *
+ * Converts a {@code Date} into a {@code Calendar}.
+ *
* @param date the date to convert to a Calendar
* @return the created Calendar
* @throws NullPointerException if null is passed in
@@ -663,7 +663,7 @@ public class DateUtils {
c.setTime(date);
return c;
}
-
+
//-----------------------------------------------------------------------
/**
* Converts a {@code Date} of a given {@code TimeZone} into a {@code Calendar}
@@ -677,7 +677,7 @@ public class DateUtils {
c.setTime(date);
return c;
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Rounds a date, leaving the field specified as the most
@@ -687,10 +687,10 @@ public class DateUtils {
* 13:45:01.231, if this was passed with HOUR, it would return
* 28 Mar 2002 14:00:00.000. If this was passed with MONTH, it
* would return 1 April 2002 0:00:00.000.</p>
- *
+ *
* <p>For a date in a timezone that handles the change to daylight
* saving time, rounding to Calendar.HOUR_OF_DAY will behave as follows.
- * Suppose daylight saving time begins at 02:00 on March 30. Rounding a
+ * Suppose daylight saving time begins at 02:00 on March 30. Rounding a
* date that crosses this time would produce the following values:
* </p>
* <ul>
@@ -699,7 +699,7 @@ public class DateUtils {
* <li>March 30, 2003 02:10 rounds to March 30, 2003 03:00</li>
* <li>March 30, 2003 02:40 rounds to March 30, 2003 04:00</li>
* </ul>
- *
+ *
* @param date the date to work with, not null
* @param field the field from {@code Calendar} or {@code SEMI_MONTH}
* @return the different rounded date, not null
@@ -721,10 +721,10 @@ public class DateUtils {
* 13:45:01.231, if this was passed with HOUR, it would return
* 28 Mar 2002 14:00:00.000. If this was passed with MONTH, it
* would return 1 April 2002 0:00:00.000.</p>
- *
+ *
* <p>For a date in a timezone that handles the change to daylight
* saving time, rounding to Calendar.HOUR_OF_DAY will behave as follows.
- * Suppose daylight saving time begins at 02:00 on March 30. Rounding a
+ * Suppose daylight saving time begins at 02:00 on March 30. Rounding a
* date that crosses this time would produce the following values:
* </p>
* <ul>
@@ -733,7 +733,7 @@ public class DateUtils {
* <li>March 30, 2003 02:10 rounds to March 30, 2003 03:00</li>
* <li>March 30, 2003 02:40 rounds to March 30, 2003 04:00</li>
* </ul>
- *
+ *
* @param date the date to work with, not null
* @param field the field from {@code Calendar} or <code>SEMI_MONTH</code>
* @return the different rounded date, not null
@@ -757,10 +757,10 @@ public class DateUtils {
* 13:45:01.231, if this was passed with HOUR, it would return
* 28 Mar 2002 14:00:00.000. If this was passed with MONTH, it
* would return 1 April 2002 0:00:00.000.</p>
- *
+ *
* <p>For a date in a timezone that handles the change to daylight
* saving time, rounding to Calendar.HOUR_OF_DAY will behave as follows.
- * Suppose daylight saving time begins at 02:00 on March 30. Rounding a
+ * Suppose daylight saving time begins at 02:00 on March 30. Rounding a
* date that crosses this time would produce the following values:
* </p>
* <ul>
@@ -769,7 +769,7 @@ public class DateUtils {
* <li>March 30, 2003 02:10 rounds to March 30, 2003 03:00</li>
* <li>March 30, 2003 02:40 rounds to March 30, 2003 04:00</li>
* </ul>
- *
+ *
* @param date the date to work with, either {@code Date} or {@code Calendar}, not null
* @param field the field from {@code Calendar} or <code>SEMI_MONTH</code>
* @return the different rounded date, not null
@@ -799,7 +799,7 @@ public class DateUtils {
* 13:45:01.231, if you passed with HOUR, it would return 28 Mar
* 2002 13:00:00.000. If this was passed with MONTH, it would
* return 1 Mar 2002 0:00:00.000.</p>
- *
+ *
* @param date the date to work with, not null
* @param field the field from {@code Calendar} or <code>SEMI_MONTH</code>
* @return the different truncated date, not null
@@ -822,7 +822,7 @@ public class DateUtils {
* 13:45:01.231, if you passed with HOUR, it would return 28 Mar
* 2002 13:00:00.000. If this was passed with MONTH, it would
* return 1 Mar 2002 0:00:00.000.</p>
- *
+ *
* @param date the date to work with, not null
* @param field the field from {@code Calendar} or <code>SEMI_MONTH</code>
* @return the different truncated date, not null
@@ -846,7 +846,7 @@ public class DateUtils {
* 13:45:01.231, if you passed with HOUR, it would return 28 Mar
* 2002 13:00:00.000. If this was passed with MONTH, it would
* return 1 Mar 2002 0:00:00.000.</p>
- *
+ *
* @param date the date to work with, either {@code Date} or {@code Calendar}, not null
* @param field the field from {@code Calendar} or <code>SEMI_MONTH</code>
* @return the different truncated date, not null
@@ -866,7 +866,7 @@ public class DateUtils {
throw new ClassCastException("Could not truncate " + date);
}
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Gets a date ceiling, leaving the field specified as the most
@@ -876,7 +876,7 @@ public class DateUtils {
* 13:45:01.231, if you passed with HOUR, it would return 28 Mar
* 2002 14:00:00.000. If this was passed with MONTH, it would
* return 1 Apr 2002 0:00:00.000.</p>
- *
+ *
* @param date the date to work with, not null
* @param field the field from {@code Calendar} or <code>SEMI_MONTH</code>
* @return the different ceil date, not null
@@ -900,7 +900,7 @@ public class DateUtils {
* 13:45:01.231, if you passed with HOUR, it would return 28 Mar
* 2002 14:00:00.000. If this was passed with MONTH, it would
* return 1 Apr 2002 0:00:00.000.</p>
- *
+ *
* @param date the date to work with, not null
* @param field the field from {@code Calendar} or <code>SEMI_MONTH</code>
* @return the different ceil date, not null
@@ -925,7 +925,7 @@ public class DateUtils {
* 13:45:01.231, if you passed with HOUR, it would return 28 Mar
* 2002 14:00:00.000. If this was passed with MONTH, it would
* return 1 Apr 2002 0:00:00.000.</p>
- *
+ *
* @param date the date to work with, either {@code Date} or {@code Calendar}, not null
* @param field the field from {@code Calendar} or <code>SEMI_MONTH</code>
* @return the different ceil date, not null
@@ -950,7 +950,7 @@ public class DateUtils {
//-----------------------------------------------------------------------
/**
* <p>Internal calculation method.</p>
- *
+ *
* @param val the calendar, not null
* @param field the field constant
* @param modType type to truncate, round or ceiling
@@ -960,7 +960,7 @@ public class DateUtils {
if (val.get(Calendar.YEAR) > 280000000) {
throw new ArithmeticException("Calendar value too large for accurate calculations");
}
-
+
if (field == Calendar.MILLISECOND) {
return;
}
@@ -1111,7 +1111,7 @@ public class DateUtils {
*
* @param focus the date to work with, not null
* @param rangeStyle the style constant to use. Must be one of
- * {@link DateUtils#RANGE_MONTH_SUNDAY},
+ * {@link DateUtils#RANGE_MONTH_SUNDAY},
* {@link DateUtils#RANGE_MONTH_MONDAY},
* {@link DateUtils#RANGE_WEEK_SUNDAY},
* {@link DateUtils#RANGE_WEEK_MONDAY},
@@ -1142,7 +1142,7 @@ public class DateUtils {
*
* @param focus the date to work with, not null
* @param rangeStyle the style constant to use. Must be one of
- * {@link DateUtils#RANGE_MONTH_SUNDAY},
+ * {@link DateUtils#RANGE_MONTH_SUNDAY},
* {@link DateUtils#RANGE_MONTH_MONDAY},
* {@link DateUtils#RANGE_WEEK_SUNDAY},
* {@link DateUtils#RANGE_WEEK_MONDAY},
@@ -1254,23 +1254,23 @@ public class DateUtils {
throw new ClassCastException("Could not iterate based on " + focus);
}
}
-
+
/**
- * <p>Returns the number of milliseconds within the
+ * <p>Returns the number of milliseconds within the
* fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ *
* <p>Asking the milliseconds of any date will only return the number of milliseconds
- * of the current second (resulting in a number between 0 and 999). This
- * method will retrieve the number of milliseconds for any fragment.
- * For example, if you want to calculate the number of milliseconds past today,
+ * of the current second (resulting in a number between 0 and 999). This
+ * method will retrieve the number of milliseconds for any fragment.
+ * For example, if you want to calculate the number of milliseconds past today,
* your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will
* be all milliseconds of the past hour(s), minutes(s) and second(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a SECOND field will return 0.</p>
- *
+ * A fragment less than or equal to a SECOND field will return 0.</p>
+ *
* <ul>
* <li>January 1, 2008 7:15:10.538 with Calendar.SECOND as fragment will return 538</li>
* <li>January 6, 2008 7:15:10.538 with Calendar.SECOND as fragment will return 538</li>
@@ -1278,34 +1278,34 @@ public class DateUtils {
* <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in milliseconds)</li>
* </ul>
- *
+ *
* @param date the date to work with, not null
- * @param fragment the {@code Calendar} field part of date to calculate
+ * @param fragment the {@code Calendar} field part of date to calculate
* @return number of milliseconds within the fragment of date
* @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
public static long getFragmentInMilliseconds(final Date date, final int fragment) {
- return getFragment(date, fragment, TimeUnit.MILLISECONDS);
+ return getFragment(date, fragment, TimeUnit.MILLISECONDS);
}
-
+
/**
- * <p>Returns the number of seconds within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of seconds within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the seconds of any date will only return the number of seconds
- * of the current minute (resulting in a number between 0 and 59). This
- * method will retrieve the number of seconds for any fragment.
- * For example, if you want to calculate the number of seconds past today,
+ * of the current minute (resulting in a number between 0 and 59). This
+ * method will retrieve the number of seconds for any fragment.
+ * For example, if you want to calculate the number of seconds past today,
* your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will
- * be all seconds of the past hour(s) and minutes(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * be all seconds of the past hour(s) and minutes(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a SECOND field will return 0.</p>
- *
+ * A fragment less than or equal to a SECOND field will return 0.</p>
+ *
* <ul>
* <li>January 1, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10
* (equivalent to deprecated date.getSeconds())</li>
@@ -1316,9 +1316,9 @@ public class DateUtils {
* <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in seconds)</li>
* </ul>
- *
+ *
* @param date the date to work with, not null
- * @param fragment the {@code Calendar} field part of date to calculate
+ * @param fragment the {@code Calendar} field part of date to calculate
* @return number of seconds within the fragment of date
* @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
@@ -1327,23 +1327,23 @@ public class DateUtils {
public static long getFragmentInSeconds(final Date date, final int fragment) {
return getFragment(date, fragment, TimeUnit.SECONDS);
}
-
+
/**
- * <p>Returns the number of minutes within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of minutes within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the minutes of any date will only return the number of minutes
- * of the current hour (resulting in a number between 0 and 59). This
- * method will retrieve the number of minutes for any fragment.
- * For example, if you want to calculate the number of minutes past this month,
- * your fragment is Calendar.MONTH. The result will be all minutes of the
- * past day(s) and hour(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * of the current hour (resulting in a number between 0 and 59). This
+ * method will retrieve the number of minutes for any fragment.
+ * For example, if you want to calculate the number of minutes past this month,
+ * your fragment is Calendar.MONTH. The result will be all minutes of the
+ * past day(s) and hour(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a MINUTE field will return 0.</p>
- *
+ * A fragment less than or equal to a MINUTE field will return 0.</p>
+ *
* <ul>
* <li>January 1, 2008 7:15:10.538 with Calendar.HOUR_OF_DAY as fragment will return 15
* (equivalent to deprecated date.getMinutes())</li>
@@ -1354,34 +1354,34 @@ public class DateUtils {
* <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in minutes)</li>
* </ul>
- *
+ *
* @param date the date to work with, not null
- * @param fragment the {@code Calendar} field part of date to calculate
+ * @param fragment the {@code Calendar} field part of date to calculate
* @return number of minutes within the fragment of date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
public static long getFragmentInMinutes(final Date date, final int fragment) {
return getFragment(date, fragment, TimeUnit.MINUTES);
}
-
+
/**
- * <p>Returns the number of hours within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of hours within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the hours of any date will only return the number of hours
- * of the current day (resulting in a number between 0 and 23). This
- * method will retrieve the number of hours for any fragment.
- * For example, if you want to calculate the number of hours past this month,
- * your fragment is Calendar.MONTH. The result will be all hours of the
- * past day(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * of the current day (resulting in a number between 0 and 23). This
+ * method will retrieve the number of hours for any fragment.
+ * For example, if you want to calculate the number of hours past this month,
+ * your fragment is Calendar.MONTH. The result will be all hours of the
+ * past day(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a HOUR field will return 0.</p>
- *
+ * A fragment less than or equal to a HOUR field will return 0.</p>
+ *
* <ul>
* <li>January 1, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7
* (equivalent to deprecated date.getHours())</li>
@@ -1392,34 +1392,34 @@ public class DateUtils {
* <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in hours)</li>
* </ul>
- *
+ *
* @param date the date to work with, not null
- * @param fragment the {@code Calendar} field part of date to calculate
+ * @param fragment the {@code Calendar} field part of date to calculate
* @return number of hours within the fragment of date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
public static long getFragmentInHours(final Date date, final int fragment) {
return getFragment(date, fragment, TimeUnit.HOURS);
}
-
+
/**
- * <p>Returns the number of days within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of days within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the days of any date will only return the number of days
- * of the current month (resulting in a number between 1 and 31). This
- * method will retrieve the number of days for any fragment.
- * For example, if you want to calculate the number of days past this year,
- * your fragment is Calendar.YEAR. The result will be all days of the
- * past month(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * of the current month (resulting in a number between 1 and 31). This
+ * method will retrieve the number of days for any fragment.
+ * For example, if you want to calculate the number of days past this year,
+ * your fragment is Calendar.YEAR. The result will be all days of the
+ * past month(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a DAY field will return 0.</p>
- *
+ * A fragment less than or equal to a DAY field will return 0.</p>
+ *
* <ul>
* <li>January 28, 2008 with Calendar.MONTH as fragment will return 28
* (equivalent to deprecated date.getDay())</li>
@@ -1430,11 +1430,11 @@ public class DateUtils {
* <li>January 28, 2008 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in days)</li>
* </ul>
- *
+ *
* @param date the date to work with, not null
- * @param fragment the {@code Calendar} field part of date to calculate
+ * @param fragment the {@code Calendar} field part of date to calculate
* @return number of days within the fragment of date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
@@ -1443,21 +1443,21 @@ public class DateUtils {
}
/**
- * <p>Returns the number of milliseconds within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of milliseconds within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the milliseconds of any date will only return the number of milliseconds
- * of the current second (resulting in a number between 0 and 999). This
- * method will retrieve the number of milliseconds for any fragment.
- * For example, if you want to calculate the number of seconds past today,
+ * of the current second (resulting in a number between 0 and 999). This
+ * method will retrieve the number of milliseconds for any fragment.
+ * For example, if you want to calculate the number of seconds past today,
* your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will
- * be all seconds of the past hour(s), minutes(s) and second(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * be all seconds of the past hour(s), minutes(s) and second(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a MILLISECOND field will return 0.</p>
- *
+ * A fragment less than or equal to a MILLISECOND field will return 0.</p>
+ *
* <ul>
* <li>January 1, 2008 7:15:10.538 with Calendar.SECOND as fragment will return 538
* (equivalent to calendar.get(Calendar.MILLISECOND))</li>
@@ -1468,11 +1468,11 @@ public class DateUtils {
* <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in milliseconds)</li>
* </ul>
- *
+ *
* @param calendar the calendar to work with, not null
- * @param fragment the {@code Calendar} field part of calendar to calculate
+ * @param fragment the {@code Calendar} field part of calendar to calculate
* @return number of milliseconds within the fragment of date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
@@ -1480,21 +1480,21 @@ public class DateUtils {
return getFragment(calendar, fragment, TimeUnit.MILLISECONDS);
}
/**
- * <p>Returns the number of seconds within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of seconds within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the seconds of any date will only return the number of seconds
- * of the current minute (resulting in a number between 0 and 59). This
- * method will retrieve the number of seconds for any fragment.
- * For example, if you want to calculate the number of seconds past today,
+ * of the current minute (resulting in a number between 0 and 59). This
+ * method will retrieve the number of seconds for any fragment.
+ * For example, if you want to calculate the number of seconds past today,
* your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will
- * be all seconds of the past hour(s) and minutes(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * be all seconds of the past hour(s) and minutes(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a SECOND field will return 0.</p>
- *
+ * A fragment less than or equal to a SECOND field will return 0.</p>
+ *
* <ul>
* <li>January 1, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10
* (equivalent to calendar.get(Calendar.SECOND))</li>
@@ -1505,34 +1505,34 @@ public class DateUtils {
* <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in seconds)</li>
* </ul>
- *
+ *
* @param calendar the calendar to work with, not null
- * @param fragment the {@code Calendar} field part of calendar to calculate
+ * @param fragment the {@code Calendar} field part of calendar to calculate
* @return number of seconds within the fragment of date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
public static long getFragmentInSeconds(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, TimeUnit.SECONDS);
}
-
+
/**
- * <p>Returns the number of minutes within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of minutes within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the minutes of any date will only return the number of minutes
- * of the current hour (resulting in a number between 0 and 59). This
- * method will retrieve the number of minutes for any fragment.
- * For example, if you want to calculate the number of minutes past this month,
- * your fragment is Calendar.MONTH. The result will be all minutes of the
- * past day(s) and hour(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * of the current hour (resulting in a number between 0 and 59). This
+ * method will retrieve the number of minutes for any fragment.
+ * For example, if you want to calculate the number of minutes past this month,
+ * your fragment is Calendar.MONTH. The result will be all minutes of the
+ * past day(s) and hour(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a MINUTE field will return 0.</p>
- *
+ * A fragment less than or equal to a MINUTE field will return 0.</p>
+ *
* <ul>
* <li>January 1, 2008 7:15:10.538 with Calendar.HOUR_OF_DAY as fragment will return 15
* (equivalent to calendar.get(Calendar.MINUTES))</li>
@@ -1543,34 +1543,34 @@ public class DateUtils {
* <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in minutes)</li>
* </ul>
- *
+ *
* @param calendar the calendar to work with, not null
- * @param fragment the {@code Calendar} field part of calendar to calculate
+ * @param fragment the {@code Calendar} field part of calendar to calculate
* @return number of minutes within the fragment of date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
public static long getFragmentInMinutes(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, TimeUnit.MINUTES);
}
-
+
/**
- * <p>Returns the number of hours within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of hours within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the hours of any date will only return the number of hours
- * of the current day (resulting in a number between 0 and 23). This
- * method will retrieve the number of hours for any fragment.
- * For example, if you want to calculate the number of hours past this month,
- * your fragment is Calendar.MONTH. The result will be all hours of the
- * past day(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * of the current day (resulting in a number between 0 and 23). This
+ * method will retrieve the number of hours for any fragment.
+ * For example, if you want to calculate the number of hours past this month,
+ * your fragment is Calendar.MONTH. The result will be all hours of the
+ * past day(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a HOUR field will return 0.</p>
- *
+ * A fragment less than or equal to a HOUR field will return 0.</p>
+ *
* <ul>
* <li>January 1, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7
* (equivalent to calendar.get(Calendar.HOUR_OF_DAY))</li>
@@ -1581,34 +1581,34 @@ public class DateUtils {
* <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in hours)</li>
* </ul>
- *
+ *
* @param calendar the calendar to work with, not null
- * @param fragment the {@code Calendar} field part of calendar to calculate
+ * @param fragment the {@code Calendar} field part of calendar to calculate
* @return number of hours within the fragment of date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
public static long getFragmentInHours(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, TimeUnit.HOURS);
}
-
+
/**
- * <p>Returns the number of days within the
- * fragment. All datefields greater than the fragment will be ignored.</p>
- *
+ * <p>Returns the number of days within the
+ * fragment. All datefields greater than the fragment will be ignored.</p>
+ *
* <p>Asking the days of any date will only return the number of days
- * of the current month (resulting in a number between 1 and 31). This
- * method will retrieve the number of days for any fragment.
- * For example, if you want to calculate the number of days past this year,
- * your fragment is Calendar.YEAR. The result will be all days of the
- * past month(s).</p>
- *
- * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
- * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
+ * of the current month (resulting in a number between 1 and 31). This
+ * method will retrieve the number of days for any fragment.
+ * For example, if you want to calculate the number of days past this year,
+ * your fragment is Calendar.YEAR. The result will be all days of the
+ * past month(s).</p>
+ *
+ * <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
+ * Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
* Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
- * A fragment less than or equal to a DAY field will return 0.</p>
- *
+ * A fragment less than or equal to a DAY field will return 0.</p>
+ *
* <ul>
* <li>January 28, 2008 with Calendar.MONTH as fragment will return 28
* (equivalent to calendar.get(Calendar.DAY_OF_MONTH))</li>
@@ -1621,26 +1621,26 @@ public class DateUtils {
* <li>January 28, 2008 with Calendar.MILLISECOND as fragment will return 0
* (a millisecond cannot be split in days)</li>
* </ul>
- *
+ *
* @param calendar the calendar to work with, not null
- * @param fragment the {@code Calendar} field part of calendar to calculate
+ * @param fragment the {@code Calendar} field part of calendar to calculate
* @return number of days within the fragment of date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
public static long getFragmentInDays(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, TimeUnit.DAYS);
}
-
+
/**
* Gets a Date fragment for any unit.
- *
+ *
* @param date the date to work with, not null
- * @param fragment the Calendar field part of date to calculate
+ * @param fragment the Calendar field part of date to calculate
* @param unit the time unit
* @return number of units within the fragment of the date
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
@@ -1653,24 +1653,24 @@ public class DateUtils {
/**
* Gets a Calendar fragment for any unit.
- *
+ *
* @param calendar the calendar to work with, not null
- * @param fragment the Calendar field part of calendar to calculate
+ * @param fragment the Calendar field part of calendar to calculate
* @param unit the time unit
* @return number of units within the fragment of the calendar
- * @throws IllegalArgumentException if the date is <code>null</code> or
+ * @throws IllegalArgumentException if the date is <code>null</code> or
* fragment is not supported
* @since 2.4
*/
private static long getFragment(final Calendar calendar, final int fragment, final TimeUnit unit) {
if(calendar == null) {
- throw new IllegalArgumentException("The date must not be null");
+ throw new IllegalArgumentException("The date must not be null");
}
long result = 0;
-
+
final int offset = (unit == TimeUnit.DAYS) ? 0 : 1;
-
+
// Fragments bigger than a day require a breakdown to days
switch (fragment) {
case Calendar.YEAR:
@@ -1687,7 +1687,7 @@ public class DateUtils {
// Number of days already calculated for these cases
case Calendar.YEAR:
case Calendar.MONTH:
-
+
// The rest of the valid cases
case Calendar.DAY_OF_YEAR:
case Calendar.DATE:
@@ -1707,11 +1707,11 @@ public class DateUtils {
}
return result;
}
-
+
/**
- * Determines if two calendars are equal up to no more than the specified
+ * Determines if two calendars are equal up to no more than the specified
* most significant field.
- *
+ *
* @param cal1 the first calendar, not <code>null</code>
* @param cal2 the second calendar, not <code>null</code>
* @param field the field from {@code Calendar}
@@ -1726,9 +1726,9 @@ public class DateUtils {
}
/**
- * Determines if two dates are equal up to no more than the specified
+ * Determines if two dates are equal up to no more than the specified
* most significant field.
- *
+ *
* @param date1 the first date, not <code>null</code>
* @param date2 the second date, not <code>null</code>
* @param field the field from {@code Calendar}
@@ -1743,13 +1743,13 @@ public class DateUtils {
}
/**
- * Determines how two calendars compare up to no more than the specified
+ * Determines how two calendars compare up to no more than the specified
* most significant field.
- *
+ *
* @param cal1 the first calendar, not <code>null</code>
* @param cal2 the second calendar, not <code>null</code>
* @param field the field from {@code Calendar}
- * @return a negative integer, zero, or a positive integer as the first
+ * @return a negative integer, zero, or a positive integer as the first
* calendar is less than, equal to, or greater than the second.
* @throws IllegalArgumentException if any argument is <code>null</code>
* @see #truncate(Calendar, int)
@@ -1763,13 +1763,13 @@ public class DateUtils {
}
/**
- * Determines how two dates compare up to no more than the specified
+ * Determines how two dates compare up to no more than the specified
* most significant field.
- *
+ *
* @param date1 the first date, not <code>null</code>
* @param date2 the second date, not <code>null</code>
* @param field the field from <code>Calendar</code>
- * @return a negative integer, zero, or a positive integer as the first
+ * @return a negative integer, zero, or a positive integer as the first
* date is less than, equal to, or greater than the second.
* @throws IllegalArgumentException if any argument is <code>null</code>
* @see #truncate(Calendar, int)
@@ -1793,9 +1793,9 @@ public class DateUtils {
static class DateIterator implements Iterator<Calendar> {
private final Calendar endFinal;
private final Calendar spot;
-
+
/**
- * Constructs a DateIterator that ranges from one date to another.
+ * Constructs a DateIterator that ranges from one date to another.
*
* @param startFinal start date (inclusive)
* @param endFinal end date (inclusive)
@@ -1833,7 +1833,7 @@ public class DateUtils {
/**
* Always throws UnsupportedOperationException.
- *
+ *
* @throws UnsupportedOperationException
* @see java.util.Iterator#remove()
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
----------------------------------------------------------------------
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 d139666..564ea16 100644
--- a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -26,7 +26,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
/**
- * <p>Duration formatting utilities and constants. The following table describes the tokens
+ * <p>Duration formatting utilities and constants. The following table describes the tokens
* used in the pattern language for formatting. </p>
* <table border="1" summary="Pattern Tokens">
* <tr><th>character</th><th>duration element</th></tr>
@@ -62,7 +62,7 @@ public class DurationFormatUtils {
/**
* <p>Pattern used with <code>FastDateFormat</code> and <code>SimpleDateFormat</code>
* for the ISO 8601 period format used in durations.</p>
- *
+ *
* @see org.apache.commons.lang3.time.FastDateFormat
* @see java.text.SimpleDateFormat
*/
@@ -71,7 +71,7 @@ public class DurationFormatUtils {
//-----------------------------------------------------------------------
/**
* <p>Formats the time gap as a string.</p>
- *
+ *
* <p>The format used is ISO 8601-like: {@code HH:mm:ss.SSS}.</p>
*
* @param durationMillis the duration to format
@@ -84,12 +84,12 @@ public class DurationFormatUtils {
/**
* <p>Formats the time gap as a string.</p>
- *
+ *
* <p>The format used is the ISO 8601 period format.</p>
- *
+ *
* <p>This method formats durations using the days and lower fields of the
* ISO format pattern, such as P7D6TH5M4.321S.</p>
- *
+ *
* @param durationMillis the duration to format
* @return the formatted duration, not null
* @throws java.lang.IllegalArgumentException if durationMillis is negative
@@ -100,10 +100,10 @@ public class DurationFormatUtils {
/**
* <p>Formats the time gap as a string, using the specified format, and padding with zeros.</p>
- *
+ *
* <p>This method formats durations using the days and lower fields of the
* format pattern. Months and larger are not used.</p>
- *
+ *
* @param durationMillis the duration to format
* @param format the way in which to format the duration, not null
* @return the formatted duration, not null
@@ -116,10 +116,10 @@ public class DurationFormatUtils {
/**
* <p>Formats the time gap as a string, using the specified format.
* Padding the left hand side of numbers with zeroes is optional.</p>
- *
+ *
* <p>This method formats durations using the days and lower fields of the
* format pattern. Months and larger are not used.</p>
- *
+ *
* @param durationMillis the duration to format
* @param format the way in which to format the duration, not null
* @param padWithZeros whether to pad the left hand side of numbers with 0's
@@ -127,7 +127,7 @@ public class DurationFormatUtils {
* @throws java.lang.IllegalArgumentException if durationMillis is negative
*/
public static String formatDuration(final long durationMillis, final String format, final boolean padWithZeros) {
- Validate.inclusiveBetween(0, Long.MAX_VALUE, durationMillis, "durationMillis must not be negative");
+ Validate.inclusiveBetween(0, Long.MAX_VALUE, durationMillis, "durationMillis must not be negative");
final Token[] tokens = lexx(format);
@@ -136,7 +136,7 @@ public class DurationFormatUtils {
long minutes = 0;
long seconds = 0;
long milliseconds = durationMillis;
-
+
if (Token.containsTokenWithValue(tokens, d) ) {
days = milliseconds / DateUtils.MILLIS_PER_DAY;
milliseconds = milliseconds - (days * DateUtils.MILLIS_PER_DAY);
@@ -159,10 +159,10 @@ public class DurationFormatUtils {
/**
* <p>Formats an elapsed time into a pluralization correct string.</p>
- *
+ *
* <p>This method formats durations using the days and lower fields of the
* format pattern. Months and larger are not used.</p>
- *
+ *
* @param durationMillis the elapsed time to report in milliseconds
* @param suppressLeadingZeroElements suppresses leading 0 elements
* @param suppressTrailingZeroElements suppresses trailing 0 elements
@@ -175,7 +175,7 @@ public class DurationFormatUtils {
final boolean suppressTrailingZeroElements) {
// This method is generally replaceable by the format method, but
- // there are a series of tweaks and special cases that require
+ // there are a series of tweaks and special cases that require
// trickery to replicate.
String duration = formatDuration(durationMillis, "d' days 'H' hours 'm' minutes 's' seconds'");
if (suppressLeadingZeroElements) {
@@ -225,9 +225,9 @@ public class DurationFormatUtils {
//-----------------------------------------------------------------------
/**
* <p>Formats the time gap as a string.</p>
- *
+ *
* <p>The format used is the ISO 8601 period format.</p>
- *
+ *
* @param startMillis the start of the duration to format
* @param endMillis the end of the duration to format
* @return the formatted duration, not null
@@ -240,7 +240,7 @@ public class DurationFormatUtils {
/**
* <p>Formats the time gap as a string, using the specified format.
* Padding the left hand side of numbers with zeroes is optional.
- *
+ *
* @param startMillis the start of the duration
* @param endMillis the end of the duration
* @param format the way in which to format the duration, not null
@@ -253,20 +253,20 @@ public class DurationFormatUtils {
/**
* <p>Formats the time gap as a string, using the specified format.
- * Padding the left hand side of numbers with zeroes is optional and
+ * Padding the left hand side of numbers with zeroes is optional and
* the timezone may be specified. </p>
*
- * <p>When calculating the difference between months/days, it chooses to
- * calculate months first. So when working out the number of months and
- * days between January 15th and March 10th, it choose 1 month and
- * 23 days gained by choosing January->February = 1 month and then
- * calculating days forwards, and not the 1 month and 26 days gained by
- * choosing March -> February = 1 month and then calculating days
+ * <p>When calculating the difference between months/days, it chooses to
+ * calculate months first. So when working out the number of months and
+ * days between January 15th and March 10th, it choose 1 month and
+ * 23 days gained by choosing January->February = 1 month and then
+ * calculating days forwards, and not the 1 month and 26 days gained by
+ * choosing March -> February = 1 month and then calculating days
* backwards. </p>
*
* <p>For more control, the <a href="http://joda-time.sf.net/">Joda-Time</a>
* library is recommended.</p>
- *
+ *
* @param startMillis the start of the duration
* @param endMillis the end of the duration
* @param format the way in which to format the duration, not null
@@ -275,20 +275,20 @@ public class DurationFormatUtils {
* @return the formatted duration, not null
* @throws java.lang.IllegalArgumentException if startMillis is greater than endMillis
*/
- public static String formatPeriod(final long startMillis, final long endMillis, final String format, final boolean padWithZeros,
+ public static String formatPeriod(final long startMillis, final long endMillis, final String format, final boolean padWithZeros,
final TimeZone timezone) {
Validate.isTrue(startMillis <= endMillis, "startMillis must not be greater than endMillis");
-
-
- // Used to optimise for differences under 28 days and
- // called formatDuration(millis, format); however this did not work
- // over leap years.
- // TODO: Compare performance to see if anything was lost by
- // losing this optimisation.
-
+
+
+ // Used to optimise for differences under 28 days and
+ // called formatDuration(millis, format); however this did not work
+ // over leap years.
+ // TODO: Compare performance to see if anything was lost by
+ // losing this optimisation.
+
final Token[] tokens = lexx(format);
- // timezones get funky around 0, so normalizing everything to GMT
+ // timezones get funky around 0, so normalizing everything to GMT
// stops the hours being off
final Calendar start = Calendar.getInstance(timezone);
start.setTime(new Date(startMillis));
@@ -321,7 +321,7 @@ public class DurationFormatUtils {
hours += 24;
days -= 1;
}
-
+
if (Token.containsTokenWithValue(tokens, M)) {
while (days < 0) {
days += start.getActualMaximum(Calendar.DAY_OF_MONTH);
@@ -349,42 +349,42 @@ public class DurationFormatUtils {
// target is end-year -1
target -= 1;
}
-
+
while (start.get(Calendar.YEAR) != target) {
days += start.getActualMaximum(Calendar.DAY_OF_YEAR) - start.get(Calendar.DAY_OF_YEAR);
-
+
// Not sure I grok why this is needed, but the brutal tests show it is
if (start instanceof GregorianCalendar &&
start.get(Calendar.MONTH) == Calendar.FEBRUARY &&
start.get(Calendar.DAY_OF_MONTH) == 29) {
days += 1;
}
-
+
start.add(Calendar.YEAR, 1);
-
+
days += start.get(Calendar.DAY_OF_YEAR);
}
-
+
years = 0;
}
-
+
while( start.get(Calendar.MONTH) != end.get(Calendar.MONTH) ) {
days += start.getActualMaximum(Calendar.DAY_OF_MONTH);
start.add(Calendar.MONTH, 1);
}
-
- months = 0;
+
+ months = 0;
while (days < 0) {
days += start.getActualMaximum(Calendar.DAY_OF_MONTH);
months -= 1;
start.add(Calendar.MONTH, 1);
}
-
+
}
- // The rest of this code adds in values that
- // aren't requested. This allows the user to ask for the
+ // The rest of this code adds in values that
+ // aren't requested. This allows the user to ask for the
// number of months and get the real count and not just 0->11.
if (!Token.containsTokenWithValue(tokens, d)) {
@@ -410,7 +410,7 @@ public class DurationFormatUtils {
//-----------------------------------------------------------------------
/**
* <p>The internal method to do the formatting.</p>
- *
+ *
* @param tokens the tokens
* @param years the number of years
* @param months the number of months
@@ -486,7 +486,7 @@ public class DurationFormatUtils {
static final Object m = "m";
static final Object s = "s";
static final Object S = "S";
-
+
/**
* Parses a classic date format string into Tokens
*
@@ -602,7 +602,7 @@ public class DurationFormatUtils {
}
/**
- * Wraps a token around a repeated number of a value, for example it would
+ * Wraps a token around a repeated number of a value, for example it would
* store 'yyyy' as a value for y and a count of 4.
*
* @param value to wrap
@@ -616,7 +616,7 @@ public class DurationFormatUtils {
/**
* Adds another one of the value
*/
- void increment() {
+ void increment() {
count++;
}
@@ -631,7 +631,7 @@ public class DurationFormatUtils {
/**
* Gets the particular value this token represents.
- *
+ *
* @return Object value
*/
Object getValue() {
@@ -666,9 +666,9 @@ public class DurationFormatUtils {
}
/**
- * Returns a hash code for the token equal to the
- * hash code for the token's value. Thus 'TT' and 'TTTT'
- * will have the same hash code.
+ * Returns a hash code for the token equal to the
+ * hash code for the token's value. Thus 'TT' and 'TTTT'
+ * will have the same hash code.
*
* @return The hash code for the token
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
index e7a25ac..b859932 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
@@ -30,16 +30,16 @@ import java.util.TimeZone;
* <p>FastDateFormat is a fast and thread-safe version of
* {@link java.text.SimpleDateFormat}.</p>
*
- * <p>To obtain an instance of FastDateFormat, use one of the static factory methods:
- * {@link #getInstance(String, TimeZone, Locale)}, {@link #getDateInstance(int, TimeZone, Locale)},
- * {@link #getTimeInstance(int, TimeZone, Locale)}, or {@link #getDateTimeInstance(int, int, TimeZone, Locale)}
+ * <p>To obtain an instance of FastDateFormat, use one of the static factory methods:
+ * {@link #getInstance(String, TimeZone, Locale)}, {@link #getDateInstance(int, TimeZone, Locale)},
+ * {@link #getTimeInstance(int, TimeZone, Locale)}, or {@link #getDateTimeInstance(int, int, TimeZone, Locale)}
* </p>
- *
+ *
* <p>Since FastDateFormat is thread safe, you can use a static member instance:</p>
* <code>
* private static final FastDateFormat DATE_FORMATTER = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.SHORT);
* </code>
- *
+ *
* <p>This class can be used as a direct replacement to
* {@code SimpleDateFormat} in most formatting and parsing situations.
* This class is especially useful in multi-threaded server environments.
@@ -70,7 +70,7 @@ import java.util.TimeZone;
* @since 2.0
*/
public class FastDateFormat extends Format implements DateParser, DatePrinter {
-
+
/**
* Required for serialization support.
*
@@ -81,19 +81,19 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
/**
* FULL locale dependent date or time style.
*/
-
+
public static final int FULL = DateFormat.FULL;
-
+
/**
* LONG locale dependent date or time style.
*/
public static final int LONG = DateFormat.LONG;
-
+
/**
* MEDIUM locale dependent date or time style.
*/
public static final int MEDIUM = DateFormat.MEDIUM;
-
+
/**
* SHORT locale dependent date or time style.
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
index 9cf1a1c..bcb5118 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
@@ -43,14 +43,14 @@ import java.util.regex.Pattern;
* <p>FastDateParser is a fast and thread-safe version of
* {@link java.text.SimpleDateFormat}.</p>
*
- * <p>To obtain a proxy to a FastDateParser, use {@link FastDateFormat#getInstance(String, TimeZone, Locale)}
+ * <p>To obtain a proxy to a FastDateParser, use {@link FastDateFormat#getInstance(String, TimeZone, Locale)}
* or another variation of the factory methods of {@link FastDateFormat}.</p>
- *
+ *
* <p>Since FastDateParser is thread safe, you can use a static member instance:</p>
* <code>
* private static final DateParser DATE_PARSER = FastDateFormat.getInstance("yyyy-MM-dd");
* </code>
- *
+ *
* <p>This class can be used as a direct replacement for
* <code>SimpleDateFormat</code> in most parsing situations.
* This class is especially useful in multi-threaded server environments.
@@ -103,8 +103,8 @@ public class FastDateParser implements DateParser, Serializable {
/**
* <p>Constructs a new FastDateParser.</p>
- *
- * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the
+ *
+ * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the
* factory methods of {@link FastDateFormat} to get a cached FastDateParser instance.
*
* @param pattern non-null {@link java.text.SimpleDateFormat} compatible
@@ -381,8 +381,8 @@ public class FastDateParser implements DateParser, Serializable {
/**
* This implementation updates the ParsePosition if the parse succeeds.
- * However, it sets the error index to the position before the failed field unlike
- * the method {@link java.text.SimpleDateFormat#parse(String, ParsePosition)} which sets
+ * However, it sets the error index to the position before the failed field unlike
+ * the method {@link java.text.SimpleDateFormat#parse(String, ParsePosition)} which sets
* the error index to after the failed field.
* <p>
* To determine if the parse has succeeded, the caller must check if the current parse position
@@ -405,7 +405,7 @@ public class FastDateParser implements DateParser, Serializable {
* Upon success, the ParsePosition index is updated to indicate how much of the source text was consumed.
* Not all source text needs to be consumed. Upon parse failure, ParsePosition error index is updated to
* the offset of the source text which does not match the supplied format.
- *
+ *
* @param source The text to parse.
* @param pos On input, the position in the source to start parsing, on output, updated position.
* @param calendar The calendar into which to set parsed fields.
@@ -566,7 +566,7 @@ public class FastDateParser implements DateParser, Serializable {
return getLocaleSpecificStrategy(Calendar.ERA, definingCalendar);
case 'H': // Hour in day (0-23)
return HOUR_OF_DAY_STRATEGY;
- case 'K': // Hour in am/pm (0-11)
+ case 'K': // Hour in am/pm (0-11)
return HOUR_STRATEGY;
case 'M':
return width>=3 ?getLocaleSpecificStrategy(Calendar.MONTH, definingCalendar) :NUMBER_MONTH_STRATEGY;
@@ -632,7 +632,7 @@ public class FastDateParser implements DateParser, Serializable {
final ConcurrentMap<Locale, Strategy> cache = getCache(field);
Strategy strategy = cache.get(locale);
if (strategy == null) {
- strategy = field == Calendar.ZONE_OFFSET
+ strategy = field == Calendar.ZONE_OFFSET
? new TimeZoneStrategy(locale)
: new CaseInsensitiveTextStrategy(field, definingCalendar, locale);
final Strategy inCache = cache.putIfAbsent(locale, strategy);
@@ -701,7 +701,7 @@ public class FastDateParser implements DateParser, Serializable {
CaseInsensitiveTextStrategy(final int field, final Calendar definingCalendar, final Locale locale) {
this.field = field;
this.locale = locale;
-
+
final StringBuilder regex = new StringBuilder();
regex.append("((?iu)");
lKeyValues = appendDisplayNames(definingCalendar, locale, field, regex);
@@ -903,9 +903,9 @@ public class FastDateParser implements DateParser, Serializable {
}
}
}
-
+
private static class ISO8601TimeZoneStrategy extends PatternStrategy {
- // Z, +hh, -hh, +hhmm, -hhmm, +hh:mm or -hh:mm
+ // Z, +hh, -hh, +hhmm, -hhmm, +hh:mm or -hh:mm
/**
* Construct a Strategy that parses a TimeZone
@@ -914,7 +914,7 @@ public class FastDateParser implements DateParser, Serializable {
ISO8601TimeZoneStrategy(final String pattern) {
createPattern(pattern);
}
-
+
/**
* {@inheritDoc}
*/
@@ -926,14 +926,14 @@ public class FastDateParser implements DateParser, Serializable {
cal.setTimeZone(TimeZone.getTimeZone("GMT" + value));
}
}
-
+
private static final Strategy ISO_8601_1_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}))");
private static final Strategy ISO_8601_2_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}\\d{2}))");
private static final Strategy ISO_8601_3_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}(?::)\\d{2}))");
/**
* Factory method for ISO8601TimeZoneStrategies.
- *
+ *
* @param tokenLen a token indicating the length of the TimeZone String to be formatted.
* @return a ISO8601TimeZoneStrategy that can format TimeZone String of length {@code tokenLen}. If no such
* strategy exists, an IllegalArgumentException will be thrown.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
----------------------------------------------------------------------
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 fafa71c..b603fac 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
@@ -37,14 +37,14 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
* <p>FastDatePrinter is a fast and thread-safe version of
* {@link java.text.SimpleDateFormat}.</p>
*
- * <p>To obtain a FastDatePrinter, use {@link FastDateFormat#getInstance(String, TimeZone, Locale)}
+ * <p>To obtain a FastDatePrinter, use {@link FastDateFormat#getInstance(String, TimeZone, Locale)}
* or another variation of the factory methods of {@link FastDateFormat}.</p>
- *
+ *
* <p>Since FastDatePrinter is thread safe, you can use a static member instance:</p>
* <code>
* private static final DatePrinter DATE_PRINTER = FastDateFormat.getInstance("yyyy-MM-dd");
* </code>
- *
+ *
* <p>This class can be used as a direct replacement to
* {@code SimpleDateFormat} in most formatting situations.
* This class is especially useful in multi-threaded server environments.
@@ -63,7 +63,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
* ISO 8601 extended format time zones (eg. {@code +08:00} or {@code -11:00}).
* This introduces a minor incompatibility with Java 1.4, but at a gain of
* useful functionality.</p>
- *
+ *
* <p>Starting with JDK7, ISO 8601 support was added using the pattern {@code 'X'}.
* To maintain compatibility, {@code 'ZZ'} will continue to be supported, but using
* one of the {@code 'X'} formats is recommended.
@@ -139,7 +139,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
//-----------------------------------------------------------------------
/**
* <p>Constructs a new FastDatePrinter.</p>
- * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the
+ * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the
* factory methods of {@link FastDateFormat} to get a cached FastDatePrinter instance.
*
* @param pattern {@link java.text.SimpleDateFormat} compatible pattern
@@ -276,9 +276,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
case 'K': // hour in am/pm (0..11)
rule = selectNumberRule(Calendar.HOUR, tokenLen);
break;
- case 'X': // ISO 8601
+ case 'X': // ISO 8601
rule = Iso8601_Rule.getRule(tokenLen);
- break;
+ break;
case 'z': // time zone (text)
if (tokenLen >= 4) {
rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.LONG);
@@ -632,7 +632,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
}
final FastDatePrinter other = (FastDatePrinter) obj;
return mPattern.equals(other.mPattern)
- && mTimeZone.equals(other.mTimeZone)
+ && mTimeZone.equals(other.mTimeZone)
&& mLocale.equals(other.mLocale);
}
@@ -1347,7 +1347,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
TimeZoneNameRule(final TimeZone timeZone, final Locale locale, final int style) {
mLocale = locale;
mStyle = style;
-
+
mStandard = getTimeZoneDisplay(timeZone, false, style, locale);
mDaylight = getTimeZoneDisplay(timeZone, true, style, locale);
}
@@ -1384,7 +1384,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
private static class TimeZoneNumberRule implements Rule {
static final TimeZoneNumberRule INSTANCE_COLON = new TimeZoneNumberRule(true);
static final TimeZoneNumberRule INSTANCE_NO_COLON = new TimeZoneNumberRule(false);
-
+
final boolean mColon;
/**
@@ -1409,7 +1409,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
*/
@Override
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
-
+
int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
if (offset < 0) {
@@ -1436,9 +1436,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
* or {@code +/-HH:MM}.</p>
*/
private static class Iso8601_Rule implements Rule {
-
+
// Sign TwoDigitHours or Z
- static final Iso8601_Rule ISO8601_HOURS = new Iso8601_Rule(3);
+ static final Iso8601_Rule ISO8601_HOURS = new Iso8601_Rule(3);
// Sign TwoDigitHours Minutes or Z
static final Iso8601_Rule ISO8601_HOURS_MINUTES = new Iso8601_Rule(5);
// Sign TwoDigitHours : Minutes or Z
@@ -1460,10 +1460,10 @@ public class FastDatePrinter implements DatePrinter, Serializable {
case 3:
return Iso8601_Rule.ISO8601_HOURS_COLON_MINUTES;
default:
- throw new IllegalArgumentException("invalid number of X");
+ throw new IllegalArgumentException("invalid number of X");
}
- }
-
+ }
+
final int length;
/**
@@ -1493,7 +1493,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
buffer.append("Z");
return;
}
-
+
if (offset < 0) {
buffer.append('-');
offset = -offset;
@@ -1507,7 +1507,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
if (length<5) {
return;
}
-
+
if (length==6) {
buffer.append(':');
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/FormatCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FormatCache.java b/src/main/java/org/apache/commons/lang3/time/FormatCache.java
index 22850f6..f6ff481 100644
--- a/src/main/java/org/apache/commons/lang3/time/FormatCache.java
+++ b/src/main/java/org/apache/commons/lang3/time/FormatCache.java
@@ -5,9 +5,9 @@
* 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.
@@ -29,27 +29,27 @@ import org.apache.commons.lang3.Validate;
/**
* <p>FormatCache is a cache and factory for {@link Format}s.</p>
- *
+ *
* @since 3.0
*/
// TODO: Before making public move from getDateTimeInstance(Integer,...) to int; or some other approach.
abstract class FormatCache<F extends Format> {
-
+
/**
* No date or no time. Used in same parameters as DateFormat.SHORT or DateFormat.LONG
*/
static final int NONE= -1;
-
- private final ConcurrentMap<MultipartKey, F> cInstanceCache
+
+ private final ConcurrentMap<MultipartKey, F> cInstanceCache
= new ConcurrentHashMap<>(7);
-
- private static final ConcurrentMap<MultipartKey, String> cDateTimeInstanceCache
+
+ private static final ConcurrentMap<MultipartKey, String> cDateTimeInstanceCache
= new ConcurrentHashMap<>(7);
/**
* <p>Gets a formatter instance using the default pattern in the
* default timezone and locale.</p>
- *
+ *
* @return a date/time formatter
*/
public F getInstance() {
@@ -59,7 +59,7 @@ abstract class FormatCache<F extends Format> {
/**
* <p>Gets a formatter instance using the specified pattern, time zone
* and locale.</p>
- *
+ *
* @param pattern {@link java.text.SimpleDateFormat} compatible
* pattern, non-null
* @param timeZone the time zone, null means use the default TimeZone
@@ -78,22 +78,22 @@ abstract class FormatCache<F extends Format> {
}
final MultipartKey key = new MultipartKey(pattern, timeZone, locale);
F format = cInstanceCache.get(key);
- if (format == null) {
+ if (format == null) {
format = createInstance(pattern, timeZone, locale);
final F previousValue= cInstanceCache.putIfAbsent(key, format);
if (previousValue != null) {
// another thread snuck in and did the same work
// we should return the instance that is in ConcurrentMap
- format= previousValue;
+ format= previousValue;
}
}
return format;
}
-
+
/**
* <p>Create a format instance using the specified pattern, time zone
* and locale.</p>
- *
+ *
* @param pattern {@link java.text.SimpleDateFormat} compatible pattern, this will not be null.
* @param timeZone time zone, this will not be null.
* @param locale locale, this will not be null.
@@ -102,11 +102,11 @@ abstract class FormatCache<F extends Format> {
* or <code>null</code>
*/
abstract protected F createInstance(String pattern, TimeZone timeZone, Locale locale);
-
+
/**
* <p>Gets a date/time formatter instance using the specified style,
* time zone and locale.</p>
- *
+ *
* @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in format
* @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in format
* @param timeZone optional time zone, overrides time zone of
@@ -116,7 +116,7 @@ abstract class FormatCache<F extends Format> {
* @throws IllegalArgumentException if the Locale has no date/time
* pattern defined
*/
- // This must remain private, see LANG-884
+ // This must remain private, see LANG-884
private F getDateTimeInstance(final Integer dateStyle, final Integer timeStyle, final TimeZone timeZone, Locale locale) {
if (locale == null) {
locale = Locale.getDefault();
@@ -128,7 +128,7 @@ abstract class FormatCache<F extends Format> {
/**
* <p>Gets a date/time formatter instance using the specified style,
* time zone and locale.</p>
- *
+ *
* @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
* @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
* @param timeZone optional time zone, overrides time zone of
@@ -146,7 +146,7 @@ abstract class FormatCache<F extends Format> {
/**
* <p>Gets a date formatter instance using the specified style,
* time zone and locale.</p>
- *
+ *
* @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
* @param timeZone optional time zone, overrides time zone of
* formatted date, null means use default Locale
@@ -163,7 +163,7 @@ abstract class FormatCache<F extends Format> {
/**
* <p>Gets a time formatter instance using the specified style,
* time zone and locale.</p>
- *
+ *
* @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
* @param timeZone optional time zone, overrides time zone of
* formatted date, null means use default Locale
@@ -179,7 +179,7 @@ abstract class FormatCache<F extends Format> {
/**
* <p>Gets a date/time format for the specified styles and locale.</p>
- *
+ *
* @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in format
* @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in format
* @param locale The non-null locale of the desired format
@@ -195,10 +195,10 @@ abstract class FormatCache<F extends Format> {
try {
DateFormat formatter;
if (dateStyle == null) {
- formatter = DateFormat.getTimeInstance(timeStyle.intValue(), locale);
+ formatter = DateFormat.getTimeInstance(timeStyle.intValue(), locale);
}
else if (timeStyle == null) {
- formatter = DateFormat.getDateInstance(dateStyle.intValue(), locale);
+ formatter = DateFormat.getDateInstance(dateStyle.intValue(), locale);
}
else {
formatter = DateFormat.getDateTimeInstance(dateStyle.intValue(), timeStyle.intValue(), locale);
[12/48] [lang] (chore) adding commons.module.name to pom
Posted by br...@apache.org.
(chore) adding commons.module.name to pom
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/55110129
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/55110129
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/55110129
Branch: refs/heads/release
Commit: 551101299da7f75ea5478db1a6bc194963e0ac34
Parents: 577f7b3
Author: Rob Tompkins <ch...@gmail.com>
Authored: Sat May 27 10:25:01 2017 -0400
Committer: Rob Tompkins <ch...@gmail.com>
Committed: Sat May 27 10:25:01 2017 -0400
----------------------------------------------------------------------
pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/55110129/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6346074..09b6aea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -576,6 +576,7 @@
properties that depend on the componentid.
-->
<commons.componentid>lang3</commons.componentid>
+ <commons.module.name>org.apache.commons.lang3</commons.module.name>
<!-- Current 3.x release series -->
<commons.release.version>3.5</commons.release.version>
<commons.release.desc>(Java 6.0+)</commons.release.desc>
[07/48] [lang] LANG-1316: Deprecate classes/methods moved to
commons-text
Posted by br...@apache.org.
LANG-1316: Deprecate classes/methods moved to commons-text
Deprecated WordUtils and RandomStringUtils now that commons-text 1.1 was released.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/ebe7bb58
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/ebe7bb58
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/ebe7bb58
Branch: refs/heads/release
Commit: ebe7bb58a541bf397333f466d412e617266ee5aa
Parents: 8019416
Author: pascalschumacher <pa...@gmx.net>
Authored: Thu May 25 14:49:46 2017 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu May 25 14:49:46 2017 +0200
----------------------------------------------------------------------
src/main/java/org/apache/commons/lang3/RandomStringUtils.java | 4 ++++
src/main/java/org/apache/commons/lang3/text/WordUtils.java | 4 ++++
.../java/org/apache/commons/lang3/RandomStringUtilsTest.java | 1 +
src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java | 1 +
4 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ebe7bb58/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
index ba42d36..c5e256b 100644
--- a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
@@ -31,7 +31,11 @@ import java.util.Random;
*
* <p>#ThreadSafe#</p>
* @since 1.0
+ * @deprecated as of 3.6, use commons-text
+ * <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/RandomStringGenerator.html">
+ * RandomStringGenerator</a> instead
*/
+@Deprecated
public class RandomStringUtils {
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ebe7bb58/src/main/java/org/apache/commons/lang3/text/WordUtils.java
----------------------------------------------------------------------
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 0f6f363..16ae683 100644
--- a/src/main/java/org/apache/commons/lang3/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
@@ -30,7 +30,11 @@ import org.apache.commons.lang3.StringUtils;
* Each method documents its behaviour in more detail.</p>
*
* @since 2.0
+ * @deprecated as of 3.6, use commons-text
+ * <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/WordUtils.html">
+ * WordUtils</a> instead
*/
+@Deprecated
public class WordUtils {
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ebe7bb58/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
index 961eb2d..68d10d2 100644
--- a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
@@ -37,6 +37,7 @@ import org.junit.Test;
/**
* Unit tests {@link org.apache.commons.lang3.RandomStringUtils}.
*/
+@Deprecated
public class RandomStringUtilsTest {
//-----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ebe7bb58/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
index a709a77..370e754 100644
--- a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
@@ -29,6 +29,7 @@ import org.junit.Test;
/**
* Unit tests for WordUtils class.
*/
+@Deprecated
public class WordUtilsTest {
//-----------------------------------------------------------------------
[09/48] [lang] Make code more readable with less nesting (move block
out of else clause).
Posted by br...@apache.org.
Make code more readable with less nesting (move block out of else
clause).
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6a688cf3
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6a688cf3
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6a688cf3
Branch: refs/heads/release
Commit: 6a688cf36e23aded8c9796b786e92144cb4a5830
Parents: ef3015c
Author: Gary Gregory <gg...@apache.org>
Authored: Thu May 25 09:25:56 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Thu May 25 09:25:56 2017 -0700
----------------------------------------------------------------------
.../java/org/apache/commons/lang3/CharSetUtils.java | 14 ++++++--------
.../org/apache/commons/lang3/math/NumberUtils.java | 3 +--
.../java/org/apache/commons/lang3/text/WordUtils.java | 3 +--
3 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6a688cf3/src/main/java/org/apache/commons/lang3/CharSetUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharSetUtils.java b/src/main/java/org/apache/commons/lang3/CharSetUtils.java
index 84c1d09..015eeb8 100644
--- a/src/main/java/org/apache/commons/lang3/CharSetUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharSetUtils.java
@@ -78,15 +78,13 @@ public class CharSetUtils {
if (ch == lastChar) {
if (inChars != null && ch == inChars) {
continue;
- } else {
- if (notInChars == null || ch != notInChars) {
- if (chars.contains(ch)) {
- inChars = ch;
- continue;
- } else {
- notInChars = ch;
- }
+ }
+ if (notInChars == null || ch != notInChars) {
+ if (chars.contains(ch)) {
+ inChars = ch;
+ continue;
}
+ notInChars = ch;
}
}
buffer.append(ch);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6a688cf3/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
----------------------------------------------------------------------
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 f77bf10..0d512fe 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -1542,9 +1542,8 @@ public class NumberUtils {
return false;
}
return withDecimalsParsing(str, 1);
- } else {
- return withDecimalsParsing(str, 0);
}
+ return withDecimalsParsing(str, 0);
}
private static boolean withDecimalsParsing(final String str, final int beginIdx) {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6a688cf3/src/main/java/org/apache/commons/lang3/text/WordUtils.java
----------------------------------------------------------------------
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 16ae683..66ce445 100644
--- a/src/main/java/org/apache/commons/lang3/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
@@ -293,9 +293,8 @@ public class WordUtils {
if (matcher.start() == 0) {
offset += matcher.end();
continue;
- }else {
- spaceToWrapAt = matcher.start() + offset;
}
+ spaceToWrapAt = matcher.start() + offset;
}
// only last line without leading spaces is left
[11/48] [lang] Add missing Javadoc.
Posted by br...@apache.org.
Add missing Javadoc.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/577f7b3b
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/577f7b3b
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/577f7b3b
Branch: refs/heads/release
Commit: 577f7b3b5462fdf84c0956a3bec5296bf7821677
Parents: 8cfc1b1
Author: ggregory <gg...@US-L-GG05.rocketsoftware.com>
Authored: Thu May 25 10:38:30 2017 -0700
Committer: ggregory <gg...@US-L-GG05.rocketsoftware.com>
Committed: Thu May 25 10:38:30 2017 -0700
----------------------------------------------------------------------
.../apache/commons/lang3/arch/Processor.java | 39 ++++++++++++++++++--
1 file changed, 36 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/577f7b3b/src/main/java/org/apache/commons/lang3/arch/Processor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/arch/Processor.java b/src/main/java/org/apache/commons/lang3/arch/Processor.java
index 1d03a83..9f6b3db 100644
--- a/src/main/java/org/apache/commons/lang3/arch/Processor.java
+++ b/src/main/java/org/apache/commons/lang3/arch/Processor.java
@@ -35,7 +35,21 @@ public class Processor {
* </ul>
*/
public enum Arch {
- BIT_32, BIT_64, UNKNOWN
+
+ /**
+ * A 32-bit processor architecture.
+ */
+ BIT_32,
+
+ /**
+ * A 64-bit processor architecture.
+ */
+ BIT_64,
+
+ /**
+ * An unknown-bit processor architecture.
+ */
+ UNKNOWN
}
/**
@@ -49,14 +63,33 @@ public class Processor {
* </ul>
*/
public enum Type {
- X86, IA_64, PPC, UNKNOWN
+
+ /**
+ * Intel x86 series of instruction set architectures.
+ */
+ X86,
+
+ /**
+ * Intel Itanium 64-bit architecture.
+ */
+ IA_64,
+
+ /**
+ * Apple–IBM–Motorola PowerPC architecture.
+ */
+ PPC,
+
+ /**
+ * Unknown architecture.
+ */
+ UNKNOWN
}
private final Arch arch;
private final Type type;
/**
- * Constructs a {@link Processor}object with the given
+ * Constructs a {@link Processor} object with the given
* parameters.
*
* @param arch The processor architecture.
[48/48] [lang] Update version numbers for release 3.6
Posted by br...@apache.org.
Update version numbers for release 3.6
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/360198df
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/360198df
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/360198df
Branch: refs/heads/release
Commit: 360198dfb6a2d68f1702f616dfacee34ae0541bb
Parents: a975a27
Author: Benedikt Ritter <br...@apache.org>
Authored: Mon Apr 17 14:17:38 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Jun 8 10:00:26 2017 +0200
----------------------------------------------------------------------
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/360198df/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bdcfef5..7005e8f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>commons-lang3</artifactId>
- <version>3.6-SNAPSHOT</version>
+ <version>3.6</version>
<name>Apache Commons Lang</name>
<inceptionYear>2001</inceptionYear>
@@ -47,7 +47,7 @@
<connection>scm:git:http://git-wip-us.apache.org/repos/asf/commons-lang.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/commons-lang.git</developerConnection>
<url>https://git-wip-us.apache.org/repos/asf?p=commons-lang.git</url>
- <tag>HEAD</tag>
+ <tag>LANG_3_6</tag>
</scm>
<developers>
[04/48] [lang] LANG-1320: correct id in changes.xml
Posted by br...@apache.org.
LANG-1320: correct id in changes.xml
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/9f2fe9bb
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/9f2fe9bb
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/9f2fe9bb
Branch: refs/heads/release
Commit: 9f2fe9bb80065fc249c61c897a0434e9ff48bbf6
Parents: 7c19a1f
Author: pascalschumacher <pa...@gmx.net>
Authored: Tue May 23 00:34:59 2017 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Tue May 23 00:34:59 2017 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/9f2fe9bb/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 69b95d7..1761d8e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -53,7 +53,7 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1110" type="update" dev="pschumacher" due-to="Bruno P. Kinoshita">Implement HashSetvBitSetTest using JMH</action>
<action issue="LANG-1256" type="add" dev="pschumacher" due-to="C0rWin">Add JMH maven dependencies</action>
<action issue="LANG-1167" type="add" dev="chtompki" due-to="Mark Dacek">Add null filter to ReflectionToStringBuilder</action>
- <action issue="LANG-1312" type="fix" dev="britter">LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code followed by variant</action>
+ <action issue="LANG-1320" type="fix" dev="britter">LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code followed by variant</action>
<action issue="LANG-1300" type="fix" dev="chtompki" due-to="Mark Dacek">Clarify or improve behaviour of int-based indexOf methods in StringUtils</action>
<action issue="LANG-1299" type="add" dev="djones">Add method for converting string to an array of code points</action>
<action issue="LANG-1286" type="fix" dev="djones">RandomStringUtils random method can overflow and return characters outside of specified range</action>
[29/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/NotImplementedException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/NotImplementedException.java b/src/main/java/org/apache/commons/lang3/NotImplementedException.java
index 82e3784..d7e2e75 100644
--- a/src/main/java/org/apache/commons/lang3/NotImplementedException.java
+++ b/src/main/java/org/apache/commons/lang3/NotImplementedException.java
@@ -5,9 +5,9 @@
* 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.
@@ -20,11 +20,11 @@ package org.apache.commons.lang3;
* <p>Thrown to indicate that a block of code has not been implemented.
* This exception supplements <code>UnsupportedOperationException</code>
* by providing a more semantically rich description of the problem.</p>
- *
+ *
* <p><code>NotImplementedException</code> represents the case where the
* author has yet to implement the logic at this point in the program.
* This can act as an exception based TODO tag. </p>
- *
+ *
* <pre>
* public void foo() {
* try {
@@ -38,7 +38,7 @@ package org.apache.commons.lang3;
*
* This class was originally added in Lang 2.0, but removed in 3.0.
*
- * @since 3.2
+ * @since 3.2
*/
public class NotImplementedException extends UnsupportedOperationException {
@@ -48,7 +48,7 @@ public class NotImplementedException extends UnsupportedOperationException {
/**
* Constructs a NotImplementedException.
- *
+ *
* @param message description of the exception
* @since 3.2
*/
@@ -58,7 +58,7 @@ public class NotImplementedException extends UnsupportedOperationException {
/**
* Constructs a NotImplementedException.
- *
+ *
* @param cause cause of the exception
* @since 3.2
*/
@@ -68,7 +68,7 @@ public class NotImplementedException extends UnsupportedOperationException {
/**
* Constructs a NotImplementedException.
- *
+ *
* @param message description of the exception
* @param cause cause of the exception
* @since 3.2
@@ -79,7 +79,7 @@ public class NotImplementedException extends UnsupportedOperationException {
/**
* Constructs a NotImplementedException.
- *
+ *
* @param message description of the exception
* @param code code indicating a resource for more information regarding the lack of implementation
* @since 3.2
@@ -91,7 +91,7 @@ public class NotImplementedException extends UnsupportedOperationException {
/**
* Constructs a NotImplementedException.
- *
+ *
* @param cause cause of the exception
* @param code code indicating a resource for more information regarding the lack of implementation
* @since 3.2
@@ -103,7 +103,7 @@ public class NotImplementedException extends UnsupportedOperationException {
/**
* Constructs a NotImplementedException.
- *
+ *
* @param message description of the exception
* @param cause cause of the exception
* @param code code indicating a resource for more information regarding the lack of implementation
@@ -115,8 +115,8 @@ public class NotImplementedException extends UnsupportedOperationException {
}
/**
- * Obtain the not implemented code. This is an unformatted piece of text intended to point to
- * further information regarding the lack of implementation. It might, for example, be an issue
+ * Obtain the not implemented code. This is an unformatted piece of text intended to point to
+ * further information regarding the lack of implementation. It might, for example, be an issue
* tracker ID or a URL.
*
* @return a code indicating a resource for more information regarding the lack of implementation
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index b5a00db..146556b 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -147,7 +147,7 @@ public class ObjectUtils {
* ObjectUtils.anyNotNull(null) = false
* ObjectUtils.anyNotNull(null, null) = false
* </pre>
- *
+ *
* @param values the values to test, may be {@code null} or empty
* @return {@code true} if there is at least one non-null value in the array,
* {@code false} if all values in the array are {@code null}s.
@@ -167,7 +167,7 @@ public class ObjectUtils {
* {@code null} or the array is empty (contains no elements) {@code true}
* is returned.
* </p>
- *
+ *
* <pre>
* ObjectUtils.allNotNull(*) = true
* ObjectUtils.allNotNull(*, *) = true
@@ -277,7 +277,7 @@ public class ObjectUtils {
/**
* <p>Gets the hash code for multiple objects.</p>
- *
+ *
* <p>This allows a hash code to be rapidly calculated for a number of objects.
* The hash code for a single object is the <em>not</em> same as {@link #hashCode(Object)}.
* The hash code for multiple objects is the same as that calculated by an
@@ -622,7 +622,7 @@ public class ObjectUtils {
//-----------------------------------------------------------------------
/**
* Find the most frequently occurring item.
- *
+ *
* @param <T> type of values processed by this method
* @param items to check
* @return most populous T, {@code null} if non-unique or no items supplied
@@ -1008,7 +1008,7 @@ public class ObjectUtils {
* have to recompile themselves if the field's value
* changes at some future date.
*
- * @param <T> the Object type
+ * @param <T> the Object type
* @param v the genericized Object value to return (typically a String).
* @return the genericized Object v, unchanged (typically a String).
* @since 3.2
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
index c5e256b..25bfe31 100644
--- a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -20,13 +20,13 @@ import java.util.Random;
/**
* <p>Operations for random {@code String}s.</p>
- * <p>Currently <em>private high surrogate</em> characters are ignored.
+ * <p>Currently <em>private high surrogate</em> characters are ignored.
* These are Unicode characters that fall between the values 56192 (db80)
- * and 56319 (dbff) as we don't know how to handle them.
- * High and low surrogates are correctly dealt with - that is if a
- * high surrogate is randomly chosen, 55296 (d800) to 56191 (db7f)
- * then it is followed by a low surrogate. If a low surrogate is chosen,
- * 56320 (dc00) to 57343 (dfff) then it is placed after a randomly
+ * and 56319 (dbff) as we don't know how to handle them.
+ * High and low surrogates are correctly dealt with - that is if a
+ * high surrogate is randomly chosen, 55296 (d800) to 56191 (db7f)
+ * then it is followed by a low surrogate. If a low surrogate is chosen,
+ * 56320 (dc00) to 57343 (dfff) then it is placed after a randomly
* chosen high surrogate. </p>
*
* <p>#ThreadSafe#</p>
@@ -40,7 +40,7 @@ public class RandomStringUtils {
/**
* <p>Random object used by random method. This has to be not local
- * to the random method so as to not return the same value in the
+ * to the random method so as to not return the same value in the
* same millisecond.</p>
*/
private static final Random RANDOM = new Random();
@@ -165,7 +165,7 @@ public class RandomStringUtils {
* <p>Creates a random string whose length is the number of characters specified.</p>
*
* <p>Characters will be chosen from the set of characters which match the POSIX [:graph:]
- * regular expression character class. This class contains all visible ASCII characters
+ * regular expression character class. This class contains all visible ASCII characters
* (i.e. anything except spaces and control characters).</p>
*
* @param count the length of random string to create
@@ -267,7 +267,7 @@ public class RandomStringUtils {
public static String random(final int count, final boolean letters, final boolean numbers) {
return random(count, 0, 0, letters, numbers);
}
-
+
/**
* <p>Creates a random string whose length is the number of characters
* specified.</p>
@@ -326,7 +326,7 @@ public class RandomStringUtils {
* end are chosen.</p>
*
* <p>This method accepts a user-supplied {@link Random}
- * instance to use as a source of randomness. By seeding a single
+ * instance to use as a source of randomness. By seeding a single
* {@link Random} instance with a fixed seed and using it for each call,
* the same random sequence of strings can be generated repeatedly
* and predictably.</p>
@@ -364,7 +364,7 @@ public class RandomStringUtils {
end = Character.MAX_CODE_POINT;
} else {
end = 'z' + 1;
- start = ' ';
+ start = ' ';
}
}
} else {
@@ -389,7 +389,7 @@ public class RandomStringUtils {
int codePoint;
if (chars == null) {
codePoint = random.nextInt(gap) + start;
-
+
switch (Character.getType(codePoint)) {
case Character.UNASSIGNED:
case Character.PRIVATE_USE:
@@ -397,26 +397,26 @@ public class RandomStringUtils {
count++;
continue;
}
-
+
} else {
codePoint = chars[random.nextInt(gap) + start];
}
-
+
final int numberOfChars = Character.charCount(codePoint);
if (count == 0 && numberOfChars > 1) {
count++;
continue;
}
-
+
if (letters && Character.isLetter(codePoint)
|| numbers && Character.isDigit(codePoint)
- || !letters && !numbers) {
+ || !letters && !numbers) {
builder.appendCodePoint(codePoint);
-
+
if (numberOfChars == 2) {
count--;
}
-
+
} else {
count++;
}
@@ -430,7 +430,7 @@ public class RandomStringUtils {
* specified.</p>
*
* <p>Characters will be chosen from the set of characters
- * specified by the string, must not be empty.
+ * specified by the string, must not be empty.
* If null, the set of all characters is used.</p>
*
* @param count the length of random string to create
@@ -464,5 +464,5 @@ public class RandomStringUtils {
}
return random(count, 0, chars.length, false, false, chars, RANDOM);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/RandomUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/RandomUtils.java b/src/main/java/org/apache/commons/lang3/RandomUtils.java
index 3ea4493..e999293 100644
--- a/src/main/java/org/apache/commons/lang3/RandomUtils.java
+++ b/src/main/java/org/apache/commons/lang3/RandomUtils.java
@@ -20,7 +20,7 @@ import java.util.Random;
/**
* <p>Utility library that supplements the standard {@link Random} class.</p>
- *
+ *
* @since 3.3
*/
public class RandomUtils {
@@ -37,7 +37,7 @@ public class RandomUtils {
* programming. Instead, the class should be used as
* {@code RandomUtils.nextBytes(5);}.
* </p>
- *
+ *
* <p>
* This constructor is public to permit tools that require a JavaBean
* instance to operate.
@@ -58,12 +58,12 @@ public class RandomUtils {
public static boolean nextBoolean() {
return RANDOM.nextBoolean();
}
-
+
/**
* <p>
* Creates an array of random bytes.
* </p>
- *
+ *
* @param count
* the size of the returned array
* @return the random byte array
@@ -81,7 +81,7 @@ public class RandomUtils {
* <p>
* Returns a random integer within the specified range.
* </p>
- *
+ *
* @param startInclusive
* the smallest value that can be returned, must be non-negative
* @param endExclusive
@@ -99,7 +99,7 @@ public class RandomUtils {
if (startInclusive == endExclusive) {
return startInclusive;
}
-
+
return startInclusive + RANDOM.nextInt(endExclusive - startInclusive);
}
@@ -113,12 +113,12 @@ public class RandomUtils {
public static int nextInt() {
return nextInt(0, Integer.MAX_VALUE);
}
-
+
/**
* <p>
* Returns a random long within the specified range.
* </p>
- *
+ *
* @param startInclusive
* the smallest value that can be returned, must be non-negative
* @param endExclusive
@@ -150,12 +150,12 @@ public class RandomUtils {
public static long nextLong() {
return nextLong(0, Long.MAX_VALUE);
}
-
+
/**
- * <p>
+ * <p>
* Returns a random double within the specified range.
* </p>
- *
+ *
* @param startInclusive
* the smallest value that can be returned, must be non-negative
* @param endInclusive
@@ -173,7 +173,7 @@ public class RandomUtils {
if (startInclusive == endInclusive) {
return startInclusive;
}
-
+
return startInclusive + ((endInclusive - startInclusive) * RANDOM.nextDouble());
}
@@ -192,7 +192,7 @@ public class RandomUtils {
* <p>
* Returns a random float within the specified range.
* </p>
- *
+ *
* @param startInclusive
* the smallest value that can be returned, must be non-negative
* @param endInclusive
@@ -206,11 +206,11 @@ public class RandomUtils {
Validate.isTrue(endInclusive >= startInclusive,
"Start value must be smaller or equal to end value.");
Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative.");
-
+
if (startInclusive == endInclusive) {
return startInclusive;
}
-
+
return startInclusive + ((endInclusive - startInclusive) * RANDOM.nextFloat());
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/Range.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/Range.java b/src/main/java/org/apache/commons/lang3/Range.java
index 29ad7a3..5962f80 100644
--- a/src/main/java/org/apache/commons/lang3/Range.java
+++ b/src/main/java/org/apache/commons/lang3/Range.java
@@ -21,12 +21,12 @@ import java.util.Comparator;
/**
* <p>An immutable range of objects from a minimum to maximum point inclusive.</p>
- *
+ *
* <p>The objects need to either be implementations of {@code Comparable}
* or you need to supply a {@code Comparator}. </p>
*
* <p>#ThreadSafe# if the objects and comparator are thread-safe</p>
- *
+ *
* @since 3.0
*/
public final class Range<T> implements Serializable {
@@ -61,7 +61,7 @@ public final class Range<T> implements Serializable {
/**
* <p>Obtains a range using the specified element as both the minimum
* and maximum in this range.</p>
- *
+ *
* <p>The range uses the natural ordering of the elements to determine where
* values lie in the range.</p>
*
@@ -78,7 +78,7 @@ public final class Range<T> implements Serializable {
/**
* <p>Obtains a range using the specified element as both the minimum
* and maximum in this range.</p>
- *
+ *
* <p>The range uses the specified {@code Comparator} to determine where
* values lie in the range.</p>
*
@@ -95,7 +95,7 @@ public final class Range<T> implements Serializable {
/**
* <p>Obtains a range with the specified minimum and maximum values (both inclusive).</p>
- *
+ *
* <p>The range uses the natural ordering of the elements to determine where
* values lie in the range.</p>
*
@@ -115,7 +115,7 @@ public final class Range<T> implements Serializable {
/**
* <p>Obtains a range with the specified minimum and maximum values (both inclusive).</p>
- *
+ *
* <p>The range uses the specified {@code Comparator} to determine where
* values lie in the range.</p>
*
@@ -150,7 +150,7 @@ public final class Range<T> implements Serializable {
if (comp == null) {
this.comparator = ComparableComparator.INSTANCE;
} else {
- this.comparator = comp;
+ this.comparator = comp;
}
if (this.comparator.compare(element1, element2) < 1) {
this.minimum = element1;
@@ -184,7 +184,7 @@ public final class Range<T> implements Serializable {
/**
* <p>Gets the comparator being used to determine if objects are within the range.</p>
- *
+ *
* <p>Natural ordering uses an internal comparator implementation, thus this
* method never returns null. See {@link #isNaturalOrdering()}.</p>
*
@@ -196,7 +196,7 @@ public final class Range<T> implements Serializable {
/**
* <p>Whether or not the Range is using the natural ordering of the elements.</p>
- *
+ *
* <p>Natural ordering uses an internal comparator implementation, thus this
* method is the only way to check if a null comparator was specified.</p>
*
@@ -276,7 +276,7 @@ public final class Range<T> implements Serializable {
/**
* <p>Checks where the specified element occurs relative to this range.</p>
- *
+ *
* <p>The API is reminiscent of the Comparable interface returning {@code -1} if
* the element is before the range, {@code 0} if contained within the range and
* {@code 1} if the element is after the range. </p>
@@ -334,7 +334,7 @@ public final class Range<T> implements Serializable {
/**
* <p>Checks whether this range is overlapped by the specified range.</p>
- *
+ *
* <p>Two ranges overlap if there is at least one element in common.</p>
*
* <p>This method may fail if the ranges have two different comparators or element types.</p>
@@ -451,13 +451,13 @@ public final class Range<T> implements Serializable {
/**
* <p>Formats the receiver using the given format.</p>
- *
+ *
* <p>This uses {@link java.util.Formattable} to perform the formatting. Three variables may
* be used to embed the minimum, maximum and comparator.
* Use {@code %1$s} for the minimum element, {@code %2$s} for the maximum element
* and {@code %3$s} for the comparator.
* The default format used by {@code toString()} is {@code [%1$s..%2$s]}.</p>
- *
+ *
* @param format the format string, optionally containing {@code %1$s}, {@code %2$s} and {@code %3$s}, not null
* @return the formatted string, not null
*/
@@ -470,7 +470,7 @@ public final class Range<T> implements Serializable {
private enum ComparableComparator implements Comparator {
INSTANCE;
/**
- * Comparable based compare implementation.
+ * Comparable based compare implementation.
*
* @param obj1 left hand side of comparison
* @param obj2 right hand side of comparison
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/SerializationException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/SerializationException.java b/src/main/java/org/apache/commons/lang3/SerializationException.java
index 588eff0..1d1d16a 100644
--- a/src/main/java/org/apache/commons/lang3/SerializationException.java
+++ b/src/main/java/org/apache/commons/lang3/SerializationException.java
@@ -5,9 +5,9 @@
* 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.
@@ -28,7 +28,7 @@ public class SerializationException extends RuntimeException {
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 4029025366392702726L;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/SerializationUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/SerializationUtils.java b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
index 670ef18..5fca908 100644
--- a/src/main/java/org/apache/commons/lang3/SerializationUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
@@ -161,17 +161,17 @@ public class SerializationUtils {
* <p>
* Deserializes an {@code Object} from the specified stream.
* </p>
- *
+ *
* <p>
* The stream will be closed once the object is written. This avoids the need for a finally clause, and maybe also
* exception handling, in the application code.
* </p>
- *
+ *
* <p>
* The stream passed in is not buffered internally within this method. This is the responsibility of your
* application if desired.
* </p>
- *
+ *
* <p>
* If the call site incorrectly types the return value, a {@link ClassCastException} is thrown from the call site.
* Without Generics in this declaration, the call site must type cast and can cause the same ClassCastException.
@@ -202,13 +202,13 @@ public class SerializationUtils {
* <p>
* Deserializes a single {@code Object} from an array of bytes.
* </p>
- *
+ *
* <p>
* If the call site incorrectly types the return value, a {@link ClassCastException} is thrown from the call site.
* Without Generics in this declaration, the call site must type cast and can cause the same ClassCastException.
* Note that in both cases, the ClassCastException is in the call site, not in this method.
* </p>
- *
+ *
* @param <T> the object type to be deserialized
* @param objectData
* the serialized object, must not be null
@@ -232,12 +232,12 @@ public class SerializationUtils {
* containers and application servers, no matter in which of the
* <code>ClassLoader</code> the particular class that encapsulates
* serialization/deserialization lives. </p>
- *
+ *
* <p>For more in-depth information about the problem for which this
* class here is a workaround, see the JIRA issue LANG-626. </p>
*/
static class ClassLoaderAwareObjectInputStream extends ObjectInputStream {
- private static final Map<String, Class<?>> primitiveTypes =
+ private static final Map<String, Class<?>> primitiveTypes =
new HashMap<>();
static {
@@ -253,7 +253,7 @@ public class SerializationUtils {
}
private final ClassLoader classLoader;
-
+
/**
* Constructor.
* @param in The <code>InputStream</code>.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java b/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
index df2a835..2d0a5db 100644
--- a/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -46,45 +46,45 @@ public class StringEscapeUtils {
/* ESCAPE TRANSLATORS */
/**
- * Translator object for escaping Java.
- *
- * While {@link #escapeJava(String)} is the expected method of use, this
- * object allows the Java escaping functionality to be used
- * as the foundation for a custom translator.
+ * Translator object for escaping Java.
+ *
+ * While {@link #escapeJava(String)} is the expected method of use, this
+ * object allows the Java escaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
- public static final CharSequenceTranslator ESCAPE_JAVA =
+ public static final CharSequenceTranslator ESCAPE_JAVA =
new LookupTranslator(
- new String[][] {
+ new String[][] {
{"\"", "\\\""},
{"\\", "\\\\"},
}).with(
new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_ESCAPE())
).with(
- JavaUnicodeEscaper.outsideOf(32, 0x7f)
+ JavaUnicodeEscaper.outsideOf(32, 0x7f)
);
/**
- * Translator object for escaping EcmaScript/JavaScript.
- *
- * While {@link #escapeEcmaScript(String)} is the expected method of use, this
- * object allows the EcmaScript escaping functionality to be used
- * as the foundation for a custom translator.
+ * Translator object for escaping EcmaScript/JavaScript.
+ *
+ * While {@link #escapeEcmaScript(String)} is the expected method of use, this
+ * object allows the EcmaScript escaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
- public static final CharSequenceTranslator ESCAPE_ECMASCRIPT =
+ public static final CharSequenceTranslator ESCAPE_ECMASCRIPT =
new AggregateTranslator(
new LookupTranslator(
- new String[][] {
+ new String[][] {
{"'", "\\'"},
{"\"", "\\\""},
{"\\", "\\\\"},
{"/", "\\/"}
}),
new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_ESCAPE()),
- JavaUnicodeEscaper.outsideOf(32, 0x7f)
+ JavaUnicodeEscaper.outsideOf(32, 0x7f)
);
/**
@@ -110,24 +110,24 @@ public class StringEscapeUtils {
/**
* Translator object for escaping XML.
- *
- * While {@link #escapeXml(String)} is the expected method of use, this
- * object allows the XML escaping functionality to be used
- * as the foundation for a custom translator.
+ *
+ * While {@link #escapeXml(String)} is the expected method of use, this
+ * object allows the XML escaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
* @deprecated use {@link #ESCAPE_XML10} or {@link #ESCAPE_XML11} instead.
*/
@Deprecated
- public static final CharSequenceTranslator ESCAPE_XML =
+ public static final CharSequenceTranslator ESCAPE_XML =
new AggregateTranslator(
new LookupTranslator(EntityArrays.BASIC_ESCAPE()),
new LookupTranslator(EntityArrays.APOS_ESCAPE())
);
-
+
/**
* Translator object for escaping XML 1.0.
- *
+ *
* While {@link #escapeXml10(String)} is the expected method of use, this
* object allows the XML escaping functionality to be used
* as the foundation for a custom translator.
@@ -176,10 +176,10 @@ public class StringEscapeUtils {
NumericEntityEscaper.between(0x86, 0x9f),
new UnicodeUnpairedSurrogateRemover()
);
-
+
/**
* Translator object for escaping XML 1.1.
- *
+ *
* While {@link #escapeXml11(String)} is the expected method of use, this
* object allows the XML escaping functionality to be used
* as the foundation for a custom translator.
@@ -207,14 +207,14 @@ public class StringEscapeUtils {
/**
* Translator object for escaping HTML version 3.0.
- *
- * While {@link #escapeHtml3(String)} is the expected method of use, this
- * object allows the HTML escaping functionality to be used
- * as the foundation for a custom translator.
+ *
+ * While {@link #escapeHtml3(String)} is the expected method of use, this
+ * object allows the HTML escaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
- public static final CharSequenceTranslator ESCAPE_HTML3 =
+ public static final CharSequenceTranslator ESCAPE_HTML3 =
new AggregateTranslator(
new LookupTranslator(EntityArrays.BASIC_ESCAPE()),
new LookupTranslator(EntityArrays.ISO8859_1_ESCAPE())
@@ -222,14 +222,14 @@ public class StringEscapeUtils {
/**
* Translator object for escaping HTML version 4.0.
- *
- * While {@link #escapeHtml4(String)} is the expected method of use, this
- * object allows the HTML escaping functionality to be used
- * as the foundation for a custom translator.
+ *
+ * While {@link #escapeHtml4(String)} is the expected method of use, this
+ * object allows the HTML escaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
- public static final CharSequenceTranslator ESCAPE_HTML4 =
+ public static final CharSequenceTranslator ESCAPE_HTML4 =
new AggregateTranslator(
new LookupTranslator(EntityArrays.BASIC_ESCAPE()),
new LookupTranslator(EntityArrays.ISO8859_1_ESCAPE()),
@@ -237,25 +237,25 @@ public class StringEscapeUtils {
);
/**
- * Translator object for escaping individual Comma Separated Values.
- *
- * While {@link #escapeCsv(String)} is the expected method of use, this
- * object allows the CSV escaping functionality to be used
- * as the foundation for a custom translator.
+ * Translator object for escaping individual Comma Separated Values.
+ *
+ * While {@link #escapeCsv(String)} is the expected method of use, this
+ * object allows the CSV escaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
public static final CharSequenceTranslator ESCAPE_CSV = new CsvEscaper();
// TODO: Create a parent class - 'SinglePassTranslator' ?
- // It would handle the index checking + length returning,
+ // It would handle the index checking + length returning,
// and could also have an optimization check method.
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 =
+ private static final char[] CSV_SEARCH_CHARS =
new char[] {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
@Override
@@ -279,22 +279,22 @@ public class StringEscapeUtils {
/* UNESCAPE TRANSLATORS */
/**
- * Translator object for unescaping escaped Java.
- *
- * While {@link #unescapeJava(String)} is the expected method of use, this
- * object allows the Java unescaping functionality to be used
- * as the foundation for a custom translator.
+ * Translator object for unescaping escaped Java.
+ *
+ * While {@link #unescapeJava(String)} is the expected method of use, this
+ * object allows the Java unescaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
// TODO: throw "illegal character: \92" as an Exception if a \ on the end of the Java (as per the compiler)?
- public static final CharSequenceTranslator UNESCAPE_JAVA =
+ public static final CharSequenceTranslator UNESCAPE_JAVA =
new AggregateTranslator(
new OctalUnescaper(), // .between('\1', '\377'),
new UnicodeUnescaper(),
new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_UNESCAPE()),
new LookupTranslator(
- new String[][] {
+ new String[][] {
{"\\\\", "\\"},
{"\\\"", "\""},
{"\\'", "'"},
@@ -303,11 +303,11 @@ public class StringEscapeUtils {
);
/**
- * Translator object for unescaping escaped EcmaScript.
- *
- * While {@link #unescapeEcmaScript(String)} is the expected method of use, this
- * object allows the EcmaScript unescaping functionality to be used
- * as the foundation for a custom translator.
+ * Translator object for unescaping escaped EcmaScript.
+ *
+ * While {@link #unescapeEcmaScript(String)} is the expected method of use, this
+ * object allows the EcmaScript unescaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
@@ -325,15 +325,15 @@ public class StringEscapeUtils {
public static final CharSequenceTranslator UNESCAPE_JSON = UNESCAPE_JAVA;
/**
- * Translator object for unescaping escaped HTML 3.0.
- *
- * While {@link #unescapeHtml3(String)} is the expected method of use, this
- * object allows the HTML unescaping functionality to be used
- * as the foundation for a custom translator.
+ * Translator object for unescaping escaped HTML 3.0.
+ *
+ * While {@link #unescapeHtml3(String)} is the expected method of use, this
+ * object allows the HTML unescaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
- public static final CharSequenceTranslator UNESCAPE_HTML3 =
+ public static final CharSequenceTranslator UNESCAPE_HTML3 =
new AggregateTranslator(
new LookupTranslator(EntityArrays.BASIC_UNESCAPE()),
new LookupTranslator(EntityArrays.ISO8859_1_UNESCAPE()),
@@ -341,15 +341,15 @@ public class StringEscapeUtils {
);
/**
- * Translator object for unescaping escaped HTML 4.0.
- *
- * While {@link #unescapeHtml4(String)} is the expected method of use, this
- * object allows the HTML unescaping functionality to be used
- * as the foundation for a custom translator.
+ * Translator object for unescaping escaped HTML 4.0.
+ *
+ * While {@link #unescapeHtml4(String)} is the expected method of use, this
+ * object allows the HTML unescaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
- public static final CharSequenceTranslator UNESCAPE_HTML4 =
+ public static final CharSequenceTranslator UNESCAPE_HTML4 =
new AggregateTranslator(
new LookupTranslator(EntityArrays.BASIC_UNESCAPE()),
new LookupTranslator(EntityArrays.ISO8859_1_UNESCAPE()),
@@ -359,14 +359,14 @@ public class StringEscapeUtils {
/**
* Translator object for unescaping escaped XML.
- *
- * While {@link #unescapeXml(String)} is the expected method of use, this
- * object allows the XML unescaping functionality to be used
- * as the foundation for a custom translator.
+ *
+ * While {@link #unescapeXml(String)} is the expected method of use, this
+ * object allows the XML unescaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
- public static final CharSequenceTranslator UNESCAPE_XML =
+ public static final CharSequenceTranslator UNESCAPE_XML =
new AggregateTranslator(
new LookupTranslator(EntityArrays.BASIC_UNESCAPE()),
new LookupTranslator(EntityArrays.APOS_UNESCAPE()),
@@ -375,10 +375,10 @@ public class StringEscapeUtils {
/**
* Translator object for unescaping escaped Comma Separated Value entries.
- *
- * While {@link #unescapeCsv(String)} is the expected method of use, this
- * object allows the CSV unescaping functionality to be used
- * as the foundation for a custom translator.
+ *
+ * While {@link #unescapeCsv(String)} is the expected method of use, this
+ * object allows the CSV unescaping functionality to be used
+ * as the foundation for a custom translator.
*
* @since 3.0
*/
@@ -389,7 +389,7 @@ public class StringEscapeUtils {
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 =
+ private static final char[] CSV_SEARCH_CHARS =
new char[] {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
@Override
@@ -520,7 +520,7 @@ public class StringEscapeUtils {
* For example, it will turn a sequence of {@code '\'} and
* {@code 'n'} into a newline character, unless the {@code '\'}
* is preceded by another {@code '\'}.</p>
- *
+ *
* @param input the {@code String} to unescape, may be null
* @return a new unescaped {@code String}, {@code null} if null string input
*/
@@ -569,7 +569,7 @@ public class StringEscapeUtils {
*
* <p>
* For example:
- * </p>
+ * </p>
* <p><code>"bread" & "butter"</code></p>
* becomes:
* <p>
@@ -582,13 +582,13 @@ public class StringEscapeUtils {
*
* @param input the {@code String} to escape, may be null
* @return a new escaped {@code String}, {@code null} if null string input
- *
+ *
* @see <a href="http://hotwired.lycos.com/webmonkey/reference/special_characters/">ISO Entities</a>
* @see <a href="http://www.w3.org/TR/REC-html32#latin1">HTML 3.2 Character Entities for ISO Latin-1</a>
* @see <a href="http://www.w3.org/TR/REC-html40/sgml/entities.html">HTML 4.0 Character entity references</a>
* @see <a href="http://www.w3.org/TR/html401/charset.html#h-5.3">HTML 4.01 Character References</a>
* @see <a href="http://www.w3.org/TR/html401/charset.html#code-position">HTML 4.01 Code positions</a>
- *
+ *
* @since 3.0
*/
public static final String escapeHtml4(final String input) {
@@ -601,7 +601,7 @@ public class StringEscapeUtils {
*
* @param input the {@code String} to escape, may be null
* @return a new escaped {@code String}, {@code null} if null string input
- *
+ *
* @since 3.0
*/
public static final String escapeHtml3(final String input) {
@@ -623,7 +623,7 @@ public class StringEscapeUtils {
*
* @param input the {@code String} to unescape, may be null
* @return a new unescaped {@code String}, {@code null} if null string input
- *
+ *
* @since 3.0
*/
public static final String unescapeHtml4(final String input) {
@@ -637,7 +637,7 @@ public class StringEscapeUtils {
*
* @param input the {@code String} to unescape, may be null
* @return a new unescaped {@code String}, {@code null} if null string input
- *
+ *
* @since 3.0
*/
public static final String unescapeHtml3(final String input) {
@@ -655,9 +655,9 @@ public class StringEscapeUtils {
* <p>Supports only the five basic XML entities (gt, lt, quot, amp, apos).
* Does not support DTDs or external entities.</p>
*
- * <p>Note that Unicode characters greater than 0x7f are as of 3.0, no longer
- * escaped. If you still wish this functionality, you can achieve it
- * via the following:
+ * <p>Note that Unicode characters greater than 0x7f are as of 3.0, no longer
+ * escaped. If you still wish this functionality, you can achieve it
+ * via the following:
* {@code StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );}</p>
*
* @param input the {@code String} to escape, may be null
@@ -681,14 +681,14 @@ public class StringEscapeUtils {
* characters or unpaired Unicode surrogate codepoints, even after escaping.
* {@code escapeXml10} will remove characters that do not fit in the
* following ranges:</p>
- *
+ *
* <p>{@code #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]}</p>
- *
+ *
* <p>Though not strictly necessary, {@code escapeXml10} will escape
* characters in the following ranges:</p>
- *
+ *
* <p>{@code [#x7F-#x84] | [#x86-#x9F]}</p>
- *
+ *
* <p>The returned string can be inserted into a valid XML 1.0 or XML 1.1
* document. If you want to allow more non-text characters in an XML 1.1
* document, use {@link #escapeXml11(String)}.</p>
@@ -701,7 +701,7 @@ public class StringEscapeUtils {
public static String escapeXml10(final String input) {
return ESCAPE_XML10.translate(input);
}
-
+
/**
* <p>Escapes the characters in a {@code String} using XML entities.</p>
*
@@ -713,13 +713,13 @@ public class StringEscapeUtils {
* the null byte or unpaired Unicode surrogate codepoints, even after escaping.
* {@code escapeXml11} will remove characters that do not fit in the following
* ranges:</p>
- *
+ *
* <p>{@code [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]}</p>
- *
+ *
* <p>{@code escapeXml11} will escape characters in the following ranges:</p>
- *
+ *
* <p>{@code [#x1-#x8] | [#xB-#xC] | [#xE-#x1F] | [#x7F-#x84] | [#x86-#x9F]}</p>
- *
+ *
* <p>The returned string can be inserted into a valid XML 1.1 document. Do not
* use it for XML 1.0 documents.</p>
*
@@ -741,7 +741,7 @@ public class StringEscapeUtils {
* <p>Supports only the five basic XML entities (gt, lt, quot, amp, apos).
* Does not support DTDs or external entities.</p>
*
- * <p>Note that numerical \\u Unicode codes are unescaped to their respective
+ * <p>Note that numerical \\u Unicode codes are unescaped to their respective
* Unicode characters. This may change in future releases. </p>
*
* @param input the {@code String} to unescape, may be null
@@ -783,21 +783,21 @@ public class StringEscapeUtils {
/**
* <p>Returns a {@code String} value for an unescaped CSV column. </p>
*
- * <p>If the value is enclosed in double quotes, and contains a comma, newline
- * or double quote, then quotes are removed.
+ * <p>If the value is enclosed in double quotes, and contains a comma, newline
+ * or double quote, then quotes are removed.
* </p>
*
- * <p>Any double quote escaped characters (a pair of double quotes) are unescaped
+ * <p>Any double quote escaped characters (a pair of double quotes) are unescaped
* to just one double quote. </p>
*
- * <p>If the value is not enclosed in double quotes, or is and does not contain a
+ * <p>If the value is not enclosed in double quotes, or is and does not contain a
* comma, newline or double quote, then the String value is returned unchanged.</p>
*
* see <a href="http://en.wikipedia.org/wiki/Comma-separated_values">Wikipedia</a> and
* <a href="http://tools.ietf.org/html/rfc4180">RFC 4180</a>.
*
* @param input the input CSV column String, may be null
- * @return the input String, with enclosing double quotes removed and embedded double
+ * @return the input String, with enclosing double quotes removed and embedded double
* quotes unescaped, {@code null} if null string input
* @since 2.4
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 7f64322..442e285 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -228,7 +228,7 @@ public class StringUtils {
public static boolean isNotEmpty(final CharSequence cs) {
return !isEmpty(cs);
}
-
+
/**
* <p>Checks if any of the CharSequences are empty ("") or null.</p>
*
@@ -316,7 +316,7 @@ public class StringUtils {
/**
* <p>Checks if a CharSequence is empty (""), null or whitespace only.</p>
- *
+ *
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <pre>
@@ -347,7 +347,7 @@ public class StringUtils {
/**
* <p>Checks if a CharSequence is not empty (""), not null and not whitespace only.</p>
- *
+ *
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <pre>
@@ -370,7 +370,7 @@ public class StringUtils {
/**
* <p>Checks if any of the CharSequences are empty ("") or null or whitespace only.</p>
- *
+ *
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <pre>
@@ -404,7 +404,7 @@ public class StringUtils {
/**
* <p>Checks if none of the CharSequences are empty (""), null or whitespace only.</p>
- *
+ *
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <pre>
@@ -450,7 +450,7 @@ public class StringUtils {
* @since 3.6
*/
public static boolean isAllBlank(final CharSequence... css) {
- if (ArrayUtils.isEmpty(css)) {
+ if (ArrayUtils.isEmpty(css)) {
return true;
}
for (final CharSequence cs : css) {
@@ -774,7 +774,7 @@ public class StringUtils {
str = stripStart(str, stripChars);
return stripEnd(str, stripChars);
}
-
+
/**
* <p>Strips any of a set of characters from the start of a String.</p>
*
@@ -2019,9 +2019,9 @@ public class StringUtils {
/**
* <p>Check whether the given CharSequence contains any whitespace characters.</p>
- *
+ *
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
- *
+ *
* @param seq the CharSequence to check (may be {@code null})
* @return {@code true} if the CharSequence is not empty and
* contains at least 1 (breaking) whitespace character
@@ -2235,7 +2235,7 @@ public class StringUtils {
* StringUtils.containsAny("abc", "d", "abc") = true
* </pre>
*
- *
+ *
* @param cs The CharSequence to check, may be null
* @param searchCharSequences The array of CharSequences to search for, may be null.
* Individual CharSequences may be null as well.
@@ -5468,7 +5468,7 @@ public class StringUtils {
/**
* <p>Replaces a String with another String inside a larger String,
- * for the first {@code max} values of the search String,
+ * for the first {@code max} values of the search String,
* case sensitively/insensisitively based on {@code ignoreCase} value.</p>
*
* <p>A {@code null} reference passed to this method is a no-op.</p>
@@ -7200,7 +7200,7 @@ public class StringUtils {
/**
* <p>Checks if the CharSequence contains only whitespace.</p>
- *
+ *
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <p>{@code null} will return {@code false}.
@@ -7390,7 +7390,7 @@ public class StringUtils {
/**
* <p>Returns either the passed in CharSequence, or if the CharSequence is
* whitespace, empty ("") or {@code null}, the value of {@code defaultStr}.</p>
- *
+ *
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <pre>
@@ -7539,7 +7539,7 @@ public class StringUtils {
*
* <p>Specifically:</p>
* <ul>
- * <li>If the number of characters in {@code str} is less than or equal to
+ * <li>If the number of characters in {@code str} is less than or equal to
* {@code maxWidth}, return {@code str}.</li>
* <li>Else abbreviate it to {@code (substring(str, 0, max-3) + "...")}.</li>
* <li>If {@code maxWidth} is less than {@code 4}, throw an
@@ -7616,7 +7616,7 @@ public class StringUtils {
*
* <p>Specifically:</p>
* <ul>
- * <li>If the number of characters in {@code str} is less than or equal to
+ * <li>If the number of characters in {@code str} is less than or equal to
* {@code maxWidth}, return {@code str}.</li>
* <li>Else abbreviate it to {@code (substring(str, 0, max-abbrevMarker.length) + abbrevMarker)}.</li>
* <li>If {@code maxWidth} is less than {@code abbrevMarker.length + 1}, throw an
@@ -8009,7 +8009,7 @@ public class StringUtils {
* another, where each change is a single character modification (deletion,
* insertion or substitution).</p>
*
- * <p>The implementation uses a single-dimensional array of length s.length() + 1. See
+ * <p>The implementation uses a single-dimensional array of length s.length() + 1. See
* <a href="http://blog.softwx.net/2014/12/optimizing-levenshtein-algorithm-in-c.html">
* http://blog.softwx.net/2014/12/optimizing-levenshtein-algorithm-in-c.html</a> for details.</p>
*
@@ -8260,16 +8260,16 @@ public class StringUtils {
}
return -1;
}
-
+
/**
* <p>Find the Jaro Winkler Distance which indicates the similarity score between two Strings.</p>
*
- * <p>The Jaro measure is the weighted sum of percentage of matched characters from each file and transposed characters.
+ * <p>The Jaro measure is the weighted sum of percentage of matched characters from each file and transposed characters.
* Winkler increased this measure for matching initial characters.</p>
*
* <p>This implementation is based on the Jaro Winkler similarity algorithm
* from <a href="http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance">http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance</a>.</p>
- *
+ *
* <pre>
* StringUtils.getJaroWinklerDistance(null, null) = IllegalArgumentException
* StringUtils.getJaroWinklerDistance("","") = 0.0
@@ -8972,7 +8972,7 @@ public class StringUtils {
/**
* Converts a <code>byte[]</code> to a String using the specified character encoding.
- *
+ *
* @param bytes
* the byte array to read from
* @param charset
@@ -8991,7 +8991,7 @@ public class StringUtils {
* <p>
* Wraps a string with a char.
* </p>
- *
+ *
* <pre>
* StringUtils.wrap(null, *) = null
* StringUtils.wrap("", *) = ""
@@ -9000,7 +9000,7 @@ public class StringUtils {
* StringUtils.wrap("ab", '\'') = "'ab'"
* StringUtils.wrap("\"ab\"", '\"') = "\"\"ab\"\""
* </pre>
- *
+ *
* @param str
* the string to be wrapped, may be {@code null}
* @param wrapWith
@@ -9021,11 +9021,11 @@ public class StringUtils {
* <p>
* Wraps a String with another String.
* </p>
- *
+ *
* <p>
* A {@code null} input String returns {@code null}.
* </p>
- *
+ *
* <pre>
* StringUtils.wrap(null, *) = null
* StringUtils.wrap("", *) = ""
@@ -9038,7 +9038,7 @@ public class StringUtils {
* StringUtils.wrap("\"abcd\"", "'") = "'\"abcd\"'"
* StringUtils.wrap("'abcd'", "\"") = "\"'abcd'\""
* </pre>
- *
+ *
* @param str
* the String to be wrapper, may be null
* @param wrapWith
@@ -9059,7 +9059,7 @@ public class StringUtils {
* <p>
* Wraps a string with a char if that char is missing from the start or end of the given string.
* </p>
- *
+ *
* <pre>
* StringUtils.wrap(null, *) = null
* StringUtils.wrap("", *) = ""
@@ -9072,7 +9072,7 @@ public class StringUtils {
* StringUtils.wrap("/a/b/c", '/') = "/a/b/c/"
* StringUtils.wrap("a/b/c/", '/') = "/a/b/c/"
* </pre>
- *
+ *
* @param str
* the string to be wrapped, may be {@code null}
* @param wrapWith
@@ -9099,7 +9099,7 @@ public class StringUtils {
* <p>
* Wraps a string with a string if that string is missing from the start or end of the given string.
* </p>
- *
+ *
* <pre>
* StringUtils.wrap(null, *) = null
* StringUtils.wrap("", *) = ""
@@ -9116,7 +9116,7 @@ public class StringUtils {
* StringUtils.wrap("/a/b/c", "/") = "/a/b/c/"
* StringUtils.wrap("a/b/c/", "/") = "/a/b/c/"
* </pre>
- *
+ *
* @param str
* the string to be wrapped, may be {@code null}
* @param wrapWith
@@ -9160,7 +9160,7 @@ public class StringUtils {
* the String to be unwrapped, can be null
* @param wrapToken
* the String used to unwrap
- * @return unwrapped String or the original string
+ * @return unwrapped String or the original string
* if it is not quoted properly with the wrapToken
* @since 3.6
*/
@@ -9185,7 +9185,7 @@ public class StringUtils {
* <p>
* Unwraps a given string from a character.
* </p>
- *
+ *
* <pre>
* StringUtils.unwrap(null, null) = null
* StringUtils.unwrap(null, '\0') = null
@@ -9201,7 +9201,7 @@ public class StringUtils {
* the String to be unwrapped, can be null
* @param wrapChar
* the character used to unwrap
- * @return unwrapped String or the original string
+ * @return unwrapped String or the original string
* if it is not quoted properly with the wrapChar
* @since 3.6
*/
@@ -9223,16 +9223,16 @@ public class StringUtils {
/**
* <p>Converts a {@code CharSequence} into an array of code points.</p>
- *
+ *
* <p>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.</p>
- *
+ *
* <pre>
* StringUtils.toCodePoints(null) = null
* StringUtils.toCodePoints("") = [] // empty array
* </pre>
- *
+ *
* @param str the character sequence to convert
* @return an array of code points
* @since 3.6
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/SystemUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index f553618..50d260b 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -955,7 +955,7 @@ public class SystemUtils {
* </p>
*
* @since 3.4
- *
+ *
* @deprecated As of release 3.5, replaced by {@link #IS_JAVA_9}
*/
@Deprecated
@@ -1497,11 +1497,11 @@ public class SystemUtils {
/**
* Gets the host name from an environment variable.
- *
+ *
* <p>
* If you want to know what the network stack says is the host name, you should use {@code InetAddress.getLocalHost().getHostName()}.
* </p>
- *
+ *
* @return the host name.
* @since 3.6
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/arch/Processor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/arch/Processor.java b/src/main/java/org/apache/commons/lang3/arch/Processor.java
index 9f6b3db..cca224d 100644
--- a/src/main/java/org/apache/commons/lang3/arch/Processor.java
+++ b/src/main/java/org/apache/commons/lang3/arch/Processor.java
@@ -35,17 +35,17 @@ public class Processor {
* </ul>
*/
public enum Arch {
-
+
/**
* A 32-bit processor architecture.
*/
- BIT_32,
-
+ BIT_32,
+
/**
* A 64-bit processor architecture.
*/
- BIT_64,
-
+ BIT_64,
+
/**
* An unknown-bit processor architecture.
*/
@@ -63,22 +63,22 @@ public class Processor {
* </ul>
*/
public enum Type {
-
+
/**
* Intel x86 series of instruction set architectures.
*/
- X86,
-
+ X86,
+
/**
* Intel Itanium 64-bit architecture.
*/
- IA_64,
-
+ IA_64,
+
/**
* Apple–IBM–Motorola PowerPC architecture.
*/
- PPC,
-
+ PPC,
+
/**
* Unknown architecture.
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/Builder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/Builder.java b/src/main/java/org/apache/commons/lang3/builder/Builder.java
index 496d224..3e69afb 100644
--- a/src/main/java/org/apache/commons/lang3/builder/Builder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/Builder.java
@@ -5,9 +5,9 @@
* 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.
@@ -18,52 +18,52 @@ package org.apache.commons.lang3.builder;
/**
* <p>
- * The Builder interface is designed to designate a class as a <em>builder</em>
- * object in the Builder design pattern. Builders are capable of creating and
- * configuring objects or results that normally take multiple steps to construct
- * or are very complex to derive.
+ * The Builder interface is designed to designate a class as a <em>builder</em>
+ * object in the Builder design pattern. Builders are capable of creating and
+ * configuring objects or results that normally take multiple steps to construct
+ * or are very complex to derive.
* </p>
- *
+ *
* <p>
- * The builder interface defines a single method, {@link #build()}, that
- * classes must implement. The result of this method should be the final
+ * The builder interface defines a single method, {@link #build()}, that
+ * classes must implement. The result of this method should be the final
* configured object or result after all building operations are performed.
* </p>
- *
+ *
* <p>
- * It is a recommended practice that the methods supplied to configure the
+ * It is a recommended practice that the methods supplied to configure the
* object or result being built return a reference to {@code this} so that
* method calls can be chained together.
* </p>
- *
+ *
* <p>
* Example Builder:
* <pre><code>
* class FontBuilder implements Builder<Font> {
* private Font font;
- *
+ *
* public FontBuilder(String fontName) {
* this.font = new Font(fontName, Font.PLAIN, 12);
* }
- *
+ *
* public FontBuilder bold() {
* this.font = this.font.deriveFont(Font.BOLD);
* return this; // Reference returned so calls can be chained
* }
- *
+ *
* public FontBuilder size(float pointSize) {
* this.font = this.font.deriveFont(pointSize);
* return this; // Reference returned so calls can be chained
* }
- *
+ *
* // Other Font construction methods
- *
+ *
* public Font build() {
* return this.font;
* }
* }
* </code></pre>
- *
+ *
* Example Builder Usage:
* <pre><code>
* Font bold14ptSansSerifFont = new FontBuilder(Font.SANS_SERIF).bold()
@@ -71,17 +71,17 @@ package org.apache.commons.lang3.builder;
* .build();
* </code></pre>
*
- *
+ *
* @param <T> the type of object that the builder will construct or compute.
- *
+ *
* @since 3.0
*/
public interface Builder<T> {
/**
- * Returns a reference to the object being constructed or result being
+ * Returns a reference to the object being constructed or result being
* calculated by the builder.
- *
+ *
* @return the object constructed or result calculated by the builder.
*/
T build();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
----------------------------------------------------------------------
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 875b088..4a0a1d1 100644
--- a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,7 +24,7 @@ import java.util.Comparator;
import org.apache.commons.lang3.ArrayUtils;
-/**
+/**
* Assists in implementing {@link java.lang.Comparable#compareTo(Object)} methods.
*
* <p>It is consistent with <code>equals(Object)</code> and
@@ -60,7 +60,7 @@ import org.apache.commons.lang3.ArrayUtils;
* }
* }
* </pre>
- *
+ *
* <p>Values are compared in the order they are appended to the builder. If any comparison returns
* a non-zero result, then that value will be the result returned by {@code toComparison()} and all
* subsequent comparisons are skipped.</p>
@@ -80,8 +80,8 @@ import org.apache.commons.lang3.ArrayUtils;
* return CompareToBuilder.reflectionCompare(this, o);
* }
* </pre>
- *
- * <p>The reflective methods compare object fields in the order returned by
+ *
+ * <p>The reflective methods compare object fields in the order returned by
* {@link Class#getDeclaredFields()}. The fields of the class are compared first, followed by those
* of its parent classes (in order from the bottom to the top of the class hierarchy).</p>
*
@@ -93,7 +93,7 @@ import org.apache.commons.lang3.ArrayUtils;
* @since 1.0
*/
public class CompareToBuilder implements Builder<Integer> {
-
+
/**
* Current state of the comparison as appended fields are checked.
*/
@@ -102,8 +102,8 @@ public class CompareToBuilder implements Builder<Integer> {
/**
* <p>Constructor for CompareToBuilder.</p>
*
- * <p>Starts off assuming that the objects are equal. Multiple calls are
- * then made to the various append methods, followed by a call to
+ * <p>Starts off assuming that the objects are equal. Multiple calls are
+ * then made to the various append methods, followed by a call to
* {@link #toComparison} to get the result.</p>
*/
public CompareToBuilder() {
@@ -112,11 +112,11 @@ public class CompareToBuilder implements Builder<Integer> {
}
//-----------------------------------------------------------------------
- /**
+ /**
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -146,7 +146,7 @@ public class CompareToBuilder implements Builder<Integer> {
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -178,7 +178,7 @@ public class CompareToBuilder implements Builder<Integer> {
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -211,7 +211,7 @@ public class CompareToBuilder implements Builder<Integer> {
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -244,7 +244,7 @@ public class CompareToBuilder implements Builder<Integer> {
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
- * is used to bypass normal access control checks. This will fail under a
+ * is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
@@ -273,10 +273,10 @@ public class CompareToBuilder implements Builder<Integer> {
* @since 2.2 (2.0 as <code>reflectionCompare(Object, Object, boolean, Class)</code>)
*/
public static int reflectionCompare(
- final Object lhs,
- final Object rhs,
- final boolean compareTransients,
- final Class<?> reflectUpToClass,
+ final Object lhs,
+ final Object rhs,
+ final boolean compareTransients,
+ final Class<?> reflectUpToClass,
final String... excludeFields) {
if (lhs == rhs) {
@@ -301,7 +301,7 @@ public class CompareToBuilder implements Builder<Integer> {
/**
* <p>Appends to <code>builder</code> the comparison of <code>lhs</code>
* to <code>rhs</code> using the fields defined in <code>clazz</code>.</p>
- *
+ *
* @param lhs left-hand object
* @param rhs right-hand object
* @param clazz <code>Class</code> that defines fields to be compared
@@ -316,7 +316,7 @@ public class CompareToBuilder implements Builder<Integer> {
final CompareToBuilder builder,
final boolean useTransients,
final String[] excludeFields) {
-
+
final Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (int i = 0; i < fields.length && builder.comparison == 0; i++) {
@@ -352,7 +352,7 @@ public class CompareToBuilder implements Builder<Integer> {
comparison = superCompareTo;
return this;
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Appends to the <code>builder</code> the comparison of
@@ -364,7 +364,7 @@ public class CompareToBuilder implements Builder<Integer> {
* a <code>null</code> object is less than a non-<code>null</code> object</li>
* <li>Check the object contents</li>
* </ol>
- *
+ *
* <p><code>lhs</code> must either be an array or implement {@link Comparable}.</p>
*
* @param lhs left-hand object
@@ -498,7 +498,7 @@ public class CompareToBuilder implements Builder<Integer> {
/**
* Appends to the <code>builder</code> the comparison of
* two <code>short</code>s.
- *
+ *
* @param lhs left-hand value
* @param rhs right-hand value
* @return this - used to chain append calls
@@ -530,7 +530,7 @@ public class CompareToBuilder implements Builder<Integer> {
/**
* Appends to the <code>builder</code> the comparison of
* two <code>byte</code>s.
- *
+ *
* @param lhs left-hand value
* @param rhs right-hand value
* @return this - used to chain append calls
@@ -632,7 +632,7 @@ public class CompareToBuilder implements Builder<Integer> {
public CompareToBuilder append(final Object[] lhs, final Object[] rhs) {
return append(lhs, rhs, null);
}
-
+
/**
* <p>Appends to the <code>builder</code> the deep comparison of
* two <code>Object</code> arrays.</p>
@@ -1007,7 +1007,7 @@ public class CompareToBuilder implements Builder<Integer> {
* the <code>builder</code> has judged the "left-hand" side
* as less than, greater than, or equal to the "right-hand"
* side.
- *
+ *
* @return final comparison result
* @see #build()
*/
@@ -1020,7 +1020,7 @@ public class CompareToBuilder implements Builder<Integer> {
* the <code>builder</code> has judged the "left-hand" side
* as less than, greater than, or equal to the "right-hand"
* side.
- *
+ *
* @return final comparison result as an Integer
* @see #toComparison()
* @since 3.0
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/Diff.java
----------------------------------------------------------------------
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 d1b0daf..aee0d24 100644
--- a/src/main/java/org/apache/commons/lang3/builder/Diff.java
+++ b/src/main/java/org/apache/commons/lang3/builder/Diff.java
@@ -27,13 +27,13 @@ import org.apache.commons.lang3.tuple.Pair;
* A {@code Diff} contains the differences between two {@link Diffable} class
* fields.
* </p>
- *
+ *
* <p>
* Typically, {@code Diff}s are retrieved by using a {@link DiffBuilder} to
* produce a {@link DiffResult}, containing the differences between two objects.
* </p>
- *
- *
+ *
+ *
* @param <T>
* The type of object contained within this {@code Diff}. Differences
* between primitive objects are stored as their Object wrapper
@@ -51,7 +51,7 @@ public abstract class Diff<T> extends Pair<T, T> {
* <p>
* Constructs a new {@code Diff} for the given field name.
* </p>
- *
+ *
* @param fieldName
* the name of the field
*/
@@ -66,7 +66,7 @@ public abstract class Diff<T> extends Pair<T, T> {
* <p>
* Returns the type of the field.
* </p>
- *
+ *
* @return the field type
*/
public final Type getType() {
@@ -77,7 +77,7 @@ public abstract class Diff<T> extends Pair<T, T> {
* <p>
* Returns the name of the field.
* </p>
- *
+ *
* @return the field name
*/
public final String getFieldName() {
@@ -88,12 +88,12 @@ public abstract class Diff<T> extends Pair<T, T> {
* <p>
* Returns a {@code String} representation of the {@code Diff}, with the
* following format:</p>
- *
+ *
* <pre>
* [fieldname: left-value, right-value]
* </pre>
- *
- *
+ *
+ *
* @return the string representation
*/
@Override
@@ -105,7 +105,7 @@ public abstract class Diff<T> extends Pair<T, T> {
* <p>
* Throws {@code UnsupportedOperationException}.
* </p>
- *
+ *
* @param value
* ignored
* @return nothing
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java
----------------------------------------------------------------------
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 ed2cfe9..3645ffc 100644
--- a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java
@@ -27,19 +27,19 @@ import org.apache.commons.lang3.Validate;
* <p>
* Assists in implementing {@link Diffable#diff(Object)} methods.
* </p>
- *
+ *
* <p>
* To use this class, write code as follows:
* </p>
- *
+ *
* <pre>
* public class Person implements Diffable<Person> {
* String name;
* int age;
* boolean smoker;
- *
+ *
* ...
- *
+ *
* public DiffResult diff(Person obj) {
* // No need for null check, as NullPointerException correct if obj is null
* return new DiffBuilder(this, obj, ToStringStyle.SHORT_PREFIX_STYLE)
@@ -50,14 +50,14 @@ import org.apache.commons.lang3.Validate;
* }
* }
* </pre>
- *
+ *
* <p>
* The {@code ToStringStyle} passed to the constructor is embedded in the
* returned {@code DiffResult} and influences the style of the
* {@code DiffResult.toString()} method. This style choice can be overridden by
* calling {@link DiffResult#toString(ToStringStyle)}.
* </p>
- *
+ *
* @since 3.3
* @see Diffable
* @see Diff
@@ -76,13 +76,13 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Constructs a builder for the specified objects with the specified style.
* </p>
- *
+ *
* <p>
* If {@code lhs == rhs} or {@code lhs.equals(rhs)} then the builder will
* not evaluate any calls to {@code append(...)} and will return an empty
* {@link DiffResult} when {@link #build()} is executed.
* </p>
- *
+ *
* @param lhs
* {@code this} object
* @param rhs
@@ -119,13 +119,13 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Constructs a builder for the specified objects with the specified style.
* </p>
- *
+ *
* <p>
* If {@code lhs == rhs} or {@code lhs.equals(rhs)} then the builder will
* not evaluate any calls to {@code append(...)} and will return an empty
* {@link DiffResult} when {@link #build()} is executed.
* </p>
- *
+ *
* <p>
* This delegates to {@link #DiffBuilder(Object, Object, ToStringStyle, boolean)}
* with the testTriviallyEqual flag enabled.
@@ -151,7 +151,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code boolean}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -191,7 +191,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code boolean[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -230,7 +230,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code byte}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -269,7 +269,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code byte[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -309,7 +309,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code char}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -349,7 +349,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code char[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -389,7 +389,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code double}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -429,7 +429,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code double[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -469,7 +469,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code float}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -509,7 +509,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code float[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -549,7 +549,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code int}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -589,7 +589,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code int[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -629,7 +629,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code long}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -669,7 +669,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code long[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -709,7 +709,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code short}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -749,7 +749,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code short[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -789,7 +789,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code Objects}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -873,7 +873,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Test if two {@code Object[]}s are equal.
* </p>
- *
+ *
* @param fieldName
* the field name
* @param lhs
@@ -914,20 +914,20 @@ public class DiffBuilder implements Builder<DiffResult> {
* <p>
* Append diffs from another {@code DiffResult}.
* </p>
- *
+ *
* <p>
* This method is useful if you want to compare properties which are
* themselves Diffable and would like to know which specific part of
* it is different.
* </p>
- *
+ *
* <pre>
* public class Person implements Diffable<Person> {
* String name;
* Address address; // implements Diffable<Address>
- *
+ *
* ...
- *
+ *
* public DiffResult diff(Person obj) {
* return new DiffBuilder(this, obj, ToStringStyle.SHORT_PREFIX_STYLE)
* .append("name", this.name, obj.name)
@@ -936,7 +936,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* }
* }
* </pre>
- *
+ *
* @param fieldName
* the field name
* @param diffResult
@@ -967,7 +967,7 @@ public class DiffBuilder implements Builder<DiffResult> {
* Builds a {@link DiffResult} based on the differences appended to this
* builder.
* </p>
- *
+ *
* @return a {@code DiffResult} containing the differences between the two
* objects.
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
----------------------------------------------------------------------
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 4bcba6b..d8fa976 100644
--- a/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
+++ b/src/main/java/org/apache/commons/lang3/builder/DiffResult.java
@@ -32,7 +32,7 @@ import org.apache.commons.lang3.Validate;
* <p>
* Use a {@link DiffBuilder} to build a {@code DiffResult} comparing two objects.
* </p>
- *
+ *
* @since 3.3
*/
public class DiffResult implements Iterable<Diff<?>> {
@@ -57,7 +57,7 @@ public class DiffResult implements Iterable<Diff<?>> {
* Creates a {@link DiffResult} containing the differences between two
* objects.
* </p>
- *
+ *
* @param lhs
* the left hand object
* @param rhs
@@ -93,7 +93,7 @@ public class DiffResult implements Iterable<Diff<?>> {
* Returns an unmodifiable list of {@code Diff}s. The list may be empty if
* there were no differences between the objects.
* </p>
- *
+ *
* @return an unmodifiable list of {@code Diff}s
*/
public List<Diff<?>> getDiffs() {
@@ -104,7 +104,7 @@ public class DiffResult implements Iterable<Diff<?>> {
* <p>
* Returns the number of differences between the two objects.
* </p>
- *
+ *
* @return the number of differences
*/
public int getNumberOfDiffs() {
@@ -115,7 +115,7 @@ public class DiffResult implements Iterable<Diff<?>> {
* <p>
* Returns the style used by the {@link #toString()} method.
* </p>
- *
+ *
* @return the style
*/
public ToStringStyle getToStringStyle() {
@@ -129,28 +129,28 @@ public class DiffResult implements Iterable<Diff<?>> {
* and the style of the output is governed by the {@code ToStringStyle}
* passed to the constructor.
* </p>
- *
+ *
* <p>
* If there are no differences stored in this list, the method will return
* {@link #OBJECTS_SAME_STRING}. Otherwise, using the example given in
* {@link Diffable} and {@link ToStringStyle#SHORT_PREFIX_STYLE}, an output
* might be:
* </p>
- *
+ *
* <pre>
* Person[name=John Doe,age=32] differs from Person[name=Joe Bloggs,age=26]
* </pre>
- *
+ *
* <p>
* This indicates that the objects differ in name and age, but not in
* smoking status.
* </p>
- *
+ *
* <p>
* To use a different {@code ToStringStyle} for an instance of this class,
* use {@link #toString(ToStringStyle)}.
* </p>
- *
+ *
* @return a {@code String} description of the differences.
*/
@Override
@@ -163,10 +163,10 @@ public class DiffResult implements Iterable<Diff<?>> {
* Builds a {@code String} description of the differences contained within
* this {@code DiffResult}, using the supplied {@code ToStringStyle}.
* </p>
- *
+ *
* @param style
* the {@code ToStringStyle} to use when outputting the objects
- *
+ *
* @return a {@code String} description of the differences.
*/
public String toString(final ToStringStyle style) {
@@ -190,7 +190,7 @@ public class DiffResult implements Iterable<Diff<?>> {
* <p>
* Returns an iterator over the {@code Diff} objects contained in this list.
* </p>
- *
+ *
* @return the iterator
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/Diffable.java
----------------------------------------------------------------------
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 9f85eb1..12bc07d 100644
--- a/src/main/java/org/apache/commons/lang3/builder/Diffable.java
+++ b/src/main/java/org/apache/commons/lang3/builder/Diffable.java
@@ -20,13 +20,13 @@ package org.apache.commons.lang3.builder;
* <p>{@code Diffable} classes can be compared with other objects
* for differences. The {@link DiffResult} object retrieved can be queried
* for a list of differences or printed using the {@link DiffResult#toString()}.</p>
- *
+ *
* <p>The calculation of the differences is <i>consistent with equals</i> if
* and only if {@code d1.equals(d2)} implies {@code d1.diff(d2) == ""}.
* It is strongly recommended that implementations are consistent with equals
* to avoid confusion. Note that {@code null} is not an instance of any class
* and {@code d1.diff(null)} should throw a {@code NullPointerException}.</p>
- *
+ *
* <p>
* {@code Diffable} classes lend themselves well to unit testing, in which a
* easily readable description of the differences between an anticipated result and
@@ -44,7 +44,7 @@ public interface Diffable<T> {
/**
* <p>Retrieves a list of the differences between
* this object and the supplied object.</p>
- *
+ *
* @param obj the object to diff against, can be {@code null}
* @return a list of differences
* @throws NullPointerException if the specified object is {@code null}
[32/48] [lang] Make sure modifiers are in JLS order
Posted by br...@apache.org.
Make sure modifiers are in JLS order
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/8a8b8ec8
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/8a8b8ec8
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/8a8b8ec8
Branch: refs/heads/release
Commit: 8a8b8ec8d244b18eeaf651d0ea6e84db579e7d92
Parents: d0650d1
Author: Benedikt Ritter <br...@apache.org>
Authored: Tue Jun 6 15:26:38 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Tue Jun 6 15:26:38 2017 +0200
----------------------------------------------------------------------
checkstyle.xml | 1 +
src/main/java/org/apache/commons/lang3/ThreadUtils.java | 2 +-
.../commons/lang3/concurrent/BackgroundInitializer.java | 2 +-
.../commons/lang3/concurrent/ThresholdCircuitBreaker.java | 2 +-
.../org/apache/commons/lang3/time/FastDateParser.java | 8 ++++----
.../java/org/apache/commons/lang3/time/FormatCache.java | 2 +-
.../org/apache/commons/lang3/CharSequenceUtilsTest.java | 2 +-
.../java/org/apache/commons/lang3/CharUtilsPerfRun.java | 9 +++++----
.../org/apache/commons/lang3/StringEscapeUtilsTest.java | 2 +-
.../apache/commons/lang3/builder/HashCodeBuilderTest.java | 2 +-
...ectionToStringBuilderMutateInspectConcurrencyTest.java | 10 +++++-----
.../org/apache/commons/lang3/time/FastDateFormatTest.java | 4 ++--
12 files changed, 24 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 4a623a6..2b76eb6 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -46,6 +46,7 @@ limitations under the License.
<property name="allowUndeclaredRTE" value="true"/>
<property name="scope" value="public" />
</module>
+ <module name="ModifierOrder"/>
<module name="UpperEll" />
</module>
</module>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/main/java/org/apache/commons/lang3/ThreadUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ThreadUtils.java b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
index 9282ed3..0091cb0 100644
--- a/src/main/java/org/apache/commons/lang3/ThreadUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
@@ -272,7 +272,7 @@ public class ThreadUtils {
/**
* A predicate implementation which always returns true.
*/
- private final static class AlwaysTruePredicate implements ThreadPredicate, ThreadGroupPredicate{
+ private static final class AlwaysTruePredicate implements ThreadPredicate, ThreadGroupPredicate{
private AlwaysTruePredicate() {
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
index 7b2662f..25e5625 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
@@ -244,7 +244,7 @@ public abstract class BackgroundInitializer<T> implements
*
* @return the {@code ExecutorService} for executing the background task
*/
- protected synchronized final ExecutorService getActiveExecutor() {
+ protected final synchronized ExecutorService getActiveExecutor() {
return executor;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/main/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreaker.java
----------------------------------------------------------------------
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 2238d74..a6f423e 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreaker.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/ThresholdCircuitBreaker.java
@@ -55,7 +55,7 @@ public class ThresholdCircuitBreaker extends AbstractCircuitBreaker<Long> {
/**
* The initial value of the internal counter.
*/
- private final static long INITIAL_COUNT = 0L;
+ private static final long INITIAL_COUNT = 0L;
/**
* The threshold.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
index bcb5118..ee48179 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
@@ -201,7 +201,7 @@ public class FastDateParser implements DateParser, Serializable {
* Parse format into Strategies
*/
private class StrategyParser {
- final private Calendar definingCalendar;
+ private final Calendar definingCalendar;
private int currentIdx;
StrategyParser(final Calendar definingCalendar) {
@@ -491,7 +491,7 @@ public class FastDateParser implements DateParser, Serializable {
/**
* A strategy to parse a single field from the parsing pattern
*/
- private static abstract class Strategy {
+ private abstract static class Strategy {
/**
* Is this field a number?
* The default implementation returns false.
@@ -508,7 +508,7 @@ public class FastDateParser implements DateParser, Serializable {
/**
* A strategy to parse a single field from the parsing pattern
*/
- private static abstract class PatternStrategy extends Strategy {
+ private abstract static class PatternStrategy extends Strategy {
private Pattern pattern;
@@ -648,7 +648,7 @@ public class FastDateParser implements DateParser, Serializable {
*/
private static class CopyQuotedStrategy extends Strategy {
- final private String formatField;
+ private final String formatField;
/**
* Construct a Strategy that ensures the formatField has literal text
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/main/java/org/apache/commons/lang3/time/FormatCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FormatCache.java b/src/main/java/org/apache/commons/lang3/time/FormatCache.java
index f6ff481..db371d2 100644
--- a/src/main/java/org/apache/commons/lang3/time/FormatCache.java
+++ b/src/main/java/org/apache/commons/lang3/time/FormatCache.java
@@ -101,7 +101,7 @@ abstract class FormatCache<F extends Format> {
* @throws IllegalArgumentException if pattern is invalid
* or <code>null</code>
*/
- abstract protected F createInstance(String pattern, TimeZone timeZone, Locale locale);
+ protected abstract F createInstance(String pattern, TimeZone timeZone, Locale locale);
/**
* <p>Gets a date/time formatter instance using the specified style,
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
index 8240619..891d7dd 100644
--- a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
@@ -137,7 +137,7 @@ public class CharSequenceUtilsTest {
new TestData("Abcd",false, 1, "abcD",1, 2, true),
};
- private static abstract class RunTest {
+ private abstract static class RunTest {
abstract boolean invoke();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java b/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
index 7ab88b2..1886d0b 100644
--- a/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
+++ b/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
@@ -56,13 +56,14 @@ run_inlined_CharUtils_isAsciiNumeric: 84,420 milliseconds.
*/
public class CharUtilsPerfRun {
- final static String VERSION = "$Id$";
+ private static final String VERSION = "$Id$";
- final static int WARM_UP = 100;
+ private static final int WARM_UP = 100;
- final static int COUNT = 5000;
+ private static final int COUNT = 5000;
+
+ private static final char[] CHAR_SAMPLES;
- final static char[] CHAR_SAMPLES;
static {
CHAR_SAMPLES = new char[Character.MAX_VALUE];
for (char i = Character.MIN_VALUE; i < Character.MAX_VALUE; i++) {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
index 47e4fce..3bfeaca 100644
--- a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
@@ -40,7 +40,7 @@ import org.junit.Test;
*/
@Deprecated
public class StringEscapeUtilsTest {
- private final static String FOO = "foo";
+ private static final String FOO = "foo";
@Test
public void testConstructor() {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
index 4ded427..03b166a 100644
--- a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
@@ -109,7 +109,7 @@ public class HashCodeBuilderTest {
private int b;
@SuppressWarnings("unused")
- transient private int t;
+ private transient int t;
public TestSubObject() {
super(0);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
index 2cf2408..85ab700 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
@@ -37,8 +37,8 @@ import org.junit.Test;
public class ReflectionToStringBuilderMutateInspectConcurrencyTest {
class TestFixture {
- final private LinkedList<Integer> listField = new LinkedList<>();
- final private Random random = new Random();
+ private final LinkedList<Integer> listField = new LinkedList<>();
+ private final Random random = new Random();
private final int N = 100;
public TestFixture() {
@@ -59,8 +59,8 @@ public class ReflectionToStringBuilderMutateInspectConcurrencyTest {
}
class MutatingClient implements Runnable {
- final private TestFixture testFixture;
- final private Random random = new Random();
+ private final TestFixture testFixture;
+ private final Random random = new Random();
public MutatingClient(final TestFixture testFixture) {
this.testFixture = testFixture;
@@ -77,7 +77,7 @@ public class ReflectionToStringBuilderMutateInspectConcurrencyTest {
}
class InspectingClient implements Runnable {
- final private TestFixture testFixture;
+ private final TestFixture testFixture;
public InspectingClient(final TestFixture testFixture) {
this.testFixture = testFixture;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8a8b8ec8/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
index 7197a98..cf7c8fe 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
@@ -253,8 +253,8 @@ public class FastDateFormatTest {
System.out.println(">>FastDateFormatTest: FastDateParser:"+fdfTime.get(1)+" SimpleDateFormat:"+sdfTime.get(1));
}
- final static private int NTHREADS= 10;
- final static private int NROUNDS= 10000;
+ private static final int NTHREADS= 10;
+ private static final int NROUNDS= 10000;
private AtomicLongArray measureTime(final Format printer, final Format parser) throws InterruptedException {
final ExecutorService pool = Executors.newFixedThreadPool(NTHREADS);
[45/48] [lang] Update download page in preparation for 3.6 release
Posted by br...@apache.org.
Update download page in preparation for 3.6 release
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/1054af76
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/1054af76
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/1054af76
Branch: refs/heads/release
Commit: 1054af76e56fa81d563385012171ca3f04de7203
Parents: b48043d
Author: Benedikt Ritter <br...@apache.org>
Authored: Mon Apr 17 13:21:13 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Jun 8 10:00:25 2017 +0200
----------------------------------------------------------------------
pom.xml | 2 +-
src/site/xdoc/download_lang.xml | 26 +++++++++++++-------------
2 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1054af76/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ac5beca..be3c2cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -578,7 +578,7 @@
<commons.componentid>lang3</commons.componentid>
<commons.module.name>org.apache.commons.lang3</commons.module.name>
<!-- Current 3.x release series -->
- <commons.release.version>3.5</commons.release.version>
+ <commons.release.version>3.6</commons.release.version>
<commons.release.desc>(Java 6.0+)</commons.release.desc>
<!-- Previous 2.x release series -->
<commons.release.2.version>2.6</commons.release.2.version>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1054af76/src/site/xdoc/download_lang.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/download_lang.xml b/src/site/xdoc/download_lang.xml
index ca32024..3f752c8 100644
--- a/src/site/xdoc/download_lang.xml
+++ b/src/site/xdoc/download_lang.xml
@@ -111,32 +111,32 @@ limitations under the License.
</p>
</subsection>
</section>
- <section name="Apache Commons Lang 3.5 (Java 6.0+)">
+ <section name="Apache Commons Lang 3.6 (Java 6.0+)">
<subsection name="Binaries">
<table>
<tr>
- <td><a href="[preferred]/commons/lang/binaries/commons-lang3-3.5-bin.tar.gz">commons-lang3-3.5-bin.tar.gz</a></td>
- <td><a href="https://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.5-bin.tar.gz.md5">md5</a></td>
- <td><a href="https://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.5-bin.tar.gz.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/lang/binaries/commons-lang3-3.6-bin.tar.gz">commons-lang3-3.6-bin.tar.gz</a></td>
+ <td><a href="https://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.6-bin.tar.gz.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.6-bin.tar.gz.asc">pgp</a></td>
</tr>
<tr>
- <td><a href="[preferred]/commons/lang/binaries/commons-lang3-3.5-bin.zip">commons-lang3-3.5-bin.zip</a></td>
- <td><a href="https://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.5-bin.zip.md5">md5</a></td>
- <td><a href="https://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.5-bin.zip.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/lang/binaries/commons-lang3-3.6-bin.zip">commons-lang3-3.6-bin.zip</a></td>
+ <td><a href="https://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.6-bin.zip.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.6-bin.zip.asc">pgp</a></td>
</tr>
</table>
</subsection>
<subsection name="Source">
<table>
<tr>
- <td><a href="[preferred]/commons/lang/source/commons-lang3-3.5-src.tar.gz">commons-lang3-3.5-src.tar.gz</a></td>
- <td><a href="https://www.apache.org/dist/commons/lang/source/commons-lang3-3.5-src.tar.gz.md5">md5</a></td>
- <td><a href="https://www.apache.org/dist/commons/lang/source/commons-lang3-3.5-src.tar.gz.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/lang/source/commons-lang3-3.6-src.tar.gz">commons-lang3-3.6-src.tar.gz</a></td>
+ <td><a href="https://www.apache.org/dist/commons/lang/source/commons-lang3-3.6-src.tar.gz.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/lang/source/commons-lang3-3.6-src.tar.gz.asc">pgp</a></td>
</tr>
<tr>
- <td><a href="[preferred]/commons/lang/source/commons-lang3-3.5-src.zip">commons-lang3-3.5-src.zip</a></td>
- <td><a href="https://www.apache.org/dist/commons/lang/source/commons-lang3-3.5-src.zip.md5">md5</a></td>
- <td><a href="https://www.apache.org/dist/commons/lang/source/commons-lang3-3.5-src.zip.asc">pgp</a></td>
+ <td><a href="[preferred]/commons/lang/source/commons-lang3-3.6-src.zip">commons-lang3-3.6-src.zip</a></td>
+ <td><a href="https://www.apache.org/dist/commons/lang/source/commons-lang3-3.6-src.zip.md5">md5</a></td>
+ <td><a href="https://www.apache.org/dist/commons/lang/source/commons-lang3-3.6-src.zip.asc">pgp</a></td>
</tr>
</table>
</subsection>
[31/48] [lang] Make sure no illegal imports (e.g. sun.*) are used
Posted by br...@apache.org.
Make sure no illegal imports (e.g. sun.*) are used
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/d0650d1a
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/d0650d1a
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/d0650d1a
Branch: refs/heads/release
Commit: d0650d1a2f24957aa032d65909ca74e879ac4557
Parents: 1da8ccd
Author: Benedikt Ritter <br...@apache.org>
Authored: Tue Jun 6 15:15:39 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Tue Jun 6 15:15:39 2017 +0200
----------------------------------------------------------------------
checkstyle.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0650d1a/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 82dfec9..4a623a6 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -38,6 +38,7 @@ limitations under the License.
<module name="TreeWalker">
<property name="cacheFile" value="target/cachefile"/>
<module name="AvoidStarImport"/>
+ <module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="NeedBraces"/>
[17/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java b/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java
index 74e81d6..7cb65f8 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -34,7 +34,7 @@ public class EntityArraysTest {
public void testConstructorExists() {
new EntityArrays();
}
-
+
// LANG-659 - check arrays for duplicate entries
@Test
public void testHTML40_EXTENDED_ESCAPE(){
@@ -46,7 +46,7 @@ public class EntityArraysTest {
assertTrue("Already added entry 1: "+i+" "+sa[i][1],col1.add(sa[i][1]));
}
}
-
+
// LANG-658 - check arrays for duplicate entries
@Test
public void testISO8859_1_ESCAPE(){
@@ -57,7 +57,7 @@ public class EntityArraysTest {
for(int i =0; i <sa.length; i++){
final boolean add0 = col0.add(sa[i][0]);
final boolean add1 = col1.add(sa[i][1]);
- if (!add0) {
+ if (!add0) {
success = false;
System.out.println("Already added entry 0: "+i+" "+sa[i][0]+" "+sa[i][1]);
}
@@ -68,6 +68,6 @@ public class EntityArraysTest {
}
assertTrue("One or more errors detected",success);
}
-
-
+
+
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java b/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java
index a53f777..e936878 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java b/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
index 9c0594b..7db8fb7 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java b/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java
index 07c1841..18f81c6 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java b/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java
index cbe80f3..c879f5f 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java b/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java
index e5ca409..7006074 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java b/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java
index 5ab6752..a0ec693 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemoverTest.java b/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemoverTest.java
index 457aa9b..fc89911 100644
--- a/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemoverTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnpairedSurrogateRemoverTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -29,14 +29,14 @@ import org.junit.Test;
public class UnicodeUnpairedSurrogateRemoverTest {
final UnicodeUnpairedSurrogateRemover subject = new UnicodeUnpairedSurrogateRemover();
final CharArrayWriter writer = new CharArrayWriter(); // nothing is ever written to it
-
+
@Test
public void testValidCharacters() throws IOException {
assertEquals(false, subject.translate(0xd7ff, writer));
assertEquals(false, subject.translate(0xe000, writer));
assertEquals(0, writer.size());
}
-
+
@Test
public void testInvalidCharacters() throws IOException {
assertEquals(true, subject.translate(0xd800, writer));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
----------------------------------------------------------------------
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 0ae29ec..f197974 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -42,7 +42,7 @@ public class DateFormatUtilsTest {
@Rule
public SystemDefaultsSwitch defaults = new SystemDefaultsSwitch();
-
+
//-----------------------------------------------------------------------
@Test
public void testConstructor() {
@@ -53,7 +53,7 @@ public class DateFormatUtilsTest {
assertTrue(Modifier.isPublic(DateFormatUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(DateFormatUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testFormat() {
@@ -70,14 +70,14 @@ public class DateFormatUtilsTest {
buffer.append(day);
buffer.append(hour);
assertEquals(buffer.toString(), DateFormatUtils.format(c.getTime(), "yyyyMdH"));
-
+
assertEquals(buffer.toString(), DateFormatUtils.format(c.getTime().getTime(), "yyyyMdH"));
-
+
assertEquals(buffer.toString(), DateFormatUtils.format(c.getTime(), "yyyyMdH", Locale.US));
-
+
assertEquals(buffer.toString(), DateFormatUtils.format(c.getTime().getTime(), "yyyyMdH", Locale.US));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testFormatCalendar() {
@@ -94,24 +94,24 @@ public class DateFormatUtilsTest {
buffer.append(day);
buffer.append(hour);
assertEquals(buffer.toString(), DateFormatUtils.format(c, "yyyyMdH"));
-
+
assertEquals(buffer.toString(), DateFormatUtils.format(c.getTime(), "yyyyMdH"));
-
+
assertEquals(buffer.toString(), DateFormatUtils.format(c, "yyyyMdH", Locale.US));
-
+
assertEquals(buffer.toString(), DateFormatUtils.format(c.getTime(), "yyyyMdH", Locale.US));
}
-
+
@Test
public void testFormatUTC() {
final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.set(2005, Calendar.JANUARY, 1, 12, 0, 0);
assertEquals ("2005-01-01T12:00:00", DateFormatUtils.formatUTC(c.getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern()));
-
+
assertEquals ("2005-01-01T12:00:00", DateFormatUtils.formatUTC(c.getTime().getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern()));
-
+
assertEquals ("2005-01-01T12:00:00", DateFormatUtils.formatUTC(c.getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), Locale.US));
-
+
assertEquals ("2005-01-01T12:00:00", DateFormatUtils.formatUTC(c.getTime().getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), Locale.US));
}
@@ -142,7 +142,7 @@ public class DateFormatUtilsTest {
final TimeZone timeZone = TimeZone.getTimeZone("UTC");
assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));
}
-
+
@Test
public void testDateTimeISO() throws Exception {
testGmtMinus3("2002-02-23T09:11:12", DateFormatUtils.ISO_DATETIME_FORMAT.getPattern());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java
index 519c9d2..7a9e114 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -44,7 +44,7 @@ public class DateUtilsFragmentTest {
aCalendar.set(Calendar.MILLISECOND, millis);
aDate = aCalendar.getTime();
}
-
+
@Test
public void testNullDate() {
try {
@@ -100,7 +100,7 @@ public class DateUtilsFragmentTest {
fail();
} catch(final IllegalArgumentException iae) {}
}
-
+
@Test
public void testInvalidFragmentWithDate() {
try {
@@ -174,7 +174,7 @@ public class DateUtilsFragmentTest {
assertEquals(0, DateUtils.getFragmentInHours(aCalendar, Calendar.MILLISECOND));
assertEquals(0, DateUtils.getFragmentInDays(aCalendar, Calendar.MILLISECOND));
}
-
+
@Test
public void testSecondFragmentInLargerUnitWithDate() {
assertEquals(0, DateUtils.getFragmentInSeconds(aDate, Calendar.SECOND));
@@ -190,7 +190,7 @@ public class DateUtilsFragmentTest {
assertEquals(0, DateUtils.getFragmentInHours(aCalendar, Calendar.SECOND));
assertEquals(0, DateUtils.getFragmentInDays(aCalendar, Calendar.SECOND));
}
-
+
@Test
public void testMinuteFragmentInLargerUnitWithDate() {
assertEquals(0, DateUtils.getFragmentInMinutes(aDate, Calendar.MINUTE));
@@ -238,7 +238,7 @@ public class DateUtilsFragmentTest {
}
//Calendar.SECOND as useful fragment
-
+
@Test
public void testMillisecondsOfSecondWithDate() {
final long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.SECOND);
@@ -280,13 +280,13 @@ public class DateUtilsFragmentTest {
}
//Calendar.HOUR_OF_DAY as useful fragment
-
+
@Test
public void testMillisecondsOfHourWithDate() {
final long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.HOUR_OF_DAY);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE), testResult);
}
-
+
@Test
public void testMillisecondsOfHourWithCalendar() {
final long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.HOUR_OF_DAY);
@@ -329,16 +329,16 @@ public class DateUtilsFragmentTest {
@Test
public void testMillisecondsOfDayWithDate() {
long testresult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.DATE);
- final long expectedValue = millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR);
+ final long expectedValue = millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR);
assertEquals(expectedValue, testresult);
testresult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testresult);
}
-
+
@Test
public void testMillisecondsOfDayWithCalendar() {
long testresult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.DATE);
- final long expectedValue = millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR);
+ final long expectedValue = millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR);
assertEquals(expectedValue, testresult);
testresult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testresult);
@@ -365,7 +365,7 @@ public class DateUtilsFragmentTest {
@Test
public void testMinutesOfDayWithDate() {
long testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.DATE);
- final long expectedValue = minutes + ((hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_MINUTE;
+ final long expectedValue = minutes + ((hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_MINUTE;
assertEquals(expectedValue,testResult);
testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue,testResult);
@@ -374,16 +374,16 @@ public class DateUtilsFragmentTest {
@Test
public void testMinutesOfDayWithCalendar() {
long testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.DATE);
- final long expectedValue = minutes + ((hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_MINUTE;
+ final long expectedValue = minutes + ((hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_MINUTE;
assertEquals(expectedValue, testResult);
testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testResult);
}
-
+
@Test
public void testHoursOfDayWithDate() {
long testResult = DateUtils.getFragmentInHours(aDate, Calendar.DATE);
- final long expectedValue = hours;
+ final long expectedValue = hours;
assertEquals(expectedValue,testResult);
testResult = DateUtils.getFragmentInHours(aDate, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue,testResult);
@@ -392,13 +392,13 @@ public class DateUtilsFragmentTest {
@Test
public void testHoursOfDayWithCalendar() {
long testResult = DateUtils.getFragmentInHours(aCalendar, Calendar.DATE);
- final long expectedValue = hours;
+ final long expectedValue = hours;
assertEquals(expectedValue, testResult);
testResult = DateUtils.getFragmentInHours(aCalendar, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testResult);
}
-
-
+
+
//Calendar.MONTH as useful fragment
@Test
public void testMillisecondsOfMonthWithDate() {
@@ -415,7 +415,7 @@ public class DateUtilsFragmentTest {
+ (hours * DateUtils.MILLIS_PER_HOUR) + ((days - 1) * DateUtils.MILLIS_PER_DAY),
testResult);
}
-
+
@Test
public void testSecondsOfMonthWithDate() {
final long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.MONTH);
@@ -470,7 +470,7 @@ testResult);
/ DateUtils.MILLIS_PER_HOUR,
testResult);
}
-
+
//Calendar.YEAR as useful fragment
@Test
public void testMillisecondsOfYearWithDate() {
@@ -489,7 +489,7 @@ testResult);
+ (hours * DateUtils.MILLIS_PER_HOUR) + ((aCalendar.get(Calendar.DAY_OF_YEAR) - 1) * DateUtils.MILLIS_PER_DAY),
testResult);
}
-
+
@Test
public void testSecondsOfYearWithDate() {
final long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.YEAR);
@@ -563,27 +563,27 @@ testResult);
/ DateUtils.MILLIS_PER_HOUR,
testResult);
}
-
+
@Test
public void testDaysOfMonthWithCalendar() throws Exception {
final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.MONTH);
assertEquals(days, testResult);
}
-
+
@Test
public void testDaysOfMonthWithDate() throws Exception {
final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.MONTH);
final Calendar cal = Calendar.getInstance();
cal.setTime(aDate);
assertEquals(cal.get(Calendar.DAY_OF_MONTH), testResult);
- }
-
+ }
+
@Test
public void testDaysOfYearWithCalendar() throws Exception {
final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.YEAR);
assertEquals(aCalendar.get(Calendar.DAY_OF_YEAR), testResult);
}
-
+
@Test
public void testDaysOfYearWithDate() throws Exception {
final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.YEAR);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java
index b2a169b..432a574 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -31,19 +31,19 @@ import java.util.Locale;
/**
* These Unit-tests will check all possible extremes when using some rounding-methods of DateUtils.
* The extremes are tested at the switch-point in milliseconds
- *
+ *
* According to the implementation SEMI_MONTH will either round/truncate to the 1st or 16th
* When rounding Calendar.MONTH it depends on the number of days within that month.
* A month with 28 days will be rounded up from the 15th
* A month with 29 or 30 days will be rounded up from the 16th
* A month with 31 days will be rounded up from the 17th
- *
+ *
* @since 3.0
*/
public class DateUtilsRoundingTest {
DateFormat dateTimeParser;
-
+
Date januaryOneDate;
Date targetYearDate;
//No targetMonths, these must be tested for every type of month(28-31 days)
@@ -62,7 +62,7 @@ public class DateUtilsRoundingTest {
public void setUp() throws Exception {
dateTimeParser = new SimpleDateFormat("MMM dd, yyyy H:mm:ss.SSS", Locale.ENGLISH);
-
+
targetYearDate = dateTimeParser.parse("January 1, 2007 0:00:00.000");
targetDateDate = targetDayOfMonthDate = dateTimeParser.parse("June 1, 2008 0:00:00.000");
targetAmDate = dateTimeParser.parse("June 1, 2008 0:00:00.000");
@@ -72,7 +72,7 @@ public class DateUtilsRoundingTest {
targetMinuteDate = dateTimeParser.parse("June 1, 2008 8:15:00.000");
targetSecondDate = dateTimeParser.parse("June 1, 2008 8:15:14.000");
targetMilliSecondDate = dateTimeParser.parse("June 1, 2008 8:15:14.231");
-
+
januaryOneDate = dateTimeParser.parse("January 1, 2008 0:00:00.000");
januaryOneCalendar = Calendar.getInstance();
januaryOneCalendar.setTime(januaryOneDate);
@@ -80,7 +80,7 @@ public class DateUtilsRoundingTest {
/**
* Tests DateUtils.round()-method with Calendar.Year
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -92,12 +92,12 @@ public class DateUtilsRoundingTest {
final Date lastRoundedDownDate = dateTimeParser.parse("June 30, 2007 23:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.MONTH
* Includes rounding months with 28, 29, 30 and 31 days
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -106,7 +106,7 @@ public class DateUtilsRoundingTest {
final int calendarField = Calendar.MONTH;
Date roundedUpDate, roundedDownDate, lastRoundedDownDate;
Date minDate, maxDate;
-
+
//month with 28 days
roundedUpDate = dateTimeParser.parse("March 1, 2007 0:00:00.000");
roundedDownDate = dateTimeParser.parse("February 1, 2007 0:00:00.000");
@@ -118,30 +118,30 @@ public class DateUtilsRoundingTest {
roundedDownDate = dateTimeParser.parse("February 1, 2008 0:00:00.000");
lastRoundedDownDate = dateTimeParser.parse("February 15, 2008 23:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//month with 30 days
roundedUpDate = dateTimeParser.parse("May 1, 2008 0:00:00.000");
roundedDownDate = dateTimeParser.parse("April 1, 2008 0:00:00.000");
lastRoundedDownDate = dateTimeParser.parse("April 15, 2008 23:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//month with 31 days
roundedUpDate = dateTimeParser.parse("June 1, 2008 0:00:00.000");
roundedDownDate = dateTimeParser.parse("May 1, 2008 0:00:00.000");
lastRoundedDownDate = dateTimeParser.parse("May 16, 2008 23:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = dateTimeParser.parse("December 17, 2007 00:00:00.000");
maxDate = dateTimeParser.parse("January 16, 2008 23:59:59.999");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with DateUtils.SEMI_MONTH
- * Includes rounding months with 28, 29, 30 and 31 days, each with first and second half
+ * Includes rounding months with 28, 29, 30 and 31 days, each with first and second half
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -150,7 +150,7 @@ public class DateUtilsRoundingTest {
final int calendarField = DateUtils.SEMI_MONTH;
Date roundedUpDate, roundedDownDate, lastRoundedDownDate;
Date minDate, maxDate;
-
+
//month with 28 days (1)
roundedUpDate = dateTimeParser.parse("February 16, 2007 0:00:00.000");
roundedDownDate = dateTimeParser.parse("February 1, 2007 0:00:00.000");
@@ -168,7 +168,7 @@ public class DateUtilsRoundingTest {
roundedDownDate = dateTimeParser.parse("February 1, 2008 0:00:00.000");
lastRoundedDownDate = dateTimeParser.parse("February 8, 2008 23:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//month with 29 days (2)
roundedUpDate = dateTimeParser.parse("March 1, 2008 0:00:00.000");
roundedDownDate = dateTimeParser.parse("February 16, 2008 0:00:00.000");
@@ -186,7 +186,7 @@ public class DateUtilsRoundingTest {
roundedDownDate = dateTimeParser.parse("April 16, 2008 0:00:00.000");
lastRoundedDownDate = dateTimeParser.parse("April 23, 2008 23:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//month with 31 days (1)
roundedUpDate = dateTimeParser.parse("May 16, 2008 0:00:00.000");
roundedDownDate = dateTimeParser.parse("May 1, 2008 0:00:00.000");
@@ -198,18 +198,18 @@ public class DateUtilsRoundingTest {
roundedDownDate = dateTimeParser.parse("May 16, 2008 0:00:00.000");
lastRoundedDownDate = dateTimeParser.parse("May 23, 2008 23:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = dateTimeParser.parse("December 24, 2007 00:00:00.000");
maxDate = dateTimeParser.parse("January 8, 2008 23:59:59.999");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.DATE
- * Includes rounding the extremes of one day
+ * Includes rounding the extremes of one day
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -223,18 +223,18 @@ public class DateUtilsRoundingTest {
roundedDownDate = targetDateDate;
lastRoundedDownDate = dateTimeParser.parse("June 1, 2008 11:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = dateTimeParser.parse("December 31, 2007 12:00:00.000");
maxDate = dateTimeParser.parse("January 1, 2008 11:59:59.999");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.DAY_OF_MONTH
- * Includes rounding the extremes of one day
+ * Includes rounding the extremes of one day
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -248,18 +248,18 @@ public class DateUtilsRoundingTest {
roundedDownDate = targetDayOfMonthDate;
lastRoundedDownDate = dateTimeParser.parse("June 1, 2008 11:59:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = dateTimeParser.parse("December 31, 2007 12:00:00.000");
maxDate = dateTimeParser.parse("January 1, 2008 11:59:59.999");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.AM_PM
- * Includes rounding the extremes of both AM and PM of one day
+ * Includes rounding the extremes of both AM and PM of one day
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -286,12 +286,12 @@ public class DateUtilsRoundingTest {
maxDate = dateTimeParser.parse("January 1, 2008 5:59:59.999");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.HOUR_OF_DAY
- * Includes rounding the extremes of one hour
+ * Includes rounding the extremes of one hour
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -305,18 +305,18 @@ public class DateUtilsRoundingTest {
roundedDownDate = targetHourOfDayDate;
lastRoundedDownDate = dateTimeParser.parse("June 1, 2008 8:29:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = dateTimeParser.parse("December 31, 2007 23:30:00.000");
maxDate = dateTimeParser.parse("January 1, 2008 0:29:59.999");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.HOUR
- * Includes rounding the extremes of one hour
+ * Includes rounding the extremes of one hour
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -330,18 +330,18 @@ public class DateUtilsRoundingTest {
roundedDownDate = targetHourDate;
lastRoundedDownDate = dateTimeParser.parse("June 1, 2008 8:29:59.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = dateTimeParser.parse("December 31, 2007 23:30:00.000");
maxDate = dateTimeParser.parse("January 1, 2008 0:29:59.999");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.MINUTE
- * Includes rounding the extremes of one minute
+ * Includes rounding the extremes of one minute
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -355,18 +355,18 @@ public class DateUtilsRoundingTest {
roundedDownDate = targetMinuteDate;
lastRoundedDownDate = dateTimeParser.parse("June 1, 2008 8:15:29.999");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = dateTimeParser.parse("December 31, 2007 23:59:30.000");
maxDate = dateTimeParser.parse("January 1, 2008 0:00:29.999");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.SECOND
- * Includes rounding the extremes of one second
+ * Includes rounding the extremes of one second
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -380,18 +380,18 @@ public class DateUtilsRoundingTest {
roundedDownDate = targetSecondDate;
lastRoundedDownDate = dateTimeParser.parse("June 1, 2008 8:15:14.499");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = dateTimeParser.parse("December 31, 2007 23:59:59.500");
maxDate = dateTimeParser.parse("January 1, 2008 0:00:00.499");
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Tests DateUtils.round()-method with Calendar.MILLISECOND
- * Includes rounding the extremes of one second
+ * Includes rounding the extremes of one second
* Includes rounding to January 1
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -404,15 +404,15 @@ public class DateUtilsRoundingTest {
roundedDownDate = lastRoundedDownDate = targetMilliSecondDate;
roundedUpDate = dateTimeParser.parse("June 1, 2008 8:15:14.232");
baseRoundTest(roundedUpDate, roundedDownDate, lastRoundedDownDate, calendarField);
-
+
//round to January 1
minDate = maxDate = januaryOneDate;
roundToJanuaryFirst(minDate, maxDate, calendarField);
}
-
+
/**
* Test DateUtils.truncate()-method with Calendar.YEAR
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -425,7 +425,7 @@ public class DateUtilsRoundingTest {
/**
* Test DateUtils.truncate()-method with Calendar.MONTH
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -440,7 +440,7 @@ public class DateUtilsRoundingTest {
/**
* Test DateUtils.truncate()-method with DateUtils.SEMI_MONTH
* Includes truncating months with 28, 29, 30 and 31 days, each with first and second half
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -448,7 +448,7 @@ public class DateUtilsRoundingTest {
public void testTruncateSemiMonth() throws Exception {
final int calendarField = DateUtils.SEMI_MONTH;
Date truncatedDate, lastTruncateDate;
-
+
//month with 28 days (1)
truncatedDate = dateTimeParser.parse("February 1, 2007 0:00:00.000");
lastTruncateDate = dateTimeParser.parse("February 15, 2007 23:59:59.999");
@@ -478,7 +478,7 @@ public class DateUtilsRoundingTest {
truncatedDate = dateTimeParser.parse("April 16, 2008 0:00:00.000");
lastTruncateDate = dateTimeParser.parse("April 30, 2008 23:59:59.999");
baseTruncateTest(truncatedDate, lastTruncateDate, calendarField);
-
+
//month with 31 days (1)
truncatedDate = dateTimeParser.parse("March 1, 2008 0:00:00.000");
lastTruncateDate = dateTimeParser.parse("March 15, 2008 23:59:59.999");
@@ -493,7 +493,7 @@ public class DateUtilsRoundingTest {
/**
* Test DateUtils.truncate()-method with Calendar.DATE
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -503,10 +503,10 @@ public class DateUtilsRoundingTest {
final Date lastTruncateDate = dateTimeParser.parse("June 1, 2008 23:59:59.999");
baseTruncateTest(targetDateDate, lastTruncateDate, calendarField);
}
-
+
/**
* Test DateUtils.truncate()-method with Calendar.DAY_OF_MONTH
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -516,18 +516,18 @@ public class DateUtilsRoundingTest {
final Date lastTruncateDate = dateTimeParser.parse("June 1, 2008 23:59:59.999");
baseTruncateTest(targetDayOfMonthDate, lastTruncateDate, calendarField);
}
-
+
/**
* Test DateUtils.truncate()-method with Calendar.AM_PM
- * Includes truncating the extremes of both AM and PM of one day
- *
+ * Includes truncating the extremes of both AM and PM of one day
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@Test
public void testTruncateAmPm() throws Exception {
final int calendarField = Calendar.AM_PM;
-
+
//AM
Date lastTruncateDate = dateTimeParser.parse("June 1, 2008 11:59:59.999");
baseTruncateTest(targetAmDate, lastTruncateDate, calendarField);
@@ -536,10 +536,10 @@ public class DateUtilsRoundingTest {
lastTruncateDate = dateTimeParser.parse("June 1, 2008 23:59:59.999");
baseTruncateTest(targetPmDate, lastTruncateDate, calendarField);
}
-
+
/**
* Test DateUtils.truncate()-method with Calendar.HOUR
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -549,10 +549,10 @@ public class DateUtilsRoundingTest {
final Date lastTruncateDate = dateTimeParser.parse("June 1, 2008 8:59:59.999");
baseTruncateTest(targetHourDate, lastTruncateDate, calendarField);
}
-
+
/**
* Test DateUtils.truncate()-method with Calendar.HOUR_OF_DAY
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -562,10 +562,10 @@ public class DateUtilsRoundingTest {
final Date lastTruncateDate = dateTimeParser.parse("June 1, 2008 8:59:59.999");
baseTruncateTest(targetHourOfDayDate, lastTruncateDate, calendarField);
}
-
+
/**
* Test DateUtils.truncate()-method with Calendar.MINUTE
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -575,10 +575,10 @@ public class DateUtilsRoundingTest {
final Date lastTruncateDate = dateTimeParser.parse("June 1, 2008 8:15:59.999");
baseTruncateTest(targetMinuteDate, lastTruncateDate, calendarField);
}
-
+
/**
* Test DateUtils.truncate()-method with Calendar.SECOND
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -588,10 +588,10 @@ public class DateUtilsRoundingTest {
final Date lastTruncateDate = dateTimeParser.parse("June 1, 2008 8:15:14.999");
baseTruncateTest(targetSecondDate, lastTruncateDate, calendarField);
}
-
+
/**
* Test DateUtils.truncate()-method with Calendar.SECOND
- *
+ *
* @throws Exception so we don't have to catch it
* @since 3.0
*/
@@ -600,13 +600,13 @@ public class DateUtilsRoundingTest {
final int calendarField = Calendar.MILLISECOND;
baseTruncateTest(targetMilliSecondDate, targetMilliSecondDate, calendarField);
}
-
+
/**
- * When using this basetest all extremes are tested.<br>
+ * When using this basetest all extremes are tested.<br>
* It will test the Date, Calendar and Object-implementation<br>
* lastRoundDownDate should round down to roundedDownDate<br>
* lastRoundDownDate + 1 millisecond should round up to roundedUpDate
- *
+ *
* @param roundedUpDate the next rounded date after <strong>roundedDownDate</strong> when using <strong>calendarField</strong>
* @param roundedDownDate the result if <strong>lastRoundDownDate</strong> was rounded with <strong>calendarField</strong>
* @param lastRoundDownDate rounding this value with <strong>calendarField</strong> will result in <strong>roundedDownDate</strong>
@@ -615,15 +615,15 @@ public class DateUtilsRoundingTest {
*/
protected void baseRoundTest(final Date roundedUpDate, final Date roundedDownDate, final Date lastRoundDownDate, final int calendarField) {
final Date firstRoundUpDate = DateUtils.addMilliseconds(lastRoundDownDate, 1);
-
+
//Date-comparison
assertEquals(roundedDownDate, DateUtils.round(roundedDownDate, calendarField));
assertEquals(roundedUpDate, DateUtils.round(roundedUpDate, calendarField));
assertEquals(roundedDownDate, DateUtils.round(lastRoundDownDate, calendarField));
assertEquals(roundedUpDate, DateUtils.round(firstRoundUpDate, calendarField));
-
+
//Calendar-initiations
- Calendar roundedUpCalendar, roundedDownCalendar, lastRoundDownCalendar, firstRoundUpCalendar;
+ Calendar roundedUpCalendar, roundedDownCalendar, lastRoundDownCalendar, firstRoundUpCalendar;
roundedDownCalendar = Calendar.getInstance();
roundedUpCalendar = Calendar.getInstance();
lastRoundDownCalendar = Calendar.getInstance();
@@ -649,13 +649,13 @@ public class DateUtilsRoundingTest {
assertEquals(roundedDownDate, DateUtils.round((Object) lastRoundDownDate, calendarField));
assertEquals(roundedUpDate, DateUtils.round((Object) firstRoundUpDate, calendarField));
}
-
+
/**
- * When using this basetest all extremes are tested.<br>
+ * When using this basetest all extremes are tested.<br>
* It will test the Date, Calendar and Object-implementation<br>
* lastTruncateDate should round down to truncatedDate<br>
* lastTruncateDate + 1 millisecond should never round down to truncatedDate
- *
+ *
* @param truncatedDate expected Date when <strong>lastTruncateDate</strong> is truncated with <strong>calendarField</strong>
* @param lastTruncateDate the last possible Date which will truncate to <strong>truncatedDate</strong> with <strong>calendarField</strong>
* @param calendarField a Calendar.field value
@@ -663,14 +663,14 @@ public class DateUtilsRoundingTest {
*/
protected void baseTruncateTest(final Date truncatedDate, final Date lastTruncateDate, final int calendarField) {
final Date nextTruncateDate = DateUtils.addMilliseconds(lastTruncateDate, 1);
-
+
//Date-comparison
assertEquals("Truncating "+ fdf.format(truncatedDate) +" as Date with CalendarField-value "+ calendarField +" must return itself", truncatedDate, DateUtils.truncate(truncatedDate, calendarField));
assertEquals(truncatedDate, DateUtils.truncate(lastTruncateDate, calendarField));
assertFalse(fdf.format(lastTruncateDate) +" is not an extreme when truncating as Date with CalendarField-value "+ calendarField, truncatedDate.equals(DateUtils.truncate(nextTruncateDate, calendarField)));
-
+
//Calendar-initiations
- Calendar truncatedCalendar, lastTruncateCalendar, nextTruncateCalendar;
+ Calendar truncatedCalendar, lastTruncateCalendar, nextTruncateCalendar;
truncatedCalendar = Calendar.getInstance();
lastTruncateCalendar = Calendar.getInstance();
nextTruncateCalendar = Calendar.getInstance();
@@ -691,12 +691,12 @@ public class DateUtilsRoundingTest {
assertEquals(truncatedDate, DateUtils.truncate((Object) lastTruncateCalendar, calendarField));
assertFalse(fdf.format(lastTruncateCalendar) +" is not an extreme when truncating as Calendar cast to Object with CalendarField-value "+ calendarField, truncatedDate.equals(DateUtils.truncate((Object) nextTruncateCalendar, calendarField)));
}
-
+
/**
- *
+ *
* Any January 1 could be considered as the ultimate extreme.
- * Instead of comparing the results if the input has a difference of 1 millisecond we check the output to be exactly January first.
- *
+ * Instead of comparing the results if the input has a difference of 1 millisecond we check the output to be exactly January first.
+ *
* @param minDate the lower bound
* @param maxDate the upper bound
* @param calendarField a Calendar.field value
@@ -706,7 +706,7 @@ public class DateUtilsRoundingTest {
assertEquals("Rounding "+ fdf.format(januaryOneDate) +" as Date with CalendarField-value "+ calendarField +" must return itself", januaryOneDate, DateUtils.round(januaryOneDate, calendarField));
assertEquals(januaryOneDate, DateUtils.round(minDate, calendarField));
assertEquals(januaryOneDate, DateUtils.round(maxDate, calendarField));
-
+
final Calendar minCalendar = Calendar.getInstance();
minCalendar.setTime(minDate);
final Calendar maxCalendar = Calendar.getInstance();
@@ -719,7 +719,7 @@ public class DateUtilsRoundingTest {
final Date toNextRoundDate = DateUtils.addMilliseconds(maxDate, 1);
assertFalse(fdf.format(minDate) +" is not an lower-extreme when rounding as Date with CalendarField-value "+ calendarField, januaryOneDate.equals(DateUtils.round(toPrevRoundDate, calendarField)));
assertFalse(fdf.format(maxDate) +" is not an upper-extreme when rounding as Date with CalendarField-value "+ calendarField, januaryOneDate.equals(DateUtils.round(toNextRoundDate, calendarField)));
-
+
final Calendar toPrevRoundCalendar = Calendar.getInstance();
toPrevRoundCalendar.setTime(toPrevRoundDate);
final Calendar toNextRoundCalendar = Calendar.getInstance();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
index 964c40b..77e1101 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -59,7 +59,7 @@ public class DateUtilsTest {
@Rule
public SystemDefaultsSwitch defaults = new SystemDefaultsSwitch();
-
+
private DateFormat dateParser = null;
private DateFormat dateTimeParser = null;
private Date dateAmPm1 = null;
@@ -152,7 +152,7 @@ public class DateUtilsTest {
assertTrue(Modifier.isPublic(DateUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(DateUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testIsSameDay_Date() {
@@ -250,7 +250,7 @@ public class DateUtilsTest {
calb.set(2004, Calendar.JULY, 9, 13, 45, 0);
calb.set(Calendar.MILLISECOND, 0);
assertFalse(DateUtils.isSameInstant(cala, calb));
-
+
calb.set(2004, Calendar.JULY, 9, 11, 45, 0);
assertTrue(DateUtils.isSameInstant(cala, calb));
}
@@ -288,7 +288,7 @@ public class DateUtilsTest {
calc.set(Calendar.MILLISECOND, 0);
cald.set(Calendar.MILLISECOND, 0);
assertFalse("LANG-677", DateUtils.isSameLocalTime(calc, cald));
-
+
calb.set(2004, Calendar.JULY, 9, 11, 45, 0);
assertFalse(DateUtils.isSameLocalTime(cala, calb));
}
@@ -316,11 +316,11 @@ public class DateUtilsTest {
final String[] parsers = new String[] {"yyyy'-'DDD", "yyyy'-'MM'-'dd", "yyyyMMdd"};
Date date = DateUtils.parseDate(dateStr, parsers);
assertEquals(cal.getTime(), date);
-
+
dateStr = "1972-338";
date = DateUtils.parseDate(dateStr, parsers);
assertEquals(cal.getTime(), date);
-
+
dateStr = "19721203";
date = DateUtils.parseDate(dateStr, parsers);
assertEquals(cal.getTime(), date);
@@ -348,7 +348,7 @@ public class DateUtilsTest {
public void testParse_NullParsers() throws Exception {
DateUtils.parseDate("19721203", (String[]) null);
}
-
+
@Test(expected = ParseException.class)
public void testParse_EmptyParsers() throws Exception {
DateUtils.parseDate("19721203");
@@ -360,10 +360,10 @@ public class DateUtilsTest {
final GregorianCalendar cal = new GregorianCalendar(1998, 6, 30);
final String dateStr = "02 942, 1996";
final String[] parsers = new String[] {"MM DDD, yyyy"};
-
+
final Date date = DateUtils.parseDate(dateStr, parsers);
assertEquals(cal.getTime(), date);
-
+
try {
DateUtils.parseDateStrictly(dateStr, parsers);
fail();
@@ -377,12 +377,12 @@ public class DateUtilsTest {
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addYears(BASE_DATE, 1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2001, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addYears(BASE_DATE, -1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
@@ -396,12 +396,12 @@ public class DateUtilsTest {
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addMonths(BASE_DATE, 1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 7, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addMonths(BASE_DATE, -1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
@@ -415,12 +415,12 @@ public class DateUtilsTest {
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addWeeks(BASE_DATE, 1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 12, 4, 3, 2, 1);
-
+
result = DateUtils.addWeeks(BASE_DATE, -1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1); // july
@@ -434,12 +434,12 @@ public class DateUtilsTest {
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addDays(BASE_DATE, 1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 6, 4, 3, 2, 1);
-
+
result = DateUtils.addDays(BASE_DATE, -1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
@@ -453,12 +453,12 @@ public class DateUtilsTest {
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addHours(BASE_DATE, 1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 5, 3, 2, 1);
-
+
result = DateUtils.addHours(BASE_DATE, -1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
@@ -472,12 +472,12 @@ public class DateUtilsTest {
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addMinutes(BASE_DATE, 1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 4, 2, 1);
-
+
result = DateUtils.addMinutes(BASE_DATE, -1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
@@ -491,12 +491,12 @@ public class DateUtilsTest {
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addSeconds(BASE_DATE, 1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 3, 1);
-
+
result = DateUtils.addSeconds(BASE_DATE, -1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
@@ -510,12 +510,12 @@ public class DateUtilsTest {
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 1);
-
+
result = DateUtils.addMilliseconds(BASE_DATE, 1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
assertDate(result, 2000, 6, 5, 4, 3, 2, 2);
-
+
result = DateUtils.addMilliseconds(BASE_DATE, -1);
assertNotSame(BASE_DATE, result);
assertDate(BASE_DATE, 2000, 6, 5, 4, 3, 2, 1);
@@ -691,19 +691,19 @@ public class DateUtilsTest {
// expected
}
}
-
+
//-----------------------------------------------------------------------
@Test(expected=NullPointerException.class)
public void testToCalendarWithDateNull() {
DateUtils.toCalendar(null, zone);
}
-
+
//-----------------------------------------------------------------------
@Test(expected=NullPointerException.class)
public void testToCalendarWithTimeZoneNull() {
DateUtils.toCalendar(date1, null);
}
-
+
//-----------------------------------------------------------------------
@Test
public void testToCalendarWithDateAndTimeZoneNotNull() {
@@ -711,7 +711,7 @@ public class DateUtilsTest {
assertEquals("Convert Date and TimeZone to a Calendar, but failed to get the Date back", date2, c.getTime());
assertEquals("Convert Date and TimeZone to a Calendar, but failed to get the TimeZone back", defaultZone, c.getTimeZone());
}
-
+
//-----------------------------------------------------------------------
@Test(expected=NullPointerException.class)
public void testToCalendarWithDateAndTimeZoneNull() {
@@ -748,8 +748,8 @@ public class DateUtilsTest {
assertEquals("round semimonth-2 failed",
dateParser.parse("November 16, 2001"),
DateUtils.round(date2, DateUtils.SEMI_MONTH));
-
-
+
+
assertEquals("round date-1 failed",
dateParser.parse("February 13, 2002"),
DateUtils.round(date1, Calendar.DATE));
@@ -882,7 +882,7 @@ public class DateUtilsTest {
assertEquals("round ampm-4 failed",
dateTimeParser.parse("February 4, 2002 00:00:00.000"),
DateUtils.round((Object) calAmPm4, Calendar.AM_PM));
-
+
// 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);
@@ -911,7 +911,7 @@ public class DateUtilsTest {
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));
@@ -1123,14 +1123,14 @@ public class DateUtilsTest {
assertEquals("truncate ampm-4 failed",
dateTimeParser.parse("February 3, 2002 12:00:00.000"),
DateUtils.truncate((Object) dateAmPm4, Calendar.AM_PM));
-
+
assertEquals("truncate calendar second-1 failed",
dateTimeParser.parse("February 12, 2002 12:34:56.000"),
DateUtils.truncate((Object) cal1, Calendar.SECOND));
assertEquals("truncate calendar second-2 failed",
dateTimeParser.parse("November 18, 2001 1:23:11.000"),
DateUtils.truncate((Object) cal2, Calendar.SECOND));
-
+
assertEquals("truncate ampm-1 failed",
dateTimeParser.parse("February 3, 2002 00:00:00.000"),
DateUtils.truncate((Object) calAmPm1, Calendar.AM_PM));
@@ -1143,7 +1143,7 @@ public class DateUtilsTest {
assertEquals("truncate ampm-4 failed",
dateTimeParser.parse("February 3, 2002 12:00:00.000"),
DateUtils.truncate((Object) calAmPm4, Calendar.AM_PM));
-
+
try {
DateUtils.truncate((Date) null, Calendar.SECOND);
fail();
@@ -1180,7 +1180,7 @@ public class DateUtilsTest {
DateUtils.truncate((Object) cal8, Calendar.DATE));
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
final GregorianCalendar endCal = new GregorianCalendar();
@@ -1214,7 +1214,7 @@ public class DateUtilsTest {
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 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
@@ -1284,9 +1284,9 @@ public class DateUtilsTest {
final String isoDateStr = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(d);
final Date d2 = DateUtils.parseDate(isoDateStr, new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern() });
// the format loses milliseconds so have to reintroduce them
- assertEquals("Date not equal to itself ISO formatted and parsed", d.getTime(), d2.getTime() + d.getTime() % 1000);
+ assertEquals("Date not equal to itself ISO formatted and parsed", d.getTime(), d2.getTime() + d.getTime() % 1000);
}
-
+
/**
* Tests various values with the ceiling method
*
@@ -1361,7 +1361,7 @@ public class DateUtilsTest {
assertEquals("ceiling ampm-4 failed",
dateTimeParser.parse("February 4, 2002 00:00:00.000"),
DateUtils.ceiling(dateAmPm4, Calendar.AM_PM));
-
+
// tests public static Date ceiling(Object date, int field)
assertEquals("ceiling year-1 failed",
dateParser.parse("January 1, 2003"),
@@ -1417,14 +1417,14 @@ public class DateUtilsTest {
assertEquals("ceiling ampm-4 failed",
dateTimeParser.parse("February 4, 2002 00:00:00.000"),
DateUtils.ceiling((Object) dateAmPm4, Calendar.AM_PM));
-
+
assertEquals("ceiling calendar second-1 failed",
dateTimeParser.parse("February 12, 2002 12:34:57.000"),
DateUtils.ceiling((Object) cal1, Calendar.SECOND));
assertEquals("ceiling calendar second-2 failed",
dateTimeParser.parse("November 18, 2001 1:23:12.000"),
DateUtils.ceiling((Object) cal2, Calendar.SECOND));
-
+
assertEquals("ceiling ampm-1 failed",
dateTimeParser.parse("February 3, 2002 12:00:00.000"),
DateUtils.ceiling((Object) calAmPm1, Calendar.AM_PM));
@@ -1459,7 +1459,7 @@ public class DateUtilsTest {
fail();
} catch(final IllegalArgumentException ex) {}
-
+
// Fix for http://issues.apache.org/bugzilla/show_bug.cgi?id=25560
// Test ceiling across the beginning of daylight saving time
TimeZone.setDefault(zone);
@@ -1489,7 +1489,7 @@ public class DateUtilsTest {
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));
@@ -1516,7 +1516,7 @@ public class DateUtilsTest {
DateUtils.ceiling((Object) cal7, Calendar.HOUR_OF_DAY));
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
final GregorianCalendar endCal = new GregorianCalendar();
@@ -1584,7 +1584,7 @@ public class DateUtilsTest {
}
final Calendar centered = DateUtils.truncate(now, Calendar.DATE);
centered.add(Calendar.DATE, -3);
-
+
Iterator<?> it = DateUtils.iterator(now, DateUtils.RANGE_WEEK_SUNDAY);
assertWeekIterator(it, sunday);
it = DateUtils.iterator(now, DateUtils.RANGE_WEEK_MONDAY);
@@ -1593,7 +1593,7 @@ public class DateUtilsTest {
assertWeekIterator(it, today);
it = DateUtils.iterator(now, DateUtils.RANGE_WEEK_CENTER);
assertWeekIterator(it, centered);
-
+
it = DateUtils.iterator((Object) now, DateUtils.RANGE_WEEK_CENTER);
assertWeekIterator(it, centered);
it = DateUtils.iterator((Object) now.getTime(), DateUtils.RANGE_WEEK_CENTER);
@@ -1607,11 +1607,11 @@ public class DateUtilsTest {
try {
it.remove();
} catch( final UnsupportedOperationException ex) {}
-
+
now.add(Calendar.DATE,1);
}
}
-
+
/**
* Tests the calendar iterator for month-based ranges
*
@@ -1667,14 +1667,14 @@ public class DateUtilsTest {
public void testLANG799_DE_FAIL() throws ParseException {
DateUtils.parseDate("Wed, 09 Apr 2008 23:55:38 GMT", "EEE, dd MMM yyyy HH:mm:ss zzz");
}
-
+
// Parse German date with English Locale, specifying German Locale override
@SystemDefaults(locale="en")
@Test
public void testLANG799_EN_WITH_DE_LOCALE() throws ParseException {
DateUtils.parseDate("Mi, 09 Apr 2008 23:55:38 GMT", Locale.GERMAN, "EEE, dd MMM yyyy HH:mm:ss zzz");
}
-
+
/**
* This checks that this is a 7 element iterator of Calendar objects
* that are dates (no time), and exactly 1 day spaced after each other.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
index 2847c6d..b5eb0fa 100644
--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -409,14 +409,14 @@ public class DurationFormatUtilsTest {
// http://issues.apache.org/bugzilla/show_bug.cgi?id=38401
@Test
public void testBugzilla38401() {
- assertEqualDuration( "0000/00/30 16:00:00 000", new int[] { 2006, 0, 26, 18, 47, 34 },
+ assertEqualDuration( "0000/00/30 16:00:00 000", new int[] { 2006, 0, 26, 18, 47, 34 },
new int[] { 2006, 1, 26, 10, 47, 34 }, "yyyy/MM/dd HH:mm:ss SSS");
}
// https://issues.apache.org/jira/browse/LANG-281
@Test
public void testJiraLang281() {
- assertEqualDuration( "09", new int[] { 2005, 11, 31, 0, 0, 0 },
+ assertEqualDuration( "09", new int[] { 2005, 11, 31, 0, 0, 0 },
new int[] { 2006, 9, 6, 0, 0, 0 }, "MM");
}
@@ -438,7 +438,7 @@ public class DurationFormatUtilsTest {
for(int hr=0; hr < 24; hr++) {
for(int min=0; min < 60; min++) {
for(int sec=0; sec < 60; sec++) {
- assertEqualDuration( hr + ":" + min + ":" + sec,
+ assertEqualDuration( hr + ":" + min + ":" + sec,
new int[] { 2000, 0, 1, 0, 0, 0, 0 },
new int[] { 2000, 0, 1, hr, min, sec },
"H:m:s"
@@ -453,92 +453,92 @@ public class DurationFormatUtilsTest {
public void testEdgeDurations() {
// This test case must use a time zone without DST
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- assertEqualDuration( "01", new int[] { 2006, 0, 15, 0, 0, 0 },
+ assertEqualDuration( "01", new int[] { 2006, 0, 15, 0, 0, 0 },
new int[] { 2006, 2, 10, 0, 0, 0 }, "MM");
- assertEqualDuration( "12", new int[] { 2005, 0, 15, 0, 0, 0 },
+ assertEqualDuration( "12", new int[] { 2005, 0, 15, 0, 0, 0 },
new int[] { 2006, 0, 15, 0, 0, 0 }, "MM");
- assertEqualDuration( "12", new int[] { 2005, 0, 15, 0, 0, 0 },
+ assertEqualDuration( "12", new int[] { 2005, 0, 15, 0, 0, 0 },
new int[] { 2006, 0, 16, 0, 0, 0 }, "MM");
- assertEqualDuration( "11", new int[] { 2005, 0, 15, 0, 0, 0 },
+ assertEqualDuration( "11", new int[] { 2005, 0, 15, 0, 0, 0 },
new int[] { 2006, 0, 14, 0, 0, 0 }, "MM");
-
+
assertEqualDuration( "01 26", new int[] { 2006, 0, 15, 0, 0, 0 },
new int[] { 2006, 2, 10, 0, 0, 0 }, "MM dd");
assertEqualDuration( "54", new int[] { 2006, 0, 15, 0, 0, 0 },
- new int[] { 2006, 2, 10, 0, 0, 0 }, "dd");
-
+ new int[] { 2006, 2, 10, 0, 0, 0 }, "dd");
+
assertEqualDuration( "09 12", new int[] { 2006, 1, 20, 0, 0, 0 },
new int[] { 2006, 11, 4, 0, 0, 0 }, "MM dd");
assertEqualDuration( "287", new int[] { 2006, 1, 20, 0, 0, 0 },
- new int[] { 2006, 11, 4, 0, 0, 0 }, "dd");
+ new int[] { 2006, 11, 4, 0, 0, 0 }, "dd");
assertEqualDuration( "11 30", new int[] { 2006, 0, 2, 0, 0, 0 },
- new int[] { 2007, 0, 1, 0, 0, 0 }, "MM dd");
+ new int[] { 2007, 0, 1, 0, 0, 0 }, "MM dd");
assertEqualDuration( "364", new int[] { 2006, 0, 2, 0, 0, 0 },
- new int[] { 2007, 0, 1, 0, 0, 0 }, "dd");
+ new int[] { 2007, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "12 00", new int[] { 2006, 0, 1, 0, 0, 0 },
- new int[] { 2007, 0, 1, 0, 0, 0 }, "MM dd");
+ new int[] { 2007, 0, 1, 0, 0, 0 }, "MM dd");
assertEqualDuration( "365", new int[] { 2006, 0, 1, 0, 0, 0 },
- new int[] { 2007, 0, 1, 0, 0, 0 }, "dd");
-
+ new int[] { 2007, 0, 1, 0, 0, 0 }, "dd");
+
assertEqualDuration( "31", new int[] { 2006, 0, 1, 0, 0, 0 },
- new int[] { 2006, 1, 1, 0, 0, 0 }, "dd");
-
+ new int[] { 2006, 1, 1, 0, 0, 0 }, "dd");
+
assertEqualDuration( "92", new int[] { 2005, 9, 1, 0, 0, 0 },
- new int[] { 2006, 0, 1, 0, 0, 0 }, "dd");
+ new int[] { 2006, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "77", new int[] { 2005, 9, 16, 0, 0, 0 },
- new int[] { 2006, 0, 1, 0, 0, 0 }, "dd");
+ new int[] { 2006, 0, 1, 0, 0, 0 }, "dd");
// test month larger in start than end
assertEqualDuration( "136", new int[] { 2005, 9, 16, 0, 0, 0 },
- new int[] { 2006, 2, 1, 0, 0, 0 }, "dd");
+ new int[] { 2006, 2, 1, 0, 0, 0 }, "dd");
// test when start in leap year
assertEqualDuration( "136", new int[] { 2004, 9, 16, 0, 0, 0 },
- new int[] { 2005, 2, 1, 0, 0, 0 }, "dd");
+ new int[] { 2005, 2, 1, 0, 0, 0 }, "dd");
// test when end in leap year
assertEqualDuration( "137", new int[] { 2003, 9, 16, 0, 0, 0 },
- new int[] { 2004, 2, 1, 0, 0, 0 }, "dd");
+ new int[] { 2004, 2, 1, 0, 0, 0 }, "dd");
// test when end in leap year but less than end of feb
assertEqualDuration( "135", new int[] { 2003, 9, 16, 0, 0, 0 },
- new int[] { 2004, 1, 28, 0, 0, 0 }, "dd");
+ new int[] { 2004, 1, 28, 0, 0, 0 }, "dd");
assertEqualDuration( "364", new int[] { 2007, 0, 2, 0, 0, 0 },
- new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
+ new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "729", new int[] { 2006, 0, 2, 0, 0, 0 },
- new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
+ new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "365", new int[] { 2007, 2, 2, 0, 0, 0 },
- new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
+ new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "333", new int[] { 2007, 1, 2, 0, 0, 0 },
- new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
+ new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "28", new int[] { 2008, 1, 2, 0, 0, 0 },
- new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
+ new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "393", new int[] { 2007, 1, 2, 0, 0, 0 },
- new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
+ new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "369", new int[] { 2004, 0, 29, 0, 0, 0 },
- new int[] { 2005, 1, 1, 0, 0, 0 }, "dd");
+ new int[] { 2005, 1, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "338", new int[] { 2004, 1, 29, 0, 0, 0 },
- new int[] { 2005, 1, 1, 0, 0, 0 }, "dd");
+ new int[] { 2005, 1, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "28", new int[] { 2004, 2, 8, 0, 0, 0 },
- new int[] { 2004, 3, 5, 0, 0, 0 }, "dd");
+ new int[] { 2004, 3, 5, 0, 0, 0 }, "dd");
assertEqualDuration( "48", new int[] { 1992, 1, 29, 0, 0, 0 },
- new int[] { 1996, 1, 29, 0, 0, 0 }, "M");
-
-
- // this seems odd - and will fail if I throw it in as a brute force
+ new int[] { 1996, 1, 29, 0, 0, 0 }, "M");
+
+
+ // this seems odd - and will fail if I throw it in as a brute force
// below as it expects the answer to be 12. It's a tricky edge case
assertEqualDuration( "11", new int[] { 1996, 1, 29, 0, 0, 0 },
- new int[] { 1997, 1, 28, 0, 0, 0 }, "M");
+ new int[] { 1997, 1, 28, 0, 0, 0 }, "M");
// again - this seems odd
assertEqualDuration( "11 28", new int[] { 1996, 1, 29, 0, 0, 0 },
- new int[] { 1997, 1, 28, 0, 0, 0 }, "M d");
-
+ new int[] { 1997, 1, 28, 0, 0, 0 }, "M d");
+
}
@Test
@@ -581,7 +581,7 @@ public class DurationFormatUtilsTest {
}
private static final int FOUR_YEARS = 365 * 3 + 366;
-
+
// Takes a minute to run, so generally turned off
// public void testBrutally() {
// Calendar c = Calendar.getInstance();
@@ -590,8 +590,8 @@ public class DurationFormatUtilsTest {
// bruteForce(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), "d", Calendar.DAY_OF_MONTH );
// c.add(Calendar.DAY_OF_MONTH, 1);
// }
-// }
-
+// }
+
private void bruteForce(final int year, final int month, final int day, final String format, final int calendarType) {
final String msg = year + "-" + month + "-" + day + " to ";
final Calendar c = Calendar.getInstance();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
index 3de6df8..7197a98 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
@@ -162,10 +162,10 @@ public class FastDateFormatTest {
final FastDateFormat format = FastDateFormat.getInstance();
final FastDateFormat medium = FastDateFormat.getDateTimeInstance(FastDateFormat.SHORT, FastDateFormat.SHORT);
assertEquals(medium, format);
-
+
final SimpleDateFormat sdf = new SimpleDateFormat();
assertEquals(sdf.toPattern(), format.getPattern());
-
+
assertEquals(Locale.getDefault(), format.getLocale());
assertEquals(TimeZone.getDefault(), format.getTimeZone());
}
@@ -176,7 +176,7 @@ public class FastDateFormatTest {
final FastDateFormat shortLong = FastDateFormat.getDateTimeInstance(FastDateFormat.SHORT, FastDateFormat.LONG, Locale.US);
final FastDateFormat longShort = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.SHORT, Locale.US);
final FastDateFormat longLong = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.LONG, Locale.US);
-
+
assertFalse(shortShort.equals(shortLong));
assertFalse(shortShort.equals(longShort));
assertFalse(shortShort.equals(longLong));
@@ -187,13 +187,13 @@ public class FastDateFormatTest {
@Test
public void testDateDefaults() {
- assertEquals(FastDateFormat.getDateInstance(FastDateFormat.LONG, Locale.CANADA),
+ assertEquals(FastDateFormat.getDateInstance(FastDateFormat.LONG, Locale.CANADA),
FastDateFormat.getDateInstance(FastDateFormat.LONG, TimeZone.getDefault(), Locale.CANADA));
-
- assertEquals(FastDateFormat.getDateInstance(FastDateFormat.LONG, TimeZone.getTimeZone("America/New_York")),
+
+ assertEquals(FastDateFormat.getDateInstance(FastDateFormat.LONG, TimeZone.getTimeZone("America/New_York")),
FastDateFormat.getDateInstance(FastDateFormat.LONG, TimeZone.getTimeZone("America/New_York"), Locale.getDefault()));
- assertEquals(FastDateFormat.getDateInstance(FastDateFormat.LONG),
+ assertEquals(FastDateFormat.getDateInstance(FastDateFormat.LONG),
FastDateFormat.getDateInstance(FastDateFormat.LONG, TimeZone.getDefault(), Locale.getDefault()));
}
@@ -255,7 +255,7 @@ public class FastDateFormatTest {
final static private int NTHREADS= 10;
final static private int NROUNDS= 10000;
-
+
private AtomicLongArray measureTime(final Format printer, final Format parser) throws InterruptedException {
final ExecutorService pool = Executors.newFixedThreadPool(NTHREADS);
final AtomicInteger failures= new AtomicInteger(0);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
index 7857751..304332b 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
@@ -36,7 +36,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
/**
- * Compare FastDateParser with SimpleDateFormat
+ * Compare FastDateParser with SimpleDateFormat
*/
@RunWith(Parameterized.class)
public class FastDateParserSDFTest {
@@ -184,9 +184,9 @@ public class FastDateParserSDFTest {
fdfE = e.getClass();
}
if (valid) {
- assertEquals(locale.toString()+" "+formattedDate +"\n",expectedTime, actualTime);
+ assertEquals(locale.toString()+" "+formattedDate +"\n",expectedTime, actualTime);
} else {
- assertEquals(locale.toString()+" "+formattedDate + " expected same Exception ", sdfE, fdfE);
+ assertEquals(locale.toString()+" "+formattedDate + " expected same Exception ", sdfE, fdfE);
}
}
private void checkParsePosition(final String formattedDate) {
@@ -203,12 +203,12 @@ public class FastDateParserSDFTest {
final int length = formattedDate.length();
if (endIndex != length) {
// Error in test data
- throw new RuntimeException("Test data error: expected SDF parse to consume entire string; endindex " + endIndex + " != " + length);
+ throw new RuntimeException("Test data error: expected SDF parse to consume entire string; endindex " + endIndex + " != " + length);
}
} else {
final int errorIndex = sdfP.getErrorIndex();
if (errorIndex == -1) {
- throw new RuntimeException("Test data error: expected SDF parse to fail, but got " + expectedTime);
+ throw new RuntimeException("Test data error: expected SDF parse to fail, but got " + expectedTime);
}
}
@@ -225,6 +225,6 @@ public class FastDateParserSDFTest {
assertNotEquals("Test data error: expected FDF parse to fail, but got " + actualTime, -1, fdferrorIndex);
assertTrue("FDF error index ("+ fdferrorIndex + ") should approximate SDF index (" + sdferrorIndex + ")",
sdferrorIndex - fdferrorIndex <= 4);
- }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
----------------------------------------------------------------------
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 ed70757..c637f79 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
@@ -343,7 +343,7 @@ public class FastDateParserTest {
}
}
}
-
+
@Test
public void testJpLocales() {
@@ -421,7 +421,7 @@ public class FastDateParserTest {
testSdfAndFdp("''yyyyMMdd'A''B'HHmmssSSS''", "'20030210A'B153320989'", false); // OK
testSdfAndFdp("''''yyyyMMdd'A''B'HHmmssSSS''", "''20030210A'B153320989'", false); // OK
testSdfAndFdp("'$\\Ed'" ,"$\\Ed", false); // OK
-
+
// quoted charaters are case sensitive
testSdfAndFdp("'QED'", "QED", false);
testSdfAndFdp("'QED'", "qed", true);
@@ -429,7 +429,7 @@ public class FastDateParserTest {
testSdfAndFdp("yyyy-MM-dd 'QED'", "2003-02-10 QED", false);
testSdfAndFdp("yyyy-MM-dd 'QED'", "2003-02-10 qed", true);
}
-
+
@Test
public void testLANG_832() throws Exception {
testSdfAndFdp("'d'd" ,"d3", false); // OK
@@ -593,19 +593,19 @@ public class FastDateParserTest {
final DateParser parser= getInstance(yMdHmsSZ, REYKJAVIK);
assertEquals(REYKJAVIK, parser.getTimeZone());
}
-
+
@Test
public void testLang996() throws ParseException {
final Calendar expected = Calendar.getInstance(NEW_YORK, Locale.US);
expected.clear();
expected.set(2014, Calendar.MAY, 14);
- final DateParser fdp = getInstance("ddMMMyyyy", NEW_YORK, Locale.US);
+ final DateParser fdp = getInstance("ddMMMyyyy", NEW_YORK, Locale.US);
assertEquals(expected.getTime(), fdp.parse("14may2014"));
assertEquals(expected.getTime(), fdp.parse("14MAY2014"));
assertEquals(expected.getTime(), fdp.parse("14May2014"));
}
-
+
@Test(expected = IllegalArgumentException.class)
public void test1806Argument() {
getInstance("XXXX");
@@ -624,8 +624,8 @@ public class FastDateParserTest {
}
private static enum Expected1806 {
- India(INDIA, "+05", "+0530", "+05:30", true),
- Greenwich(GMT, "Z", "Z", "Z", false),
+ India(INDIA, "+05", "+0530", "+05:30", true),
+ Greenwich(GMT, "Z", "Z", "Z", false),
NewYork(NEW_YORK, "-05", "-0500", "-05:00", false);
private Expected1806(final TimeZone zone, final String one, final String two, final String three, final boolean hasHalfHourOffset) {
@@ -642,17 +642,17 @@ public class FastDateParserTest {
final String three;
final long offset;
}
-
+
@Test
public void test1806() throws ParseException {
final String formatStub = "yyyy-MM-dd'T'HH:mm:ss.SSS";
final String dateStub = "2001-02-04T12:08:56.235";
-
+
for (final Expected1806 trial : Expected1806.values()) {
final Calendar cal = initializeCalendar(trial.zone);
final String message = trial.zone.getDisplayName()+";";
-
+
DateParser parser = getInstance(formatStub+"X", trial.zone);
assertEquals(message+trial.one, cal.getTime().getTime(), parser.parse(dateStub+trial.one).getTime()-trial.offset);
[15/48] [lang] Make sure files end with a new line
Posted by br...@apache.org.
Make sure files end with a new line
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/fa91c1b2
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/fa91c1b2
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/fa91c1b2
Branch: refs/heads/release
Commit: fa91c1b28647bd4217b0c325249aff9638fbeb6a
Parents: f21c32a
Author: Benedikt Ritter <br...@apache.org>
Authored: Tue Jun 6 15:05:02 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Tue Jun 6 15:05:02 2017 +0200
----------------------------------------------------------------------
checkstyle.xml | 3 +++
src/main/java/org/apache/commons/lang3/arch/package-info.java | 2 +-
.../commons/lang3/concurrent/CircuitBreakingExceptionTest.java | 2 +-
.../commons/lang3/concurrent/EventCountCircuitBreakerTest.java | 2 +-
.../apache/commons/lang3/exception/CloneFailedExceptionTest.java | 2 +-
5 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fa91c1b2/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 3963bfc..7070d0b 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -24,6 +24,9 @@ limitations under the License.
<module name="Checker">
<property name="localeLanguage" value="en"/>
<module name="JavadocPackage"/>
+ <module name="NewlineAtEndOfFile">
+ <property name="lineSeparator" value="lf" />
+ </module>
<module name="FileTabCharacter">
<property name="fileExtensions" value="java,xml"/>
</module>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fa91c1b2/src/main/java/org/apache/commons/lang3/arch/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/arch/package-info.java b/src/main/java/org/apache/commons/lang3/arch/package-info.java
index 0a60a81..f256190 100644
--- a/src/main/java/org/apache/commons/lang3/arch/package-info.java
+++ b/src/main/java/org/apache/commons/lang3/arch/package-info.java
@@ -18,4 +18,4 @@
* Provides classes to work with the values of the os.arch system property.
* @since 3.6
*/
-package org.apache.commons.lang3.arch;
\ No newline at end of file
+package org.apache.commons.lang3.arch;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fa91c1b2/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java b/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java
index cdcd679..a794018 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/CircuitBreakingExceptionTest.java
@@ -80,4 +80,4 @@ public class CircuitBreakingExceptionTest extends AbstractExceptionTest {
assertNotNull(cause);
assertEquals(WRONG_CAUSE_MESSAGE, CAUSE_MESSAGE, cause.getMessage());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fa91c1b2/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
----------------------------------------------------------------------
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 8e0ee2a..ab80b13 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
+++ b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java
@@ -399,4 +399,4 @@ public class EventCountCircuitBreakerTest {
changedValues.toArray(new Boolean[changedValues.size()]));
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fa91c1b2/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java b/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java
index 5273575..5406be5 100644
--- a/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java
@@ -73,4 +73,4 @@ public class CloneFailedExceptionTest extends AbstractExceptionTest {
assertNotNull(cause);
assertEquals(WRONG_CAUSE_MESSAGE, CAUSE_MESSAGE, cause.getMessage());
}
-}
\ No newline at end of file
+}
[13/48] [lang] LANG-1337: Fix test failures in IBM JDK 8 for
ToStringBuilderTest by specifying the ArrayList initial capacity.
Posted by br...@apache.org.
LANG-1337: Fix test failures in IBM JDK 8 for ToStringBuilderTest by specifying the ArrayList initial capacity.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/65b08c4f
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/65b08c4f
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/65b08c4f
Branch: refs/heads/release
Commit: 65b08c4f91a4e5d78eb645b46d06d7a46f8c62dd
Parents: 5511012
Author: Bruno P. Kinoshita <ki...@apache.org>
Authored: Tue Jun 6 23:41:31 2017 +1200
Committer: Bruno P. Kinoshita <ki...@apache.org>
Committed: Tue Jun 6 23:41:31 2017 +1200
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
.../java/org/apache/commons/lang3/builder/ToStringBuilderTest.java | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/65b08c4f/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cb2cbf3..4496b9b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="3.6" date="2017-MM-DD" description="TBD">
+ <action issue="LANG-1337" type="fix" dev="kinow">Fix test failures in IBM JDK 8 for ToStringBuilderTest</action>
<action issue="LANG-1304" type="add" dev="pschumacher" due-to="Andy Klimczak">Add method in StringUtils to determine if string contains both mixed cased characters</action>
<action issue="LANG-1334" type="update" dev="djones">Deprecate CharEncoding in favour of java.nio.charset.StandardCharsets</action>
<action issue="LANG-1319" type="fix" dev="djones">MultilineRecursiveToStringStyle StackOverflowError when object is an array</action>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/65b08c4f/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
index 8e32287..f0c5af7 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
@@ -316,7 +316,7 @@ public class ToStringBuilderTest {
// representation different for IBM JDK 1.6.0, LANG-727
assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION));
assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0);
- final List<Object> list = new ArrayList<>();
+ final List<Object> list = new ArrayList<>(10);
final String baseString = this.toBaseString(list);
final String expectedWithTransients = baseString + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]";
final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true);
[24/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/time/StopWatch.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/StopWatch.java b/src/main/java/org/apache/commons/lang3/time/StopWatch.java
index 0bd60a7..573fa86 100644
--- a/src/main/java/org/apache/commons/lang3/time/StopWatch.java
+++ b/src/main/java/org/apache/commons/lang3/time/StopWatch.java
@@ -5,9 +5,9 @@
* 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.
@@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit;
* <p>
* <code>StopWatch</code> provides a convenient API for timings.
* </p>
- *
+ *
* <p>
* To start the watch, call {@link #start()} or {@link StopWatch#createStarted()}. At this point you can:
* </p>
@@ -34,26 +34,26 @@ import java.util.concurrent.TimeUnit;
* suspend and resume will not be counted in the total. At this point, these three options are available again.</li>
* <li>{@link #stop()} the watch to complete the timing session.</li>
* </ul>
- *
+ *
* <p>
* It is intended that the output methods {@link #toString()} and {@link #getTime()} should only be called after stop,
* split or suspend, however a suitable result will be returned at other points.
* </p>
- *
+ *
* <p>
* NOTE: As from v2.1, the methods protect against inappropriate calls. Thus you cannot now call stop before start,
* resume before suspend or unsplit before split.
* </p>
- *
+ *
* <p>
* 1. split(), suspend(), or stop() cannot be invoked twice<br>
* 2. unsplit() may only be called if the watch has been split()<br>
* 3. resume() may only be called if the watch has been suspend()<br>
* 4. start() cannot be called twice without calling reset()
* </p>
- *
+ *
* <p>This class is not thread-safe</p>
- *
+ *
* @since 2.0
*/
public class StopWatch {
@@ -64,7 +64,7 @@ public class StopWatch {
/**
* Provides a started stopwatch for convenience.
*
- * @return StopWatch a stopwatch that's already been started.
+ * @return StopWatch a stopwatch that's already been started.
*
* @since 3.5
*/
@@ -73,7 +73,7 @@ public class StopWatch {
sw.start();
return sw;
}
-
+
/**
* Enumeration type which indicates the status of stopwatch.
*/
@@ -136,7 +136,7 @@ public class StopWatch {
/**
* Enumeration type which indicates the split status of stopwatch.
- */
+ */
private enum SplitState {
SPLIT,
UNSPLIT
@@ -157,8 +157,8 @@ public class StopWatch {
private long startTime;
/**
- * The start time in Millis - nanoTime is only for elapsed time so we
- * need to also store the currentTimeMillis to maintain the old
+ * The start time in Millis - nanoTime is only for elapsed time so we
+ * need to also store the currentTimeMillis to maintain the old
* getStartTime API.
*/
private long startTimeMillis;
@@ -181,11 +181,11 @@ public class StopWatch {
* <p>
* Start the stopwatch.
* </p>
- *
+ *
* <p>
* This method starts a new timing session, clearing any previous values.
* </p>
- *
+ *
* @throws IllegalStateException
* if the StopWatch is already running.
*/
@@ -206,11 +206,11 @@ public class StopWatch {
* <p>
* Stop the stopwatch.
* </p>
- *
+ *
* <p>
* This method ends a new timing session, allowing the time to be retrieved.
* </p>
- *
+ *
* @throws IllegalStateException
* if the StopWatch is not running.
*/
@@ -228,7 +228,7 @@ public class StopWatch {
* <p>
* Resets the stopwatch. Stops it if need be.
* </p>
- *
+ *
* <p>
* This method clears the internal values to allow the object to be reused.
* </p>
@@ -242,12 +242,12 @@ public class StopWatch {
* <p>
* Split the time.
* </p>
- *
+ *
* <p>
* This method sets the stop time of the watch to allow a time to be extracted. The start time is unaffected,
* enabling {@link #unsplit()} to continue the timing from the original start point.
* </p>
- *
+ *
* @throws IllegalStateException
* if the StopWatch is not running.
*/
@@ -263,12 +263,12 @@ public class StopWatch {
* <p>
* Remove a split.
* </p>
- *
+ *
* <p>
* This method clears the stop time. The start time is unaffected, enabling timing from the original start point to
* continue.
* </p>
- *
+ *
* @throws IllegalStateException
* if the StopWatch has not been split.
*/
@@ -283,12 +283,12 @@ public class StopWatch {
* <p>
* Suspend the stopwatch for later resumption.
* </p>
- *
+ *
* <p>
* This method suspends the watch until it is resumed. The watch will not include time between the suspend and
* resume calls in the total time.
* </p>
- *
+ *
* @throws IllegalStateException
* if the StopWatch is not currently running.
*/
@@ -304,12 +304,12 @@ public class StopWatch {
* <p>
* Resume the stopwatch after a suspend.
* </p>
- *
+ *
* <p>
* This method resumes the watch after it was suspended. The watch will not include time between the suspend and
* resume calls in the total time.
* </p>
- *
+ *
* @throws IllegalStateException
* if the StopWatch has not been suspended.
*/
@@ -325,12 +325,12 @@ public class StopWatch {
* <p>
* Get the time on the stopwatch.
* </p>
- *
+ *
* <p>
* This is either the time between the start and the moment this method is called, or the amount of time between
* start and stop.
* </p>
- *
+ *
* @return the time in milliseconds
*/
public long getTime() {
@@ -341,14 +341,14 @@ public class StopWatch {
* <p>
* Get the time on the stopwatch in the specified TimeUnit.
* </p>
- *
+ *
* <p>
* This is either the time between the start and the moment this method is called, or the amount of time between
* start and stop. The resulting time will be expressed in the desired TimeUnit with any remainder rounded down.
* For example, if the specified unit is {@code TimeUnit.HOURS} and the stopwatch time is 59 minutes, then the
* result returned will be {@code 0}.
* </p>
- *
+ *
* @param timeUnit the unit of time, not null
* @return the time in the specified TimeUnit, rounded down
* @since 3.5
@@ -361,12 +361,12 @@ public class StopWatch {
* <p>
* Get the time on the stopwatch in nanoseconds.
* </p>
- *
+ *
* <p>
* This is either the time between the start and the moment this method is called, or the amount of time between
* start and stop.
* </p>
- *
+ *
* @return the time in nanoseconds
* @since 3.0
*/
@@ -385,13 +385,13 @@ public class StopWatch {
* <p>
* Get the split time on the stopwatch.
* </p>
- *
+ *
* <p>
* This is the time between start and latest split.
* </p>
- *
+ *
* @return the split time in milliseconds
- *
+ *
* @throws IllegalStateException
* if the StopWatch has not yet been split.
* @since 2.1
@@ -403,13 +403,13 @@ public class StopWatch {
* <p>
* Get the split time on the stopwatch in nanoseconds.
* </p>
- *
+ *
* <p>
* This is the time between start and latest split.
* </p>
- *
+ *
* @return the split time in nanoseconds
- *
+ *
* @throws IllegalStateException
* if the StopWatch has not yet been split.
* @since 3.0
@@ -423,7 +423,7 @@ public class StopWatch {
/**
* Returns the time this stopwatch was started.
- *
+ *
* @return the time this stopwatch was started
* @throws IllegalStateException
* if this StopWatch has not been started
@@ -441,11 +441,11 @@ public class StopWatch {
* <p>
* Gets a summary of the time that the stopwatch recorded as a string.
* </p>
- *
+ *
* <p>
* The format used is ISO 8601-like, <i>hours</i>:<i>minutes</i>:<i>seconds</i>.<i>milliseconds</i>.
* </p>
- *
+ *
* @return the time as a String
*/
@Override
@@ -457,11 +457,11 @@ public class StopWatch {
* <p>
* Gets a summary of the split time that the stopwatch recorded as a string.
* </p>
- *
+ *
* <p>
* The format used is ISO 8601-like, <i>hours</i>:<i>minutes</i>:<i>seconds</i>.<i>milliseconds</i>.
* </p>
- *
+ *
* @return the split time as a String
* @since 2.1
*/
@@ -509,6 +509,6 @@ public class StopWatch {
*/
public boolean isStopped() {
return runningState.isStopped();
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
----------------------------------------------------------------------
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 3df3a7f..e84c49b 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
@@ -18,12 +18,12 @@ package org.apache.commons.lang3.tuple;
/**
* <p>An immutable pair consisting of two {@code Object} elements.</p>
- *
+ *
* <p>Although the implementation is immutable, there is no restriction on the objects
* that may be stored. If mutable objects are stored in the pair, then the pair
* itself effectively becomes mutable. The class is also {@code final}, so a subclass
* can not add undesirable behaviour.</p>
- *
+ *
* <p>#ThreadSafe# if both paired objects are thread-safe</p>
*
* @param <L> the left element type
@@ -55,7 +55,7 @@ public final class ImmutablePair<L, R> extends Pair<L, R> {
public static <L, R> ImmutablePair<L, R> nullPair() {
return NULL;
}
-
+
/** Left object */
public final L left;
/** Right object */
@@ -63,10 +63,10 @@ public final class ImmutablePair<L, R> extends Pair<L, R> {
/**
* <p>Obtains an immutable pair of from two objects inferring the generic types.</p>
- *
+ *
* <p>This factory allows the pair to be created using inference to
* obtain the generic types.</p>
- *
+ *
* @param <L> the left element type
* @param <R> the right element type
* @param left the left element, may be null
@@ -108,7 +108,7 @@ public final class ImmutablePair<L, R> extends Pair<L, R> {
/**
* <p>Throws {@code UnsupportedOperationException}.</p>
- *
+ *
* <p>This pair is immutable, so this operation is not supported.</p>
*
* @param value the value to set
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
----------------------------------------------------------------------
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 83e212e..725f721 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
@@ -18,12 +18,12 @@ package org.apache.commons.lang3.tuple;
/**
* <p>An immutable triple consisting of three {@code Object} elements.</p>
- *
+ *
* <p>Although the implementation is immutable, there is no restriction on the objects
* that may be stored. If mutable objects are stored in the triple, then the triple
* itself effectively becomes mutable. The class is also {@code final}, so a subclass
* can not add undesirable behaviour.</p>
- *
+ *
* <p>#ThreadSafe# if all three objects are thread-safe</p>
*
* @param <L> the left element type
@@ -50,14 +50,14 @@ public final class ImmutableTriple<L, M, R> extends Triple<L, M, R> {
* @param <L> the left element of this triple. Value is {@code null}.
* @param <M> the middle element of this triple. Value is {@code null}.
* @param <R> the right element of this triple. Value is {@code null}.
- * @return an immutable triple of nulls.
+ * @return an immutable triple of nulls.
* @since 3.6
*/
@SuppressWarnings("unchecked")
public static <L, M, R> ImmutableTriple<L, M, R> nullTriple() {
return NULL;
}
-
+
/** Left object */
public final L left;
/** Middle object */
@@ -67,10 +67,10 @@ public final class ImmutableTriple<L, M, R> extends Triple<L, M, R> {
/**
* <p>Obtains an immutable triple of from three objects inferring the generic types.</p>
- *
+ *
* <p>This factory allows the triple to be created using inference to
* obtain the generic types.</p>
- *
+ *
* @param <L> the left element type
* @param <M> the middle element type
* @param <R> the right element type
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
----------------------------------------------------------------------
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 3c99ac4..852edae 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java
@@ -18,7 +18,7 @@ package org.apache.commons.lang3.tuple;
/**
* <p>A mutable pair consisting of two {@code Object} elements.</p>
- *
+ *
* <p>Not #ThreadSafe#</p>
*
* @param <L> the left element type
@@ -38,10 +38,10 @@ public class MutablePair<L, R> extends Pair<L, R> {
/**
* <p>Obtains an immutable pair of from two objects inferring the generic types.</p>
- *
+ *
* <p>This factory allows the pair to be created using inference to
* obtain the generic types.</p>
- *
+ *
* @param <L> the left element type
* @param <R> the right element type
* @param left the left element, may be null
@@ -82,7 +82,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
/**
* Sets the left element of the pair.
- *
+ *
* @param left the new value of the left element, may be null
*/
public void setLeft(final L left) {
@@ -99,7 +99,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
/**
* Sets the right element of the pair.
- *
+ *
* @param right the new value of the right element, may be null
*/
public void setRight(final R right) {
@@ -109,7 +109,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
/**
* Sets the {@code Map.Entry} value.
* This sets the right element of the pair.
- *
+ *
* @param value the right value to set, not null
* @return the old value for the right element
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/tuple/Pair.java
----------------------------------------------------------------------
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 de95170..3414d04 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/Pair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/Pair.java
@@ -24,11 +24,11 @@ import org.apache.commons.lang3.builder.CompareToBuilder;
/**
* <p>A pair consisting of two elements.</p>
- *
+ *
* <p>This class is an abstract implementation defining the basic API.
* It refers to the elements as 'left' and 'right'. It also implements the
* {@code Map.Entry} interface where the key is 'left' and the value is 'right'.</p>
- *
+ *
* <p>Subclass implementations may be mutable or immutable.
* However, there is no restriction on the type of the stored objects that may be stored.
* If mutable objects are stored in the pair, then the pair itself effectively becomes mutable.</p>
@@ -45,10 +45,10 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
/**
* <p>Obtains an immutable pair of from two objects inferring the generic types.</p>
- *
+ *
* <p>This factory allows the pair to be created using inference to
* obtain the generic types.</p>
- *
+ *
* @param <L> the left element type
* @param <R> the right element type
* @param left the left element, may be null
@@ -62,28 +62,28 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
//-----------------------------------------------------------------------
/**
* <p>Gets the left element from this pair.</p>
- *
+ *
* <p>When treated as a key-value pair, this is the key.</p>
- *
+ *
* @return the left element, may be null
*/
public abstract L getLeft();
/**
* <p>Gets the right element from this pair.</p>
- *
+ *
* <p>When treated as a key-value pair, this is the value.</p>
- *
+ *
* @return the right element, may be null
*/
public abstract R getRight();
/**
* <p>Gets the key from this pair.</p>
- *
+ *
* <p>This method implements the {@code Map.Entry} interface returning the
* left element as the key.</p>
- *
+ *
* @return the left element as the key, may be null
*/
@Override
@@ -93,10 +93,10 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
/**
* <p>Gets the value from this pair.</p>
- *
+ *
* <p>This method implements the {@code Map.Entry} interface returning the
* right element as the value.</p>
- *
+ *
* @return the right element as the value, may be null
*/
@Override
@@ -108,7 +108,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
/**
* <p>Compares the pair based on the left element followed by the right element.
* The types must be {@code Comparable}.</p>
- *
+ *
* @param other the other pair, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@@ -120,7 +120,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
/**
* <p>Compares this pair to another based on the two elements.</p>
- *
+ *
* @param obj the object to compare to, null returns false
* @return true if the elements of the pair are equal
*/
@@ -140,7 +140,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
/**
* <p>Returns a suitable hash code.
* The hash code follows the definition in {@code Map.Entry}.</p>
- *
+ *
* @return the hash code
*/
@Override
@@ -152,7 +152,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
/**
* <p>Returns a String representation of this pair using the format {@code ($left,$right)}.</p>
- *
+ *
* @return a string describing this object, not null
*/
@Override
@@ -162,12 +162,12 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
/**
* <p>Formats the receiver using the given format.</p>
- *
+ *
* <p>This uses {@link java.util.Formattable} to perform the formatting. Two variables may
* be used to embed the left and right elements. Use {@code %1$s} for the left
* element (key) and {@code %2$s} for the right element (value).
* The default format used by {@code toString()} is {@code (%1$s,%2$s)}.</p>
- *
+ *
* @param format the format string, optionally containing {@code %1$s} and {@code %2$s}, not null
* @return the formatted string, not null
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java b/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java
index ee4a361..390b5f7 100644
--- a/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java
@@ -350,7 +350,7 @@ public class AnnotationUtilsTest {
NestAnnotation nest();
NestAnnotation[] nests();
}
-
+
@Retention(RUNTIME)
public @interface NestAnnotation {
String string();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
index 28c6bbd..dbbcdfd 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java
@@ -224,7 +224,7 @@ public class ArrayUtilsAddTest {
assertTrue(Arrays.equals(new Float[]{Float.valueOf(3)}, newArray));
assertEquals(Float.class, newArray.getClass().getComponentType());
}
-
+
@Test
public void testLANG571(){
final String[] stringArray=null;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java
index 86b0916..80ff24d 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsInsertTest.java
@@ -28,34 +28,34 @@ import org.junit.Test;
* Tests ArrayUtils insert methods.
*/
public class ArrayUtilsInsertTest {
-
+
@Test
public void testInsertBooleans() throws Exception {
final boolean[] array = {true,false,true};
final boolean[] values = {false,true,false};
-
+
boolean[] result = ArrayUtils.insert(42, array, null);
assertArrayEquals(array, result);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
- assertArrayEquals(new boolean[0], ArrayUtils.insert(0, new boolean[0], null));
+
+ assertNull(ArrayUtils.insert(42, null, array));
+ assertArrayEquals(new boolean[0], ArrayUtils.insert(0, new boolean[0], null));
assertNull(ArrayUtils.insert(42, (boolean[]) null, null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new boolean[]{false,true,false,true}, ArrayUtils.insert(0, array, false));
assertArrayEquals(new boolean[]{true,false,false,true}, ArrayUtils.insert(1, array, false));
assertArrayEquals(new boolean[]{true,false,true,false}, ArrayUtils.insert(array.length, array, false));
@@ -69,29 +69,29 @@ public class ArrayUtilsInsertTest {
public void testInsertBytes() throws Exception {
final byte[] array = {1,2,3};
final byte[] values = {4,5,6};
-
+
byte[] result = ArrayUtils.insert(42, array, null);
assertArrayEquals(array, result);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
+
+ assertNull(ArrayUtils.insert(42, null, array));
assertArrayEquals(new byte[0], ArrayUtils.insert(0, new byte[0], null));
assertNull(ArrayUtils.insert(42, (byte[]) null, null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new byte[]{0,1,2,3}, ArrayUtils.insert(0, array, (byte) 0));
assertArrayEquals(new byte[]{1,0,2,3}, ArrayUtils.insert(1, array, (byte) 0));
assertArrayEquals(new byte[]{1,2,3,0}, ArrayUtils.insert(array.length, array, (byte) 0));
@@ -99,34 +99,34 @@ public class ArrayUtilsInsertTest {
assertArrayEquals(new byte[]{1,4,5,6,2,3}, ArrayUtils.insert(1, array, values));
assertArrayEquals(new byte[]{1,2,3,4,5,6}, ArrayUtils.insert(array.length, array, values));
}
-
+
@Test
public void testInsertChars() throws Exception {
final char[] array = {'a','b','c'};
final char[] values = {'d','e','f'};
-
+
char[] result = ArrayUtils.insert(42, array, null);
assertArrayEquals(array, result);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
+
+ assertNull(ArrayUtils.insert(42, null, array));
assertArrayEquals(new char[0], ArrayUtils.insert(0, new char[0], null));
assertNull(ArrayUtils.insert(42, (char[]) null, null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new char[]{'z','a','b','c'}, ArrayUtils.insert(0, array, 'z'));
assertArrayEquals(new char[]{'a','z','b','c'}, ArrayUtils.insert(1, array, 'z'));
assertArrayEquals(new char[]{'a','b','c','z'}, ArrayUtils.insert(array.length, array, 'z'));
@@ -134,219 +134,219 @@ public class ArrayUtilsInsertTest {
assertArrayEquals(new char[]{'a','d','e','f','b','c'}, ArrayUtils.insert(1, array, values));
assertArrayEquals(new char[]{'a','b','c','d','e','f'}, ArrayUtils.insert(array.length, array, values));
}
-
+
@Test
public void testInsertDoubles() throws Exception {
final double[] array = {1,2,3};
final double[] values = {4,5,6};
final double delta = 0.000001;
-
+
double[] result = ArrayUtils.insert(42, array, null);
assertArrayEquals(array, result, delta);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
+
+ assertNull(ArrayUtils.insert(42, null, array));
assertArrayEquals(new double[0], ArrayUtils.insert(0, new double[0], null), delta);
assertNull(ArrayUtils.insert(42, (double[]) null, null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new double[]{0,1,2,3}, ArrayUtils.insert(0, array, 0), delta);
assertArrayEquals(new double[]{1,0,2,3}, ArrayUtils.insert(1, array, 0), delta);
assertArrayEquals(new double[]{1,2,3,0}, ArrayUtils.insert(array.length, array, 0), delta);
assertArrayEquals(new double[]{4,5,6,1,2,3}, ArrayUtils.insert(0, array, values), delta);
assertArrayEquals(new double[]{1,4,5,6,2,3}, ArrayUtils.insert(1, array, values), delta);
assertArrayEquals(new double[]{1,2,3,4,5,6}, ArrayUtils.insert(array.length, array, values), delta);
- }
-
+ }
+
@Test
public void testInsertFloats() throws Exception {
final float[] array = {1,2,3};
final float[] values = {4,5,6};
final float delta = 0.000001f;
-
+
float[] result = ArrayUtils.insert(42, array, null);
assertArrayEquals(array, result, delta);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
+
+ assertNull(ArrayUtils.insert(42, null, array));
assertArrayEquals(new float[0], ArrayUtils.insert(0, new float[0], null), delta);
assertNull(ArrayUtils.insert(42, (float[]) null, null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new float[]{0,1,2,3}, ArrayUtils.insert(0, array, 0), delta);
assertArrayEquals(new float[]{1,0,2,3}, ArrayUtils.insert(1, array, 0), delta);
assertArrayEquals(new float[]{1,2,3,0}, ArrayUtils.insert(array.length, array, 0), delta);
assertArrayEquals(new float[]{4,5,6,1,2,3}, ArrayUtils.insert(0, array, values), delta);
assertArrayEquals(new float[]{1,4,5,6,2,3}, ArrayUtils.insert(1, array, values), delta);
assertArrayEquals(new float[]{1,2,3,4,5,6}, ArrayUtils.insert(array.length, array, values), delta);
- }
-
+ }
+
@Test
public void testInsertInts() throws Exception {
final int[] array = {1,2,3};
final int[] values = {4,5,6};
-
+
int[] result = ArrayUtils.insert(42, array, null);
assertArrayEquals(array, result);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
+
+ assertNull(ArrayUtils.insert(42, null, array));
assertArrayEquals(new int[0], ArrayUtils.insert(0, new int[0], null));
assertNull(ArrayUtils.insert(42, (int[]) null, null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new int[]{0,1,2,3}, ArrayUtils.insert(0, array, 0));
assertArrayEquals(new int[]{1,0,2,3}, ArrayUtils.insert(1, array, 0));
assertArrayEquals(new int[]{1,2,3,0}, ArrayUtils.insert(array.length, array, 0));
assertArrayEquals(new int[]{4,5,6,1,2,3}, ArrayUtils.insert(0, array, values));
assertArrayEquals(new int[]{1,4,5,6,2,3}, ArrayUtils.insert(1, array, values));
assertArrayEquals(new int[]{1,2,3,4,5,6}, ArrayUtils.insert(array.length, array, values));
- }
-
-
+ }
+
+
@Test
public void testInsertLongs() throws Exception {
final long[] array = {1,2,3};
final long[] values = {4,5,6};
-
+
long[] result = ArrayUtils.insert(42, array, null);
assertArrayEquals(array, result);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
+
+ assertNull(ArrayUtils.insert(42, null, array));
assertArrayEquals(new long[0], ArrayUtils.insert(0, new long[0], null));
assertNull(ArrayUtils.insert(42, (long[]) null, null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new long[]{0,1,2,3}, ArrayUtils.insert(0, array, 0));
assertArrayEquals(new long[]{1,0,2,3}, ArrayUtils.insert(1, array, 0));
assertArrayEquals(new long[]{1,2,3,0}, ArrayUtils.insert(array.length, array, 0));
assertArrayEquals(new long[]{4,5,6,1,2,3}, ArrayUtils.insert(0, array, values));
assertArrayEquals(new long[]{1,4,5,6,2,3}, ArrayUtils.insert(1, array, values));
assertArrayEquals(new long[]{1,2,3,4,5,6}, ArrayUtils.insert(array.length, array, values));
- }
-
-
+ }
+
+
@Test
public void testInsertShorts() throws Exception {
final short[] array = {1,2,3};
final short[] values = {4,5,6};
-
+
short[] result = ArrayUtils.insert(42, array, null);
assertArrayEquals(array, result);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
+
+ assertNull(ArrayUtils.insert(42, null, array));
assertArrayEquals(new short[0], ArrayUtils.insert(0, new short[0], null));
assertNull(ArrayUtils.insert(42, (short[]) null, null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new short[]{0,1,2,3}, ArrayUtils.insert(0, array, (short) 0));
assertArrayEquals(new short[]{1,0,2,3}, ArrayUtils.insert(1, array, (short) 0));
assertArrayEquals(new short[]{1,2,3,0}, ArrayUtils.insert(array.length, array, (short) 0));
assertArrayEquals(new short[]{4,5,6,1,2,3}, ArrayUtils.insert(0, array, values));
assertArrayEquals(new short[]{1,4,5,6,2,3}, ArrayUtils.insert(1, array, values));
assertArrayEquals(new short[]{1,2,3,4,5,6}, ArrayUtils.insert(array.length, array, values));
- }
-
-
+ }
+
+
@Test
public void testInsertGenericArray() throws Exception {
final String[] array = {"a","b","c"};
final String[] values = {"d","e","f"};
-
+
String[] result = ArrayUtils.insert(42, array, (String[]) null);
assertArrayEquals(array, result);
assertFalse(array == result);
-
- assertNull(ArrayUtils.insert(42, null, array));
+
+ assertNull(ArrayUtils.insert(42, null, array));
assertArrayEquals(new String[0], ArrayUtils.insert(0, new String[0], (String[]) null));
assertNull(ArrayUtils.insert(42, null, (String[]) null));
-
+
try {
ArrayUtils.insert(-1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
-
+
try {
ArrayUtils.insert(array.length + 1, array, array);
fail("Expected IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
- }
-
+ }
+
assertArrayEquals(new String[]{"z","a","b","c"}, ArrayUtils.insert(0, array, "z"));
assertArrayEquals(new String[]{"a","z","b","c"}, ArrayUtils.insert(1, array, "z"));
assertArrayEquals(new String[]{"a","b","c","z"}, ArrayUtils.insert(array.length, array, "z"));
assertArrayEquals(new String[]{"d","e","f","a","b","c"}, ArrayUtils.insert(0, array, values));
assertArrayEquals(new String[]{"a","d","e","f","b","c"}, ArrayUtils.insert(1, array, values));
assertArrayEquals(new String[]{"a","b","c","d","e","f"}, ArrayUtils.insert(array.length, array, values));
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java
index 3414027..9e596d4 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveMultipleTest.java
@@ -5,9 +5,9 @@
* 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.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveTest.java
index 0572f8c..95ea490 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsRemoveTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -104,7 +104,7 @@ public class ArrayUtilsRemoveTest {
fail("IndexOutOfBoundsException expected");
} catch (final IndexOutOfBoundsException e) {}
}
-
+
@Test
public void testRemoveByteArray() {
byte[] array;
@@ -133,7 +133,7 @@ public class ArrayUtilsRemoveTest {
fail("IndexOutOfBoundsException expected");
} catch (final IndexOutOfBoundsException e) {}
}
-
+
@Test
public void testRemoveCharArray() {
char[] array;
@@ -162,7 +162,7 @@ public class ArrayUtilsRemoveTest {
fail("IndexOutOfBoundsException expected");
} catch (final IndexOutOfBoundsException e) {}
}
-
+
@Test
public void testRemoveDoubleArray() {
double[] array;
@@ -191,7 +191,7 @@ public class ArrayUtilsRemoveTest {
fail("IndexOutOfBoundsException expected");
} catch (final IndexOutOfBoundsException e) {}
}
-
+
@Test
public void testRemoveFloatArray() {
float[] array;
@@ -220,7 +220,7 @@ public class ArrayUtilsRemoveTest {
fail("IndexOutOfBoundsException expected");
} catch (final IndexOutOfBoundsException e) {}
}
-
+
@Test
public void testRemoveIntArray() {
int[] array;
@@ -249,7 +249,7 @@ public class ArrayUtilsRemoveTest {
fail("IndexOutOfBoundsException expected");
} catch (final IndexOutOfBoundsException e) {}
}
-
+
@Test
public void testRemoveLongArray() {
long[] array;
@@ -278,7 +278,7 @@ public class ArrayUtilsRemoveTest {
fail("IndexOutOfBoundsException expected");
} catch (final IndexOutOfBoundsException e) {}
}
-
+
@Test
public void testRemoveShortArray() {
short[] array;
@@ -307,7 +307,7 @@ public class ArrayUtilsRemoveTest {
fail("IndexOutOfBoundsException expected");
} catch (final IndexOutOfBoundsException e) {}
}
-
+
@Test
public void testRemoveElementObjectArray() {
Object[] array;
@@ -326,7 +326,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new Object[] {"b", "a"}, array));
assertEquals(Object.class, array.getClass().getComponentType());
}
-
+
@Test
public void testRemoveElementBooleanArray() {
boolean[] array;
@@ -345,7 +345,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new boolean[] {false, true}, array));
assertEquals(Boolean.TYPE, array.getClass().getComponentType());
}
-
+
@Test
public void testRemoveElementByteArray() {
byte[] array;
@@ -364,7 +364,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new byte[] {2, 1}, array));
assertEquals(Byte.TYPE, array.getClass().getComponentType());
}
-
+
@Test
public void testRemoveElementCharArray() {
char[] array;
@@ -383,7 +383,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new char[] {'b', 'a'}, array));
assertEquals(Character.TYPE, array.getClass().getComponentType());
}
-
+
@Test
@SuppressWarnings("cast")
public void testRemoveElementDoubleArray() {
@@ -403,7 +403,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new double[] {2, 1}, array));
assertEquals(Double.TYPE, array.getClass().getComponentType());
}
-
+
@Test
@SuppressWarnings("cast")
public void testRemoveElementFloatArray() {
@@ -423,7 +423,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new float[] {2, 1}, array));
assertEquals(Float.TYPE, array.getClass().getComponentType());
}
-
+
@Test
public void testRemoveElementIntArray() {
int[] array;
@@ -442,7 +442,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new int[] {2, 1}, array));
assertEquals(Integer.TYPE, array.getClass().getComponentType());
}
-
+
@Test
@SuppressWarnings("cast")
public void testRemoveElementLongArray() {
@@ -462,7 +462,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new long[] {2, 1}, array));
assertEquals(Long.TYPE, array.getClass().getComponentType());
}
-
+
@Test
public void testRemoveElementShortArray() {
short[] array;
@@ -481,7 +481,7 @@ public class ArrayUtilsRemoveTest {
assertTrue(Arrays.equals(new short[] {2, 1}, array));
assertEquals(Short.TYPE, array.getClass().getComponentType());
}
-
+
@Test
public void testRemoveAllBooleanOccurences() {
@@ -524,7 +524,7 @@ public class ArrayUtilsRemoveTest {
a = new char[] { '1', '2', '2', '3', '2' };
assertTrue(Arrays.equals(new char[] { '1', '2', '2', '3', '2' }, ArrayUtils.removeAllOccurences(a, '4')));
}
-
+
@Test
public void testRemoveAllByteOccurences() {
byte[] a = null;
@@ -568,7 +568,7 @@ public class ArrayUtilsRemoveTest {
}
@Test
- public void testRemoveAllIntOccurences() {
+ public void testRemoveAllIntOccurences() {
int[] a = null;
assertNull(ArrayUtils.removeAllOccurences(a, 2));
@@ -586,10 +586,10 @@ public class ArrayUtilsRemoveTest {
a = new int[] { 1, 2, 2, 3, 2 };
assertTrue(Arrays.equals(new int[] { 1, 2, 2, 3, 2 }, ArrayUtils.removeAllOccurences(a, 4)));
- }
-
+ }
+
@Test
- public void testRemoveAllLongOccurences() {
+ public void testRemoveAllLongOccurences() {
long[] a = null;
assertNull(ArrayUtils.removeAllOccurences(a, 2));
@@ -610,7 +610,7 @@ public class ArrayUtilsRemoveTest {
}
@Test
- public void testRemoveAllFloatOccurences() {
+ public void testRemoveAllFloatOccurences() {
float[] a = null;
assertNull(ArrayUtils.removeAllOccurences(a, 2));
@@ -631,7 +631,7 @@ public class ArrayUtilsRemoveTest {
}
@Test
- public void testRemoveAllDoubleOccurences() {
+ public void testRemoveAllDoubleOccurences() {
double[] a = null;
assertNull(ArrayUtils.removeAllOccurences(a, 2));
@@ -652,7 +652,7 @@ public class ArrayUtilsRemoveTest {
}
@Test
- public void testRemoveAllObjectOccurences() {
+ public void testRemoveAllObjectOccurences() {
String[] a = null;
assertNull(ArrayUtils.removeAllOccurences(a, "2"));
[22/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java b/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
index b16a2e0..5d22dad 100644
--- a/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -42,7 +42,7 @@ public class BooleanUtilsTest {
assertTrue(Modifier.isPublic(BooleanUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(BooleanUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@Test
public void test_negate_Boolean() {
@@ -107,14 +107,14 @@ public class BooleanUtilsTest {
assertTrue(BooleanUtils.toBoolean(-1));
assertFalse(BooleanUtils.toBoolean(0));
}
-
+
@Test
public void test_toBooleanObject_int() {
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject(1));
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject(-1));
assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject(0));
}
-
+
@Test
public void test_toBooleanObject_Integer() {
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject(Integer.valueOf(1)));
@@ -122,7 +122,7 @@ public class BooleanUtilsTest {
assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject(Integer.valueOf(0)));
assertEquals(null, BooleanUtils.toBooleanObject((Integer) null));
}
-
+
//-----------------------------------------------------------------------
@Test
public void test_toBoolean_int_int_int() {
@@ -134,7 +134,7 @@ public class BooleanUtilsTest {
public void test_toBoolean_int_int_int_noMatch() {
BooleanUtils.toBoolean(8, 6, 7);
}
-
+
@Test
public void test_toBoolean_Integer_Integer_Integer() {
final Integer six = Integer.valueOf(6);
@@ -156,7 +156,7 @@ public class BooleanUtilsTest {
public void test_toBoolean_Integer_Integer_Integer_noMatch() {
BooleanUtils.toBoolean(Integer.valueOf(8), Integer.valueOf(6), Integer.valueOf(7));
}
-
+
//-----------------------------------------------------------------------
@Test
public void test_toBooleanObject_int_int_int() {
@@ -169,7 +169,7 @@ public class BooleanUtilsTest {
public void test_toBooleanObject_int_int_int_noMatch() {
BooleanUtils.toBooleanObject(9, 6, 7, 8);
}
-
+
@Test
public void test_toBooleanObject_Integer_Integer_Integer_Integer() {
final Integer six = Integer.valueOf(6);
@@ -201,34 +201,34 @@ public class BooleanUtilsTest {
assertEquals(1, BooleanUtils.toInteger(true));
assertEquals(0, BooleanUtils.toInteger(false));
}
-
+
@Test
public void test_toIntegerObject_boolean() {
assertEquals(Integer.valueOf(1), BooleanUtils.toIntegerObject(true));
assertEquals(Integer.valueOf(0), BooleanUtils.toIntegerObject(false));
}
-
+
@Test
public void test_toIntegerObject_Boolean() {
assertEquals(Integer.valueOf(1), BooleanUtils.toIntegerObject(Boolean.TRUE));
assertEquals(Integer.valueOf(0), BooleanUtils.toIntegerObject(Boolean.FALSE));
assertEquals(null, BooleanUtils.toIntegerObject(null));
}
-
+
//-----------------------------------------------------------------------
@Test
public void test_toInteger_boolean_int_int() {
assertEquals(6, BooleanUtils.toInteger(true, 6, 7));
assertEquals(7, BooleanUtils.toInteger(false, 6, 7));
}
-
+
@Test
public void test_toInteger_Boolean_int_int_int() {
assertEquals(6, BooleanUtils.toInteger(Boolean.TRUE, 6, 7, 8));
assertEquals(7, BooleanUtils.toInteger(Boolean.FALSE, 6, 7, 8));
assertEquals(8, BooleanUtils.toInteger(null, 6, 7, 8));
}
-
+
@Test
public void test_toIntegerObject_boolean_Integer_Integer() {
final Integer six = Integer.valueOf(6);
@@ -236,7 +236,7 @@ public class BooleanUtilsTest {
assertEquals(six, BooleanUtils.toIntegerObject(true, six, seven));
assertEquals(seven, BooleanUtils.toIntegerObject(false, six, seven));
}
-
+
@Test
public void test_toIntegerObject_Boolean_Integer_Integer_Integer() {
final Integer six = Integer.valueOf(6);
@@ -247,7 +247,7 @@ public class BooleanUtilsTest {
assertEquals(eight, BooleanUtils.toIntegerObject(null, six, seven, eight));
assertEquals(null, BooleanUtils.toIntegerObject(null, six, seven, null));
}
-
+
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
@Test
@@ -285,7 +285,7 @@ public class BooleanUtilsTest {
assertEquals(null, BooleanUtils.toBooleanObject("true "));
assertEquals(null, BooleanUtils.toBooleanObject("ono"));
}
-
+
@Test
public void test_toBooleanObject_String_String_String_String() {
assertSame(Boolean.TRUE, BooleanUtils.toBooleanObject(null, null, "N", "U"));
@@ -385,53 +385,53 @@ public class BooleanUtilsTest {
assertEquals("true", BooleanUtils.toStringTrueFalse(Boolean.TRUE));
assertEquals("false", BooleanUtils.toStringTrueFalse(Boolean.FALSE));
}
-
+
@Test
public void test_toStringOnOff_Boolean() {
assertEquals(null, BooleanUtils.toStringOnOff(null));
assertEquals("on", BooleanUtils.toStringOnOff(Boolean.TRUE));
assertEquals("off", BooleanUtils.toStringOnOff(Boolean.FALSE));
}
-
+
@Test
public void test_toStringYesNo_Boolean() {
assertEquals(null, BooleanUtils.toStringYesNo(null));
assertEquals("yes", BooleanUtils.toStringYesNo(Boolean.TRUE));
assertEquals("no", BooleanUtils.toStringYesNo(Boolean.FALSE));
}
-
+
@Test
public void test_toString_Boolean_String_String_String() {
assertEquals("U", BooleanUtils.toString(null, "Y", "N", "U"));
assertEquals("Y", BooleanUtils.toString(Boolean.TRUE, "Y", "N", "U"));
assertEquals("N", BooleanUtils.toString(Boolean.FALSE, "Y", "N", "U"));
}
-
+
//-----------------------------------------------------------------------
@Test
public void test_toStringTrueFalse_boolean() {
assertEquals("true", BooleanUtils.toStringTrueFalse(true));
assertEquals("false", BooleanUtils.toStringTrueFalse(false));
}
-
+
@Test
public void test_toStringOnOff_boolean() {
assertEquals("on", BooleanUtils.toStringOnOff(true));
assertEquals("off", BooleanUtils.toStringOnOff(false));
}
-
+
@Test
public void test_toStringYesNo_boolean() {
assertEquals("yes", BooleanUtils.toStringYesNo(true));
assertEquals("no", BooleanUtils.toStringYesNo(false));
}
-
+
@Test
public void test_toString_boolean_String_String_String() {
assertEquals("Y", BooleanUtils.toString(true, "Y", "N"));
assertEquals("N", BooleanUtils.toString(false, "Y", "N"));
}
-
+
// testXor
// -----------------------------------------------------------------------
@Test(expected = IllegalArgumentException.class)
@@ -519,7 +519,7 @@ public class BooleanUtilsTest {
public void testXor_object_emptyInput() {
BooleanUtils.xor(new Boolean[] {});
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testXor_object_nullElementInput() {
BooleanUtils.xor(new Boolean[] {null});
@@ -645,81 +645,81 @@ public class BooleanUtilsTest {
public void testAnd_primitive_nullInput() {
BooleanUtils.and((boolean[]) null);
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testAnd_primitive_emptyInput() {
BooleanUtils.and(new boolean[] {});
}
-
+
@Test
public void testAnd_primitive_validInput_2items() {
assertTrue(
"False result for (true, true)",
BooleanUtils.and(new boolean[] { true, true }));
-
+
assertTrue(
"True result for (false, false)",
! BooleanUtils.and(new boolean[] { false, false }));
-
+
assertTrue(
"True result for (true, false)",
! BooleanUtils.and(new boolean[] { true, false }));
-
+
assertTrue(
"True result for (false, true)",
! BooleanUtils.and(new boolean[] { false, true }));
}
-
+
@Test
public void testAnd_primitive_validInput_3items() {
assertTrue(
"True result for (false, false, true)",
! BooleanUtils.and(new boolean[] { false, false, true }));
-
+
assertTrue(
"True result for (false, true, false)",
! BooleanUtils.and(new boolean[] { false, true, false }));
-
+
assertTrue(
"True result for (true, false, false)",
! BooleanUtils.and(new boolean[] { true, false, false }));
-
+
assertTrue(
"False result for (true, true, true)",
BooleanUtils.and(new boolean[] { true, true, true }));
-
+
assertTrue(
"True result for (false, false)",
! BooleanUtils.and(new boolean[] { false, false, false }));
-
+
assertTrue(
"True result for (true, true, false)",
! BooleanUtils.and(new boolean[] { true, true, false }));
-
+
assertTrue(
"True result for (true, false, true)",
! BooleanUtils.and(new boolean[] { true, false, true }));
-
+
assertTrue(
"True result for (false, true, true)",
! BooleanUtils.and(new boolean[] { false, true, true }));
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testAnd_object_nullInput() {
BooleanUtils.and((Boolean[]) null);
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testAnd_object_emptyInput() {
BooleanUtils.and(new Boolean[] {});
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testAnd_object_nullElementInput() {
BooleanUtils.and(new Boolean[] {null});
}
-
+
@Test
public void testAnd_object_validInput_2items() {
assertTrue(
@@ -727,26 +727,26 @@ public class BooleanUtilsTest {
BooleanUtils
.and(new Boolean[] { Boolean.TRUE, Boolean.TRUE })
.booleanValue());
-
+
assertTrue(
"True result for (false, false)",
! BooleanUtils
.and(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"True result for (true, false)",
! BooleanUtils
.and(new Boolean[] { Boolean.TRUE, Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"True result for (false, true)",
! BooleanUtils
.and(new Boolean[] { Boolean.FALSE, Boolean.TRUE })
.booleanValue());
}
-
+
@Test
public void testAnd_object_validInput_3items() {
assertTrue(
@@ -758,7 +758,7 @@ public class BooleanUtilsTest {
Boolean.FALSE,
Boolean.TRUE })
.booleanValue());
-
+
assertTrue(
"True result for (false, true, false)",
! BooleanUtils
@@ -768,7 +768,7 @@ public class BooleanUtilsTest {
Boolean.TRUE,
Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"True result for (true, false, false)",
! BooleanUtils
@@ -778,13 +778,13 @@ public class BooleanUtilsTest {
Boolean.FALSE,
Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"False result for (true, true, true)",
BooleanUtils
.and(new Boolean[] { Boolean.TRUE, Boolean.TRUE, Boolean.TRUE })
.booleanValue());
-
+
assertTrue(
"True result for (false, false)",
! BooleanUtils.and(
@@ -793,7 +793,7 @@ public class BooleanUtilsTest {
Boolean.FALSE,
Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"True result for (true, true, false)",
! BooleanUtils.and(
@@ -802,7 +802,7 @@ public class BooleanUtilsTest {
Boolean.TRUE,
Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"True result for (true, false, true)",
! BooleanUtils.and(
@@ -811,7 +811,7 @@ public class BooleanUtilsTest {
Boolean.FALSE,
Boolean.TRUE })
.booleanValue());
-
+
assertTrue(
"True result for (false, true, true)",
! BooleanUtils.and(
@@ -821,88 +821,88 @@ public class BooleanUtilsTest {
Boolean.TRUE })
.booleanValue());
}
-
+
// testOr
// -----------------------------------------------------------------------
@Test(expected = IllegalArgumentException.class)
public void testOr_primitive_nullInput() {
BooleanUtils.or((boolean[]) null);
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testOr_primitive_emptyInput() {
BooleanUtils.or(new boolean[] {});
}
-
+
@Test
public void testOr_primitive_validInput_2items() {
assertTrue(
"False result for (true, true)",
BooleanUtils.or(new boolean[] { true, true }));
-
+
assertTrue(
"True result for (false, false)",
! BooleanUtils.or(new boolean[] { false, false }));
-
+
assertTrue(
"False result for (true, false)",
BooleanUtils.or(new boolean[] { true, false }));
-
+
assertTrue(
"False result for (false, true)",
BooleanUtils.or(new boolean[] { false, true }));
}
-
+
@Test
public void testOr_primitive_validInput_3items() {
assertTrue(
"False result for (false, false, true)",
BooleanUtils.or(new boolean[] { false, false, true }));
-
+
assertTrue(
"False result for (false, true, false)",
BooleanUtils.or(new boolean[] { false, true, false }));
-
+
assertTrue(
"False result for (true, false, false)",
BooleanUtils.or(new boolean[] { true, false, false }));
-
+
assertTrue(
"False result for (true, true, true)",
BooleanUtils.or(new boolean[] { true, true, true }));
-
+
assertTrue(
"True result for (false, false)",
! BooleanUtils.or(new boolean[] { false, false, false }));
-
+
assertTrue(
"False result for (true, true, false)",
BooleanUtils.or(new boolean[] { true, true, false }));
-
+
assertTrue(
"False result for (true, false, true)",
BooleanUtils.or(new boolean[] { true, false, true }));
-
+
assertTrue(
"False result for (false, true, true)",
BooleanUtils.or(new boolean[] { false, true, true }));
-
+
}
@Test(expected = IllegalArgumentException.class)
public void testOr_object_nullInput() {
BooleanUtils.or((Boolean[]) null);
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testOr_object_emptyInput() {
BooleanUtils.or(new Boolean[] {});
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testOr_object_nullElementInput() {
BooleanUtils.or(new Boolean[] {null});
}
-
+
@Test
public void testOr_object_validInput_2items() {
assertTrue(
@@ -910,26 +910,26 @@ public class BooleanUtilsTest {
BooleanUtils
.or(new Boolean[] { Boolean.TRUE, Boolean.TRUE })
.booleanValue());
-
+
assertTrue(
"True result for (false, false)",
! BooleanUtils
.or(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"False result for (true, false)",
BooleanUtils
.or(new Boolean[] { Boolean.TRUE, Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"False result for (false, true)",
BooleanUtils
.or(new Boolean[] { Boolean.FALSE, Boolean.TRUE })
.booleanValue());
}
-
+
@Test
public void testOr_object_validInput_3items() {
assertTrue(
@@ -941,7 +941,7 @@ public class BooleanUtilsTest {
Boolean.FALSE,
Boolean.TRUE })
.booleanValue());
-
+
assertTrue(
"False result for (false, true, false)",
BooleanUtils
@@ -951,7 +951,7 @@ public class BooleanUtilsTest {
Boolean.TRUE,
Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"False result for (true, false, false)",
BooleanUtils
@@ -961,13 +961,13 @@ public class BooleanUtilsTest {
Boolean.FALSE,
Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"False result for (true, true, true)",
BooleanUtils
.or(new Boolean[] { Boolean.TRUE, Boolean.TRUE, Boolean.TRUE })
.booleanValue());
-
+
assertTrue(
"True result for (false, false)",
! BooleanUtils.or(
@@ -976,7 +976,7 @@ public class BooleanUtilsTest {
Boolean.FALSE,
Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"False result for (true, true, false)",
BooleanUtils.or(
@@ -985,7 +985,7 @@ public class BooleanUtilsTest {
Boolean.TRUE,
Boolean.FALSE })
.booleanValue());
-
+
assertTrue(
"False result for (true, false, true)",
BooleanUtils.or(
@@ -994,7 +994,7 @@ public class BooleanUtilsTest {
Boolean.FALSE,
Boolean.TRUE })
.booleanValue());
-
+
assertTrue(
"False result for (false, true, true)",
BooleanUtils.or(
@@ -1012,5 +1012,5 @@ public class BooleanUtilsTest {
assertTrue(BooleanUtils.compare(false, false) == 0);
assertTrue(BooleanUtils.compare(false, true) < 0);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
index 9e8e540..7999457 100644
--- a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,7 +24,7 @@ import org.junit.Test;
/**
* Tests CharEncoding.
- *
+ *
* @see CharEncoding
*/
@SuppressWarnings("deprecation")
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/CharRangeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharRangeTest.java b/src/test/java/org/apache/commons/lang3/CharRangeTest.java
index b36e43e..83a1008 100644
--- a/src/test/java/org/apache/commons/lang3/CharRangeTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharRangeTest.java
@@ -390,11 +390,11 @@ public class CharRangeTest {
@Test
public void testSerialization() {
CharRange range = CharRange.is('a');
- assertEquals(range, SerializationUtils.clone(range));
+ assertEquals(range, SerializationUtils.clone(range));
range = CharRange.isIn('a', 'e');
- assertEquals(range, SerializationUtils.clone(range));
+ assertEquals(range, SerializationUtils.clone(range));
range = CharRange.isNotIn('a', 'e');
- assertEquals(range, SerializationUtils.clone(range));
+ assertEquals(range, SerializationUtils.clone(range));
}
//-----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
index 591bf38..8240619 100644
--- a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
@@ -43,7 +43,7 @@ public class CharSequenceUtilsTest {
assertTrue(Modifier.isPublic(CharSequenceUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(CharSequenceUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testSubSequence() {
@@ -138,9 +138,9 @@ public class CharSequenceUtilsTest {
};
private static abstract class RunTest {
-
+
abstract boolean invoke();
-
+
void run(final TestData data, final String id) {
if (data.throwable != null) {
try {
@@ -156,7 +156,7 @@ public class CharSequenceUtilsTest {
assertEquals(id + " Failed test " + data, data.expected, stringCheck);
}
}
-
+
}
@Test
@@ -165,25 +165,25 @@ public class CharSequenceUtilsTest {
new RunTest() {
@Override
boolean invoke() {
- return data.source.regionMatches(data.ignoreCase, data.toffset, data.other, data.ooffset, data.len);
+ return data.source.regionMatches(data.ignoreCase, data.toffset, data.other, data.ooffset, data.len);
}
}.run(data, "String");
new RunTest() {
@Override
boolean invoke() {
- return CharSequenceUtils.regionMatches(data.source, data.ignoreCase, data.toffset, data.other, data.ooffset, data.len);
+ return CharSequenceUtils.regionMatches(data.source, data.ignoreCase, data.toffset, data.other, data.ooffset, data.len);
}
}.run(data, "CSString");
new RunTest() {
@Override
boolean invoke() {
- return CharSequenceUtils.regionMatches(new StringBuilder(data.source), data.ignoreCase, data.toffset, data.other, data.ooffset, data.len);
+ return CharSequenceUtils.regionMatches(new StringBuilder(data.source), data.ignoreCase, data.toffset, data.other, data.ooffset, data.len);
}
}.run(data, "CSNonString");
}
}
-
-
+
+
@Test
public void testToCharArray() throws Exception {
final StringBuilder builder = new StringBuilder("abcdefg");
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/CharSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharSetTest.java b/src/test/java/org/apache/commons/lang3/CharSetTest.java
index 2c05e98..035dc4b 100644
--- a/src/test/java/org/apache/commons/lang3/CharSetTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharSetTest.java
@@ -38,7 +38,7 @@ public class CharSetTest {
assertTrue(Modifier.isPublic(CharSet.class.getModifiers()));
assertFalse(Modifier.isFinal(CharSet.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testGetInstance() {
@@ -59,78 +59,78 @@ public class CharSetTest {
assertEquals("[]", CharSet.getInstance(new String[] {null}).toString());
assertEquals("[a-e]", CharSet.getInstance(new String[] {"a-e"}).toString());
}
-
+
//-----------------------------------------------------------------------
@Test
public void testConstructor_String_simple() {
CharSet set;
CharRange[] array;
-
+
set = CharSet.getInstance((String) null);
array = set.getCharRanges();
assertEquals("[]", set.toString());
assertEquals(0, array.length);
-
+
set = CharSet.getInstance("");
array = set.getCharRanges();
assertEquals("[]", set.toString());
assertEquals(0, array.length);
-
+
set = CharSet.getInstance("a");
array = set.getCharRanges();
assertEquals("[a]", set.toString());
assertEquals(1, array.length);
assertEquals("a", array[0].toString());
-
+
set = CharSet.getInstance("^a");
array = set.getCharRanges();
assertEquals("[^a]", set.toString());
assertEquals(1, array.length);
assertEquals("^a", array[0].toString());
-
+
set = CharSet.getInstance("a-e");
array = set.getCharRanges();
assertEquals("[a-e]", set.toString());
assertEquals(1, array.length);
assertEquals("a-e", array[0].toString());
-
+
set = CharSet.getInstance("^a-e");
array = set.getCharRanges();
assertEquals("[^a-e]", set.toString());
assertEquals(1, array.length);
assertEquals("^a-e", array[0].toString());
}
-
+
@Test
public void testConstructor_String_combo() {
CharSet set;
CharRange[] array;
-
+
set = CharSet.getInstance("abc");
array = set.getCharRanges();
assertEquals(3, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
assertTrue(ArrayUtils.contains(array, CharRange.is('c')));
-
+
set = CharSet.getInstance("a-ce-f");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', 'c')));
assertTrue(ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
-
+
set = CharSet.getInstance("ae-f");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
assertTrue(ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
-
+
set = CharSet.getInstance("e-fa");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
assertTrue(ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
-
+
set = CharSet.getInstance("ae-fm-pz");
array = set.getCharRanges();
assertEquals(4, array.length);
@@ -139,26 +139,26 @@ public class CharSetTest {
assertTrue(ArrayUtils.contains(array, CharRange.isIn('m', 'p')));
assertTrue(ArrayUtils.contains(array, CharRange.is('z')));
}
-
+
@Test
public void testConstructor_String_comboNegated() {
CharSet set;
CharRange[] array;
-
+
set = CharSet.getInstance("^abc");
array = set.getCharRanges();
assertEquals(3, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a')));
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
assertTrue(ArrayUtils.contains(array, CharRange.is('c')));
-
+
set = CharSet.getInstance("b^ac");
array = set.getCharRanges();
assertEquals(3, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a')));
assertTrue(ArrayUtils.contains(array, CharRange.is('c')));
-
+
set = CharSet.getInstance("db^ac");
array = set.getCharRanges();
assertEquals(4, array.length);
@@ -166,13 +166,13 @@ public class CharSetTest {
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a')));
assertTrue(ArrayUtils.contains(array, CharRange.is('c')));
-
+
set = CharSet.getInstance("^b^a");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNot('b')));
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a')));
-
+
set = CharSet.getInstance("b^a-c^z");
array = set.getCharRanges();
assertEquals(3, array.length);
@@ -185,50 +185,50 @@ public class CharSetTest {
public void testConstructor_String_oddDash() {
CharSet set;
CharRange[] array;
-
+
set = CharSet.getInstance("-");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
-
+
set = CharSet.getInstance("--");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
-
+
set = CharSet.getInstance("---");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
-
+
set = CharSet.getInstance("----");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
-
+
set = CharSet.getInstance("-a");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
-
+
set = CharSet.getInstance("a-");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
-
+
set = CharSet.getInstance("a--");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', '-')));
-
+
set = CharSet.getInstance("--a");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isIn('-', 'a')));
}
-
+
@Test
public void testConstructor_String_oddNegate() {
CharSet set;
@@ -237,80 +237,80 @@ public class CharSetTest {
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('^'))); // "^"
-
+
set = CharSet.getInstance("^^");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
-
+
set = CharSet.getInstance("^^^");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
assertTrue(ArrayUtils.contains(array, CharRange.is('^'))); // "^"
-
+
set = CharSet.getInstance("^^^^");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^" x2
-
+
set = CharSet.getInstance("a^");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.is('a'))); // "a"
assertTrue(ArrayUtils.contains(array, CharRange.is('^'))); // "^"
-
+
set = CharSet.getInstance("^a-");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a'))); // "^a"
assertTrue(ArrayUtils.contains(array, CharRange.is('-'))); // "-"
-
+
set = CharSet.getInstance("^^-c");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('^', 'c'))); // "^^-c"
-
+
set = CharSet.getInstance("^c-^");
array = set.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('c', '^'))); // "^c-^"
-
+
set = CharSet.getInstance("^c-^d");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('c', '^'))); // "^c-^"
assertTrue(ArrayUtils.contains(array, CharRange.is('d'))); // "d"
-
+
set = CharSet.getInstance("^^-");
array = set.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
assertTrue(ArrayUtils.contains(array, CharRange.is('-'))); // "-"
}
-
+
@Test
public void testConstructor_String_oddCombinations() {
CharSet set;
CharRange[] array = null;
-
+
set = CharSet.getInstance("a-^c");
array = set.getCharRanges();
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', '^'))); // "a-^"
assertTrue(ArrayUtils.contains(array, CharRange.is('c'))); // "c"
assertFalse(set.contains('b'));
- assertTrue(set.contains('^'));
+ assertTrue(set.contains('^'));
assertTrue(set.contains('_')); // between ^ and a
- assertTrue(set.contains('c'));
-
+ assertTrue(set.contains('c'));
+
set = CharSet.getInstance("^a-^c");
array = set.getCharRanges();
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('a', '^'))); // "^a-^"
assertTrue(ArrayUtils.contains(array, CharRange.is('c'))); // "c"
assertTrue(set.contains('b'));
- assertFalse(set.contains('^'));
+ assertFalse(set.contains('^'));
assertFalse(set.contains('_')); // between ^ and a
-
+
set = CharSet.getInstance("a- ^-- "); //contains everything
array = set.getCharRanges();
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', ' '))); // "a- "
@@ -320,25 +320,25 @@ public class CharSetTest {
assertTrue(set.contains('a'));
assertTrue(set.contains('*'));
assertTrue(set.contains('A'));
-
+
set = CharSet.getInstance("^-b");
array = set.getCharRanges();
assertTrue(ArrayUtils.contains(array, CharRange.isIn('^','b'))); // "^-b"
assertTrue(set.contains('b'));
assertTrue(set.contains('_')); // between ^ and a
assertFalse(set.contains('A'));
- assertTrue(set.contains('^'));
-
+ assertTrue(set.contains('^'));
+
set = CharSet.getInstance("b-^");
array = set.getCharRanges();
assertTrue(ArrayUtils.contains(array, CharRange.isIn('^','b'))); // "b-^"
assertTrue(set.contains('b'));
assertTrue(set.contains('^'));
assertTrue(set.contains('a')); // between ^ and b
- assertFalse(set.contains('c'));
+ assertFalse(set.contains('c'));
}
-
- //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
@Test
public void testEquals_Object() {
final CharSet abc = CharSet.getInstance("abc");
@@ -347,25 +347,25 @@ public class CharSetTest {
final CharSet atoc2 = CharSet.getInstance("a-c");
final CharSet notatoc = CharSet.getInstance("^a-c");
final CharSet notatoc2 = CharSet.getInstance("^a-c");
-
+
assertFalse(abc.equals(null));
-
+
assertTrue(abc.equals(abc));
assertTrue(abc.equals(abc2));
assertFalse(abc.equals(atoc));
assertFalse(abc.equals(notatoc));
-
+
assertFalse(atoc.equals(abc));
assertTrue(atoc.equals(atoc));
assertTrue(atoc.equals(atoc2));
assertFalse(atoc.equals(notatoc));
-
+
assertFalse(notatoc.equals(abc));
assertFalse(notatoc.equals(atoc));
assertTrue(notatoc.equals(notatoc));
assertTrue(notatoc.equals(notatoc2));
}
-
+
@Test
public void testHashCode() {
final CharSet abc = CharSet.getInstance("abc");
@@ -374,7 +374,7 @@ public class CharSetTest {
final CharSet atoc2 = CharSet.getInstance("a-c");
final CharSet notatoc = CharSet.getInstance("^a-c");
final CharSet notatoc2 = CharSet.getInstance("^a-c");
-
+
assertEquals(abc.hashCode(), abc.hashCode());
assertEquals(abc.hashCode(), abc2.hashCode());
assertEquals(atoc.hashCode(), atoc.hashCode());
@@ -382,8 +382,8 @@ public class CharSetTest {
assertEquals(notatoc.hashCode(), notatoc.hashCode());
assertEquals(notatoc.hashCode(), notatoc2.hashCode());
}
-
- //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
@Test
public void testContains_Char() {
final CharSet btod = CharSet.getInstance("b-d");
@@ -391,79 +391,79 @@ public class CharSetTest {
final CharSet bcd = CharSet.getInstance("bcd");
final CharSet bd = CharSet.getInstance("bd");
final CharSet notbtod = CharSet.getInstance("^b-d");
-
+
assertFalse(btod.contains('a'));
assertTrue(btod.contains('b'));
assertTrue(btod.contains('c'));
assertTrue(btod.contains('d'));
assertFalse(btod.contains('e'));
-
+
assertFalse(bcd.contains('a'));
assertTrue(bcd.contains('b'));
assertTrue(bcd.contains('c'));
assertTrue(bcd.contains('d'));
assertFalse(bcd.contains('e'));
-
+
assertFalse(bd.contains('a'));
assertTrue(bd.contains('b'));
assertFalse(bd.contains('c'));
assertTrue(bd.contains('d'));
assertFalse(bd.contains('e'));
-
+
assertTrue(notbtod.contains('a'));
assertFalse(notbtod.contains('b'));
assertFalse(notbtod.contains('c'));
assertFalse(notbtod.contains('d'));
assertTrue(notbtod.contains('e'));
-
+
assertFalse(dtob.contains('a'));
assertTrue(dtob.contains('b'));
assertTrue(dtob.contains('c'));
assertTrue(dtob.contains('d'));
assertFalse(dtob.contains('e'));
-
+
final CharRange[] array = dtob.getCharRanges();
assertEquals("[b-d]", dtob.toString());
assertEquals(1, array.length);
}
-
- //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
@Test
public void testSerialization() {
CharSet set = CharSet.getInstance("a");
- assertEquals(set, SerializationUtils.clone(set));
+ assertEquals(set, SerializationUtils.clone(set));
set = CharSet.getInstance("a-e");
- assertEquals(set, SerializationUtils.clone(set));
+ assertEquals(set, SerializationUtils.clone(set));
set = CharSet.getInstance("be-f^a-z");
- assertEquals(set, SerializationUtils.clone(set));
+ assertEquals(set, SerializationUtils.clone(set));
}
-
- //-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
@Test
public void testStatics() {
CharRange[] array;
-
+
array = CharSet.EMPTY.getCharRanges();
assertEquals(0, array.length);
-
+
array = CharSet.ASCII_ALPHA.getCharRanges();
assertEquals(2, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', 'z')));
assertTrue(ArrayUtils.contains(array, CharRange.isIn('A', 'Z')));
-
+
array = CharSet.ASCII_ALPHA_LOWER.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', 'z')));
-
+
array = CharSet.ASCII_ALPHA_UPPER.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isIn('A', 'Z')));
-
+
array = CharSet.ASCII_NUMERIC.getCharRanges();
assertEquals(1, array.length);
assertTrue(ArrayUtils.contains(array, CharRange.isIn('0', '9')));
}
-
+
@Test
public void testJavadocExamples() throws Exception {
assertFalse(CharSet.getInstance("^a-c").contains('a'));
@@ -472,6 +472,6 @@ public class CharSetTest {
assertFalse(CharSet.getInstance("^^a-c").contains('^'));
assertTrue(CharSet.getInstance("^a-cd-f").contains('d'));
assertTrue(CharSet.getInstance("a-c^").contains('^'));
- assertTrue(CharSet.getInstance("^", "a-c").contains('^'));
+ assertTrue(CharSet.getInstance("^", "a-c").contains('^'));
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java
index 9b74d35..829ff6c 100644
--- a/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharSetUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -41,17 +41,17 @@ public class CharSetUtilsTest {
assertTrue(Modifier.isPublic(CharSetUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(CharSetUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testSqueeze_StringString() {
assertEquals(null, CharSetUtils.squeeze(null, (String) null));
assertEquals(null, CharSetUtils.squeeze(null, ""));
-
+
assertEquals("", CharSetUtils.squeeze("", (String) null));
assertEquals("", CharSetUtils.squeeze("", ""));
assertEquals("", CharSetUtils.squeeze("", "a-e"));
-
+
assertEquals("hello", CharSetUtils.squeeze("hello", (String) null));
assertEquals("hello", CharSetUtils.squeeze("hello", ""));
assertEquals("hello", CharSetUtils.squeeze("hello", "a-e"));
@@ -59,24 +59,24 @@ public class CharSetUtilsTest {
assertEquals("heloo", CharSetUtils.squeeze("helloo", "l"));
assertEquals("hello", CharSetUtils.squeeze("helloo", "^l"));
}
-
+
@Test
public void testSqueeze_StringStringarray() {
assertEquals(null, CharSetUtils.squeeze(null, (String[]) null));
assertEquals(null, CharSetUtils.squeeze(null, new String[0]));
assertEquals(null, CharSetUtils.squeeze(null, new String[] {null}));
assertEquals(null, CharSetUtils.squeeze(null, new String[] {"el"}));
-
+
assertEquals("", CharSetUtils.squeeze("", (String[]) null));
assertEquals("", CharSetUtils.squeeze("", new String[0]));
assertEquals("", CharSetUtils.squeeze("", new String[] {null}));
assertEquals("", CharSetUtils.squeeze("", new String[] {"a-e"}));
-
+
assertEquals("hello", CharSetUtils.squeeze("hello", (String[]) null));
assertEquals("hello", CharSetUtils.squeeze("hello", new String[0]));
assertEquals("hello", CharSetUtils.squeeze("hello", new String[] {null}));
assertEquals("hello", CharSetUtils.squeeze("hello", new String[] {"a-e"}));
-
+
assertEquals("helo", CharSetUtils.squeeze("hello", new String[] { "el" }));
assertEquals("hello", CharSetUtils.squeeze("hello", new String[] { "e" }));
assertEquals("fofof", CharSetUtils.squeeze("fooffooff", new String[] { "of" }));
@@ -88,34 +88,34 @@ public class CharSetUtilsTest {
public void testContainsAny_StringString() {
assertFalse(CharSetUtils.containsAny(null, (String) null));
assertFalse(CharSetUtils.containsAny(null, ""));
-
+
assertFalse(CharSetUtils.containsAny("", (String) null));
assertFalse(CharSetUtils.containsAny("", ""));
assertFalse(CharSetUtils.containsAny("", "a-e"));
-
+
assertFalse(CharSetUtils.containsAny("hello", (String) null));
assertFalse(CharSetUtils.containsAny("hello", ""));
assertTrue(CharSetUtils.containsAny("hello", "a-e"));
assertTrue(CharSetUtils.containsAny("hello", "l-p"));
}
-
+
@Test
public void testContainsAny_StringStringarray() {
assertFalse(CharSetUtils.containsAny(null, (String[]) null));
assertFalse(CharSetUtils.containsAny(null, new String[0]));
assertFalse(CharSetUtils.containsAny(null, new String[] {null}));
assertFalse(CharSetUtils.containsAny(null, new String[] {"a-e"}));
-
+
assertFalse(CharSetUtils.containsAny("", (String[]) null));
assertFalse(CharSetUtils.containsAny("", new String[0]));
assertFalse(CharSetUtils.containsAny("", new String[] {null}));
assertFalse(CharSetUtils.containsAny("", new String[] {"a-e"}));
-
+
assertFalse(CharSetUtils.containsAny("hello", (String[]) null));
assertFalse(CharSetUtils.containsAny("hello", new String[0]));
assertFalse(CharSetUtils.containsAny("hello", new String[] {null}));
assertTrue(CharSetUtils.containsAny("hello", new String[] {"a-e"}));
-
+
assertTrue(CharSetUtils.containsAny("hello", new String[] { "el" }));
assertFalse(CharSetUtils.containsAny("hello", new String[] { "x" }));
assertTrue(CharSetUtils.containsAny("hello", new String[] { "e-i" }));
@@ -128,34 +128,34 @@ public class CharSetUtilsTest {
public void testCount_StringString() {
assertEquals(0, CharSetUtils.count(null, (String) null));
assertEquals(0, CharSetUtils.count(null, ""));
-
+
assertEquals(0, CharSetUtils.count("", (String) null));
assertEquals(0, CharSetUtils.count("", ""));
assertEquals(0, CharSetUtils.count("", "a-e"));
-
+
assertEquals(0, CharSetUtils.count("hello", (String) null));
assertEquals(0, CharSetUtils.count("hello", ""));
assertEquals(1, CharSetUtils.count("hello", "a-e"));
assertEquals(3, CharSetUtils.count("hello", "l-p"));
}
-
+
@Test
public void testCount_StringStringarray() {
assertEquals(0, CharSetUtils.count(null, (String[]) null));
assertEquals(0, CharSetUtils.count(null, new String[0]));
assertEquals(0, CharSetUtils.count(null, new String[] {null}));
assertEquals(0, CharSetUtils.count(null, new String[] {"a-e"}));
-
+
assertEquals(0, CharSetUtils.count("", (String[]) null));
assertEquals(0, CharSetUtils.count("", new String[0]));
assertEquals(0, CharSetUtils.count("", new String[] {null}));
assertEquals(0, CharSetUtils.count("", new String[] {"a-e"}));
-
+
assertEquals(0, CharSetUtils.count("hello", (String[]) null));
assertEquals(0, CharSetUtils.count("hello", new String[0]));
assertEquals(0, CharSetUtils.count("hello", new String[] {null}));
assertEquals(1, CharSetUtils.count("hello", new String[] {"a-e"}));
-
+
assertEquals(3, CharSetUtils.count("hello", new String[] { "el" }));
assertEquals(0, CharSetUtils.count("hello", new String[] { "x" }));
assertEquals(2, CharSetUtils.count("hello", new String[] { "e-i" }));
@@ -168,11 +168,11 @@ public class CharSetUtilsTest {
public void testKeep_StringString() {
assertEquals(null, CharSetUtils.keep(null, (String) null));
assertEquals(null, CharSetUtils.keep(null, ""));
-
+
assertEquals("", CharSetUtils.keep("", (String) null));
assertEquals("", CharSetUtils.keep("", ""));
assertEquals("", CharSetUtils.keep("", "a-e"));
-
+
assertEquals("", CharSetUtils.keep("hello", (String) null));
assertEquals("", CharSetUtils.keep("hello", ""));
assertEquals("", CharSetUtils.keep("hello", "xyz"));
@@ -180,24 +180,24 @@ public class CharSetUtilsTest {
assertEquals("hello", CharSetUtils.keep("hello", "oleh"));
assertEquals("ell", CharSetUtils.keep("hello", "el"));
}
-
+
@Test
public void testKeep_StringStringarray() {
assertEquals(null, CharSetUtils.keep(null, (String[]) null));
assertEquals(null, CharSetUtils.keep(null, new String[0]));
assertEquals(null, CharSetUtils.keep(null, new String[] {null}));
assertEquals(null, CharSetUtils.keep(null, new String[] {"a-e"}));
-
+
assertEquals("", CharSetUtils.keep("", (String[]) null));
assertEquals("", CharSetUtils.keep("", new String[0]));
assertEquals("", CharSetUtils.keep("", new String[] {null}));
assertEquals("", CharSetUtils.keep("", new String[] {"a-e"}));
-
+
assertEquals("", CharSetUtils.keep("hello", (String[]) null));
assertEquals("", CharSetUtils.keep("hello", new String[0]));
assertEquals("", CharSetUtils.keep("hello", new String[] {null}));
assertEquals("e", CharSetUtils.keep("hello", new String[] {"a-e"}));
-
+
assertEquals("e", CharSetUtils.keep("hello", new String[] { "a-e" }));
assertEquals("ell", CharSetUtils.keep("hello", new String[] { "el" }));
assertEquals("hello", CharSetUtils.keep("hello", new String[] { "elho" }));
@@ -211,30 +211,30 @@ public class CharSetUtilsTest {
public void testDelete_StringString() {
assertEquals(null, CharSetUtils.delete(null, (String) null));
assertEquals(null, CharSetUtils.delete(null, ""));
-
+
assertEquals("", CharSetUtils.delete("", (String) null));
assertEquals("", CharSetUtils.delete("", ""));
assertEquals("", CharSetUtils.delete("", "a-e"));
-
+
assertEquals("hello", CharSetUtils.delete("hello", (String) null));
assertEquals("hello", CharSetUtils.delete("hello", ""));
assertEquals("hllo", CharSetUtils.delete("hello", "a-e"));
assertEquals("he", CharSetUtils.delete("hello", "l-p"));
assertEquals("hello", CharSetUtils.delete("hello", "z"));
}
-
+
@Test
public void testDelete_StringStringarray() {
assertEquals(null, CharSetUtils.delete(null, (String[]) null));
assertEquals(null, CharSetUtils.delete(null, new String[0]));
assertEquals(null, CharSetUtils.delete(null, new String[] {null}));
assertEquals(null, CharSetUtils.delete(null, new String[] {"el"}));
-
+
assertEquals("", CharSetUtils.delete("", (String[]) null));
assertEquals("", CharSetUtils.delete("", new String[0]));
assertEquals("", CharSetUtils.delete("", new String[] {null}));
assertEquals("", CharSetUtils.delete("", new String[] {"a-e"}));
-
+
assertEquals("hello", CharSetUtils.delete("hello", (String[]) null));
assertEquals("hello", CharSetUtils.delete("hello", new String[0]));
assertEquals("hello", CharSetUtils.delete("hello", new String[] {null}));
@@ -248,5 +248,5 @@ public class CharSetUtilsTest {
assertEquals("", CharSetUtils.delete("----", new String[] { "-" }));
assertEquals("heo", CharSetUtils.delete("hello", new String[] { "l" }));
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java b/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
index 5cc4e2f..7ab88b2 100644
--- a/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
+++ b/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java
@@ -5,9 +5,9 @@
* 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.
@@ -22,7 +22,7 @@ import java.util.Calendar;
/**
* Tests the difference in performance between CharUtils and CharSet.
- *
+ *
* Sample runs:
Now: Thu Mar 18 14:29:48 PST 2004
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
index ea68ada..bd92c33 100644
--- a/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -35,7 +35,7 @@ public class CharUtilsTest {
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 testConstructor() {
assertNotNull(new CharUtils());
@@ -45,13 +45,13 @@ public class CharUtilsTest {
assertTrue(Modifier.isPublic(BooleanUtils.class.getModifiers()));
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'));
-
+
for (int i = 0; i < 128; i++) {
final Character ch = CharUtils.toCharacterObject((char) i);
final Character ch2 = CharUtils.toCharacterObject((char) i);
@@ -68,7 +68,7 @@ public class CharUtilsTest {
}
assertSame(CharUtils.toCharacterObject("a"), CharUtils.toCharacterObject('a'));
}
-
+
@Test
public void testToCharacterObject_String() {
assertEquals(null, CharUtils.toCharacterObject(null));
@@ -77,7 +77,7 @@ public class CharUtilsTest {
assertEquals(new Character('a'), CharUtils.toCharacterObject("abc"));
assertSame(CharUtils.toCharacterObject("a"), CharUtils.toCharacterObject("a"));
}
-
+
@Test
public void testToChar_Character() {
assertEquals('A', CharUtils.toChar(CHARACTER_A));
@@ -86,14 +86,14 @@ public class CharUtilsTest {
CharUtils.toChar((Character) null);
} catch (final IllegalArgumentException ex) {}
}
-
+
@Test
public void testToChar_Character_char() {
assertEquals('A', CharUtils.toChar(CHARACTER_A, 'X'));
assertEquals('B', CharUtils.toChar(CHARACTER_B, 'X'));
assertEquals('X', CharUtils.toChar((Character) null, 'X'));
}
-
+
@Test
public void testToChar_String() {
assertEquals('A', CharUtils.toChar("A"));
@@ -105,7 +105,7 @@ public class CharUtilsTest {
CharUtils.toChar("");
} catch (final IllegalArgumentException ex) {}
}
-
+
@Test
public void testToChar_String_char() {
assertEquals('A', CharUtils.toChar("A", 'X'));
@@ -113,7 +113,7 @@ public class CharUtilsTest {
assertEquals('X', CharUtils.toChar("", 'X'));
assertEquals('X', CharUtils.toChar((String) null, 'X'));
}
-
+
@Test
public void testToIntValue_char() {
assertEquals(0, CharUtils.toIntValue('0'));
@@ -130,14 +130,14 @@ public class CharUtilsTest {
CharUtils.toIntValue('a');
} catch (final IllegalArgumentException ex) {}
}
-
+
@Test
public void testToIntValue_char_int() {
assertEquals(0, CharUtils.toIntValue('0', -1));
assertEquals(3, CharUtils.toIntValue('3', -1));
assertEquals(-1, CharUtils.toIntValue('a', -1));
}
-
+
@Test
public void testToIntValue_Character() {
assertEquals(0, CharUtils.toIntValue(new Character('0')));
@@ -149,7 +149,7 @@ public class CharUtilsTest {
CharUtils.toIntValue(CHARACTER_A);
} catch (final IllegalArgumentException ex) {}
}
-
+
@Test
public void testToIntValue_Character_int() {
assertEquals(0, CharUtils.toIntValue(new Character('0'), -1));
@@ -157,12 +157,12 @@ public class CharUtilsTest {
assertEquals(-1, CharUtils.toIntValue(new Character('A'), -1));
assertEquals(-1, CharUtils.toIntValue(null, -1));
}
-
+
@Test
public void testToString_char() {
assertEquals("a", CharUtils.toString('a'));
assertSame(CharUtils.toString('a'), CharUtils.toString('a'));
-
+
for (int i = 0; i < 128; i++) {
final String str = CharUtils.toString((char) i);
final String str2 = CharUtils.toString((char) i);
@@ -181,19 +181,19 @@ public class CharUtilsTest {
assertEquals(i, str2.charAt(0));
}
}
-
+
@Test
public void testToString_Character() {
assertEquals(null, CharUtils.toString(null));
assertEquals("A", CharUtils.toString(CHARACTER_A));
assertSame(CharUtils.toString(CHARACTER_A), CharUtils.toString(CHARACTER_A));
}
-
+
@Test
public void testToUnicodeEscaped_char() {
assertEquals("\\u0041", CharUtils.unicodeEscaped('A'));
assertEquals("\\u004c", CharUtils.unicodeEscaped('L'));
-
+
for (int i = 0; i < 196; i++) {
final String str = CharUtils.unicodeEscaped((char) i);
assertEquals(6, str.length());
@@ -203,13 +203,13 @@ public class CharUtilsTest {
assertEquals("\\u0999", CharUtils.unicodeEscaped((char) 0x999));
assertEquals("\\u1001", CharUtils.unicodeEscaped((char) 0x1001));
}
-
+
@Test
public void testToUnicodeEscaped_Character() {
assertEquals(null, CharUtils.unicodeEscaped(null));
assertEquals("\\u0041", CharUtils.unicodeEscaped(CHARACTER_A));
}
-
+
@Test
public void testIsAscii_char() {
assertTrue(CharUtils.isAscii('a'));
@@ -218,7 +218,7 @@ public class CharUtilsTest {
assertTrue(CharUtils.isAscii('-'));
assertTrue(CharUtils.isAscii('\n'));
assertFalse(CharUtils.isAscii(CHAR_COPY));
-
+
for (int i = 0; i < 128; i++) {
if (i < 128) {
assertTrue(CharUtils.isAscii((char) i));
@@ -227,7 +227,7 @@ public class CharUtilsTest {
}
}
}
-
+
@Test
public void testIsAsciiPrintable_char() {
assertTrue(CharUtils.isAsciiPrintable('a'));
@@ -236,7 +236,7 @@ public class CharUtilsTest {
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));
@@ -245,7 +245,7 @@ public class CharUtilsTest {
}
}
}
-
+
@Test
public void testIsAsciiControl_char() {
assertFalse(CharUtils.isAsciiControl('a'));
@@ -254,7 +254,7 @@ public class CharUtilsTest {
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));
@@ -263,7 +263,7 @@ public class CharUtilsTest {
}
}
}
-
+
@Test
public void testIsAsciiAlpha_char() {
assertTrue(CharUtils.isAsciiAlpha('a'));
@@ -272,7 +272,7 @@ public class CharUtilsTest {
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));
@@ -281,7 +281,7 @@ public class CharUtilsTest {
}
}
}
-
+
@Test
public void testIsAsciiAlphaUpper_char() {
assertFalse(CharUtils.isAsciiAlphaUpper('a'));
@@ -290,7 +290,7 @@ public class CharUtilsTest {
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));
@@ -299,7 +299,7 @@ public class CharUtilsTest {
}
}
}
-
+
@Test
public void testIsAsciiAlphaLower_char() {
assertTrue(CharUtils.isAsciiAlphaLower('a'));
@@ -308,7 +308,7 @@ public class CharUtilsTest {
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));
@@ -317,7 +317,7 @@ public class CharUtilsTest {
}
}
}
-
+
@Test
public void testIsAsciiNumeric_char() {
assertFalse(CharUtils.isAsciiNumeric('a'));
@@ -326,7 +326,7 @@ public class CharUtilsTest {
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));
@@ -335,7 +335,7 @@ public class CharUtilsTest {
}
}
}
-
+
@Test
public void testIsAsciiAlphanumeric_char() {
assertTrue(CharUtils.isAsciiAlphanumeric('a'));
@@ -344,7 +344,7 @@ public class CharUtilsTest {
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));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
index 744aaa8..a31c78c 100644
--- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
@@ -114,7 +114,7 @@ public class ClassUtilsTest {
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()));
@@ -166,7 +166,7 @@ public class ClassUtilsTest {
assertEquals("String[][]", ClassUtils.getSimpleName(String[][].class));
assertEquals("String[][][]", ClassUtils.getSimpleName(String[][][].class));
assertEquals("String[][][][]", ClassUtils.getSimpleName(String[][][][].class));
-
+
// On-the-fly types
class Named {}
assertEquals("", ClassUtils.getSimpleName(new Object(){}.getClass()));
@@ -212,7 +212,7 @@ public class ClassUtilsTest {
assertEquals("java.lang", ClassUtils.getPackageName(String[][].class));
assertEquals("java.lang", ClassUtils.getPackageName(String[][][].class));
assertEquals("java.lang", ClassUtils.getPackageName(String[][][][].class));
-
+
// On-the-fly types
class Named {}
assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new Object() {
@@ -783,7 +783,7 @@ public class ClassUtilsTest {
assertTrue("Long.class", ClassUtils.isPrimitiveOrWrapper(Long.class));
assertTrue("Double.class", ClassUtils.isPrimitiveOrWrapper(Double.class));
assertTrue("Float.class", ClassUtils.isPrimitiveOrWrapper(Float.class));
-
+
// test primitive classes
assertTrue("boolean", ClassUtils.isPrimitiveOrWrapper(Boolean.TYPE));
assertTrue("byte", ClassUtils.isPrimitiveOrWrapper(Byte.TYPE));
@@ -794,14 +794,14 @@ public class ClassUtilsTest {
assertTrue("double", ClassUtils.isPrimitiveOrWrapper(Double.TYPE));
assertTrue("float", ClassUtils.isPrimitiveOrWrapper(Float.TYPE));
assertTrue("Void.TYPE", ClassUtils.isPrimitiveOrWrapper(Void.TYPE));
-
+
// others
assertFalse("null", ClassUtils.isPrimitiveOrWrapper(null));
assertFalse("Void.class", ClassUtils.isPrimitiveOrWrapper(Void.class));
assertFalse("String.class", ClassUtils.isPrimitiveOrWrapper(String.class));
assertFalse("this.getClass()", ClassUtils.isPrimitiveOrWrapper(this.getClass()));
}
-
+
@Test
public void testIsPrimitiveWrapper() {
@@ -814,7 +814,7 @@ public class ClassUtilsTest {
assertTrue("Long.class", ClassUtils.isPrimitiveWrapper(Long.class));
assertTrue("Double.class", ClassUtils.isPrimitiveWrapper(Double.class));
assertTrue("Float.class", ClassUtils.isPrimitiveWrapper(Float.class));
-
+
// test primitive classes
assertFalse("boolean", ClassUtils.isPrimitiveWrapper(Boolean.TYPE));
assertFalse("byte", ClassUtils.isPrimitiveWrapper(Byte.TYPE));
@@ -824,7 +824,7 @@ public class ClassUtilsTest {
assertFalse("long", ClassUtils.isPrimitiveWrapper(Long.TYPE));
assertFalse("double", ClassUtils.isPrimitiveWrapper(Double.TYPE));
assertFalse("float", ClassUtils.isPrimitiveWrapper(Float.TYPE));
-
+
// others
assertFalse("null", ClassUtils.isPrimitiveWrapper(null));
assertFalse("Void.class", ClassUtils.isPrimitiveWrapper(Void.class));
@@ -832,7 +832,7 @@ public class ClassUtilsTest {
assertFalse("String.class", ClassUtils.isPrimitiveWrapper(String.class));
assertFalse("this.getClass()", ClassUtils.isPrimitiveWrapper(this.getClass()));
}
-
+
@Test
public void testPrimitiveToWrapper() {
@@ -1127,7 +1127,7 @@ public class ClassUtilsTest {
public void testToClass_object() {
// assertNull(ClassUtils.toClass(null)); // generates warning
assertNull(ClassUtils.toClass((Object[]) null)); // equivalent explicit cast
-
+
// Additional varargs tests
assertTrue("empty -> empty", Arrays.equals(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.toClass()));
final Class<?>[] castNull = ClassUtils.toClass((Object) null); // == new Object[]{null}
@@ -1165,7 +1165,7 @@ public class ClassUtilsTest {
assertEquals("ClassUtils[][]", ClassUtils.getShortCanonicalName(ClassUtils[][].class));
assertEquals("int[]", ClassUtils.getShortCanonicalName(int[].class));
assertEquals("int[][]", ClassUtils.getShortCanonicalName(int[][].class));
-
+
// Inner types
class Named {}
assertEquals("ClassUtilsTest.7", ClassUtils.getShortCanonicalName(new Object(){}.getClass()));
@@ -1184,7 +1184,7 @@ public class ClassUtilsTest {
assertEquals("int[][]", ClassUtils.getShortCanonicalName("[[I"));
assertEquals("int[]", ClassUtils.getShortCanonicalName("int[]"));
assertEquals("int[][]", ClassUtils.getShortCanonicalName("int[][]"));
-
+
// Inner types
assertEquals("ClassUtilsTest.6", ClassUtils.getShortCanonicalName("org.apache.commons.lang3.ClassUtilsTest$6"));
assertEquals("ClassUtilsTest.5Named", ClassUtils.getShortCanonicalName("org.apache.commons.lang3.ClassUtilsTest$5Named"));
@@ -1199,7 +1199,7 @@ public class ClassUtilsTest {
assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new ClassUtils[0][0], "<null>"));
assertEquals("", ClassUtils.getPackageCanonicalName(new int[0], "<null>"));
assertEquals("", ClassUtils.getPackageCanonicalName(new int[0][0], "<null>"));
-
+
// Inner types
class Named {}
assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Object(){}, "<null>"));
@@ -1214,7 +1214,7 @@ public class ClassUtilsTest {
assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(ClassUtils[][].class));
assertEquals("", ClassUtils.getPackageCanonicalName(int[].class));
assertEquals("", ClassUtils.getPackageCanonicalName(int[][].class));
-
+
// Inner types
class Named {}
assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Object(){}.getClass()));
@@ -1238,7 +1238,7 @@ public class ClassUtilsTest {
assertEquals("", ClassUtils.getPackageCanonicalName("[[I"));
assertEquals("", ClassUtils.getPackageCanonicalName("int[]"));
assertEquals("", ClassUtils.getPackageCanonicalName("int[][]"));
-
+
// Inner types
assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName("org.apache.commons.lang3.ClassUtilsTest$6"));
assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName("org.apache.commons.lang3.ClassUtilsTest$5Named"));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
index 5845ef6..bb425d4 100644
--- a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java
@@ -32,7 +32,7 @@ import org.junit.Assert;
import org.junit.Test;
/**
- *
+ *
*/
public class EnumUtilsTest {
@@ -102,7 +102,7 @@ public class EnumUtilsTest {
public void test_generateBitVectors_nullClass() {
EnumUtils.generateBitVectors(null, EnumSet.of(Traffic.RED));
}
-
+
@Test(expected=NullPointerException.class)
public void test_generateBitVector_nullIterable() {
EnumUtils.generateBitVector(Traffic.class, (Iterable<Traffic>) null);
@@ -112,27 +112,27 @@ public class EnumUtilsTest {
public void test_generateBitVectors_nullIterable() {
EnumUtils.generateBitVectors(null, (Iterable<Traffic>) null);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void test_generateBitVector_nullElement() {
EnumUtils.generateBitVector(Traffic.class, Arrays.asList(Traffic.RED, null));
}
-
+
@Test(expected=IllegalArgumentException.class)
public void test_generateBitVectors_nullElement() {
EnumUtils.generateBitVectors(Traffic.class, Arrays.asList(Traffic.RED, null));
}
-
+
@Test(expected=NullPointerException.class)
public void test_generateBitVector_nullClassWithArray() {
EnumUtils.generateBitVector(null, Traffic.RED);
}
-
+
@Test(expected=NullPointerException.class)
public void test_generateBitVectors_nullClassWithArray() {
EnumUtils.generateBitVectors(null, Traffic.RED);
}
-
+
@Test(expected=NullPointerException.class)
public void test_generateBitVector_nullArray() {
EnumUtils.generateBitVector(Traffic.class, (Traffic[]) null);
@@ -142,17 +142,17 @@ public class EnumUtilsTest {
public void test_generateBitVectors_nullArray() {
EnumUtils.generateBitVectors(Traffic.class, (Traffic[]) null);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void test_generateBitVector_nullArrayElement() {
EnumUtils.generateBitVector(Traffic.class, Traffic.RED, null);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void test_generateBitVectors_nullArrayElement() {
EnumUtils.generateBitVectors(Traffic.class, Traffic.RED, null);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void test_generateBitVector_longClass() {
EnumUtils.generateBitVector(TooMany.class, EnumSet.of(TooMany.A1));
@@ -174,7 +174,7 @@ public class EnumUtilsTest {
List rawList = new ArrayList();
EnumUtils.generateBitVector(rawType, rawList);
}
-
+
@SuppressWarnings("unchecked")
@Test(expected=IllegalArgumentException.class)
public void test_generateBitVectors_nonEnumClass() {
@@ -186,7 +186,7 @@ public class EnumUtilsTest {
List rawList = new ArrayList();
EnumUtils.generateBitVectors(rawType, rawList);
}
-
+
@SuppressWarnings("unchecked")
@Test(expected=IllegalArgumentException.class)
public void test_generateBitVector_nonEnumClassWithArray() {
@@ -204,7 +204,7 @@ public class EnumUtilsTest {
Class rawType = Object.class;
EnumUtils.generateBitVectors(rawType);
}
-
+
@Test
public void test_generateBitVector() {
assertEquals(0L, EnumUtils.generateBitVector(Traffic.class, EnumSet.noneOf(Traffic.class)));
@@ -264,7 +264,7 @@ public class EnumUtilsTest {
assertEquals((1L << 63), EnumUtils.generateBitVector(Enum64.class, Enum64.A63));
assertEquals(Long.MIN_VALUE, EnumUtils.generateBitVector(Enum64.class, Enum64.A63));
}
-
+
@Test
public void test_generateBitVectorsFromArray() {
assertArrayEquals(EnumUtils.generateBitVectors(Traffic.class), 0L);
@@ -365,7 +365,7 @@ public class EnumUtilsTest {
public void test_processBitVector_longClass() {
EnumUtils.processBitVector(TooMany.class, 0L);
}
-
+
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));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java b/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java
index 97fe714..5c04cd6 100644
--- a/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java
+++ b/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -64,7 +64,7 @@ public class HashSetvBitSetTest {
toRemove.set(10, 20);
return (int[]) ArrayUtils.removeAll(array, toRemove);
}
-
+
@Benchmark
public int[] timeExtractRemoveAll() {
final BitSet toRemove = new BitSet();
@@ -89,7 +89,7 @@ public class HashSetvBitSetTest {
int i = 0;
int j=0;
while((j=coll.nextSetBit(j)) != -1) {
- result[i++] = j++;
+ result[i++] = j++;
}
return result;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
index bbb93de..1c39a77 100644
--- a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -49,7 +49,7 @@ public class LocaleUtilsTest {
private static final Locale LOCALE_FR = new Locale("fr", "");
private static final Locale LOCALE_FR_CA = new Locale("fr", "CA");
private static final Locale LOCALE_QQ = new Locale("qq", "");
- private static final Locale LOCALE_QQ_ZZ = new Locale("qq", "ZZ");
+ private static final Locale LOCALE_QQ_ZZ = new Locale("qq", "ZZ");
@Before
public void setUp() throws Exception {
@@ -111,7 +111,7 @@ public class LocaleUtilsTest {
* @param variant of the resulting Locale
*/
private static void assertValidToLocale(
- final String localeString, final String language,
+ final String localeString, final String language,
final String country, final String variant) {
final Locale locale = LocaleUtils.toLocale(localeString);
assertNotNull("valid locale", locale);
@@ -126,7 +126,7 @@ public class LocaleUtilsTest {
@Test
public void testToLocale_1Part() {
assertNull(LocaleUtils.toLocale(null));
-
+
assertValidToLocale("us");
assertValidToLocale("fr");
assertValidToLocale("de");
@@ -152,7 +152,7 @@ public class LocaleUtilsTest {
LocaleUtils.toLocale("u#");
fail("Should fail if not lowercase");
} catch (final IllegalArgumentException iae) {}
-
+
try {
LocaleUtils.toLocale("u");
fail("Must be 2 chars if less than 5");
@@ -162,7 +162,7 @@ public class LocaleUtilsTest {
LocaleUtils.toLocale("uu_U");
fail("Must be 2 chars if less than 5");
} catch (final IllegalArgumentException iae) {}
- }
+ }
/**
* Test toLocale() method.
@@ -172,7 +172,7 @@ public class LocaleUtilsTest {
assertValidToLocale("us_EN", "us", "EN");
//valid though doesn't exist
assertValidToLocale("us_ZH", "us", "ZH");
-
+
try {
LocaleUtils.toLocale("us-EN");
fail("Should fail as not underscore");
@@ -197,7 +197,7 @@ public class LocaleUtilsTest {
LocaleUtils.toLocale("us_E3");
fail("Should fail second part not uppercase");
} catch (final IllegalArgumentException iae) {}
- }
+ }
/**
* Test toLocale() method.
@@ -214,7 +214,7 @@ public class LocaleUtilsTest {
assertValidToLocale("us_EN_a", "us", "EN", "A");
assertValidToLocale("us_EN_SFsafdFDsdfF", "us", "EN", "SFSAFDFDSDFF");
}
-
+
try {
LocaleUtils.toLocale("us_EN-a");
fail("Should fail as not underscore");
@@ -237,7 +237,7 @@ public class LocaleUtilsTest {
final List<Locale> localeList = defaultLocale == null ?
LocaleUtils.localeLookupList(locale) :
LocaleUtils.localeLookupList(locale, defaultLocale);
-
+
assertEquals(expected.length, localeList.size());
assertEquals(Arrays.asList(expected), localeList);
assertUnmodifiableCollection(localeList);
@@ -262,19 +262,19 @@ public class LocaleUtilsTest {
LOCALE_EN_US_ZZZZ,
LOCALE_EN_US,
LOCALE_EN});
- }
+ }
/**
* Test localeLookupList() method.
*/
@Test
public void testLocaleLookupList_LocaleLocale() {
- assertLocaleLookupList(LOCALE_QQ, LOCALE_QQ,
+ assertLocaleLookupList(LOCALE_QQ, LOCALE_QQ,
new Locale[]{LOCALE_QQ});
- assertLocaleLookupList(LOCALE_EN, LOCALE_EN,
+ assertLocaleLookupList(LOCALE_EN, LOCALE_EN,
new Locale[]{LOCALE_EN});
-
- assertLocaleLookupList(LOCALE_EN_US, LOCALE_EN_US,
+
+ assertLocaleLookupList(LOCALE_EN_US, LOCALE_EN_US,
new Locale[]{
LOCALE_EN_US,
LOCALE_EN});
@@ -288,7 +288,7 @@ public class LocaleUtilsTest {
LOCALE_EN_US,
LOCALE_EN,
LOCALE_QQ_ZZ});
-
+
assertLocaleLookupList(LOCALE_EN_US_ZZZZ, null,
new Locale[] {
LOCALE_EN_US_ZZZZ,
@@ -329,7 +329,7 @@ public class LocaleUtilsTest {
assertNotNull(list);
assertSame(list, list2);
assertUnmodifiableCollection(list);
-
+
final Locale[] jdkLocaleArray = Locale.getAvailableLocales();
final List<Locale> jdkLocaleList = Arrays.asList(jdkLocaleArray);
assertEquals(jdkLocaleList, list);
@@ -346,7 +346,7 @@ public class LocaleUtilsTest {
assertNotNull(set);
assertSame(set, set2);
assertUnmodifiableCollection(set);
-
+
final Locale[] jdkLocaleArray = Locale.getAvailableLocales();
final List<Locale> jdkLocaleList = Arrays.asList(jdkLocaleArray);
final Set<Locale> jdkLocaleSet = new HashSet<>(jdkLocaleList);
@@ -369,10 +369,10 @@ public class LocaleUtilsTest {
assertEquals(set.contains(LOCALE_QQ), LocaleUtils.isAvailableLocale(LOCALE_QQ));
assertEquals(set.contains(LOCALE_QQ_ZZ), LocaleUtils.isAvailableLocale(LOCALE_QQ_ZZ));
}
-
+
/**
* Test for 3-chars locale, further details at LANG-915
- *
+ *
*/
@Test
public void testThreeCharsLocale() {
@@ -387,9 +387,9 @@ public class LocaleUtilsTest {
//-----------------------------------------------------------------------
/**
- * Make sure the language by country is correct. It checks that
- * the LocaleUtils.languagesByCountry(country) call contains the
- * array of languages passed in. It may contain more due to JVM
+ * Make sure the language by country is correct. It checks that
+ * the LocaleUtils.languagesByCountry(country) call contains the
+ * array of languages passed in. It may contain more due to JVM
* variations.
*
* @param country
@@ -437,9 +437,9 @@ public class LocaleUtilsTest {
//-----------------------------------------------------------------------
/**
- * Make sure the country by language is correct. It checks that
- * the LocaleUtils.countryByLanguage(language) call contains the
- * array of countries passed in. It may contain more due to JVM
+ * Make sure the country by language is correct. It checks that
+ * the LocaleUtils.countryByLanguage(language) call contains the
+ * array of countries passed in. It may contain more due to JVM
* variations.
*
*
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/NotImplementedExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/NotImplementedExceptionTest.java b/src/test/java/org/apache/commons/lang3/NotImplementedExceptionTest.java
index ff422ae..86f4fab 100644
--- a/src/test/java/org/apache/commons/lang3/NotImplementedExceptionTest.java
+++ b/src/test/java/org/apache/commons/lang3/NotImplementedExceptionTest.java
@@ -5,9 +5,9 @@
* 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.
[06/48] [lang] ObjectUtils#identityToString(StrBuilder,
Object): improve deprecating javadoc comment
Posted by br...@apache.org.
ObjectUtils#identityToString(StrBuilder, Object): improve deprecating javadoc comment
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/8019416d
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/8019416d
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/8019416d
Branch: refs/heads/release
Commit: 8019416d8197df8881788f889edfcf2ad45c4bf8
Parents: 670bb2e
Author: pascalschumacher <pa...@gmx.net>
Authored: Thu May 25 14:46:50 2017 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu May 25 14:46:50 2017 +0200
----------------------------------------------------------------------
src/main/java/org/apache/commons/lang3/ObjectUtils.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8019416d/src/main/java/org/apache/commons/lang3/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 13d1256..b5a00db 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -373,7 +373,8 @@ public class ObjectUtils {
* @param builder the builder to append to
* @param object the object to create a toString for
* @since 3.2
- * @deprecated as of 3.6, use one of the other {@code identityToString} methods instead
+ * @deprecated as of 3.6, because StrBuilder was moved to commons-text,
+ * use one of the other {@code identityToString} methods instead
*/
@Deprecated
public static void identityToString(final StrBuilder builder, final Object object) {
[46/48] [lang] Add release notes for 3.6 release
Posted by br...@apache.org.
Add release notes for 3.6 release
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/841915d6
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/841915d6
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/841915d6
Branch: refs/heads/release
Commit: 841915d69ab996f45d9b59e4b1e18c3b46d86b13
Parents: 1054af7
Author: Benedikt Ritter <br...@apache.org>
Authored: Mon Apr 17 14:05:42 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Jun 8 10:00:26 2017 +0200
----------------------------------------------------------------------
RELEASE-NOTES.txt | 156 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 152 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/841915d6/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 141203a..535fdc6 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,15 +1,16 @@
Apache Commons Lang
- Version 3.5
+ Version 3.6
Release Notes
INTRODUCTION:
-This document contains the release notes for the 3.5 version of
+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.5 at
-least requires Java 6.0.
+components that should be of use in any Java environment. Commons Lang 3.6 at
+least requires Java 7. 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:
@@ -20,6 +21,153 @@ 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 Most of the classes in the org.apache.commons.lang3.text package
+o org.apache.commons.lang3.StringEscapeUtils
+o 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
+
+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.
[43/48] [lang] Merge branch 'LANG-1338'
Posted by br...@apache.org.
Merge branch 'LANG-1338'
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/82f1ca8e
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/82f1ca8e
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/82f1ca8e
Branch: refs/heads/release
Commit: 82f1ca8efd7254e0598d69da301ea19721b43d00
Parents: ad648cf 8ec7e02
Author: Benedikt Ritter <br...@apache.org>
Authored: Thu Jun 8 09:34:21 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Jun 8 09:34:21 2017 +0200
----------------------------------------------------------------------
pom.xml | 13 +++++++++++++
src/changes/changes.xml | 1 +
2 files changed, 14 insertions(+)
----------------------------------------------------------------------
[28/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
----------------------------------------------------------------------
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 aa7fb06..a07ea27 100644
--- a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
@@ -69,7 +69,7 @@ import org.apache.commons.lang3.tuple.Pair;
* <code>reflectionEquals</code>, uses <code>AccessibleObject.setAccessible</code> to
* change the visibility of the fields. This will fail under a security
* manager, unless the appropriate permissions are set up correctly. It is
- * also slower than testing explicitly. Non-primitive fields are compared using
+ * also slower than testing explicitly. Non-primitive fields are compared using
* <code>equals()</code>.</p>
*
* <p> A typical invocation for this method would look like:</p>
@@ -78,7 +78,7 @@ import org.apache.commons.lang3.tuple.Pair;
* return EqualsBuilder.reflectionEquals(this, obj);
* }
* </pre>
- *
+ *
* <p>The {@link EqualsExclude} annotation can be used to exclude fields from being
* used by the <code>reflectionEquals</code> methods.</p>
*
@@ -271,7 +271,7 @@ public class EqualsBuilder implements Builder<Boolean> {
this.excludeFields = excludeFields;
return this;
}
-
+
/**
* <p>This method uses reflection to determine if the two <code>Object</code>s
@@ -280,9 +280,9 @@ public class EqualsBuilder implements Builder<Boolean> {
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under
* a security manager, if the permissions are not set up correctly. It is also
- * not as efficient as testing explicitly. Non-primitive fields are compared using
+ * not as efficient as testing explicitly. Non-primitive fields are compared using
* <code>equals()</code>.</p>
- *
+ *
* <p>Transient members will be not be tested, as they are likely derived
* fields, and not part of the value of the Object.</p>
*
@@ -292,7 +292,7 @@ public class EqualsBuilder implements Builder<Boolean> {
* @param rhs the other object
* @param excludeFields Collection of String field names to exclude from testing
* @return <code>true</code> if the two Objects have tested equals.
- *
+ *
* @see EqualsExclude
*/
public static boolean reflectionEquals(final Object lhs, final Object rhs, final Collection<String> excludeFields) {
@@ -306,7 +306,7 @@ public class EqualsBuilder implements Builder<Boolean> {
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under
* a security manager, if the permissions are not set up correctly. It is also
- * not as efficient as testing explicitly. Non-primitive fields are compared using
+ * not as efficient as testing explicitly. Non-primitive fields are compared using
* <code>equals()</code>.</p>
*
* <p>Transient members will be not be tested, as they are likely derived
@@ -318,7 +318,7 @@ public class EqualsBuilder implements Builder<Boolean> {
* @param rhs the other object
* @param excludeFields array of field names to exclude from testing
* @return <code>true</code> if the two Objects have tested equals.
- *
+ *
* @see EqualsExclude
*/
public static boolean reflectionEquals(final Object lhs, final Object rhs, final String... excludeFields) {
@@ -332,7 +332,7 @@ public class EqualsBuilder implements Builder<Boolean> {
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under
* a security manager, if the permissions are not set up correctly. It is also
- * not as efficient as testing explicitly. Non-primitive fields are compared using
+ * not as efficient as testing explicitly. Non-primitive fields are compared using
* <code>equals()</code>.</p>
*
* <p>If the TestTransients parameter is set to <code>true</code>, transient
@@ -345,7 +345,7 @@ public class EqualsBuilder implements Builder<Boolean> {
* @param rhs the other object
* @param testTransients whether to include transient fields
* @return <code>true</code> if the two Objects have tested equals.
- *
+ *
* @see EqualsExclude
*/
public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients) {
@@ -359,7 +359,7 @@ public class EqualsBuilder implements Builder<Boolean> {
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under
* a security manager, if the permissions are not set up correctly. It is also
- * not as efficient as testing explicitly. Non-primitive fields are compared using
+ * not as efficient as testing explicitly. Non-primitive fields are compared using
* <code>equals()</code>.</p>
*
* <p>If the testTransients parameter is set to <code>true</code>, transient
@@ -377,7 +377,7 @@ public class EqualsBuilder implements Builder<Boolean> {
* may be <code>null</code>
* @param excludeFields array of field names to exclude from testing
* @return <code>true</code> if the two Objects have tested equals.
- *
+ *
* @see EqualsExclude
* @since 2.0
*/
@@ -385,7 +385,7 @@ public class EqualsBuilder implements Builder<Boolean> {
final String... excludeFields) {
return reflectionEquals(lhs, rhs, testTransients, reflectUpToClass, false, excludeFields);
}
-
+
/**
* <p>This method uses reflection to determine if the two <code>Object</code>s
* are equal.</p>
@@ -403,10 +403,10 @@ public class EqualsBuilder implements Builder<Boolean> {
* <p>Static fields will not be included. Superclass fields will be appended
* up to and including the specified superclass. A null superclass is treated
* as java.lang.Object.</p>
- *
+ *
* <p>If the testRecursive parameter is set to <code>true</code>, non primitive
- * (and non primitive wrapper) field types will be compared by
- * <code>EqualsBuilder</code> recursively instead of invoking their
+ * (and non primitive wrapper) field types will be compared by
+ * <code>EqualsBuilder</code> recursively instead of invoking their
* <code>equals()</code> method. Leading to a deep reflection equals test.
*
* @param lhs <code>this</code> object
@@ -415,10 +415,10 @@ public class EqualsBuilder implements Builder<Boolean> {
* @param reflectUpToClass the superclass to reflect up to (inclusive),
* may be <code>null</code>
* @param testRecursive whether to call reflection equals on non primitive
- * fields recursively.
+ * fields recursively.
* @param excludeFields array of field names to exclude from testing
* @return <code>true</code> if the two Objects have tested equals.
- *
+ *
* @see EqualsExclude
* @since 3.6
*/
@@ -438,16 +438,16 @@ public class EqualsBuilder implements Builder<Boolean> {
.reflectionAppend(lhs, rhs)
.isEquals();
}
-
+
/**
* <p>Tests if two <code>objects</code> by using reflection.</p>
- *
+ *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under
* a security manager, if the permissions are not set up correctly. It is also
- * not as efficient as testing explicitly. Non-primitive fields are compared using
+ * not as efficient as testing explicitly. Non-primitive fields are compared using
* <code>equals()</code>.</p>
- *
+ *
* <p>If the testTransients field is set to <code>true</code>, transient
* members will be tested, otherwise they are ignored, as they are likely
* derived fields, and not part of the value of the <code>Object</code>.</p>
@@ -455,9 +455,9 @@ public class EqualsBuilder implements Builder<Boolean> {
* <p>Static fields will not be included. Superclass fields will be appended
* up to and including the specified superclass in field <code>reflectUpToClass</code>.
* A null superclass is treated as java.lang.Object.</p>
- *
+ *
* <p>Field names listed in field <code>excludeFields</code> will be ignored.</p>
- *
+ *
* @param lhs the left hand object
* @param rhs the left hand object
* @return EqualsBuilder - used to chain calls.
@@ -583,10 +583,10 @@ public class EqualsBuilder implements Builder<Boolean> {
//-------------------------------------------------------------------------
/**
- * <p>Test if two <code>Object</code>s are equal using either
+ * <p>Test if two <code>Object</code>s are equal using either
* #{@link #reflectionAppend(Object, Object)}, if object are non
- * primitives (or wrapper of primitives) or if field <code>testRecursive</code>
- * is set to <code>false</code>. Otherwise, using their
+ * primitives (or wrapper of primitives) or if field <code>testRecursive</code>
+ * is set to <code>false</code>. Otherwise, using their
* <code>equals</code> method.</p>
*
* @param lhs the left hand object
@@ -794,7 +794,7 @@ public class EqualsBuilder implements Builder<Boolean> {
*
* <p>This also will be called for the top level of
* multi-dimensional, ragged, and multi-typed arrays.</p>
- *
+ *
* <p>Note that this method does not compare the type of the arrays; it only
* compares the contents.</p>
*
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java b/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
index d68e36b..1c2d722 100644
--- a/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
@@ -94,7 +94,7 @@ import org.apache.commons.lang3.Validate;
* return HashCodeBuilder.reflectionHashCode(this);
* }
* </pre>
- *
+ *
* <p>The {@link HashCodeExclude} annotation can be used to exclude fields from being
* used by the <code>reflectionHashCode</code> methods.</p>
*
@@ -105,12 +105,12 @@ public class HashCodeBuilder implements Builder<Integer> {
* The default initial value to use in reflection hash code building.
*/
private static final int DEFAULT_INITIAL_VALUE = 17;
-
+
/**
* The default multiplier value to use in reflection hash code building.
*/
private static final int DEFAULT_MULTIPLIER_VALUE = 37;
-
+
/**
* <p>
* A registry of objects used by reflection methods to detect cyclical object references and avoid infinite loops.
@@ -401,7 +401,7 @@ public class HashCodeBuilder implements Builder<Integer> {
* @see HashCodeExclude
*/
public static int reflectionHashCode(final Object object, final boolean testTransients) {
- return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object,
+ return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object,
testTransients, null);
}
@@ -482,7 +482,7 @@ public class HashCodeBuilder implements Builder<Integer> {
* @see HashCodeExclude
*/
public static int reflectionHashCode(final Object object, final String... excludeFields) {
- return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, false,
+ return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, false,
null, excludeFields);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/IDKey.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/IDKey.java b/src/main/java/org/apache/commons/lang3/builder/IDKey.java
index b66cdb8..8eab0ea 100644
--- a/src/main/java/org/apache/commons/lang3/builder/IDKey.java
+++ b/src/main/java/org/apache/commons/lang3/builder/IDKey.java
@@ -20,12 +20,12 @@ package org.apache.commons.lang3.builder;
// adapted from org.apache.axis.utils.IDKey
/**
- * Wrap an identity key (System.identityHashCode())
+ * Wrap an identity key (System.identityHashCode())
* so that an object can only be equal() to itself.
- *
+ *
* This is necessary to disambiguate the occasional duplicate
* identityHashCodes that can occur.
- */
+ */
final class IDKey {
private final Object value;
private final int id;
@@ -33,12 +33,12 @@ final class IDKey {
/**
* Constructor for IDKey
* @param _value The value
- */
+ */
public IDKey(final Object _value) {
- // This is the Object hash code
- id = System.identityHashCode(_value);
- // There have been some cases (LANG-459) that return the
- // same identity hash code for different objects. So
+ // This is the Object hash code
+ id = System.identityHashCode(_value);
+ // There have been some cases (LANG-459) that return the
+ // same identity hash code for different objects. So
// the value is also added to disambiguate these cases.
value = _value;
}
@@ -46,7 +46,7 @@ final class IDKey {
/**
* returns hash code - i.e. the system identity hashcode.
* @return the hashcode
- */
+ */
@Override
public int hashCode() {
return id;
@@ -56,7 +56,7 @@ final class IDKey {
* checks if instances are equal
* @param other The other object to compare to
* @return if the instances are for the same object
- */
+ */
@Override
public boolean equals(final Object other) {
if (!(other instanceof IDKey)) {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
index 7c0375a..cf89675 100644
--- a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
@@ -5,9 +5,9 @@
* 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.
@@ -21,9 +21,9 @@ import org.apache.commons.lang3.ClassUtils;
/**
* <p>Works with {@link ToStringBuilder} to create a "deep" <code>toString</code>.
- * But instead a single line like the {@link RecursiveToStringStyle} this creates a multiline String
+ * But instead a single line like the {@link RecursiveToStringStyle} this creates a multiline String
* similar to the {@link ToStringStyle#MULTI_LINE_STYLE}.</p>
- *
+ *
* <p>To use this class write code as follows:</p>
*
* <pre>
@@ -31,15 +31,15 @@ import org.apache.commons.lang3.ClassUtils;
* String title;
* ...
* }
- *
+ *
* public class Person {
* String name;
* int age;
* boolean smoker;
* Job job;
- *
+ *
* ...
- *
+ *
* public String toString() {
* return new ReflectionToStringBuilder(this, new MultilineRecursiveToStringStyle()).toString();
* }
@@ -58,7 +58,7 @@ import org.apache.commons.lang3.ClassUtils;
* ]
* </code>
* </p>
- *
+ *
* @since 3.4
*/
public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle {
@@ -84,7 +84,7 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle {
}
/**
- * Resets the fields responsible for the line breaks and indenting.
+ * Resets the fields responsible for the line breaks and indenting.
* Must be invoked after changing the {@link #spaces} value.
*/
private void resetIndent() {
@@ -99,7 +99,7 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle {
/**
* Creates a StringBuilder responsible for the indenting.
- *
+ *
* @param spaces how far to indent
* @return a StringBuilder with {spaces} leading space characters.
*/
@@ -142,7 +142,7 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle {
spaces -= INDENT;
resetIndent();
}
-
+
@Override
protected void appendDetail(final StringBuffer buffer, final String fieldName, final long[] array) {
spaces += INDENT;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/RecursiveToStringStyle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/RecursiveToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/RecursiveToStringStyle.java
index b39e9ea..aa5dd71 100644
--- a/src/main/java/org/apache/commons/lang3/builder/RecursiveToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/RecursiveToStringStyle.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang3.ClassUtils;
* String title;
* ...
* }
- *
+ *
* public class Person {
* String name;
* int age;
@@ -47,14 +47,14 @@ import org.apache.commons.lang3.ClassUtils;
*
* <p>This will produce a toString of the format:
* <code>Person@7f54[name=Stephen,age=29,smoker=false,job=Job@43cd2[title=Manager]]</code></p>
- *
+ *
* @since 3.2
*/
public class RecursiveToStringStyle extends ToStringStyle {
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 1L;
@@ -83,7 +83,7 @@ public class RecursiveToStringStyle extends ToStringStyle {
appendIdentityHashCode(buffer, coll);
appendDetail(buffer, fieldName, coll.toArray());
}
-
+
/**
* Returns whether or not to recursively format the given <code>Class</code>.
* By default, this method always returns {@code true}, but may be overwritten by
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
----------------------------------------------------------------------
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 b1952dd..887368e 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
@@ -33,18 +33,18 @@ import org.apache.commons.lang3.reflect.FieldUtils;
* of the objects to diff are discovered using reflection and compared
* for differences.
* </p>
- *
+ *
* <p>
* To use this class, write code as follows:
* </p>
- *
+ *
* <pre>
* public class Person implements Diffable<Person> {
* String name;
* int age;
* boolean smoker;
* ...
- *
+ *
* public DiffResult diff(Person obj) {
* // No need for null check, as NullPointerException correct if obj is null
* return new ReflectionDiffBuilder(this, obj, ToStringStyle.SHORT_PREFIX_STYLE)
@@ -52,7 +52,7 @@ import org.apache.commons.lang3.reflect.FieldUtils;
* }
* }
* </pre>
- *
+ *
* <p>
* The {@code ToStringStyle} passed to the constructor is embedded in the
* returned {@code DiffResult} and influences the style of the
@@ -75,7 +75,7 @@ public class ReflectionDiffBuilder implements Builder<DiffResult> {
* <p>
* Constructs a builder for the specified objects with the specified style.
* </p>
- *
+ *
* <p>
* If {@code lhs == rhs} or {@code lhs.equals(rhs)} then the builder will
* not evaluate any calls to {@code append(...)} and will return an empty
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
index 5e512d3..3716bc1 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
@@ -80,7 +80,7 @@ import org.apache.commons.lang3.Validate;
* }
* </pre>
* <p>
- * Alternatively the {@link ToStringExclude} annotation can be used to exclude fields from being incorporated in the
+ * Alternatively the {@link ToStringExclude} annotation can be used to exclude fields from being incorporated in the
* result.
* </p>
* <p>
@@ -238,7 +238,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* @return the String result
* @throws IllegalArgumentException
* if the Object is <code>null</code>
- *
+ *
* @see ToStringExclude
* @since 2.1
*/
@@ -291,7 +291,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* @return the String result
* @throws IllegalArgumentException
* if the Object is <code>null</code>
- *
+ *
* @see ToStringExclude
* @since 2.1
*/
@@ -301,7 +301,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
return new ReflectionToStringBuilder(object, style, null, reflectUpToClass, outputTransients, outputStatics)
.toString();
}
-
+
/**
* <p>
* Builds a <code>toString</code> value through reflection.
@@ -349,7 +349,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* @return the String result
* @throws IllegalArgumentException
* if the Object is <code>null</code>
- *
+ *
* @see ToStringExclude
* @since 3.6
*/
@@ -421,7 +421,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
public static String toStringExclude(final Object object, final String... excludeFieldNames) {
return new ReflectionToStringBuilder(object).setExcludeFieldNames(excludeFieldNames).toString();
}
-
+
private static Object checkNotNull(final Object obj) {
Validate.isTrue(obj != null, "The Object passed in should not be null.");
return obj;
@@ -436,7 +436,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* Whether or not to append transient fields.
*/
private boolean appendTransients = false;
-
+
/**
* Whether or not to append fields that are null.
*/
@@ -545,7 +545,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
this.setAppendTransients(outputTransients);
this.setAppendStatics(outputStatics);
}
-
+
/**
* Constructor.
*
@@ -715,7 +715,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
public boolean isAppendTransients() {
return this.appendTransients;
}
-
+
/**
* <p>
* Gets whether or not to append fields whose values are null.
@@ -766,7 +766,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
public void setAppendTransients(final boolean appendTransients) {
this.appendTransients = appendTransients;
}
-
+
/**
* <p>
* Sets whether or not to append fields whose values are null.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/StandardToStringStyle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/StandardToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/StandardToStringStyle.java
index b9ba30c..f87d5b5 100644
--- a/src/main/java/org/apache/commons/lang3/builder/StandardToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/StandardToStringStyle.java
@@ -5,9 +5,9 @@
* 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.
@@ -28,10 +28,10 @@ package org.apache.commons.lang3.builder;
* @since 1.0
*/
public class StandardToStringStyle extends ToStringStyle {
-
+
/**
* Required for serialization support.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 1L;
@@ -42,9 +42,9 @@ public class StandardToStringStyle extends ToStringStyle {
public StandardToStringStyle() {
super();
}
-
+
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to use the class name.</p>
*
@@ -66,7 +66,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to output short or long class names.</p>
*
@@ -90,7 +90,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to use the identity hash code.</p>
* @return the current useIdentityHashCode flag
@@ -111,7 +111,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to use the field names passed in.</p>
*
@@ -133,7 +133,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to use full detail when the caller doesn't
* specify.</p>
@@ -157,7 +157,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets whether to output array content detail.</p>
*
@@ -167,7 +167,7 @@ public class StandardToStringStyle extends ToStringStyle {
public boolean isArrayContentDetail() { // NOPMD as this is implementing the abstract class
return super.isArrayContentDetail();
}
-
+
/**
* <p>Sets whether to output array content detail.</p>
*
@@ -179,7 +179,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the array start text.</p>
*
@@ -204,7 +204,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the array end text.</p>
*
@@ -229,7 +229,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the array separator text.</p>
*
@@ -254,7 +254,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the content start text.</p>
*
@@ -279,7 +279,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the content end text.</p>
*
@@ -304,7 +304,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the field name value separator text.</p>
*
@@ -329,7 +329,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the field separator text.</p>
*
@@ -354,11 +354,11 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
- * <p>Gets whether the field separator should be added at the start
+ * <p>Gets whether the field separator should be added at the start
* of each buffer.</p>
- *
+ *
* @return the fieldSeparatorAtStart flag
* @since 2.0
*/
@@ -368,9 +368,9 @@ public class StandardToStringStyle extends ToStringStyle {
}
/**
- * <p>Sets whether the field separator should be added at the start
+ * <p>Sets whether the field separator should be added at the start
* of each buffer.</p>
- *
+ *
* @param fieldSeparatorAtStart the fieldSeparatorAtStart flag
* @since 2.0
*/
@@ -380,11 +380,11 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
- * <p>Gets whether the field separator should be added at the end
+ * <p>Gets whether the field separator should be added at the end
* of each buffer.</p>
- *
+ *
* @return fieldSeparatorAtEnd flag
* @since 2.0
*/
@@ -394,9 +394,9 @@ public class StandardToStringStyle extends ToStringStyle {
}
/**
- * <p>Sets whether the field separator should be added at the end
+ * <p>Sets whether the field separator should be added at the end
* of each buffer.</p>
- *
+ *
* @param fieldSeparatorAtEnd the fieldSeparatorAtEnd flag
* @since 2.0
*/
@@ -406,7 +406,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the text to output when <code>null</code> found.</p>
*
@@ -431,7 +431,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the text to output when a <code>Collection</code>,
* <code>Map</code> or <code>Array</code> size is output.</p>
@@ -462,7 +462,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the end text to output when a <code>Collection</code>,
* <code>Map</code> or <code>Array</code> size is output.</p>
@@ -493,7 +493,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the start text to output when an <code>Object</code> is
* output in summary mode.</p>
@@ -524,7 +524,7 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
/**
* <p>Gets the end text to output when an <code>Object</code> is
* output in summary mode.</p>
@@ -555,5 +555,5 @@ public class StandardToStringStyle extends ToStringStyle {
}
//---------------------------------------------------------------------
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
index 645525e..375efb7 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
@@ -168,10 +168,10 @@ public abstract class ToStringStyle implements Serializable {
/*
* Note that objects of this class are generally shared between threads, so
* an instance variable would not be suitable here.
- *
+ *
* In normal use the registry should always be left empty, because the caller
* should call toString() which will clean up.
- *
+ *
* See LANG-792
*/
@@ -2602,7 +2602,7 @@ public abstract class ToStringStyle implements Serializable {
/**
* Appends the given String in parenthesis to the given StringBuffer.
- *
+ *
* @param buffer the StringBuffer to append the value to.
* @param value the value to append.
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
----------------------------------------------------------------------
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 b25a51a..3882b81 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
@@ -251,9 +251,9 @@ public class BasicThreadFactory implements ThreadFactory {
* </p>
*
*/
- public static class Builder
+ public static class Builder
implements org.apache.commons.lang3.builder.Builder<BasicThreadFactory> {
-
+
/** The wrapped factory. */
private ThreadFactory wrappedFactory;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/concurrent/Computable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/Computable.java b/src/main/java/org/apache/commons/lang3/concurrent/Computable.java
index 6cb37aa..c949f08 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/Computable.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/Computable.java
@@ -23,7 +23,7 @@ package org.apache.commons.lang3.concurrent;
*
* @param <I> the type of the input to the calculation
* @param <O> the type of the output of the calculation
- *
+ *
* @since 3.6
*/
public interface Computable<I, O> {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java b/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java
index d024524..dcbea8a 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java
@@ -144,7 +144,7 @@ public class ConcurrentUtils {
static Throwable checkedException(final Throwable ex) {
Validate.isTrue(ex != null && !(ex instanceof RuntimeException)
&& !(ex instanceof Error), "Not a checked exception: " + ex);
-
+
return ex;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
index fb2c154..cae0646 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
@@ -48,7 +48,7 @@ import java.util.concurrent.FutureTask;
* the type of the input to the calculation
* @param <O>
* the type of the output of the calculation
- *
+ *
* @since 3.6
*/
public class Memoizer<I, O> implements Computable<I, O> {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/exception/CloneFailedException.java
----------------------------------------------------------------------
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 138b250..ae534b4 100644
--- a/src/main/java/org/apache/commons/lang3/exception/CloneFailedException.java
+++ b/src/main/java/org/apache/commons/lang3/exception/CloneFailedException.java
@@ -5,9 +5,9 @@
* 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.
@@ -19,7 +19,7 @@ package org.apache.commons.lang3.exception;
/**
* Exception thrown when a clone cannot be created. In contrast to
* {@link CloneNotSupportedException} this is a {@link RuntimeException}.
- *
+ *
* @since 3.0
*/
public class CloneFailedException extends RuntimeException {
@@ -31,7 +31,7 @@ public class CloneFailedException extends RuntimeException {
/**
* Constructs a CloneFailedException.
- *
+ *
* @param message description of the exception
* @since upcoming
*/
@@ -41,7 +41,7 @@ public class CloneFailedException extends RuntimeException {
/**
* Constructs a CloneFailedException.
- *
+ *
* @param cause cause of the exception
* @since upcoming
*/
@@ -51,7 +51,7 @@ public class CloneFailedException extends RuntimeException {
/**
* Constructs a CloneFailedException.
- *
+ *
* @param message description of the exception
* @param cause cause of the exception
* @since upcoming
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/exception/ContextedException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/exception/ContextedException.java b/src/main/java/org/apache/commons/lang3/exception/ContextedException.java
index 326152a..4ab95f3 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ContextedException.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ContextedException.java
@@ -5,9 +5,9 @@
* 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.
@@ -80,7 +80,7 @@ import org.apache.commons.lang3.tuple.Pair;
* at org.apache.commons.lang3.exception.ContextedExceptionTest.testAddValue(ContextedExceptionTest.java:88)
* ..... (rest of trace)
* </pre>
- *
+ *
* @see ContextedRuntimeException
* @since 3.0
*/
@@ -105,7 +105,7 @@ public class ContextedException extends Exception implements ExceptionContext {
* Instantiates ContextedException with message, but without cause.
* <p>
* The context information is stored using a default implementation.
- *
+ *
* @param message the exception message, may be null
*/
public ContextedException(final String message) {
@@ -117,7 +117,7 @@ public class ContextedException extends Exception implements ExceptionContext {
* Instantiates ContextedException with cause, but without message.
* <p>
* The context information is stored using a default implementation.
- *
+ *
* @param cause the underlying cause of the exception, may be null
*/
public ContextedException(final Throwable cause) {
@@ -129,7 +129,7 @@ public class ContextedException extends Exception implements ExceptionContext {
* Instantiates ContextedException with cause and message.
* <p>
* The context information is stored using a default implementation.
- *
+ *
* @param message the exception message, may be null
* @param cause the underlying cause of the exception, may be null
*/
@@ -140,7 +140,7 @@ public class ContextedException extends Exception implements ExceptionContext {
/**
* Instantiates ContextedException with cause, message, and ExceptionContext.
- *
+ *
* @param message the exception message, may be null
* @param cause the underlying cause of the exception, may be null
* @param context the context used to store the additional information, null uses default implementation
@@ -162,13 +162,13 @@ public class ContextedException extends Exception implements ExceptionContext {
* <p>
* Note: This exception is only serializable if the object added is serializable.
* </p>
- *
+ *
* @param label a textual label associated with information, {@code null} not recommended
* @param value information needed to understand exception, may be {@code null}
* @return {@code this}, for method chaining, not {@code null}
*/
@Override
- public ContextedException addContextValue(final String label, final Object value) {
+ public ContextedException addContextValue(final String label, final Object value) {
exceptionContext.addContextValue(label, value);
return this;
}
@@ -181,13 +181,13 @@ public class ContextedException extends Exception implements ExceptionContext {
* <p>
* Note: This exception is only serializable if the object added as value is serializable.
* </p>
- *
+ *
* @param label a textual label associated with information, {@code null} not recommended
* @param value information needed to understand exception, may be {@code null}
* @return {@code this}, for method chaining, not {@code null}
*/
@Override
- public ContextedException setContextValue(final String label, final Object value) {
+ public ContextedException setContextValue(final String label, final Object value) {
exceptionContext.setContextValue(label, value);
return this;
}
@@ -226,7 +226,7 @@ public class ContextedException extends Exception implements ExceptionContext {
/**
* Provides the message explaining the exception, including the contextual data.
- *
+ *
* @see java.lang.Throwable#getMessage()
* @return the message, never null
*/
@@ -237,7 +237,7 @@ public class ContextedException extends Exception implements ExceptionContext {
/**
* Provides the message explaining the exception without the contextual data.
- *
+ *
* @see java.lang.Throwable#getMessage()
* @return the message
* @since 3.0.1
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java b/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
index 0120883..9b904fc 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
@@ -5,9 +5,9 @@
* 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.
@@ -80,7 +80,7 @@ import org.apache.commons.lang3.tuple.Pair;
* at org.apache.commons.lang3.exception.ContextedRuntimeExceptionTest.testAddValue(ContextedExceptionTest.java:88)
* ..... (rest of trace)
* </pre>
- *
+ *
* @see ContextedException
* @since 3.0
*/
@@ -105,7 +105,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
* Instantiates ContextedRuntimeException with message, but without cause.
* <p>
* The context information is stored using a default implementation.
- *
+ *
* @param message the exception message, may be null
*/
public ContextedRuntimeException(final String message) {
@@ -117,7 +117,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
* Instantiates ContextedRuntimeException with cause, but without message.
* <p>
* The context information is stored using a default implementation.
- *
+ *
* @param cause the underlying cause of the exception, may be null
*/
public ContextedRuntimeException(final Throwable cause) {
@@ -129,7 +129,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
* Instantiates ContextedRuntimeException with cause and message.
* <p>
* The context information is stored using a default implementation.
- *
+ *
* @param message the exception message, may be null
* @param cause the underlying cause of the exception, may be null
*/
@@ -140,7 +140,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
/**
* Instantiates ContextedRuntimeException with cause, message, and ExceptionContext.
- *
+ *
* @param message the exception message, may be null
* @param cause the underlying cause of the exception, may be null
* @param context the context used to store the additional information, null uses default implementation
@@ -162,13 +162,13 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
* <p>
* Note: This exception is only serializable if the object added is serializable.
* </p>
- *
+ *
* @param label a textual label associated with information, {@code null} not recommended
* @param value information needed to understand exception, may be {@code null}
* @return {@code this}, for method chaining, not {@code null}
*/
@Override
- public ContextedRuntimeException addContextValue(final String label, final Object value) {
+ public ContextedRuntimeException addContextValue(final String label, final Object value) {
exceptionContext.addContextValue(label, value);
return this;
}
@@ -181,13 +181,13 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
* <p>
* Note: This exception is only serializable if the object added as value is serializable.
* </p>
- *
+ *
* @param label a textual label associated with information, {@code null} not recommended
* @param value information needed to understand exception, may be {@code null}
* @return {@code this}, for method chaining, not {@code null}
*/
@Override
- public ContextedRuntimeException setContextValue(final String label, final Object value) {
+ public ContextedRuntimeException setContextValue(final String label, final Object value) {
exceptionContext.setContextValue(label, value);
return this;
}
@@ -226,7 +226,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
/**
* Provides the message explaining the exception, including the contextual data.
- *
+ *
* @see java.lang.Throwable#getMessage()
* @return the message, never null
*/
@@ -237,7 +237,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
/**
* Provides the message explaining the exception without the contextual data.
- *
+ *
* @see java.lang.Throwable#getMessage()
* @return the message
* @since 3.0.1
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java
----------------------------------------------------------------------
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 17d98a4..69a4ccf 100644
--- a/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java
+++ b/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java
@@ -5,9 +5,9 @@
* 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.
@@ -33,7 +33,7 @@ import org.apache.commons.lang3.tuple.Pair;
* This implementation is serializable, however this is dependent on the values that
* are added also being serializable.
* </p>
- *
+ *
* @see ContextedException
* @see ContextedRuntimeException
* @since 3.0
@@ -119,7 +119,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable {
/**
* Builds the message containing the contextual information.
- *
+ *
* @param baseMessage the base exception message <b>without</b> context information appended
* @return the exception message <b>with</b> context information appended, never null
*/
@@ -129,13 +129,13 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable {
if (baseMessage != null) {
buffer.append(baseMessage);
}
-
+
if (contextValues.size() > 0) {
if (buffer.length() > 0) {
buffer.append('\n');
}
buffer.append("Exception Context:\n");
-
+
int i = 0;
for (final Pair<String, Object> pair : contextValues) {
buffer.append("\t[");
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/exception/ExceptionContext.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionContext.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionContext.java
index 1e84659..f055d5b 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionContext.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionContext.java
@@ -5,9 +5,9 @@
* 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.
@@ -28,7 +28,7 @@ import org.apache.commons.lang3.tuple.Pair;
* Implementations are expected to manage the pairs in a list-style collection
* that keeps the pairs in the sequence of their addition.
* </p>
- *
+ *
* @see ContextedException
* @see ContextedRuntimeException
* @since 3.0
@@ -41,7 +41,7 @@ public interface ExceptionContext {
* The pair will be added to the context, independently of an already
* existing pair with the same label.
* </p>
- *
+ *
* @param label the label of the item to add, {@code null} not recommended
* @param value the value of item to add, may be {@code null}
* @return {@code this}, for method chaining, not {@code null}
@@ -54,7 +54,7 @@ public interface ExceptionContext {
* The pair will be added normally, but any existing label-value pair with
* the same label is removed from the context.
* </p>
- *
+ *
* @param label the label of the item to add, {@code null} not recommended
* @param value the value of item to add, may be {@code null}
* @return {@code this}, for method chaining, not {@code null}
@@ -63,7 +63,7 @@ public interface ExceptionContext {
/**
* Retrieves all the contextual data values associated with the label.
- *
+ *
* @param label the label to get the contextual values for, may be {@code null}
* @return the contextual values associated with the label, never {@code null}
*/
@@ -71,7 +71,7 @@ public interface ExceptionContext {
/**
* Retrieves the first available contextual data value associated with the label.
- *
+ *
* @param label the label to get the contextual value for, may be {@code null}
* @return the first contextual value associated with the label, may be {@code null}
*/
@@ -79,14 +79,14 @@ public interface ExceptionContext {
/**
* Retrieves the full set of labels defined in the contextual data.
- *
+ *
* @return the set of labels, not {@code null}
*/
Set<String> getContextLabels();
/**
* Retrieves the full list of label-value pairs defined in the contextual data.
- *
+ *
* @return the list of pairs, not {@code null}
*/
List<Pair<String, Object>> getContextEntries();
@@ -94,7 +94,7 @@ public interface ExceptionContext {
/**
* Gets the contextualized error message based on a base message.
* This will add the context label-value pairs to the message.
- *
+ *
* @param baseMessage the base exception message <b>without</b> context information appended
* @return the exception message <b>with</b> context information appended, not {@code null}
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
index 63510f0..0318512 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -32,13 +32,13 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
/**
- * <p>Provides utilities for manipulating and examining
+ * <p>Provides utilities for manipulating and examining
* <code>Throwable</code> objects.</p>
*
* @since 1.0
*/
public class ExceptionUtils {
-
+
/**
* <p>Used when printing stack frames to denote the start of a
* wrapped exception.</p>
@@ -95,7 +95,7 @@ public class ExceptionUtils {
/**
* <p>Introspects the <code>Throwable</code> to obtain the cause.</p>
*
- * <p>The method searches for methods with specific names that return a
+ * <p>The method searches for methods with specific names that return a
* <code>Throwable</code> object. This will pick up most wrapping exceptions,
* including those from JDK 1.4.
*
@@ -110,7 +110,7 @@ public class ExceptionUtils {
* <li><code>getCausedByException()</code></li>
* <li><code>getNested()</code></li>
* </ul>
- *
+ *
* <p>If none of the above is found, returns <code>null</code>.</p>
*
* @param throwable the throwable to introspect for a cause, may be null
@@ -628,7 +628,7 @@ public class ExceptionUtils {
* <p>This works in most cases - it will only fail if the exception
* message contains a line that starts with:
* <code>" at".</code></p>
- *
+ *
* @param t is any throwable
* @return List of stack frames
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/math/Fraction.java
----------------------------------------------------------------------
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 d4b8ae0..e59789d 100644
--- a/src/main/java/org/apache/commons/lang3/math/Fraction.java
+++ b/src/main/java/org/apache/commons/lang3/math/Fraction.java
@@ -5,9 +5,9 @@
* 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.
@@ -28,7 +28,7 @@ import org.apache.commons.lang3.Validate;
* a <code>Number</code>.</p>
*
* <p>Note that this class is intended for common use cases, it is <i>int</i>
- * based and thus suffers from various overflow issues. For a BigInteger based
+ * based and thus suffers from various overflow issues. For a BigInteger based
* equivalent, please see the Commons Math BigFraction class. </p>
*
* @since 2.0
@@ -37,7 +37,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
/**
* Required for serialization support. Lang version 2.0.
- *
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 65382027393090L;
@@ -166,7 +166,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
* @throws ArithmeticException if the denominator is <code>zero</code>
* @throws ArithmeticException if the denominator is negative
* @throws ArithmeticException if the numerator is negative
- * @throws ArithmeticException if the resulting numerator exceeds
+ * @throws ArithmeticException if the resulting numerator exceeds
* <code>Integer.MAX_VALUE</code>
*/
public static Fraction getFraction(final int whole, final int numerator, final int denominator) {
@@ -240,7 +240,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
*
* @param value the double value to convert
* @return a new fraction instance that is close to the value
- * @throws ArithmeticException if <code>|value| > Integer.MAX_VALUE</code>
+ * @throws ArithmeticException if <code>|value| > Integer.MAX_VALUE</code>
* or <code>value = NaN</code>
* @throws ArithmeticException if the calculated denominator is <code>zero</code>
* @throws ArithmeticException if the the algorithm does not converge
@@ -454,7 +454,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
/**
* <p>Reduce the fraction to the smallest values for the numerator and
* denominator, returning the result.</p>
- *
+ *
* <p>For example, if this fraction represents 2/4, then the result
* will be 1/2.</p>
*
@@ -473,7 +473,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
/**
* <p>Gets a fraction that is the inverse (1/fraction) of this one.</p>
- *
+ *
* <p>The returned fraction is not reduced.</p>
*
* @return a new fraction instance with the numerator and denominator
@@ -531,7 +531,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
*
* @param power the power to raise the fraction to
* @return <code>this</code> if the power is one, <code>ONE</code> if the power
- * is zero (even if the fraction equals ZERO) or a new fraction instance
+ * is zero (even if the fraction equals ZERO) or a new fraction instance
* raised to the appropriate power
* @throws ArithmeticException if the resulting numerator or denominator exceeds
* <code>Integer.MAX_VALUE</code>
@@ -625,9 +625,9 @@ public final class Fraction extends Number implements Comparable<Fraction> {
// Arithmetic
//-------------------------------------------------------------------
- /**
+ /**
* Multiply two integers, checking for overflow.
- *
+ *
* @param x a factor
* @param y a factor
* @return the product <code>x*y</code>
@@ -641,10 +641,10 @@ public final class Fraction extends Number implements Comparable<Fraction> {
}
return (int) m;
}
-
+
/**
* Multiply two non-negative integers, checking for overflow.
- *
+ *
* @param x a non-negative factor
* @param y a non-negative factor
* @return the product <code>x*y</code>
@@ -659,10 +659,10 @@ public final class Fraction extends Number implements Comparable<Fraction> {
}
return (int) m;
}
-
- /**
+
+ /**
* Add two integers, checking for overflow.
- *
+ *
* @param x an addend
* @param y an addend
* @return the sum <code>x+y</code>
@@ -676,10 +676,10 @@ public final class Fraction extends Number implements Comparable<Fraction> {
}
return (int) s;
}
-
- /**
+
+ /**
* Subtract two integers, checking for overflow.
- *
+ *
* @param x the minuend
* @param y the subtrahend
* @return the difference <code>x-y</code>
@@ -693,7 +693,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
}
return (int) s;
}
-
+
/**
* <p>Adds the value of this fraction to another, returning the result in reduced form.
* The algorithm follows Knuth, 4.5.1.</p>
@@ -709,7 +709,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
}
/**
- * <p>Subtracts the value of another fraction from the value of this one,
+ * <p>Subtracts the value of another fraction from the value of this one,
* returning the result in reduced form.</p>
*
* @param fraction the fraction to subtract, must not be <code>null</code>
@@ -722,9 +722,9 @@ public final class Fraction extends Number implements Comparable<Fraction> {
return addSub(fraction, false /* subtract */);
}
- /**
+ /**
* Implement add and subtract using algorithm described in Knuth 4.5.1.
- *
+ *
* @param fraction the fraction to subtract, must not be <code>null</code>
* @param isAdd true to add, false to subtract
* @return a <code>Fraction</code> instance with the resulting values
@@ -771,7 +771,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
}
/**
- * <p>Multiplies the value of this fraction by another, returning the
+ * <p>Multiplies the value of this fraction by another, returning the
* result in reduced form.</p>
*
* @param fraction the fraction to multiply by, must not be <code>null</code>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java b/src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java
index 6142832..8cd351b 100644
--- a/src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/IEEE754rUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -26,10 +26,10 @@ import org.apache.commons.lang3.Validate;
* @since 2.4
*/
public class IEEE754rUtils {
-
+
/**
* <p>Returns the minimum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -39,19 +39,19 @@ public class IEEE754rUtils {
public static double min(final double... array) {
Validate.isTrue(array != null, "The Array must not be null");
Validate.isTrue(array.length != 0, "Array cannot be empty.");
-
+
// Finds and returns min
double min = array[0];
for (int i = 1; i < array.length; i++) {
min = min(array[i], min);
}
-
+
return min;
}
/**
* <p>Returns the minimum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -61,21 +61,21 @@ public class IEEE754rUtils {
public static float min(final float... array) {
Validate.isTrue(array != null, "The Array must not be null");
Validate.isTrue(array.length != 0, "Array cannot be empty.");
-
+
// Finds and returns min
float min = array[0];
for (int i = 1; i < array.length; i++) {
min = min(array[i], min);
}
-
+
return min;
}
/**
* <p>Gets the minimum of three <code>double</code> values.</p>
- *
+ *
* <p>NaN is only returned if all numbers are NaN as per IEEE-754r. </p>
- *
+ *
* @param a value 1
* @param b value 2
* @param c value 3
@@ -87,9 +87,9 @@ public class IEEE754rUtils {
/**
* <p>Gets the minimum of two <code>double</code> values.</p>
- *
+ *
* <p>NaN is only returned if all numbers are NaN as per IEEE-754r. </p>
- *
+ *
* @param a value 1
* @param b value 2
* @return the smallest of the values
@@ -107,7 +107,7 @@ public class IEEE754rUtils {
/**
* <p>Gets the minimum of three <code>float</code> values.</p>
- *
+ *
* <p>NaN is only returned if all numbers are NaN as per IEEE-754r. </p>
*
* @param a value 1
@@ -121,7 +121,7 @@ public class IEEE754rUtils {
/**
* <p>Gets the minimum of two <code>float</code> values.</p>
- *
+ *
* <p>NaN is only returned if all numbers are NaN as per IEEE-754r. </p>
*
* @param a value 1
@@ -141,7 +141,7 @@ public class IEEE754rUtils {
/**
* <p>Returns the maximum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -151,19 +151,19 @@ public class IEEE754rUtils {
public static double max(final double... array) {
Validate.isTrue(array != null, "The Array must not be null");
Validate.isTrue(array.length != 0, "Array cannot be empty.");
-
+
// Finds and returns max
double max = array[0];
for (int j = 1; j < array.length; j++) {
max = max(array[j], max);
}
-
+
return max;
}
/**
* <p>Returns the maximum value in an array.</p>
- *
+ *
* @param array an array, must not be null or empty
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
@@ -173,7 +173,7 @@ public class IEEE754rUtils {
public static float max(final float... array) {
Validate.isTrue(array != null, "The Array must not be null");
Validate.isTrue(array.length != 0, "Array cannot be empty.");
-
+
// Finds and returns max
float max = array[0];
for (int j = 1; j < array.length; j++) {
@@ -182,10 +182,10 @@ public class IEEE754rUtils {
return max;
}
-
+
/**
* <p>Gets the maximum of three <code>double</code> values.</p>
- *
+ *
* <p>NaN is only returned if all numbers are NaN as per IEEE-754r. </p>
*
* @param a value 1
@@ -199,7 +199,7 @@ public class IEEE754rUtils {
/**
* <p>Gets the maximum of two <code>double</code> values.</p>
- *
+ *
* <p>NaN is only returned if all numbers are NaN as per IEEE-754r. </p>
*
* @param a value 1
@@ -219,7 +219,7 @@ public class IEEE754rUtils {
/**
* <p>Gets the maximum of three <code>float</code> values.</p>
- *
+ *
* <p>NaN is only returned if all numbers are NaN as per IEEE-754r. </p>
*
* @param a value 1
@@ -233,7 +233,7 @@ public class IEEE754rUtils {
/**
* <p>Gets the maximum of two <code>float</code> values.</p>
- *
+ *
* <p>NaN is only returned if all numbers are NaN as per IEEE-754r. </p>
*
* @param a value 1
[08/48] [lang] [LANG-1304] StringUtils method to check for mixed case
in string (closes #223)
Posted by br...@apache.org.
[LANG-1304] StringUtils method to check for mixed case in string (closes #223)
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/ef3015cc
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/ef3015cc
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/ef3015cc
Branch: refs/heads/release
Commit: ef3015cc99f7bd51862c1d95014e8332d24c2341
Parents: ebe7bb5
Author: Andy Klimczak <an...@fastmail.com>
Authored: Thu Dec 29 21:01:12 2016 -0500
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu May 25 16:14:46 2017 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/StringUtils.java | 41 ++++++++++++++++++++
.../apache/commons/lang3/StringUtilsTest.java | 23 +++++++++++
3 files changed, 65 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ef3015cc/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1761d8e..cb2cbf3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="3.6" date="2017-MM-DD" description="TBD">
+ <action issue="LANG-1304" type="add" dev="pschumacher" due-to="Andy Klimczak">Add method in StringUtils to determine if string contains both mixed cased characters</action>
<action issue="LANG-1334" type="update" dev="djones">Deprecate CharEncoding in favour of java.nio.charset.StandardCharsets</action>
<action issue="LANG-1319" type="fix" dev="djones">MultilineRecursiveToStringStyle StackOverflowError when object is an array</action>
<action issue="LANG-1325" type="add" dev="kinow" due-to="Arshad Basha">Increase test coverage of ToStringBuilder class to 100%</action>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ef3015cc/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 7134853..7f64322 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -7303,6 +7303,47 @@ public class StringUtils {
return true;
}
+ /**
+ * <p>Checks if the CharSequence contains mixed casing of both uppercase and lowercase characters.</p>
+ *
+ * <p>{@code null} will return {@code false}. An empty CharSequence ({@code length()=0}) will return
+ * {@code false}.</p>
+ *
+ * <pre>
+ * StringUtils.isMixedCase(null) = false
+ * StringUtils.isMixedCase("") = false
+ * StringUtils.isMixedCase("ABC") = false
+ * StringUtils.isMixedCase("abc") = false
+ * StringUtils.isMixedCase("aBc") = true
+ * StringUtils.isMixedCase("A c") = true
+ * StringUtils.isMixedCase("A1c") = true
+ * StringUtils.isMixedCase("a/C") = true
+ * StringUtils.isMixedCase("aC\t") = true
+ * </pre>
+ *
+ * @param cs the CharSequence to check, may be null
+ * @return {@code true} if the CharSequence contains both uppercase and lowercase characters
+ * @since 3.5
+ */
+ public static boolean isMixedCase(final CharSequence cs) {
+ if (isEmpty(cs) || cs.length() == 1) {
+ return false;
+ }
+ boolean containsUppercase = false;
+ boolean containsLowercase = false;
+ final int sz = cs.length();
+ for (int i = 0; i < sz; i++) {
+ if (containsUppercase && containsLowercase) {
+ return true;
+ } else if (Character.isUpperCase(cs.charAt(i))) {
+ containsUppercase = true;
+ } else if (Character.isLowerCase(cs.charAt(i))) {
+ containsLowercase = true;
+ }
+ }
+ return containsUppercase && containsLowercase;
+ }
+
// Defaults
//-----------------------------------------------------------------------
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ef3015cc/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 3051b47..2b49669 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -2581,6 +2581,29 @@ public class StringUtilsTest {
assertFalse(StringUtils.isAllUpperCase("A/C"));
}
+ /**
+ * Test for {@link StringUtils#isMixedCase(CharSequence)}.
+ */
+ @Test
+ public void testIsMixedCase() {
+ assertFalse(StringUtils.isMixedCase(null));
+ assertFalse(StringUtils.isMixedCase(StringUtils.EMPTY));
+ assertFalse(StringUtils.isMixedCase(" "));
+ assertFalse(StringUtils.isMixedCase("A"));
+ assertFalse(StringUtils.isMixedCase("a"));
+ assertFalse(StringUtils.isMixedCase("/"));
+ assertFalse(StringUtils.isMixedCase("A/"));
+ assertFalse(StringUtils.isMixedCase("/b"));
+ assertFalse(StringUtils.isMixedCase("abc"));
+ assertFalse(StringUtils.isMixedCase("ABC"));
+ assertTrue(StringUtils.isMixedCase("aBc"));
+ assertTrue(StringUtils.isMixedCase("aBc "));
+ assertTrue(StringUtils.isMixedCase("A c"));
+ assertTrue(StringUtils.isMixedCase("aBc\n"));
+ assertTrue(StringUtils.isMixedCase("A1c"));
+ assertTrue(StringUtils.isMixedCase("a/C"));
+ }
+
@Test
public void testRemoveStart() {
// StringUtils.removeStart("", *) = ""
[10/48] [lang] Add missing '@Deprecated' annotations.
Posted by br...@apache.org.
Add missing '@Deprecated' annotations.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/8cfc1b12
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/8cfc1b12
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/8cfc1b12
Branch: refs/heads/release
Commit: 8cfc1b1207577943d412789765a3a2085f1b3036
Parents: 6a688cf
Author: Gary Gregory <gg...@apache.org>
Authored: Thu May 25 09:28:33 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Thu May 25 09:28:33 2017 -0700
----------------------------------------------------------------------
src/main/java/org/apache/commons/lang3/CharEncoding.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8cfc1b12/src/main/java/org/apache/commons/lang3/CharEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharEncoding.java b/src/main/java/org/apache/commons/lang3/CharEncoding.java
index 65dca33..634b3af 100644
--- a/src/main/java/org/apache/commons/lang3/CharEncoding.java
+++ b/src/main/java/org/apache/commons/lang3/CharEncoding.java
@@ -96,6 +96,7 @@ public class CharEncoding {
* @deprecated Please use {@link Charset#isSupported(String)} instead, although be aware that {@code null}
* values are not accepted by that method and an {@link IllegalCharsetNameException} may be thrown.
*/
+ @Deprecated
public static boolean isSupported(final String name) {
if (name == null) {
return false;
[40/48] [lang] Merge branch 'LANG-1337'
Posted by br...@apache.org.
Merge branch 'LANG-1337'
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/21bab1d3
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/21bab1d3
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/21bab1d3
Branch: refs/heads/release
Commit: 21bab1d3a0b48c37592686fed7e1b2025fbf78aa
Parents: 309b34f c68285b
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed Jun 7 09:57:05 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed Jun 7 09:57:05 2017 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/builder/ToStringBuilderTest.java | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/21bab1d3/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
----------------------------------------------------------------------
[35/48] [lang] Make sure placement of curly braces is consistent
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
index 524140f..ab98319 100644
--- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
@@ -1076,8 +1076,7 @@ public class ClassUtilsTest {
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 ) {
+ } catch( final Exception e ) {
assertTrue( exceptionType.isAssignableFrom( e.getClass() ) );
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
index d9a5bde..4912ece 100644
--- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
@@ -179,8 +179,7 @@ public class SerializationUtilsTest {
};
try {
SerializationUtils.serialize(iMap, streamTest);
- }
- catch(final SerializationException e) {
+ } catch(final SerializationException e) {
assertEquals("java.io.IOException: " + SERIALIZE_IO_EXCEPTION_MESSAGE, e.getMessage());
}
}
@@ -422,8 +421,7 @@ public class SerializationUtilsTest {
}
-class ClassNotFoundSerialization implements Serializable
-{
+class ClassNotFoundSerialization implements Serializable {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/ValidateTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ValidateTest.java b/src/test/java/org/apache/commons/lang3/ValidateTest.java
index 958c6d3..e5d077a 100644
--- a/src/test/java/org/apache/commons/lang3/ValidateTest.java
+++ b/src/test/java/org/apache/commons/lang3/ValidateTest.java
@@ -40,7 +40,7 @@ import org.junit.Test;
/**
* Unit tests {@link org.apache.commons.lang3.Validate}.
*/
-public class ValidateTest {
+public class ValidateTest {
//-----------------------------------------------------------------------
@Test
@@ -141,7 +141,7 @@ public class ValidateTest {
//-----------------------------------------------------------------------
@Test
public void testNotEmptyArray1() {
- Validate.notEmpty(new Object[] {null});
+ Validate.notEmpty(new Object[]{null});
try {
Validate.notEmpty((Object[]) null);
fail("Expecting NullPointerException");
@@ -155,7 +155,7 @@ public class ValidateTest {
assertEquals("The validated array is empty", ex.getMessage());
}
- final String[] array = new String[] {"hi"};
+ final String[] array = new String[]{"hi"};
final String[] test = Validate.notEmpty(array);
assertSame(array, test);
}
@@ -163,7 +163,7 @@ public class ValidateTest {
//-----------------------------------------------------------------------
@Test
public void testNotEmptyArray2() {
- Validate.notEmpty(new Object[] {null}, "MSG");
+ Validate.notEmpty(new Object[]{null}, "MSG");
try {
Validate.notEmpty((Object[]) null, "MSG");
fail("Expecting NullPointerException");
@@ -177,7 +177,7 @@ public class ValidateTest {
assertEquals("MSG", ex.getMessage());
}
- final String[] array = new String[] {"hi"};
+ final String[] array = new String[]{"hi"};
final String[] test = Validate.notEmpty(array, "Message");
assertSame(array, test);
}
@@ -541,7 +541,7 @@ public class ValidateTest {
//-----------------------------------------------------------------------
@Test
public void testNoNullElementsArray1() {
- String[] array = new String[] {"a", "b"};
+ String[] array = new String[]{"a", "b"};
Validate.noNullElements(array);
try {
Validate.noNullElements((Object[]) null);
@@ -557,7 +557,7 @@ public class ValidateTest {
assertEquals("The validated array contains null element at index: 1", ex.getMessage());
}
- array = new String[] {"a", "b"};
+ array = new String[]{"a", "b"};
final String[] test = Validate.noNullElements(array);
assertSame(array, test);
}
@@ -565,7 +565,7 @@ public class ValidateTest {
//-----------------------------------------------------------------------
@Test
public void testNoNullElementsArray2() {
- String[] array = new String[] {"a", "b"};
+ String[] array = new String[]{"a", "b"};
Validate.noNullElements(array, "MSG");
try {
Validate.noNullElements((Object[]) null, "MSG");
@@ -581,7 +581,7 @@ public class ValidateTest {
assertEquals("MSG", ex.getMessage());
}
- array = new String[] {"a", "b"};
+ array = new String[]{"a", "b"};
final String[] test = Validate.noNullElements(array, "Message");
assertSame(array, test);
}
@@ -671,7 +671,7 @@ public class ValidateTest {
assertEquals("Broken: ", ex.getMessage());
}
- final String[] strArray = new String[] {"Hi"};
+ final String[] strArray = new String[]{"Hi"};
final String[] test = Validate.noNullElements(strArray, "Message");
assertSame(strArray, test);
}
@@ -694,7 +694,7 @@ public class ValidateTest {
assertEquals("The validated array index is invalid: 2", ex.getMessage());
}
- final String[] strArray = new String[] {"Hi"};
+ final String[] strArray = new String[]{"Hi"};
final String[] test = Validate.noNullElements(strArray);
assertSame(strArray, test);
}
@@ -800,33 +800,25 @@ public class ValidateTest {
}
@Test
- public void testMatchesPattern()
- {
+ public void testMatchesPattern() {
final CharSequence str = "hi";
Validate.matchesPattern(str, "[a-z]*");
- try
- {
+ try {
Validate.matchesPattern(str, "[0-9]*");
fail("Expecting IllegalArgumentException");
- }
- catch (final IllegalArgumentException e)
- {
+ } catch (final IllegalArgumentException e) {
assertEquals("The string hi does not match the pattern [0-9]*", e.getMessage());
}
}
@Test
- public void testMatchesPattern_withMessage()
- {
+ public void testMatchesPattern_withMessage() {
final CharSequence str = "hi";
Validate.matchesPattern(str, "[a-z]*", "Does not match");
- try
- {
+ try {
Validate.matchesPattern(str, "[0-9]*", "Does not match");
fail("Expecting IllegalArgumentException");
- }
- catch (final IllegalArgumentException e)
- {
+ } catch (final IllegalArgumentException e) {
assertEquals("Does not match", e.getMessage());
}
}
@@ -913,8 +905,7 @@ public class ValidateTest {
//-----------------------------------------------------------------------
@Test
- public void testInclusiveBetween()
- {
+ public void testInclusiveBetween() {
Validate.inclusiveBetween("a", "c", "b");
try {
Validate.inclusiveBetween("0", "5", "6");
@@ -925,8 +916,7 @@ public class ValidateTest {
}
@Test
- public void testInclusiveBetween_withMessage()
- {
+ public void testInclusiveBetween_withMessage() {
Validate.inclusiveBetween("a", "c", "b", "Error");
try {
Validate.inclusiveBetween("0", "5", "6", "Error");
@@ -937,8 +927,7 @@ public class ValidateTest {
}
@Test
- public void testInclusiveBetweenLong()
- {
+ public void testInclusiveBetweenLong() {
Validate.inclusiveBetween(0, 2, 1);
Validate.inclusiveBetween(0, 2, 2);
try {
@@ -950,8 +939,7 @@ public class ValidateTest {
}
@Test
- public void testInclusiveBetweenLong_withMessage()
- {
+ public void testInclusiveBetweenLong_withMessage() {
Validate.inclusiveBetween(0, 2, 1, "Error");
Validate.inclusiveBetween(0, 2, 2, "Error");
try {
@@ -963,8 +951,7 @@ public class ValidateTest {
}
@Test
- public void testInclusiveBetweenDouble()
- {
+ public void testInclusiveBetweenDouble() {
Validate.inclusiveBetween(0.1, 2.1, 1.1);
Validate.inclusiveBetween(0.1, 2.1, 2.1);
try {
@@ -976,8 +963,7 @@ public class ValidateTest {
}
@Test
- public void testInclusiveBetweenDouble_withMessage()
- {
+ public void testInclusiveBetweenDouble_withMessage() {
Validate.inclusiveBetween(0.1, 2.1, 1.1, "Error");
Validate.inclusiveBetween(0.1, 2.1, 2.1, "Error");
try {
@@ -989,8 +975,7 @@ public class ValidateTest {
}
@Test
- public void testExclusiveBetween()
- {
+ public void testExclusiveBetween() {
Validate.exclusiveBetween("a", "c", "b");
try {
Validate.exclusiveBetween("0", "5", "6");
@@ -1007,8 +992,7 @@ public class ValidateTest {
}
@Test
- public void testExclusiveBetween_withMessage()
- {
+ public void testExclusiveBetween_withMessage() {
Validate.exclusiveBetween("a", "c", "b", "Error");
try {
Validate.exclusiveBetween("0", "5", "6", "Error");
@@ -1025,8 +1009,7 @@ public class ValidateTest {
}
@Test
- public void testExclusiveBetweenLong()
- {
+ public void testExclusiveBetweenLong() {
Validate.exclusiveBetween(0, 2, 1);
try {
Validate.exclusiveBetween(0, 5, 6);
@@ -1043,8 +1026,7 @@ public class ValidateTest {
}
@Test
- public void testExclusiveBetweenLong_withMessage()
- {
+ public void testExclusiveBetweenLong_withMessage() {
Validate.exclusiveBetween(0, 2, 1, "Error");
try {
Validate.exclusiveBetween(0, 5, 6, "Error");
@@ -1061,8 +1043,7 @@ public class ValidateTest {
}
@Test
- public void testExclusiveBetweenDouble()
- {
+ public void testExclusiveBetweenDouble() {
Validate.exclusiveBetween(0.1, 2.1, 1.1);
try {
Validate.exclusiveBetween(0.1, 5.1, 6.1);
@@ -1079,8 +1060,7 @@ public class ValidateTest {
}
@Test
- public void testExclusiveBetweenDouble_withMessage()
- {
+ public void testExclusiveBetweenDouble_withMessage() {
Validate.exclusiveBetween(0.1, 2.1, 1.1, "Error");
try {
Validate.exclusiveBetween(0.1, 5.1, 6.1, "Error");
@@ -1107,7 +1087,7 @@ public class ValidateTest {
try {
Validate.isInstanceOf(List.class, "hi");
fail("Expecting IllegalArgumentException");
- } catch(final IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals("Expected type: java.util.List, actual: java.lang.String", e.getMessage());
}
}
@@ -1119,7 +1099,7 @@ public class ValidateTest {
try {
Validate.isInstanceOf(List.class, "hi", "Error");
fail("Expecting IllegalArgumentException");
- } catch(final IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals("Error", e.getMessage());
}
}
@@ -1131,19 +1111,19 @@ public class ValidateTest {
try {
Validate.isInstanceOf(List.class, "hi", "Error %s=%s", "Name", "Value");
fail("Expecting IllegalArgumentException");
- } catch(final IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals("Error Name=Value", e.getMessage());
}
try {
Validate.isInstanceOf(List.class, "hi", "Error %s=%s", List.class, "Value");
fail("Expecting IllegalArgumentException");
- } catch(final IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals("Error interface java.util.List=Value", e.getMessage());
}
try {
Validate.isInstanceOf(List.class, "hi", "Error %s=%s", List.class, null);
fail("Expecting IllegalArgumentException");
- } catch(final IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals("Error interface java.util.List=null", e.getMessage());
}
}
@@ -1159,7 +1139,7 @@ public class ValidateTest {
try {
Validate.isAssignableFrom(List.class, String.class);
fail("Expecting IllegalArgumentException");
- } catch(final IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals("Cannot assign a java.lang.String to a java.util.List", e.getMessage());
}
}
@@ -1171,7 +1151,7 @@ public class ValidateTest {
try {
Validate.isAssignableFrom(List.class, String.class, "Error");
fail("Expecting IllegalArgumentException");
- } catch(final IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
assertEquals("Error", e.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
----------------------------------------------------------------------
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 8be9b98..3e47b3a 100644
--- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
@@ -34,15 +34,22 @@ public class EqualsBuilderTest {
static class TestObject {
private int a;
+
TestObject() {
}
+
TestObject(final int a) {
this.a = a;
}
+
@Override
public boolean equals(final Object o) {
- if (o == null) { return false; }
- if (o == this) { return true; }
+ if (o == null) {
+ return false;
+ }
+ if (o == this) {
+ return true;
+ }
if (o.getClass() != getClass()) {
return false;
}
@@ -67,17 +74,24 @@ public class EqualsBuilderTest {
static class TestSubObject extends TestObject {
private int b;
+
TestSubObject() {
super(0);
}
+
TestSubObject(final int a, final int b) {
super(a);
this.b = b;
}
+
@Override
public boolean equals(final Object o) {
- if (o == null) { return false; }
- if (o == this) { return true; }
+ if (o == null) {
+ return false;
+ }
+ if (o == this) {
+ return true;
+ }
if (o.getClass() != getClass()) {
return false;
}
@@ -88,7 +102,7 @@ public class EqualsBuilderTest {
@Override
public int hashCode() {
- return b *17 + super.hashCode();
+ return b * 17 + super.hashCode();
}
public void setB(final int b) {
@@ -109,6 +123,7 @@ public class EqualsBuilderTest {
static class TestTSubObject extends TestObject {
@SuppressWarnings("unused")
private transient int t;
+
TestTSubObject(final int a, final int t) {
super(a);
this.t = t;
@@ -118,6 +133,7 @@ public class EqualsBuilderTest {
static class TestTTSubObject extends TestTSubObject {
@SuppressWarnings("unused")
private transient int tt;
+
TestTTSubObject(final int a, final int t, final int tt) {
super(a, t);
this.tt = tt;
@@ -127,6 +143,7 @@ public class EqualsBuilderTest {
static class TestTTLeafObject extends TestTTSubObject {
@SuppressWarnings("unused")
private final int leafValue;
+
TestTTLeafObject(final int a, final int t, final int tt, final int leafValue) {
super(a, t, tt);
this.leafValue = leafValue;
@@ -135,12 +152,15 @@ public class EqualsBuilderTest {
static class TestTSubObject2 extends TestObject {
private transient int t;
+
TestTSubObject2(final int a, final int t) {
super(a);
}
+
public int getT() {
return t;
}
+
public void setT(final int t) {
this.t = t;
}
@@ -152,7 +172,7 @@ public class EqualsBuilderTest {
private int z;
TestRecursiveObject(final TestRecursiveInnerObject a,
- final TestRecursiveInnerObject b, final int z) {
+ final TestRecursiveInnerObject b, final int z) {
this.a = a;
this.b = b;
}
@@ -173,6 +193,7 @@ public class EqualsBuilderTest {
static class TestRecursiveInnerObject {
private final int n;
+
TestRecursiveInnerObject(final int n) {
this.n = n;
}
@@ -185,6 +206,7 @@ public class EqualsBuilderTest {
static class TestRecursiveCycleObject {
private TestRecursiveCycleObject cycle;
private final int n;
+
TestRecursiveCycleObject(final int n) {
this.n = n;
this.cycle = this;
@@ -301,20 +323,21 @@ public class EqualsBuilderTest {
* <li>consistency</li>
* <li>non-null reference</li>
* </ul>
- * @param to a TestObject
- * @param toBis a TestObject, equal to to and toTer
- * @param toTer Left hand side, equal to to and toBis
- * @param to2 a different TestObject
- * @param oToChange a TestObject that will be changed
+ *
+ * @param to a TestObject
+ * @param toBis a TestObject, equal to to and toTer
+ * @param toTer Left hand side, equal to to and toBis
+ * @param to2 a different TestObject
+ * @param oToChange a TestObject that will be changed
* @param testTransients whether to test transient instance variables
*/
private void testReflectionEqualsEquivalenceRelationship(
- final TestObject to,
- final TestObject toBis,
- final TestObject toTer,
- final TestObject to2,
- final TestObject oToChange,
- final boolean testTransients) {
+ final TestObject to,
+ final TestObject toBis,
+ final TestObject toTer,
+ final TestObject to2,
+ final TestObject oToChange,
+ final boolean testTransients) {
// reflection test
assertTrue(EqualsBuilder.reflectionEquals(to, to, testTransients));
@@ -325,9 +348,9 @@ public class EqualsBuilderTest {
// transitive test
assertTrue(
- EqualsBuilder.reflectionEquals(to, toBis, testTransients)
- && EqualsBuilder.reflectionEquals(toBis, toTer, testTransients)
- && EqualsBuilder.reflectionEquals(to, toTer, testTransients));
+ EqualsBuilder.reflectionEquals(to, toBis, testTransients)
+ && EqualsBuilder.reflectionEquals(toBis, toTer, testTransients)
+ && EqualsBuilder.reflectionEquals(to, toTer, testTransients));
// consistency test
oToChange.setA(to.getA());
@@ -1146,8 +1169,8 @@ public class EqualsBuilderTest {
*/
@Test
public void testNpeForNullElement() {
- final Object[] x1 = new Object[] { Integer.valueOf(1), null, Integer.valueOf(3) };
- final Object[] x2 = new Object[] { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) };
+ final Object[] x1 = new Object[]{Integer.valueOf(1), null, Integer.valueOf(3)};
+ final Object[] x2 = new Object[]{Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)};
// causes an NPE in 2.0 according to:
// http://issues.apache.org/bugzilla/show_bug.cgi?id=33067
@@ -1249,17 +1272,17 @@ public class EqualsBuilderTest {
final TestObject one = new TestObject(1);
final TestObject two = new TestObject(2);
- final Object[] o1 = new Object[] { one };
- final Object[] o2 = new Object[] { two };
- final Object[] o3 = new Object[] { one };
+ final Object[] o1 = new Object[]{one};
+ final Object[] o2 = new Object[]{two};
+ final Object[] o3 = new Object[]{one};
assertFalse(EqualsBuilder.reflectionEquals(o1, o2));
assertTrue(EqualsBuilder.reflectionEquals(o1, o1));
assertTrue(EqualsBuilder.reflectionEquals(o1, o3));
- final double[] d1 = { 0, 1 };
- final double[] d2 = { 2, 3 };
- final double[] d3 = { 0, 1 };
+ final double[] d1 = {0, 1};
+ final double[] d2 = {2, 3};
+ final double[] d3 = {0, 1};
assertFalse(EqualsBuilder.reflectionEquals(d1, d2));
assertTrue(EqualsBuilder.reflectionEquals(d1, d1));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
----------------------------------------------------------------------
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 a6e2555..9c4265a 100644
--- a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java
@@ -41,8 +41,7 @@ import org.junit.Test;
/**
* @since 3.0
*/
-public class EventUtilsTest
-{
+public class EventUtilsTest {
@Test
public void testConstructor() {
@@ -55,8 +54,7 @@ public class EventUtilsTest
}
@Test
- public void testAddEventListener()
- {
+ public void testAddEventListener() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final PropertyChangeListener listener = handler.createListener(PropertyChangeListener.class);
@@ -68,64 +66,49 @@ public class EventUtilsTest
}
@Test
- public void testAddEventListenerWithNoAddMethod()
- {
+ public void testAddEventListenerWithNoAddMethod() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class);
- try
- {
+ 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)
- {
+ } 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());
}
}
@Test
- public void testAddEventListenerThrowsException()
- {
+ public void testAddEventListenerThrowsException() {
final ExceptionEventSource src = new ExceptionEventSource();
- try
- {
- EventUtils.addEventListener(src, PropertyChangeListener.class, new PropertyChangeListener()
- {
+ try {
+ EventUtils.addEventListener(src, PropertyChangeListener.class, new PropertyChangeListener() {
@Override
- public void propertyChange(final PropertyChangeEvent e)
- {
+ public void propertyChange(final PropertyChangeEvent e) {
// Do nothing!
}
});
fail("Add method should have thrown an exception, so method should fail.");
- }
- catch (final RuntimeException e)
- {
+ } catch (final RuntimeException e) {
}
}
@Test
- public void testAddEventListenerWithPrivateAddMethod()
- {
+ public void testAddEventListenerWithPrivateAddMethod() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final VetoableChangeListener listener = handler.createListener(VetoableChangeListener.class);
- try
- {
+ 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)
- {
+ } 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());
}
}
@Test
- public void testBindEventsToMethod()
- {
+ public void testBindEventsToMethod() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCounter counter = new EventCounter();
EventUtils.bindEventsToMethod(counter, "eventOccurred", src, PropertyChangeListener.class);
@@ -136,8 +119,7 @@ public class EventUtilsTest
@Test
- public void testBindEventsToMethodWithEvent()
- {
+ public void testBindEventsToMethodWithEvent() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCounterWithEvent counter = new EventCounterWithEvent();
EventUtils.bindEventsToMethod(counter, "eventOccurred", src, PropertyChangeListener.class);
@@ -148,8 +130,7 @@ public class EventUtilsTest
@Test
- public void testBindFilteredEventsToMethod()
- {
+ public void testBindFilteredEventsToMethod() {
final MultipleEventSource src = new MultipleEventSource();
final EventCounter counter = new EventCounter();
EventUtils.bindEventsToMethod(counter, "eventOccurred", src, MultipleEventListener.class, "event1");
@@ -160,120 +141,97 @@ public class EventUtilsTest
assertEquals(1, counter.getCount());
}
- public interface MultipleEventListener
- {
+ public interface MultipleEventListener {
void event1(PropertyChangeEvent e);
void event2(PropertyChangeEvent e);
}
- public static class EventCounter
- {
+ public static class EventCounter {
private int count;
- public void eventOccurred()
- {
+ public void eventOccurred() {
count++;
}
- public int getCount()
- {
+ public int getCount() {
return count;
}
}
- public static class EventCounterWithEvent
- {
+ public static class EventCounterWithEvent {
private int count;
- public void eventOccurred(final PropertyChangeEvent e)
- {
+ public void eventOccurred(final PropertyChangeEvent e) {
count++;
}
- public int getCount()
- {
+ public int getCount() {
return count;
}
}
- private static class EventCountingInvociationHandler implements InvocationHandler
- {
+ private static class EventCountingInvociationHandler implements InvocationHandler {
private final Map<String, Integer> eventCounts = new TreeMap<>();
- public <L> L createListener(final Class<L> listenerType)
- {
+ public <L> L createListener(final Class<L> listenerType) {
return listenerType.cast(Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class[]{listenerType},
this));
}
- public int getEventCount(final String eventName)
- {
+ public int getEventCount(final String eventName) {
final Integer count = eventCounts.get(eventName);
return count == null ? 0 : count.intValue();
}
@Override
- public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable
- {
+ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
final Integer count = eventCounts.get(method.getName());
- if (count == null)
- {
+ if (count == null) {
eventCounts.put(method.getName(), Integer.valueOf(1));
- }
- else
- {
+ } else {
eventCounts.put(method.getName(), Integer.valueOf(count.intValue() + 1));
}
return null;
}
}
- public static class MultipleEventSource
- {
+ public static class MultipleEventSource {
private final EventListenerSupport<MultipleEventListener> listeners = EventListenerSupport.create(MultipleEventListener.class);
- public void addMultipleEventListener(final MultipleEventListener listener)
- {
+ public void addMultipleEventListener(final MultipleEventListener listener) {
listeners.addListener(listener);
}
}
- public static class ExceptionEventSource
- {
- public void addPropertyChangeListener(final PropertyChangeListener listener)
- {
+ public static class ExceptionEventSource {
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
throw new RuntimeException();
}
}
- public static class PropertyChangeSource
- {
+ public static class PropertyChangeSource {
private final EventListenerSupport<PropertyChangeListener> listeners = EventListenerSupport.create(PropertyChangeListener.class);
private String property;
- public void setProperty(final String property)
- {
+ public void setProperty(final String property) {
final String oldValue = this.property;
this.property = property;
listeners.fire().propertyChange(new PropertyChangeEvent(this, "property", oldValue, property));
}
- protected void addVetoableChangeListener(final VetoableChangeListener listener)
- {
+ protected void addVetoableChangeListener(final VetoableChangeListener listener) {
// Do nothing!
}
- public void addPropertyChangeListener(final PropertyChangeListener listener)
- {
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
listeners.addListener(listener);
}
- public void removePropertyChangeListener(final PropertyChangeListener listener)
- {
+ public void removePropertyChangeListener(final PropertyChangeListener listener) {
listeners.removeListener(listener);
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
----------------------------------------------------------------------
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 d319e2e..aa69ce7 100644
--- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
@@ -40,6 +40,7 @@ import org.junit.Test;
/**
* Tests {@link org.apache.commons.lang3.exception.ExceptionUtils}.
+ *
* @since 1.0
*/
public class ExceptionUtilsTest {
@@ -133,15 +134,15 @@ public class ExceptionUtilsTest {
// not known type, so match on supplied method names
assertSame(nested, ExceptionUtils.getCause(withCause, null)); // default names
assertSame(null, ExceptionUtils.getCause(withCause, new String[0]));
- assertSame(null, ExceptionUtils.getCause(withCause, new String[] {null}));
- assertSame(nested, ExceptionUtils.getCause(withCause, new String[] {"getCause"}));
+ assertSame(null, ExceptionUtils.getCause(withCause, new String[]{null}));
+ assertSame(nested, ExceptionUtils.getCause(withCause, new String[]{"getCause"}));
// not known type, so match on supplied method names
assertSame(null, ExceptionUtils.getCause(withoutCause, null));
assertSame(null, ExceptionUtils.getCause(withoutCause, new String[0]));
- assertSame(null, ExceptionUtils.getCause(withoutCause, new String[] {null}));
- assertSame(null, ExceptionUtils.getCause(withoutCause, new String[] {"getCause"}));
- assertSame(null, ExceptionUtils.getCause(withoutCause, new String[] {"getTargetException"}));
+ assertSame(null, ExceptionUtils.getCause(withoutCause, new String[]{null}));
+ assertSame(null, ExceptionUtils.getCause(withoutCause, new String[]{"getCause"}));
+ assertSame(null, ExceptionUtils.getCause(withoutCause, new String[]{"getTargetException"}));
}
@Test
@@ -449,7 +450,7 @@ public class ExceptionUtilsTest {
assertFalse(match);
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected = IllegalArgumentException.class)
public void testRemoveCommonFrames_ListList() throws Exception {
ExceptionUtils.removeCommonFrames(null, null);
}
@@ -479,6 +480,7 @@ public class ExceptionUtilsTest {
}
//-----------------------------------------------------------------------
+
/**
* Provides a method with a well known chained/nested exception
* name which matches the full signature (e.g. has a return value
@@ -517,7 +519,7 @@ public class ExceptionUtilsTest {
private static class ExceptionWithoutCause extends Exception {
private static final long serialVersionUID = 1L;
- @SuppressWarnings("unused")
+ @SuppressWarnings("unused")
public void getTargetException() {
}
}
@@ -528,8 +530,13 @@ public class ExceptionUtilsTest {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
- NestableException() { super(); }
- NestableException(final Throwable t) { super(t); }
+ NestableException() {
+ super();
+ }
+
+ NestableException(final Throwable t) {
+ super(t);
+ }
}
@Test
@@ -538,8 +545,7 @@ public class ExceptionUtilsTest {
try {
ExceptionUtils.rethrow(expected);
Assert.fail("Exception not thrown");
- }
- catch(final Exception actual) {
+ } catch (final Exception actual) {
Assert.assertSame(expected, actual);
}
}
@@ -549,8 +555,7 @@ public class ExceptionUtilsTest {
try {
throwsCheckedException();
Assert.fail("Exception not thrown");
- }
- catch(final Exception ioe) {
+ } catch (final Exception ioe) {
assertTrue(ioe instanceof IOException);
assertEquals(1, ExceptionUtils.getThrowableCount(ioe));
}
@@ -558,8 +563,7 @@ public class ExceptionUtilsTest {
try {
redeclareCheckedException();
Assert.fail("Exception not thrown");
- }
- catch(final IOException ioe) {
+ } catch (final IOException ioe) {
assertEquals(1, ExceptionUtils.getThrowableCount(ioe));
}
}
@@ -585,8 +589,7 @@ public class ExceptionUtilsTest {
try {
ExceptionUtils.wrapAndThrow(new OutOfMemoryError());
Assert.fail("Error not thrown");
- }
- catch(final Throwable t) {
+ } catch (final Throwable t) {
Assert.assertTrue(ExceptionUtils.hasCause(t, Error.class));
}
}
@@ -596,8 +599,7 @@ public class ExceptionUtilsTest {
try {
ExceptionUtils.wrapAndThrow(new IllegalArgumentException());
Assert.fail("RuntimeException not thrown");
- }
- catch(final Throwable t) {
+ } catch (final Throwable t) {
Assert.assertTrue(ExceptionUtils.hasCause(t, RuntimeException.class));
}
}
@@ -607,8 +609,7 @@ public class ExceptionUtilsTest {
try {
ExceptionUtils.wrapAndThrow(new IOException());
Assert.fail("Checked Exception not thrown");
- }
- catch(final Throwable t) {
+ } catch (final Throwable t) {
Assert.assertTrue(ExceptionUtils.hasCause(t, IOException.class));
}
}
@@ -618,8 +619,7 @@ public class ExceptionUtilsTest {
try {
ExceptionUtils.wrapAndThrow(new TestThrowable());
Assert.fail("Checked Exception not thrown");
- }
- catch(final Throwable t) {
+ } catch (final Throwable t) {
Assert.assertTrue(ExceptionUtils.hasCause(t, TestThrowable.class));
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
index 5c1989b..5f29430 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java
@@ -59,7 +59,8 @@ import org.junit.Test;
*/
public class MethodUtilsTest {
- private interface PrivateInterface {}
+ private interface PrivateInterface {
+ }
static class TestBeanWithInterfaces implements PrivateInterface {
public String foo() {
@@ -197,54 +198,107 @@ public class MethodUtilsTest {
// This method is overloaded for the wrapper class for every primitive type, plus the common supertypes
// Number and Object. This is an acid test since it easily leads to ambiguous methods.
- public static String varOverload(final Byte... args) { return "Byte..."; }
- public static String varOverload(final Character... args) { return "Character..."; }
- public static String varOverload(final Short... args) { return "Short..."; }
- public static String varOverload(final Boolean... args) { return "Boolean..."; }
- public static String varOverload(final Float... args) { return "Float..."; }
- public static String varOverload(final Double... args) { return "Double..."; }
- public static String varOverload(final Integer... args) { return "Integer..."; }
- public static String varOverload(final Long... args) { return "Long..."; }
- public static String varOverload(final Number... args) { return "Number..."; }
- public static String varOverload(final Object... args) { return "Object..."; }
- public static String varOverload(final String... args) { return "String..."; }
+ public static String varOverload(final Byte... args) {
+ return "Byte...";
+ }
+
+ public static String varOverload(final Character... args) {
+ return "Character...";
+ }
+
+ public static String varOverload(final Short... args) {
+ return "Short...";
+ }
+
+ public static String varOverload(final Boolean... args) {
+ return "Boolean...";
+ }
+
+ public static String varOverload(final Float... args) {
+ return "Float...";
+ }
+
+ public static String varOverload(final Double... args) {
+ return "Double...";
+ }
+
+ public static String varOverload(final Integer... args) {
+ return "Integer...";
+ }
+
+ public static String varOverload(final Long... args) {
+ return "Long...";
+ }
+
+ public static String varOverload(final Number... args) {
+ return "Number...";
+ }
+
+ public static String varOverload(final Object... args) {
+ return "Object...";
+ }
+
+ public static String varOverload(final String... args) {
+ return "String...";
+ }
// This method is overloaded for the wrapper class for every numeric primitive type, plus the common
// supertype Number
- public static String numOverload(final Byte... args) { return "Byte..."; }
- public static String numOverload(final Short... args) { return "Short..."; }
- public static String numOverload(final Float... args) { return "Float..."; }
- public static String numOverload(final Double... args) { return "Double..."; }
- public static String numOverload(final Integer... args) { return "Integer..."; }
- public static String numOverload(final Long... args) { return "Long..."; }
- public static String numOverload(final Number... args) { return "Number..."; }
+ public static String numOverload(final Byte... args) {
+ return "Byte...";
+ }
+
+ public static String numOverload(final Short... args) {
+ return "Short...";
+ }
+
+ public static String numOverload(final Float... args) {
+ return "Float...";
+ }
+
+ public static String numOverload(final Double... args) {
+ return "Double...";
+ }
+
+ public static String numOverload(final Integer... args) {
+ return "Integer...";
+ }
+
+ public static String numOverload(final Long... args) {
+ return "Long...";
+ }
+
+ public static String numOverload(final Number... args) {
+ return "Number...";
+ }
// These varOverloadEcho and varOverloadEchoStatic methods are designed to verify that
// not only is the correct overloaded variant invoked, but that the varags arguments
// are also delivered correctly to the method.
public ImmutablePair<String, Object[]> varOverloadEcho(final String... args) {
- return new ImmutablePair<String, Object[]>("String...", args);
+ return new ImmutablePair<String, Object[]>("String...", args);
}
+
public ImmutablePair<String, Object[]> varOverloadEcho(final Number... args) {
- return new ImmutablePair<String, Object[]>("Number...", args);
+ return new ImmutablePair<String, Object[]>("Number...", args);
}
public static ImmutablePair<String, Object[]> varOverloadEchoStatic(final String... args) {
- return new ImmutablePair<String, Object[]>("String...", args);
+ return new ImmutablePair<String, Object[]>("String...", args);
}
+
public static ImmutablePair<String, Object[]> varOverloadEchoStatic(final Number... args) {
- return new ImmutablePair<String, Object[]>("Number...", args);
+ return new ImmutablePair<String, Object[]>("Number...", args);
}
static void verify(final ImmutablePair<String, Object[]> a, final ImmutablePair<String, Object[]> b) {
- assertEquals(a.getLeft(), b.getLeft());
- assertArrayEquals(a.getRight(), b.getRight());
+ assertEquals(a.getLeft(), b.getLeft());
+ assertArrayEquals(a.getRight(), b.getRight());
}
static void verify(final ImmutablePair<String, Object[]> a, final Object _b) {
- @SuppressWarnings("unchecked")
- final ImmutablePair<String, Object[]> b = (ImmutablePair<String, Object[]>) _b;
- verify(a, b);
+ @SuppressWarnings("unchecked") final ImmutablePair<String, Object[]> b = (ImmutablePair<String, Object[]>) _b;
+ verify(a, b);
}
}
@@ -389,13 +443,13 @@ public class MethodUtilsTest {
}
TestBean.verify(new ImmutablePair<String, Object[]>("String...", new String[]{"x", "y"}),
- MethodUtils.invokeMethod(testBean, "varOverloadEcho", "x", "y"));
+ MethodUtils.invokeMethod(testBean, "varOverloadEcho", "x", "y"));
TestBean.verify(new ImmutablePair<String, Object[]>("Number...", new Number[]{17, 23, 42}),
- MethodUtils.invokeMethod(testBean, "varOverloadEcho", 17, 23, 42));
+ MethodUtils.invokeMethod(testBean, "varOverloadEcho", 17, 23, 42));
TestBean.verify(new ImmutablePair<String, Object[]>("String...", new String[]{"x", "y"}),
- MethodUtils.invokeMethod(testBean, "varOverloadEcho", "x", "y"));
+ MethodUtils.invokeMethod(testBean, "varOverloadEcho", "x", "y"));
TestBean.verify(new ImmutablePair<String, Object[]>("Number...", new Number[]{17, 23, 42}),
- MethodUtils.invokeMethod(testBean, "varOverloadEcho", 17, 23, 42));
+ MethodUtils.invokeMethod(testBean, "varOverloadEcho", 17, 23, 42));
}
@Test
@@ -414,8 +468,8 @@ public class MethodUtilsTest {
assertEquals("foo(Integer)", MethodUtils.invokeExactMethod(testBean,
"foo", NumberUtils.INTEGER_ONE));
assertEquals("foo(double)", MethodUtils.invokeExactMethod(testBean,
- "foo", new Object[] { NumberUtils.DOUBLE_ONE },
- new Class[] { Double.TYPE }));
+ "foo", new Object[]{NumberUtils.DOUBLE_ONE},
+ new Class[]{Double.TYPE}));
try {
MethodUtils
@@ -464,13 +518,13 @@ public class MethodUtilsTest {
TestBean.class, "bar", NumberUtils.INTEGER_ONE, "a", "b"));
TestBean.verify(new ImmutablePair<String, Object[]>("String...", new String[]{"x", "y"}),
- MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", "x", "y"));
+ MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", "x", "y"));
TestBean.verify(new ImmutablePair<String, Object[]>("Number...", new Number[]{17, 23, 42}),
- MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", 17, 23, 42));
+ MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", 17, 23, 42));
TestBean.verify(new ImmutablePair<String, Object[]>("String...", new String[]{"x", "y"}),
- MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", "x", "y"));
+ MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", "x", "y"));
TestBean.verify(new ImmutablePair<String, Object[]>("Number...", new Number[]{17, 23, 42}),
- MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", 17, 23, 42));
+ MethodUtils.invokeStaticMethod(TestBean.class, "varOverloadEchoStatic", 17, 23, 42));
try {
MethodUtils.invokeStaticMethod(TestBean.class, "does_not_exist");
@@ -494,8 +548,8 @@ public class MethodUtilsTest {
assertEquals("bar(Integer)", MethodUtils.invokeExactStaticMethod(
TestBean.class, "bar", NumberUtils.INTEGER_ONE));
assertEquals("bar(double)", MethodUtils.invokeExactStaticMethod(
- TestBean.class, "bar", new Object[] { NumberUtils.DOUBLE_ONE },
- new Class[] { Double.TYPE }));
+ TestBean.class, "bar", new Object[]{NumberUtils.DOUBLE_ONE},
+ new Class[]{Double.TYPE}));
try {
MethodUtils.invokeExactStaticMethod(TestBean.class, "bar",
@@ -519,7 +573,7 @@ public class MethodUtilsTest {
@Test
public void testGetAccessibleInterfaceMethod() throws Exception {
- final Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
+ final Class<?>[][] p = {ArrayUtils.EMPTY_CLASS_ARRAY, null};
for (final Class<?>[] element : p) {
final Method method = TestMutable.class.getMethod("getValue", element);
final Method accessibleMethod = MethodUtils.getAccessibleMethod(method);
@@ -539,7 +593,7 @@ public class MethodUtilsTest {
@Test
public void testGetAccessibleInterfaceMethodFromDescription()
throws Exception {
- final Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null };
+ final Class<?>[][] p = {ArrayUtils.EMPTY_CLASS_ARRAY, null};
for (final Class<?>[] element : p) {
final Method accessibleMethod = MethodUtils.getAccessibleMethod(
TestMutable.class, "getValue", element);
@@ -562,14 +616,14 @@ public class MethodUtilsTest {
}
@Test
- public void testGetAccessibleMethodInaccessible() throws Exception {
+ public void testGetAccessibleMethodInaccessible() throws Exception {
final Method expected = TestBean.class.getDeclaredMethod("privateStuff");
final Method actual = MethodUtils.getAccessibleMethod(expected);
assertNull(actual);
}
@Test
- public void testGetMatchingAccessibleMethod() throws Exception {
+ public void testGetMatchingAccessibleMethod() throws Exception {
expectMatchingAccessibleMethodParameterTypes(TestBean.class, "foo",
ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_CLASS_ARRAY);
expectMatchingAccessibleMethodParameterTypes(TestBean.class, "foo",
@@ -611,9 +665,9 @@ public class MethodUtilsTest {
expectMatchingAccessibleMethodParameterTypes(TestBean.class, "foo",
singletonArray(Double.TYPE), singletonArray(Double.TYPE));
expectMatchingAccessibleMethodParameterTypes(TestBean.class, "foo",
- new Class[] {String.class, String.class}, new Class[] {String[].class});
+ new Class[]{String.class, String.class}, new Class[]{String[].class});
expectMatchingAccessibleMethodParameterTypes(TestBean.class, "foo",
- new Class[] {Integer.TYPE, String.class, String.class}, new Class[] {Integer.class, String[].class});
+ new Class[]{Integer.TYPE, String.class, String.class}, new Class[]{Integer.class, String[].class});
expectMatchingAccessibleMethodParameterTypes(InheritanceBean.class, "testOne",
singletonArray(ParentObject.class), singletonArray(ParentObject.class));
expectMatchingAccessibleMethodParameterTypes(InheritanceBean.class, "testOne",
@@ -634,10 +688,10 @@ public class MethodUtilsTest {
public void testGetOverrideHierarchyIncludingInterfaces() {
final Method method = MethodUtils.getAccessibleMethod(StringParameterizedChild.class, "consume", String.class);
final Iterator<MethodDescriptor> expected =
- Arrays.asList(new MethodDescriptor(StringParameterizedChild.class, "consume", String.class),
- new MethodDescriptor(GenericParent.class, "consume", GenericParent.class.getTypeParameters()[0]),
- new MethodDescriptor(GenericConsumer.class, "consume", GenericConsumer.class.getTypeParameters()[0]))
- .iterator();
+ Arrays.asList(new MethodDescriptor(StringParameterizedChild.class, "consume", String.class),
+ new MethodDescriptor(GenericParent.class, "consume", GenericParent.class.getTypeParameters()[0]),
+ new MethodDescriptor(GenericConsumer.class, "consume", GenericConsumer.class.getTypeParameters()[0]))
+ .iterator();
for (final Method m : MethodUtils.getOverrideHierarchy(method, Interfaces.INCLUDE)) {
assertTrue(expected.hasNext());
final MethodDescriptor md = expected.next();
@@ -655,9 +709,9 @@ public class MethodUtilsTest {
public void testGetOverrideHierarchyExcludingInterfaces() {
final Method method = MethodUtils.getAccessibleMethod(StringParameterizedChild.class, "consume", String.class);
final Iterator<MethodDescriptor> expected =
- Arrays.asList(new MethodDescriptor(StringParameterizedChild.class, "consume", String.class),
- new MethodDescriptor(GenericParent.class, "consume", GenericParent.class.getTypeParameters()[0]))
- .iterator();
+ Arrays.asList(new MethodDescriptor(StringParameterizedChild.class, "consume", String.class),
+ new MethodDescriptor(GenericParent.class, "consume", GenericParent.class.getTypeParameters()[0]))
+ .iterator();
for (final Method m : MethodUtils.getOverrideHierarchy(method, Interfaces.EXCLUDE)) {
assertTrue(expected.hasNext());
final MethodDescriptor md = expected.next();
@@ -861,7 +915,7 @@ public class MethodUtilsTest {
}
private void expectMatchingAccessibleMethodParameterTypes(final Class<?> cls,
- final String methodName, final Class<?>[] requestTypes, final Class<?>[] actualTypes) {
+ final String methodName, final Class<?>[] requestTypes, final Class<?>[] actualTypes) {
final Method m = MethodUtils.getMatchingAccessibleMethod(cls, methodName,
requestTypes);
assertNotNull("could not find any matches for " + methodName
@@ -878,25 +932,43 @@ public class MethodUtilsTest {
private Class<?>[] singletonArray(final Class<?> c) {
Class<?>[] result = classCache.get(c);
if (result == null) {
- result = new Class[] { c };
+ result = new Class[]{c};
classCache.put(c, result);
}
return result;
}
public static class InheritanceBean {
- public void testOne(final Object obj) {}
- public void testOne(final GrandParentObject obj) {}
- public void testOne(final ParentObject obj) {}
- public void testTwo(final Object obj) {}
- public void testTwo(final GrandParentObject obj) {}
- public void testTwo(final ChildInterface obj) {}
+ public void testOne(final Object obj) {
+ }
+
+ public void testOne(final GrandParentObject obj) {
+ }
+
+ public void testOne(final ParentObject obj) {
+ }
+
+ public void testTwo(final Object obj) {
+ }
+
+ public void testTwo(final GrandParentObject obj) {
+ }
+
+ public void testTwo(final ChildInterface obj) {
+ }
}
- interface ChildInterface {}
- public static class GrandParentObject {}
- public static class ParentObject extends GrandParentObject {}
- public static class ChildObject extends ParentObject implements ChildInterface {}
+ interface ChildInterface {
+ }
+
+ public static class GrandParentObject {
+ }
+
+ public static class ParentObject extends GrandParentObject {
+ }
+
+ public static class ChildObject extends ParentObject implements ChildInterface {
+ }
private static class MethodDescriptor {
final Class<?> declaringClass;
@@ -913,7 +985,7 @@ public class MethodUtilsTest {
@Test
public void testVarArgsUnboxing() throws Exception {
final TestBean testBean = new TestBean();
- final int[] actual = (int[])MethodUtils.invokeMethod(testBean, "unboxing", Integer.valueOf(1), Integer.valueOf(2));
+ final int[] actual = (int[]) MethodUtils.invokeMethod(testBean, "unboxing", Integer.valueOf(1), Integer.valueOf(2));
Assert.assertArrayEquals(new int[]{1, 2}, actual);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
index cdc53f7..17ec976 100644
--- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
@@ -409,7 +409,9 @@ public class ExtendedMessageFormatTest {
return toAppendTo.append(((String)obj).toLowerCase());
}
@Override
- public Object parseObject(final String source, final ParsePosition pos) {throw new UnsupportedOperationException();}
+ public Object parseObject(final String source, final ParsePosition pos) {
+ throw new UnsupportedOperationException();
+ }
}
/**
@@ -423,7 +425,9 @@ public class ExtendedMessageFormatTest {
return toAppendTo.append(((String)obj).toUpperCase());
}
@Override
- public Object parseObject(final String source, final ParsePosition pos) {throw new UnsupportedOperationException();}
+ public Object parseObject(final String source, final ParsePosition pos) {
+ throw new UnsupportedOperationException();
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java b/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
index 09486ef..435ae42 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrBuilderTest.java
@@ -565,29 +565,25 @@ public class StrBuilderTest {
try {
sb.getChars(-1,0,a,0);
fail("no exception");
- }
- catch (final IndexOutOfBoundsException e) {
+ } catch (final IndexOutOfBoundsException e) {
}
try {
sb.getChars(0,-1,a,0);
fail("no exception");
- }
- catch (final IndexOutOfBoundsException e) {
+ } catch (final IndexOutOfBoundsException e) {
}
try {
sb.getChars(0,20,a,0);
fail("no exception");
- }
- catch (final IndexOutOfBoundsException e) {
+ } catch (final IndexOutOfBoundsException e) {
}
try {
sb.getChars(4,2,a,0);
fail("no exception");
- }
- catch (final IndexOutOfBoundsException e) {
+ } catch (final IndexOutOfBoundsException e) {
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
----------------------------------------------------------------------
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 3289e5b..55bac2d 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
@@ -206,8 +206,7 @@ public class FastDateParserTest {
cal.set(Calendar.ERA, 0);
cal.set(Calendar.YEAR, 1868-year);
}
- }
- else {
+ } else {
if (year < 0) {
cal.set(Calendar.ERA, GregorianCalendar.BC);
year= -year;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
index ecb876b..33104b5 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
@@ -40,8 +40,7 @@ public class FastDateParser_TimeZoneStrategyTest {
}
try {
parser.parse(tzDisplay);
- }
- catch(final Exception ex) {
+ } catch(final Exception ex) {
Assert.fail("'" + tzDisplay + "'"
+ " Locale: '" + locale.getDisplayName() + "'"
+ " TimeZone: " + zone[0]
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
index 645b680..3ff1e77 100644
--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
@@ -30,14 +30,17 @@ import org.junit.Test;
/**
* TestCase for StopWatch.
*/
-public class StopWatchTest {
+public class StopWatchTest {
//-----------------------------------------------------------------------
@Test
- public void testStopWatchSimple(){
+ public void testStopWatchSimple() {
final StopWatch watch = new StopWatch();
watch.start();
- try {Thread.sleep(550);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(550);
+ } catch (final InterruptedException ex) {
+ }
watch.stop();
final long time = watch.getTime();
assertEquals(time, watch.getTime());
@@ -56,13 +59,16 @@ public class StopWatchTest {
}
@Test
- public void testStopWatchSimpleGet(){
+ public void testStopWatchSimpleGet() {
final StopWatch watch = new StopWatch();
assertEquals(0, watch.getTime());
assertEquals("00:00:00.000", watch.toString());
watch.start();
- try {Thread.sleep(500);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(500);
+ } catch (final InterruptedException ex) {
+ }
assertTrue(watch.getTime() < 2000);
}
@@ -71,9 +77,9 @@ public class StopWatchTest {
// Create a mock StopWatch with a time of 2:59:01.999
final StopWatch watch = createMockStopWatch(
TimeUnit.HOURS.toNanos(2)
- + TimeUnit.MINUTES.toNanos(59)
- + TimeUnit.SECONDS.toNanos(1)
- + TimeUnit.MILLISECONDS.toNanos(999));
+ + TimeUnit.MINUTES.toNanos(59)
+ + TimeUnit.SECONDS.toNanos(1)
+ + TimeUnit.MILLISECONDS.toNanos(999));
assertEquals(2L, watch.getTime(TimeUnit.HOURS));
assertEquals(179L, watch.getTime(TimeUnit.MINUTES));
@@ -82,21 +88,30 @@ public class StopWatchTest {
}
@Test
- public void testStopWatchSplit(){
+ public void testStopWatchSplit() {
final StopWatch watch = new StopWatch();
watch.start();
- try {Thread.sleep(550);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(550);
+ } catch (final InterruptedException ex) {
+ }
watch.split();
final long splitTime = watch.getSplitTime();
final String splitStr = watch.toSplitString();
- try {Thread.sleep(550);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(550);
+ } catch (final InterruptedException ex) {
+ }
watch.unsplit();
- try {Thread.sleep(550);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(550);
+ } catch (final InterruptedException ex) {
+ }
watch.stop();
final long totalTime = watch.getTime();
assertEquals("Formatted split string not the correct length",
- splitStr.length(), 12);
+ splitStr.length(), 12);
assertTrue(splitTime >= 500);
assertTrue(splitTime < 700);
assertTrue(totalTime >= 1500);
@@ -104,15 +119,24 @@ public class StopWatchTest {
}
@Test
- public void testStopWatchSuspend(){
+ public void testStopWatchSuspend() {
final StopWatch watch = new StopWatch();
watch.start();
- try {Thread.sleep(550);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(550);
+ } catch (final InterruptedException ex) {
+ }
watch.suspend();
final long suspendTime = watch.getTime();
- try {Thread.sleep(550);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(550);
+ } catch (final InterruptedException ex) {
+ }
watch.resume();
- try {Thread.sleep(550);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(550);
+ } catch (final InterruptedException ex) {
+ }
watch.stop();
final long totalTime = watch.getTime();
@@ -126,13 +150,19 @@ public class StopWatchTest {
public void testLang315() {
final StopWatch watch = new StopWatch();
watch.start();
- try {Thread.sleep(200);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(200);
+ } catch (final InterruptedException ex) {
+ }
watch.suspend();
final long suspendTime = watch.getTime();
- try {Thread.sleep(200);} catch (final InterruptedException ex) {}
+ try {
+ Thread.sleep(200);
+ } catch (final InterruptedException ex) {
+ }
watch.stop();
final long totalTime = watch.getTime();
- assertTrue( suspendTime == totalTime );
+ assertTrue(suspendTime == totalTime);
}
// test bad states
@@ -142,42 +172,42 @@ public class StopWatchTest {
try {
watch.stop();
fail("Calling stop on an unstarted StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
try {
watch.stop();
fail("Calling stop on an unstarted StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
try {
watch.suspend();
fail("Calling suspend on an unstarted StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
try {
watch.split();
fail("Calling split on a non-running StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
try {
watch.unsplit();
fail("Calling unsplit on an unsplit StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
try {
watch.resume();
fail("Calling resume on an unsuspended StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
@@ -186,28 +216,28 @@ public class StopWatchTest {
try {
watch.start();
fail("Calling start on a started StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
try {
watch.unsplit();
fail("Calling unsplit on an unsplit StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
try {
watch.getSplitTime();
fail("Calling getSplitTime on an unsplit StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
try {
watch.resume();
fail("Calling resume on an unsuspended StopWatch should throw an exception. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
@@ -216,7 +246,7 @@ public class StopWatchTest {
try {
watch.start();
fail("Calling start on a stopped StopWatch should throw an exception as it needs to be reset. ");
- } catch(final IllegalStateException ise) {
+ } catch (final IllegalStateException ise) {
// expected
}
}
@@ -275,7 +305,7 @@ public class StopWatchTest {
* Creates a suspended StopWatch object which appears to have elapsed
* for the requested amount of time in nanoseconds.
* <p>
- *
+ * <p>
* <pre>
* // Create a mock StopWatch with a time of 2:59:01.999
* final long nanos = TimeUnit.HOURS.toNanos(2)
[19/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java b/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java
index ce94122..8d5de10 100644
--- a/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -150,7 +150,7 @@ public abstract class AbstractExceptionContextTest<T extends ExceptionContext &
@Test
public void testGetContextLabels() {
assertEquals(5, exceptionContext.getContextEntries().size());
-
+
exceptionContext.addContextValue("test2", "different value");
final Set<String> labels = exceptionContext.getContextLabels();
@@ -165,7 +165,7 @@ public abstract class AbstractExceptionContextTest<T extends ExceptionContext &
@Test
public void testGetContextEntries() {
assertEquals(5, exceptionContext.getContextEntries().size());
-
+
exceptionContext.addContextValue("test2", "different value");
final List<Pair<String, Object>> entries = exceptionContext.getContextEntries();
@@ -177,7 +177,7 @@ public abstract class AbstractExceptionContextTest<T extends ExceptionContext &
assertEquals("test Poorly written obj", entries.get(4).getKey());
assertEquals("test2", entries.get(5).getKey());
}
-
+
@Test
public void testJavaSerialization() {
exceptionContext.setContextValue("test Poorly written obj", "serializable replacement");
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionTest.java b/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionTest.java
index ee5e0c5..e0e6071 100644
--- a/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionTest.java
@@ -21,13 +21,13 @@ package org.apache.commons.lang3.exception;
* Base class for testing {@link Exception} descendants
*/
public abstract class AbstractExceptionTest {
-
+
protected static final String CAUSE_MESSAGE = "Cause message";
protected static final String EXCEPTION_MESSAGE = "Exception message";
-
+
protected static final String WRONG_EXCEPTION_MESSAGE = "Wrong exception message";
protected static final String WRONG_CAUSE_MESSAGE = "Wrong cause message";
-
+
protected Exception generateCause() {
return new Exception(CAUSE_MESSAGE);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java b/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java
index 5406be5..6030f89 100644
--- a/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/CloneFailedExceptionTest.java
@@ -26,49 +26,49 @@ import static org.junit.Assert.assertNull;
* JUnit tests for {@link CloneFailedExceptionTest}.
*/
public class CloneFailedExceptionTest extends AbstractExceptionTest {
-
+
@Test(expected = CloneFailedException.class)
public void testThrowingInformativeException() throws Exception {
throw new CloneFailedException(EXCEPTION_MESSAGE, generateCause());
}
-
+
@Test(expected = CloneFailedException.class)
public void testThrowingExceptionWithMessage() throws Exception {
throw new CloneFailedException(EXCEPTION_MESSAGE);
}
-
+
@Test(expected = CloneFailedException.class)
public void testThrowingExceptionWithCause() throws Exception {
throw new CloneFailedException(generateCause());
}
-
+
@Test
public void testWithCauseAndMessage() throws Exception {
final Exception exception = new CloneFailedException(EXCEPTION_MESSAGE, generateCause());
assertNotNull(exception);
assertEquals(WRONG_EXCEPTION_MESSAGE, EXCEPTION_MESSAGE, exception.getMessage());
-
+
final Throwable cause = exception.getCause();
assertNotNull(cause);
assertEquals(WRONG_CAUSE_MESSAGE, CAUSE_MESSAGE, cause.getMessage());
}
-
+
@Test
public void testWithoutCause() throws Exception {
final Exception exception = new CloneFailedException(EXCEPTION_MESSAGE);
assertNotNull(exception);
assertEquals(WRONG_EXCEPTION_MESSAGE, EXCEPTION_MESSAGE, exception.getMessage());
-
+
final Throwable cause = exception.getCause();
assertNull(cause);
}
-
+
@Test
public void testWithoutMessage() throws Exception {
final Exception exception = new CloneFailedException(generateCause());
assertNotNull(exception);
assertNotNull(exception.getMessage());
-
+
final Throwable cause = exception.getCause();
assertNotNull(cause);
assertEquals(WRONG_CAUSE_MESSAGE, CAUSE_MESSAGE, cause.getMessage());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java b/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java
index 75b66ab..9df0e75 100644
--- a/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -29,7 +29,7 @@ import org.junit.Test;
* JUnit tests for ContextedException.
*/
public class ContextedExceptionTest extends AbstractExceptionContextTest<ContextedException> {
-
+
@Override
public void setUp() throws Exception {
exceptionContext = new ContextedException(new Exception(TEST_MESSAGE));
@@ -49,7 +49,7 @@ public class ContextedExceptionTest extends AbstractExceptionContextTest<Context
public void testContextedExceptionString() {
exceptionContext = new ContextedException(TEST_MESSAGE);
assertEquals(TEST_MESSAGE, exceptionContext.getMessage());
-
+
final String trace = ExceptionUtils.getStackTrace(exceptionContext);
assertTrue(trace.contains(TEST_MESSAGE));
}
@@ -74,7 +74,7 @@ public class ContextedExceptionTest extends AbstractExceptionContextTest<Context
assertTrue(trace.contains(TEST_MESSAGE_2));
assertTrue(message.contains(TEST_MESSAGE_2));
}
-
+
@Test
public void testContextedExceptionStringThrowableContext() {
exceptionContext = new ContextedException(TEST_MESSAGE_2, new Exception(TEST_MESSAGE), new DefaultExceptionContext());
@@ -94,7 +94,7 @@ public class ContextedExceptionTest extends AbstractExceptionContextTest<Context
.addContextValue("test Date", new Date())
.addContextValue("test Nbr", Integer.valueOf(5))
.addContextValue("test Poorly written obj", new ObjectWithFaultyToString());
-
+
final String message = exceptionContext.getMessage();
assertTrue(message != null);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java b/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java
index c10b1e8..3a32175 100644
--- a/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -30,7 +30,7 @@ import org.junit.Test;
* JUnit tests for ContextedRuntimeException.
*/
public class ContextedRuntimeExceptionTest extends AbstractExceptionContextTest<ContextedRuntimeException> {
-
+
@Override
@Before
public void setUp() throws Exception {
@@ -51,7 +51,7 @@ public class ContextedRuntimeExceptionTest extends AbstractExceptionContextTest<
public void testContextedExceptionString() {
exceptionContext = new ContextedRuntimeException(TEST_MESSAGE);
assertEquals(TEST_MESSAGE, exceptionContext.getMessage());
-
+
final String trace = ExceptionUtils.getStackTrace(exceptionContext);
assertTrue(trace.contains(TEST_MESSAGE));
}
@@ -76,11 +76,11 @@ public class ContextedRuntimeExceptionTest extends AbstractExceptionContextTest<
assertTrue(trace.contains(TEST_MESSAGE_2));
assertTrue(message.contains(TEST_MESSAGE_2));
}
-
+
@Test
public void testContextedExceptionStringThrowableContext() {
// Use an anonymous subclass to make sure users can provide custom implementations
- exceptionContext = new ContextedRuntimeException(TEST_MESSAGE_2, new Exception(TEST_MESSAGE),
+ exceptionContext = new ContextedRuntimeException(TEST_MESSAGE_2, new Exception(TEST_MESSAGE),
new DefaultExceptionContext() {private static final long serialVersionUID = 1L;});
final String message = exceptionContext.getMessage();
final String trace = ExceptionUtils.getStackTrace(exceptionContext);
@@ -98,7 +98,7 @@ public class ContextedRuntimeExceptionTest extends AbstractExceptionContextTest<
.addContextValue("test Date", new Date())
.addContextValue("test Nbr", Integer.valueOf(5))
.addContextValue("test Poorly written obj", new ObjectWithFaultyToString());
-
+
final String message = exceptionContext.getMessage();
assertTrue(message != null);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java b/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java
index 79bf332..5a6c292 100644
--- a/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -23,14 +23,14 @@ import org.junit.Test;
* JUnit tests for DefaultExceptionContext.
*/
public class DefaultExceptionContextTest extends AbstractExceptionContextTest<DefaultExceptionContext> {
-
+
@Override
@Before
public void setUp() throws Exception {
exceptionContext = new DefaultExceptionContext();
super.setUp();
}
-
+
@Test
public void testFormattedExceptionMessageNull() {
exceptionContext = new DefaultExceptionContext();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
----------------------------------------------------------------------
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 af8b847..00ec843 100644
--- a/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -43,7 +43,7 @@ import org.junit.Test;
* @since 1.0
*/
public class ExceptionUtilsTest {
-
+
private NestableException nested;
private Throwable withCause;
private Throwable withoutCause;
@@ -98,7 +98,7 @@ public class ExceptionUtilsTest {
}
//-----------------------------------------------------------------------
-
+
@Test
public void testConstructor() {
assertNotNull(new ExceptionUtils());
@@ -108,7 +108,7 @@ public class ExceptionUtilsTest {
assertTrue(Modifier.isPublic(ExceptionUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(ExceptionUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@SuppressWarnings("deprecation") // Specifically tests the deprecated methods
@Test
@@ -135,7 +135,7 @@ public class ExceptionUtilsTest {
assertSame(null, ExceptionUtils.getCause(withCause, new String[0]));
assertSame(null, ExceptionUtils.getCause(withCause, new String[] {null}));
assertSame(nested, ExceptionUtils.getCause(withCause, new String[] {"getCause"}));
-
+
// not known type, so match on supplied method names
assertSame(null, ExceptionUtils.getCause(withoutCause, null));
assertSame(null, ExceptionUtils.getCause(withoutCause, new String[0]));
@@ -263,22 +263,22 @@ public class ExceptionUtilsTest {
public void testIndexOf_ThrowableClass() {
assertEquals(-1, ExceptionUtils.indexOfThrowable(null, null));
assertEquals(-1, ExceptionUtils.indexOfThrowable(null, NestableException.class));
-
+
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, null));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, ExceptionWithCause.class));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, NestableException.class));
assertEquals(0, ExceptionUtils.indexOfThrowable(withoutCause, ExceptionWithoutCause.class));
-
+
assertEquals(-1, ExceptionUtils.indexOfThrowable(nested, null));
assertEquals(-1, ExceptionUtils.indexOfThrowable(nested, ExceptionWithCause.class));
assertEquals(0, ExceptionUtils.indexOfThrowable(nested, NestableException.class));
assertEquals(1, ExceptionUtils.indexOfThrowable(nested, ExceptionWithoutCause.class));
-
+
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, null));
assertEquals(0, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class));
assertEquals(1, ExceptionUtils.indexOfThrowable(withCause, NestableException.class));
assertEquals(2, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithoutCause.class));
-
+
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, Exception.class));
}
@@ -286,17 +286,17 @@ public class ExceptionUtilsTest {
public void testIndexOf_ThrowableClassInt() {
assertEquals(-1, ExceptionUtils.indexOfThrowable(null, null, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(null, NestableException.class, 0));
-
+
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, null));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, ExceptionWithCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, NestableException.class, 0));
assertEquals(0, ExceptionUtils.indexOfThrowable(withoutCause, ExceptionWithoutCause.class, 0));
-
+
assertEquals(-1, ExceptionUtils.indexOfThrowable(nested, null, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(nested, ExceptionWithCause.class, 0));
assertEquals(0, ExceptionUtils.indexOfThrowable(nested, NestableException.class, 0));
assertEquals(1, ExceptionUtils.indexOfThrowable(nested, ExceptionWithoutCause.class, 0));
-
+
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, null));
assertEquals(0, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, 0));
assertEquals(1, ExceptionUtils.indexOfThrowable(withCause, NestableException.class, 0));
@@ -306,7 +306,7 @@ public class ExceptionUtilsTest {
assertEquals(0, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, 1));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, 9));
-
+
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, Exception.class, 0));
}
@@ -315,22 +315,22 @@ public class ExceptionUtilsTest {
public void testIndexOfType_ThrowableClass() {
assertEquals(-1, ExceptionUtils.indexOfType(null, null));
assertEquals(-1, ExceptionUtils.indexOfType(null, NestableException.class));
-
+
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, null));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, ExceptionWithCause.class));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, NestableException.class));
assertEquals(0, ExceptionUtils.indexOfType(withoutCause, ExceptionWithoutCause.class));
-
+
assertEquals(-1, ExceptionUtils.indexOfType(nested, null));
assertEquals(-1, ExceptionUtils.indexOfType(nested, ExceptionWithCause.class));
assertEquals(0, ExceptionUtils.indexOfType(nested, NestableException.class));
assertEquals(1, ExceptionUtils.indexOfType(nested, ExceptionWithoutCause.class));
-
+
assertEquals(-1, ExceptionUtils.indexOfType(withCause, null));
assertEquals(0, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class));
assertEquals(1, ExceptionUtils.indexOfType(withCause, NestableException.class));
assertEquals(2, ExceptionUtils.indexOfType(withCause, ExceptionWithoutCause.class));
-
+
assertEquals(0, ExceptionUtils.indexOfType(withCause, Exception.class));
}
@@ -338,17 +338,17 @@ public class ExceptionUtilsTest {
public void testIndexOfType_ThrowableClassInt() {
assertEquals(-1, ExceptionUtils.indexOfType(null, null, 0));
assertEquals(-1, ExceptionUtils.indexOfType(null, NestableException.class, 0));
-
+
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, null));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, ExceptionWithCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, NestableException.class, 0));
assertEquals(0, ExceptionUtils.indexOfType(withoutCause, ExceptionWithoutCause.class, 0));
-
+
assertEquals(-1, ExceptionUtils.indexOfType(nested, null, 0));
assertEquals(-1, ExceptionUtils.indexOfType(nested, ExceptionWithCause.class, 0));
assertEquals(0, ExceptionUtils.indexOfType(nested, NestableException.class, 0));
assertEquals(1, ExceptionUtils.indexOfType(nested, ExceptionWithoutCause.class, 0));
-
+
assertEquals(-1, ExceptionUtils.indexOfType(withCause, null));
assertEquals(0, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, 0));
assertEquals(1, ExceptionUtils.indexOfType(withCause, NestableException.class, 0));
@@ -358,7 +358,7 @@ public class ExceptionUtilsTest {
assertEquals(0, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, 1));
assertEquals(-1, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, 9));
-
+
assertEquals(0, ExceptionUtils.indexOfType(withCause, Exception.class, 0));
}
@@ -369,27 +369,27 @@ public class ExceptionUtilsTest {
// could pipe system.err to a known stream, but not much point as
// internally this method calls stream method anyway
}
-
+
@Test
public void testPrintRootCauseStackTrace_ThrowableStream() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
ExceptionUtils.printRootCauseStackTrace(null, (PrintStream) null);
ExceptionUtils.printRootCauseStackTrace(null, new PrintStream(out));
assertEquals(0, out.toString().length());
-
+
out = new ByteArrayOutputStream(1024);
try {
ExceptionUtils.printRootCauseStackTrace(withCause, (PrintStream) null);
fail();
} catch (final IllegalArgumentException ex) {
}
-
+
out = new ByteArrayOutputStream(1024);
final Throwable cause = createExceptionWithCause();
ExceptionUtils.printRootCauseStackTrace(cause, new PrintStream(out));
String stackTrace = out.toString();
assertTrue(stackTrace.contains(ExceptionUtils.WRAPPED_MARKER));
-
+
out = new ByteArrayOutputStream(1024);
ExceptionUtils.printRootCauseStackTrace(withoutCause, new PrintStream(out));
stackTrace = out.toString();
@@ -402,20 +402,20 @@ public class ExceptionUtilsTest {
ExceptionUtils.printRootCauseStackTrace(null, (PrintWriter) null);
ExceptionUtils.printRootCauseStackTrace(null, new PrintWriter(writer));
assertEquals(0, writer.getBuffer().length());
-
+
writer = new StringWriter(1024);
try {
ExceptionUtils.printRootCauseStackTrace(withCause, (PrintWriter) null);
fail();
} catch (final IllegalArgumentException ex) {
}
-
+
writer = new StringWriter(1024);
final Throwable cause = createExceptionWithCause();
ExceptionUtils.printRootCauseStackTrace(cause, new PrintWriter(writer));
String stackTrace = writer.toString();
assertTrue(stackTrace.contains(ExceptionUtils.WRAPPED_MARKER));
-
+
writer = new StringWriter(1024);
ExceptionUtils.printRootCauseStackTrace(withoutCause, new PrintWriter(writer));
stackTrace = writer.toString();
@@ -426,7 +426,7 @@ public class ExceptionUtilsTest {
@Test
public void testGetRootCauseStackTrace_Throwable() throws Exception {
assertEquals(0, ExceptionUtils.getRootCauseStackTrace(null).length);
-
+
final Throwable cause = createExceptionWithCause();
String[] stackTrace = ExceptionUtils.getRootCauseStackTrace(cause);
boolean match = false;
@@ -437,7 +437,7 @@ public class ExceptionUtilsTest {
}
}
assertTrue(match);
-
+
stackTrace = ExceptionUtils.getRootCauseStackTrace(withoutCause);
match = false;
for (final String element : stackTrace) {
@@ -458,10 +458,10 @@ public class ExceptionUtilsTest {
public void test_getMessage_Throwable() {
Throwable th = null;
assertEquals("", ExceptionUtils.getMessage(th));
-
+
th = new IllegalArgumentException("Base");
assertEquals("IllegalArgumentException: Base", ExceptionUtils.getMessage(th));
-
+
th = new ExceptionWithCause("Wrapper", th);
assertEquals("ExceptionUtilsTest.ExceptionWithCause: Wrapper", ExceptionUtils.getMessage(th));
}
@@ -470,10 +470,10 @@ public class ExceptionUtilsTest {
public void test_getRootCauseMessage_Throwable() {
Throwable th = null;
assertEquals("", ExceptionUtils.getRootCauseMessage(th));
-
+
th = new IllegalArgumentException("Base");
assertEquals("IllegalArgumentException: Base", ExceptionUtils.getRootCauseMessage(th));
-
+
th = new ExceptionWithCause("Wrapper", th);
assertEquals("IllegalArgumentException: Base", ExceptionUtils.getRootCauseMessage(th));
}
@@ -522,9 +522,9 @@ public class ExceptionUtilsTest {
}
}
- // Temporary classes to allow the nested exception code to be removed
- // prior to a rewrite of this test class.
- private static class NestableException extends Exception {
+ // Temporary classes to allow the nested exception code to be removed
+ // prior to a rewrite of this test class.
+ private static class NestableException extends Exception {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
@@ -554,7 +554,7 @@ public class ExceptionUtilsTest {
assertTrue(ioe instanceof IOException);
assertEquals(1, ExceptionUtils.getThrowableCount(ioe));
}
-
+
try {
redeclareCheckedException();
Assert.fail("Exception not thrown");
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/math/FractionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/math/FractionTest.java b/src/test/java/org/apache/commons/lang3/math/FractionTest.java
index d55b8d8..3c36761 100644
--- a/src/test/java/org/apache/commons/lang3/math/FractionTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/FractionTest.java
@@ -30,7 +30,7 @@ import org.junit.Test;
* Test cases for the {@link Fraction} class
*/
public class FractionTest {
-
+
private static final int SKIP = 500; //53
//--------------------------------------------------------------------------
@@ -38,37 +38,37 @@ public class FractionTest {
public void testConstants() {
assertEquals(0, Fraction.ZERO.getNumerator());
assertEquals(1, Fraction.ZERO.getDenominator());
-
+
assertEquals(1, Fraction.ONE.getNumerator());
assertEquals(1, Fraction.ONE.getDenominator());
-
+
assertEquals(1, Fraction.ONE_HALF.getNumerator());
assertEquals(2, Fraction.ONE_HALF.getDenominator());
-
+
assertEquals(1, Fraction.ONE_THIRD.getNumerator());
assertEquals(3, Fraction.ONE_THIRD.getDenominator());
-
+
assertEquals(2, Fraction.TWO_THIRDS.getNumerator());
assertEquals(3, Fraction.TWO_THIRDS.getDenominator());
-
+
assertEquals(1, Fraction.ONE_QUARTER.getNumerator());
assertEquals(4, Fraction.ONE_QUARTER.getDenominator());
-
+
assertEquals(2, Fraction.TWO_QUARTERS.getNumerator());
assertEquals(4, Fraction.TWO_QUARTERS.getDenominator());
-
+
assertEquals(3, Fraction.THREE_QUARTERS.getNumerator());
assertEquals(4, Fraction.THREE_QUARTERS.getDenominator());
-
+
assertEquals(1, Fraction.ONE_FIFTH.getNumerator());
assertEquals(5, Fraction.ONE_FIFTH.getDenominator());
-
+
assertEquals(2, Fraction.TWO_FIFTHS.getNumerator());
assertEquals(5, Fraction.TWO_FIFTHS.getDenominator());
-
+
assertEquals(3, Fraction.THREE_FIFTHS.getNumerator());
assertEquals(5, Fraction.THREE_FIFTHS.getDenominator());
-
+
assertEquals(4, Fraction.FOUR_FIFTHS.getNumerator());
assertEquals(5, Fraction.FOUR_FIFTHS.getDenominator());
}
@@ -76,58 +76,58 @@ public class FractionTest {
@Test
public void testFactory_int_int() {
Fraction f = null;
-
+
// zero
f = Fraction.getFraction(0, 1);
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getFraction(0, 2);
assertEquals(0, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
// normal
f = Fraction.getFraction(1, 1);
assertEquals(1, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getFraction(2, 1);
assertEquals(2, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getFraction(23, 345);
assertEquals(23, f.getNumerator());
assertEquals(345, f.getDenominator());
-
+
// improper
f = Fraction.getFraction(22, 7);
assertEquals(22, f.getNumerator());
assertEquals(7, f.getDenominator());
-
+
// negatives
f = Fraction.getFraction(-6, 10);
assertEquals(-6, f.getNumerator());
assertEquals(10, f.getDenominator());
-
+
f = Fraction.getFraction(6, -10);
assertEquals(-6, f.getNumerator());
assertEquals(10, f.getDenominator());
-
+
f = Fraction.getFraction(-6, -10);
assertEquals(6, f.getNumerator());
assertEquals(10, f.getDenominator());
-
+
// zero denominator
try {
f = Fraction.getFraction(1, 0);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction(2, 0);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction(-3, 0);
fail("expecting ArithmeticException");
@@ -147,25 +147,25 @@ public class FractionTest {
@Test
public void testFactory_int_int_int() {
Fraction f = null;
-
+
// zero
f = Fraction.getFraction(0, 0, 2);
assertEquals(0, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f = Fraction.getFraction(2, 0, 2);
assertEquals(4, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f = Fraction.getFraction(0, 1, 2);
assertEquals(1, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
// normal
f = Fraction.getFraction(1, 1, 2);
assertEquals(3, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
// negatives
try {
f = Fraction.getFraction(1, -6, -10);
@@ -181,12 +181,12 @@ public class FractionTest {
f = Fraction.getFraction(1, -6, -10);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
// negative whole
f = Fraction.getFraction(-1, 6, 10);
assertEquals(-16, f.getNumerator());
assertEquals(10, f.getDenominator());
-
+
try {
f = Fraction.getFraction(-1, -6, 10);
fail("expecting ArithmeticException");
@@ -196,33 +196,33 @@ public class FractionTest {
f = Fraction.getFraction(-1, 6, -10);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction(-1, -6, -10);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
// zero denominator
try {
f = Fraction.getFraction(0, 1, 0);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction(1, 2, 0);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction(-1, -3, 0);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
- f = Fraction.getFraction(Integer.MAX_VALUE, 1, 2);
+ f = Fraction.getFraction(Integer.MAX_VALUE, 1, 2);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction(-Integer.MAX_VALUE, 1, 2);
fail("expecting ArithmeticException");
@@ -250,87 +250,87 @@ public class FractionTest {
@Test
public void testReducedFactory_int_int() {
Fraction f = null;
-
+
// zero
f = Fraction.getReducedFraction(0, 1);
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
// normal
f = Fraction.getReducedFraction(1, 1);
assertEquals(1, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getReducedFraction(2, 1);
assertEquals(2, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
// improper
f = Fraction.getReducedFraction(22, 7);
assertEquals(22, f.getNumerator());
assertEquals(7, f.getDenominator());
-
+
// negatives
f = Fraction.getReducedFraction(-6, 10);
assertEquals(-3, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f = Fraction.getReducedFraction(6, -10);
assertEquals(-3, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f = Fraction.getReducedFraction(-6, -10);
assertEquals(3, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
// zero denominator
try {
f = Fraction.getReducedFraction(1, 0);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getReducedFraction(2, 0);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getReducedFraction(-3, 0);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
- // reduced
+ // reduced
f = Fraction.getReducedFraction(0, 2);
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getReducedFraction(2, 2);
assertEquals(1, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getReducedFraction(2, 4);
assertEquals(1, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f = Fraction.getReducedFraction(15, 10);
assertEquals(3, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f = Fraction.getReducedFraction(121, 22);
assertEquals(11, f.getNumerator());
assertEquals(2, f.getDenominator());
-
- // Extreme values
+
+ // Extreme values
// OK, can reduce before negating
f = Fraction.getReducedFraction(-2, Integer.MIN_VALUE);
assertEquals(1, f.getNumerator());
assertEquals(-(Integer.MIN_VALUE / 2), f.getDenominator());
-
+
// Can't reduce, negation will throw
- try {
- f = Fraction.getReducedFraction(-7, Integer.MIN_VALUE);
+ try {
+ f = Fraction.getReducedFraction(-7, Integer.MIN_VALUE);
fail("Expecting ArithmeticException");
- } catch (final ArithmeticException ex) {}
+ } catch (final ArithmeticException ex) {}
// LANG-662
f = Fraction.getReducedFraction(Integer.MIN_VALUE, 2);
@@ -341,62 +341,62 @@ public class FractionTest {
@Test
public void testFactory_double() {
Fraction f = null;
-
+
try {
f = Fraction.getFraction(Double.NaN);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction(Double.POSITIVE_INFINITY);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction(Double.NEGATIVE_INFINITY);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f = Fraction.getFraction((double) Integer.MAX_VALUE + 1);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
// zero
f = Fraction.getFraction(0.0d);
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
// one
f = Fraction.getFraction(1.0d);
assertEquals(1, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
// one half
f = Fraction.getFraction(0.5d);
assertEquals(1, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
// negative
f = Fraction.getFraction(-0.875d);
assertEquals(-7, f.getNumerator());
assertEquals(8, f.getDenominator());
-
+
// over 1
f = Fraction.getFraction(1.25d);
assertEquals(5, f.getNumerator());
assertEquals(4, f.getDenominator());
-
+
// two thirds
f = Fraction.getFraction(0.66666d);
assertEquals(2, f.getNumerator());
assertEquals(3, f.getDenominator());
-
+
// small
f = Fraction.getFraction(1.0d/10001d);
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
// normal
Fraction f2 = null;
for (int i = 1; i <= 100; i++) { // denominator
@@ -432,38 +432,38 @@ public class FractionTest {
public void testFactory_String() {
Fraction.getFraction(null);
}
-
-
+
+
@Test
public void testFactory_String_double() {
Fraction f = null;
-
+
f = Fraction.getFraction("0.0");
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getFraction("0.2");
assertEquals(1, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f = Fraction.getFraction("0.5");
assertEquals(1, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f = Fraction.getFraction("0.66666");
assertEquals(2, f.getNumerator());
assertEquals(3, f.getDenominator());
-
+
try {
f = Fraction.getFraction("2.3R");
fail("Expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction("2147483648"); // too big
fail("Expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction(".");
fail("Expecting NumberFormatException");
@@ -473,46 +473,46 @@ public class FractionTest {
@Test
public void testFactory_String_proper() {
Fraction f = null;
-
+
f = Fraction.getFraction("0 0/1");
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getFraction("1 1/5");
assertEquals(6, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f = Fraction.getFraction("7 1/2");
assertEquals(15, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f = Fraction.getFraction("1 2/4");
assertEquals(6, f.getNumerator());
assertEquals(4, f.getDenominator());
-
+
f = Fraction.getFraction("-7 1/2");
assertEquals(-15, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f = Fraction.getFraction("-1 2/4");
assertEquals(-6, f.getNumerator());
assertEquals(4, f.getDenominator());
-
+
try {
f = Fraction.getFraction("2 3");
fail("expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction("a 3");
fail("expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction("2 b/4");
fail("expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction("2 ");
fail("expecting NumberFormatException");
@@ -522,7 +522,7 @@ public class FractionTest {
f = Fraction.getFraction(" 3");
fail("expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction(" ");
fail("expecting NumberFormatException");
@@ -532,46 +532,46 @@ public class FractionTest {
@Test
public void testFactory_String_improper() {
Fraction f = null;
-
+
f = Fraction.getFraction("0/1");
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f = Fraction.getFraction("1/5");
assertEquals(1, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f = Fraction.getFraction("1/2");
assertEquals(1, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f = Fraction.getFraction("2/3");
assertEquals(2, f.getNumerator());
assertEquals(3, f.getDenominator());
-
+
f = Fraction.getFraction("7/3");
assertEquals(7, f.getNumerator());
assertEquals(3, f.getDenominator());
-
+
f = Fraction.getFraction("2/4");
assertEquals(2, f.getNumerator());
assertEquals(4, f.getDenominator());
-
+
try {
f = Fraction.getFraction("2/d");
fail("expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction("2e/3");
fail("expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction("2/");
fail("expecting NumberFormatException");
} catch (final NumberFormatException ex) {}
-
+
try {
f = Fraction.getFraction("/");
fail("expecting NumberFormatException");
@@ -581,13 +581,13 @@ public class FractionTest {
@Test
public void testGets() {
Fraction f = null;
-
+
f = Fraction.getFraction(3, 5, 6);
assertEquals(23, f.getNumerator());
assertEquals(3, f.getProperWhole());
assertEquals(5, f.getProperNumerator());
assertEquals(6, f.getDenominator());
-
+
f = Fraction.getFraction(-3, 5, 6);
assertEquals(-23, f.getNumerator());
assertEquals(-3, f.getProperWhole());
@@ -600,22 +600,22 @@ public class FractionTest {
assertEquals(0, f.getProperNumerator());
assertEquals(1, f.getDenominator());
}
-
+
@Test
public void testConversions() {
Fraction f = null;
-
+
f = Fraction.getFraction(3, 7, 8);
assertEquals(3, f.intValue());
assertEquals(3L, f.longValue());
assertEquals(3.875f, f.floatValue(), 0.00001f);
assertEquals(3.875d, f.doubleValue(), 0.00001d);
}
-
+
@Test
public void testReduce() {
Fraction f = null;
-
+
f = Fraction.getFraction(50, 75);
Fraction result = f.reduce();
assertEquals(2, result.getNumerator());
@@ -660,26 +660,26 @@ public class FractionTest {
assertEquals(Integer.MIN_VALUE / 2, result.getNumerator());
assertEquals(1, result.getDenominator());
}
-
+
@Test
public void testInvert() {
Fraction f = null;
-
+
f = Fraction.getFraction(50, 75);
f = f.invert();
assertEquals(75, f.getNumerator());
assertEquals(50, f.getDenominator());
-
+
f = Fraction.getFraction(4, 3);
f = f.invert();
assertEquals(3, f.getNumerator());
assertEquals(4, f.getDenominator());
-
+
f = Fraction.getFraction(-15, 47);
f = f.invert();
assertEquals(-47, f.getNumerator());
assertEquals(15, f.getDenominator());
-
+
f = Fraction.getFraction(0, 3);
try {
f = f.invert();
@@ -698,16 +698,16 @@ public class FractionTest {
assertEquals(1, f.getNumerator());
assertEquals(Integer.MAX_VALUE, f.getDenominator());
}
-
+
@Test
public void testNegate() {
Fraction f = null;
-
+
f = Fraction.getFraction(50, 75);
f = f.negate();
assertEquals(-50, f.getNumerator());
assertEquals(75, f.getDenominator());
-
+
f = Fraction.getFraction(-50, 75);
f = f.negate();
assertEquals(50, f.getNumerator());
@@ -725,16 +725,16 @@ public class FractionTest {
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
}
-
+
@Test
public void testAbs() {
Fraction f = null;
-
+
f = Fraction.getFraction(50, 75);
f = f.abs();
assertEquals(50, f.getNumerator());
assertEquals(75, f.getDenominator());
-
+
f = Fraction.getFraction(-50, 75);
f = f.abs();
assertEquals(50, f.getNumerator());
@@ -756,14 +756,14 @@ public class FractionTest {
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
}
-
+
@Test
public void testPow() {
Fraction f = null;
-
+
f = Fraction.getFraction(3, 5);
assertEquals(Fraction.ONE, f.pow(0));
-
+
f = Fraction.getFraction(3, 5);
assertSame(f, f.pow(1));
assertEquals(f, f.pow(1));
@@ -772,26 +772,26 @@ public class FractionTest {
f = f.pow(2);
assertEquals(9, f.getNumerator());
assertEquals(25, f.getDenominator());
-
+
f = Fraction.getFraction(3, 5);
f = f.pow(3);
assertEquals(27, f.getNumerator());
assertEquals(125, f.getDenominator());
-
+
f = Fraction.getFraction(3, 5);
f = f.pow(-1);
assertEquals(5, f.getNumerator());
assertEquals(3, f.getDenominator());
-
+
f = Fraction.getFraction(3, 5);
f = f.pow(-2);
assertEquals(25, f.getNumerator());
assertEquals(9, f.getDenominator());
-
+
// check unreduced fractions stay that way.
f = Fraction.getFraction(6, 10);
assertEquals(Fraction.ONE, f.pow(0));
-
+
f = Fraction.getFraction(6, 10);
assertEquals(f, f.pow(1));
assertFalse(f.pow(1).equals(Fraction.getFraction(3,5)));
@@ -800,22 +800,22 @@ public class FractionTest {
f = f.pow(2);
assertEquals(9, f.getNumerator());
assertEquals(25, f.getDenominator());
-
+
f = Fraction.getFraction(6, 10);
f = f.pow(3);
assertEquals(27, f.getNumerator());
assertEquals(125, f.getDenominator());
-
+
f = Fraction.getFraction(6, 10);
f = f.pow(-1);
assertEquals(10, f.getNumerator());
assertEquals(6, f.getDenominator());
-
+
f = Fraction.getFraction(6, 10);
f = f.pow(-2);
assertEquals(25, f.getNumerator());
assertEquals(9, f.getDenominator());
-
+
// zero to any positive power is still zero.
f = Fraction.getFraction(0, 1231);
f = f.pow(1);
@@ -869,73 +869,73 @@ public class FractionTest {
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
}
-
+
@Test
public void testAdd() {
Fraction f = null;
Fraction f1 = null;
Fraction f2 = null;
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(1, 5);
f = f1.add(f2);
assertEquals(4, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(2, 5);
f = f1.add(f2);
assertEquals(1, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(3, 5);
f = f1.add(f2);
assertEquals(6, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(-4, 5);
f = f1.add(f2);
assertEquals(-1, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f1 = Fraction.getFraction(Integer.MAX_VALUE - 1, 1);
f2 = Fraction.ONE;
f = f1.add(f2);
assertEquals(Integer.MAX_VALUE, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(1, 2);
f = f1.add(f2);
assertEquals(11, f.getNumerator());
assertEquals(10, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 8);
f2 = Fraction.getFraction(1, 6);
f = f1.add(f2);
assertEquals(13, f.getNumerator());
assertEquals(24, f.getDenominator());
-
+
f1 = Fraction.getFraction(0, 5);
f2 = Fraction.getFraction(1, 5);
f = f1.add(f2);
assertSame(f2, f);
f = f2.add(f1);
assertSame(f2, f);
-
+
f1 = Fraction.getFraction(-1, 13*13*2*2);
f2 = Fraction.getFraction(-2, 13*17*2);
f = f1.add(f2);
assertEquals(13*13*17*2*2, f.getDenominator());
assertEquals(-17 - 2*13*2, f.getNumerator());
-
+
try {
f.add(null);
fail("expecting IllegalArgumentException");
} catch (final IllegalArgumentException ex) {}
-
+
// if this fraction is added naively, it will overflow.
// check that it doesn't.
f1 = Fraction.getFraction(1,32768*3);
@@ -949,18 +949,18 @@ public class FractionTest {
f = f1.add(f2);
assertEquals(Integer.MIN_VALUE+1, f.getNumerator());
assertEquals(3, f.getDenominator());
-
+
f1 = Fraction.getFraction(Integer.MAX_VALUE - 1, 1);
f2 = Fraction.ONE;
f = f1.add(f2);
assertEquals(Integer.MAX_VALUE, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
try {
f = f.add(Fraction.ONE); // should overflow
fail("expecting ArithmeticException but got: " + f.toString());
} catch (final ArithmeticException ex) {}
-
+
// denominator should not be a multiple of 2 or 3 to trigger overflow
f1 = Fraction.getFraction(Integer.MIN_VALUE, 5);
f2 = Fraction.getFraction(-1,5);
@@ -968,19 +968,19 @@ public class FractionTest {
f = f1.add(f2); // should overflow
fail("expecting ArithmeticException but got: " + f.toString());
} catch (final ArithmeticException ex) {}
-
+
try {
f= Fraction.getFraction(-Integer.MAX_VALUE, 1);
f = f.add(f);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f= Fraction.getFraction(-Integer.MAX_VALUE, 1);
f = f.add(f);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
f1 = Fraction.getFraction(3,327680);
f2 = Fraction.getFraction(2,59049);
try {
@@ -988,65 +988,65 @@ public class FractionTest {
fail("expecting ArithmeticException but got: " + f.toString());
} catch (final ArithmeticException ex) {}
}
-
+
@Test
public void testSubtract() {
Fraction f = null;
Fraction f1 = null;
Fraction f2 = null;
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(1, 5);
f = f1.subtract(f2);
assertEquals(2, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f1 = Fraction.getFraction(7, 5);
f2 = Fraction.getFraction(2, 5);
f = f1.subtract(f2);
assertEquals(1, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(3, 5);
f = f1.subtract(f2);
assertEquals(0, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(-4, 5);
f = f1.subtract(f2);
assertEquals(7, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f1 = Fraction.getFraction(0, 5);
f2 = Fraction.getFraction(4, 5);
f = f1.subtract(f2);
assertEquals(-4, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f1 = Fraction.getFraction(0, 5);
f2 = Fraction.getFraction(-4, 5);
f = f1.subtract(f2);
assertEquals(4, f.getNumerator());
assertEquals(5, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(1, 2);
f = f1.subtract(f2);
assertEquals(1, f.getNumerator());
assertEquals(10, f.getDenominator());
-
+
f1 = Fraction.getFraction(0, 5);
f2 = Fraction.getFraction(1, 5);
f = f2.subtract(f1);
assertSame(f2, f);
-
+
try {
f.subtract(null);
fail("expecting IllegalArgumentException");
} catch (final IllegalArgumentException ex) {}
-
+
// if this fraction is subtracted naively, it will overflow.
// check that it doesn't.
f1 = Fraction.getFraction(1,32768*3);
@@ -1060,7 +1060,7 @@ public class FractionTest {
f = f1.subtract(f2);
assertEquals(Integer.MIN_VALUE+1, f.getNumerator());
assertEquals(3, f.getDenominator());
-
+
f1 = Fraction.getFraction(Integer.MAX_VALUE, 1);
f2 = Fraction.ONE;
f = f1.subtract(f2);
@@ -1073,7 +1073,7 @@ public class FractionTest {
f = f1.subtract(f2);
fail("expecting ArithmeticException"); //should overflow
} catch (final ArithmeticException ex) {}
-
+
// denominator should not be a multiple of 2 or 3 to trigger overflow
f1 = Fraction.getFraction(Integer.MIN_VALUE, 5);
f2 = Fraction.getFraction(1,5);
@@ -1081,19 +1081,19 @@ public class FractionTest {
f = f1.subtract(f2); // should overflow
fail("expecting ArithmeticException but got: " + f.toString());
} catch (final ArithmeticException ex) {}
-
+
try {
f= Fraction.getFraction(Integer.MIN_VALUE, 1);
f = f.subtract(Fraction.ONE);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f= Fraction.getFraction(Integer.MAX_VALUE, 1);
f = f.subtract(Fraction.ONE.negate());
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
f1 = Fraction.getFraction(3,327680);
f2 = Fraction.getFraction(2,59049);
try {
@@ -1101,19 +1101,19 @@ public class FractionTest {
fail("expecting ArithmeticException but got: " + f.toString());
} catch (final ArithmeticException ex) {}
}
-
+
@Test
public void testMultiply() {
Fraction f = null;
Fraction f1 = null;
Fraction f2 = null;
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(2, 5);
f = f1.multiplyBy(f2);
assertEquals(6, f.getNumerator());
assertEquals(25, f.getDenominator());
-
+
f1 = Fraction.getFraction(6, 10);
f2 = Fraction.getFraction(6, 10);
f = f1.multiplyBy(f2);
@@ -1122,31 +1122,31 @@ public class FractionTest {
f = f.multiplyBy(f2);
assertEquals(27, f.getNumerator());
assertEquals(125, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(-2, 5);
f = f1.multiplyBy(f2);
assertEquals(-6, f.getNumerator());
assertEquals(25, f.getDenominator());
-
+
f1 = Fraction.getFraction(-3, 5);
f2 = Fraction.getFraction(-2, 5);
f = f1.multiplyBy(f2);
assertEquals(6, f.getNumerator());
assertEquals(25, f.getDenominator());
-
-
+
+
f1 = Fraction.getFraction(0, 5);
f2 = Fraction.getFraction(2, 7);
f = f1.multiplyBy(f2);
assertSame(Fraction.ZERO, f);
-
+
f1 = Fraction.getFraction(2, 7);
f2 = Fraction.ONE;
f = f1.multiplyBy(f2);
assertEquals(2, f.getNumerator());
assertEquals(7, f.getDenominator());
-
+
f1 = Fraction.getFraction(Integer.MAX_VALUE, 1);
f2 = Fraction.getFraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
f = f1.multiplyBy(f2);
@@ -1157,55 +1157,55 @@ public class FractionTest {
f.multiplyBy(null);
fail("expecting IllegalArgumentException");
} catch (final IllegalArgumentException ex) {}
-
+
try {
f1 = Fraction.getFraction(1, Integer.MAX_VALUE);
f = f1.multiplyBy(f1); // should overflow
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
try {
f1 = Fraction.getFraction(1, -Integer.MAX_VALUE);
f = f1.multiplyBy(f1); // should overflow
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
}
-
+
@Test
public void testDivide() {
Fraction f = null;
Fraction f1 = null;
Fraction f2 = null;
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(2, 5);
f = f1.divideBy(f2);
assertEquals(3, f.getNumerator());
assertEquals(2, f.getDenominator());
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.ZERO;
try {
f = f1.divideBy(f2);
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
-
+
f1 = Fraction.getFraction(0, 5);
f2 = Fraction.getFraction(2, 7);
f = f1.divideBy(f2);
assertSame(Fraction.ZERO, f);
-
+
f1 = Fraction.getFraction(2, 7);
f2 = Fraction.ONE;
f = f1.divideBy(f2);
assertEquals(2, f.getNumerator());
assertEquals(7, f.getDenominator());
-
+
f1 = Fraction.getFraction(1, Integer.MAX_VALUE);
- f = f1.divideBy(f1);
+ f = f1.divideBy(f1);
assertEquals(1, f.getNumerator());
assertEquals(1, f.getDenominator());
-
+
f1 = Fraction.getFraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
f2 = Fraction.getFraction(1, Integer.MAX_VALUE);
f = f1.divideBy(f2);
@@ -1216,7 +1216,7 @@ public class FractionTest {
f.divideBy(null);
fail("IllegalArgumentException");
} catch (final IllegalArgumentException ex) {}
-
+
try {
f1 = Fraction.getFraction(1, Integer.MAX_VALUE);
f = f1.divideBy(f1.invert()); // should overflow
@@ -1228,69 +1228,69 @@ public class FractionTest {
fail("expecting ArithmeticException");
} catch (final ArithmeticException ex) {}
}
-
+
@Test
public void testEquals() {
Fraction f1 = null;
Fraction f2 = null;
-
+
f1 = Fraction.getFraction(3, 5);
assertFalse(f1.equals(null));
assertFalse(f1.equals(new Object()));
assertFalse(f1.equals(Integer.valueOf(6)));
-
+
f1 = Fraction.getFraction(3, 5);
f2 = Fraction.getFraction(2, 5);
assertFalse(f1.equals(f2));
assertTrue(f1.equals(f1));
assertTrue(f2.equals(f2));
-
+
f2 = Fraction.getFraction(3, 5);
assertTrue(f1.equals(f2));
-
+
f2 = Fraction.getFraction(6, 10);
assertFalse(f1.equals(f2));
}
-
+
@Test
public void testHashCode() {
final Fraction f1 = Fraction.getFraction(3, 5);
Fraction f2 = Fraction.getFraction(3, 5);
-
+
assertTrue(f1.hashCode() == f2.hashCode());
-
+
f2 = Fraction.getFraction(2, 5);
assertTrue(f1.hashCode() != f2.hashCode());
-
+
f2 = Fraction.getFraction(6, 10);
assertTrue(f1.hashCode() != f2.hashCode());
}
-
+
@Test
public void testCompareTo() {
Fraction f1 = null;
Fraction f2 = null;
-
+
f1 = Fraction.getFraction(3, 5);
assertTrue(f1.compareTo(f1) == 0);
-
+
try {
f1.compareTo(null);
fail("expecting NullPointerException");
} catch (final NullPointerException ex) {}
-
+
f2 = Fraction.getFraction(2, 5);
assertTrue(f1.compareTo(f2) > 0);
assertTrue(f2.compareTo(f2) == 0);
-
+
f2 = Fraction.getFraction(4, 5);
assertTrue(f1.compareTo(f2) < 0);
assertTrue(f2.compareTo(f2) == 0);
-
+
f2 = Fraction.getFraction(3, 5);
assertTrue(f1.compareTo(f2) == 0);
assertTrue(f2.compareTo(f2) == 0);
-
+
f2 = Fraction.getFraction(6, 10);
assertTrue(f1.compareTo(f2) == 0);
assertTrue(f2.compareTo(f2) == 0);
@@ -1300,7 +1300,7 @@ public class FractionTest {
assertTrue(f2.compareTo(f2) == 0);
}
-
+
@Test
public void testToString() {
Fraction f = null;
@@ -1309,26 +1309,26 @@ public class FractionTest {
final String str = f.toString();
assertEquals("3/5", str);
assertSame(str, f.toString());
-
+
f = Fraction.getFraction(7, 5);
- assertEquals("7/5", f.toString());
-
+ assertEquals("7/5", f.toString());
+
f = Fraction.getFraction(4, 2);
- assertEquals("4/2", f.toString());
-
+ assertEquals("4/2", f.toString());
+
f = Fraction.getFraction(0, 2);
- assertEquals("0/2", f.toString());
-
+ assertEquals("0/2", f.toString());
+
f = Fraction.getFraction(2, 2);
- assertEquals("2/2", f.toString());
+ assertEquals("2/2", f.toString());
f = Fraction.getFraction(Integer.MIN_VALUE, 0, 1);
- assertEquals("-2147483648/1", f.toString());
+ assertEquals("-2147483648/1", f.toString());
f = Fraction.getFraction(-1, 1, Integer.MAX_VALUE);
assertEquals("-2147483648/2147483647", f.toString());
}
-
+
@Test
public void testToProperString() {
Fraction f = null;
@@ -1337,27 +1337,27 @@ public class FractionTest {
final String str = f.toProperString();
assertEquals("3/5", str);
assertSame(str, f.toProperString());
-
+
f = Fraction.getFraction(7, 5);
- assertEquals("1 2/5", f.toProperString());
-
+ assertEquals("1 2/5", f.toProperString());
+
f = Fraction.getFraction(14, 10);
- assertEquals("1 4/10", f.toProperString());
-
+ assertEquals("1 4/10", f.toProperString());
+
f = Fraction.getFraction(4, 2);
- assertEquals("2", f.toProperString());
-
+ assertEquals("2", f.toProperString());
+
f = Fraction.getFraction(0, 2);
- assertEquals("0", f.toProperString());
-
+ assertEquals("0", f.toProperString());
+
f = Fraction.getFraction(2, 2);
- assertEquals("1", f.toProperString());
-
+ assertEquals("1", f.toProperString());
+
f = Fraction.getFraction(-7, 5);
- assertEquals("-1 2/5", f.toProperString());
+ assertEquals("-1 2/5", f.toProperString());
f = Fraction.getFraction(Integer.MIN_VALUE, 0, 1);
- assertEquals("-2147483648", f.toProperString());
+ assertEquals("-2147483648", f.toProperString());
f = Fraction.getFraction(-1, 1, Integer.MAX_VALUE);
assertEquals("-1 1/2147483647", f.toProperString());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java
index 1c98c3d..026c0f7 100644
--- a/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/IEEE754rUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -101,5 +101,5 @@ public class IEEE754rUtilsTest {
public void testConstructorExists() {
new IEEE754rUtils();
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
index e504239..3a53c1e 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -114,7 +114,7 @@ public class NumberUtilsTest {
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);
}
-
+
/**
* Test for {(@link NumberUtils#createNumber(String)}
*/
@@ -123,7 +123,7 @@ public class NumberUtilsTest {
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);
@@ -243,7 +243,7 @@ public class NumberUtilsTest {
final Number bigNum = NumberUtils.createNumber("-1.1E-700F");
assertNotNull(bigNum);
assertEquals(BigDecimal.class, bigNum.getClass());
-
+
// LANG-1018
assertEquals("createNumber(String) LANG-1018 failed",
Double.valueOf("-160952.54"), NumberUtils.createNumber("-160952.54"));
@@ -254,7 +254,7 @@ public class NumberUtilsTest {
assertEquals("createNumber(String) LANG-1215 failed",
Double.valueOf("193343.82"), NumberUtils.createNumber("193343.82"));
}
-
+
@Test
public void testLang1087(){
// no sign cases
@@ -1418,7 +1418,7 @@ public class NumberUtilsTest {
}
fail("Expecting "+ expected + " for isCreatable/createNumber using \"" + val + "\" but got " + isValid + " and " + canCreate);
}
-
+
@Test
public void testIsParsable() {
assertFalse( NumberUtils.isParsable(null) );
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/mutable/MutableBooleanTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableBooleanTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableBooleanTest.java
index 67c6229..09c793c 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableBooleanTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableBooleanTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;
/**
* JUnit tests.
- *
+ *
* @since 2.2
* @see MutableBoolean
*/
@@ -41,7 +41,7 @@ public class MutableBooleanTest {
assertEquals(+1, mutBool.compareTo(new MutableBoolean(false)));
assertEquals(0, mutBool.compareTo(new MutableBoolean(true)));
}
-
+
@Test(expected=NullPointerException.class)
public void testCompareToNull() {
final MutableBoolean mutBool = new MutableBoolean(false);
@@ -88,7 +88,7 @@ public class MutableBooleanTest {
public void testGetSet() {
assertFalse(new MutableBoolean().booleanValue());
assertEquals(Boolean.FALSE, new MutableBoolean().getValue());
-
+
final MutableBoolean mutBool = new MutableBoolean(false);
assertEquals(Boolean.FALSE, mutBool.toBoolean());
assertFalse(mutBool.booleanValue());
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java
index 10d9aee..61dfd0d 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableByteTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
/**
* JUnit tests.
- *
+ *
* @see MutableByte
*/
public class MutableByteTest {
@@ -33,9 +33,9 @@ public class MutableByteTest {
@Test
public void testConstructors() {
assertEquals((byte) 0, new MutableByte().byteValue());
-
+
assertEquals((byte) 1, new MutableByte((byte) 1).byteValue());
-
+
assertEquals((byte) 2, new MutableByte(Byte.valueOf((byte) 2)).byteValue());
assertEquals((byte) 3, new MutableByte(new MutableByte((byte) 3)).byteValue());
@@ -53,15 +53,15 @@ public class MutableByteTest {
final MutableByte mutNum = new MutableByte((byte) 0);
assertEquals((byte) 0, new MutableByte().byteValue());
assertEquals(Byte.valueOf((byte) 0), new MutableByte().getValue());
-
+
mutNum.setValue((byte) 1);
assertEquals((byte) 1, mutNum.byteValue());
assertEquals(Byte.valueOf((byte) 1), mutNum.getValue());
-
+
mutNum.setValue(Byte.valueOf((byte) 2));
assertEquals((byte) 2, mutNum.byteValue());
assertEquals(Byte.valueOf((byte) 2), mutNum.getValue());
-
+
mutNum.setValue(new MutableByte((byte) 3));
assertEquals((byte) 3, mutNum.byteValue());
assertEquals(Byte.valueOf((byte) 3), mutNum.getValue());
@@ -121,7 +121,7 @@ public class MutableByteTest {
@Test
public void testPrimitiveValues() {
final MutableByte mutNum = new MutableByte( (byte) 1 );
-
+
assertEquals( 1.0F, mutNum.floatValue(), 0 );
assertEquals( 1.0, mutNum.doubleValue(), 0 );
assertEquals( (byte) 1, mutNum.byteValue() );
@@ -140,7 +140,7 @@ public class MutableByteTest {
public void testIncrement() {
final MutableByte mutNum = new MutableByte((byte) 1);
mutNum.increment();
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -169,7 +169,7 @@ public class MutableByteTest {
public void testDecrement() {
final MutableByte mutNum = new MutableByte((byte) 1);
mutNum.decrement();
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
@@ -198,7 +198,7 @@ public class MutableByteTest {
public void testAddValuePrimitive() {
final MutableByte mutNum = new MutableByte((byte) 1);
mutNum.add((byte)1);
-
+
assertEquals((byte) 2, mutNum.byteValue());
}
@@ -206,7 +206,7 @@ public class MutableByteTest {
public void testAddValueObject() {
final MutableByte mutNum = new MutableByte((byte) 1);
mutNum.add(Integer.valueOf(1));
-
+
assertEquals((byte) 2, mutNum.byteValue());
}
@@ -250,7 +250,7 @@ public class MutableByteTest {
public void testSubtractValuePrimitive() {
final MutableByte mutNum = new MutableByte((byte) 1);
mutNum.subtract((byte) 1);
-
+
assertEquals((byte) 0, mutNum.byteValue());
}
@@ -258,7 +258,7 @@ public class MutableByteTest {
public void testSubtractValueObject() {
final MutableByte mutNum = new MutableByte((byte) 1);
mutNum.subtract(Integer.valueOf(1));
-
+
assertEquals((byte) 0, mutNum.byteValue());
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java
index 8cfb8f3..df1b6d5 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableDoubleTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
/**
* JUnit tests.
- *
+ *
* @see MutableDouble
*/
public class MutableDoubleTest {
@@ -33,12 +33,12 @@ public class MutableDoubleTest {
@Test
public void testConstructors() {
assertEquals(0d, new MutableDouble().doubleValue(), 0.0001d);
-
+
assertEquals(1d, new MutableDouble(1d).doubleValue(), 0.0001d);
-
+
assertEquals(2d, new MutableDouble(Double.valueOf(2d)).doubleValue(), 0.0001d);
assertEquals(3d, new MutableDouble(new MutableDouble(3d)).doubleValue(), 0.0001d);
-
+
assertEquals(2d, new MutableDouble("2.0").doubleValue(), 0.0001d);
}
@@ -53,15 +53,15 @@ public class MutableDoubleTest {
final MutableDouble mutNum = new MutableDouble(0d);
assertEquals(0d, new MutableDouble().doubleValue(), 0.0001d);
assertEquals(Double.valueOf(0), new MutableDouble().getValue());
-
+
mutNum.setValue(1);
assertEquals(1d, mutNum.doubleValue(), 0.0001d);
assertEquals(Double.valueOf(1d), mutNum.getValue());
-
+
mutNum.setValue(Double.valueOf(2d));
assertEquals(2d, mutNum.doubleValue(), 0.0001d);
assertEquals(Double.valueOf(2d), mutNum.getValue());
-
+
mutNum.setValue(new MutableDouble(3d));
assertEquals(3d, mutNum.doubleValue(), 0.0001d);
assertEquals(Double.valueOf(3d), mutNum.getValue());
@@ -77,10 +77,10 @@ public class MutableDoubleTest {
public void testNanInfinite() {
MutableDouble mutNum = new MutableDouble(Double.NaN);
assertTrue(mutNum.isNaN());
-
+
mutNum = new MutableDouble(Double.POSITIVE_INFINITY);
assertTrue(mutNum.isInfinite());
-
+
mutNum = new MutableDouble(Double.NEGATIVE_INFINITY);
assertTrue(mutNum.isInfinite());
}
@@ -133,7 +133,7 @@ public class MutableDoubleTest {
@Test
public void testPrimitiveValues() {
final MutableDouble mutNum = new MutableDouble(1.7);
-
+
assertEquals( 1.7F, mutNum.floatValue(), 0 );
assertEquals( 1.7, mutNum.doubleValue(), 0 );
assertEquals( (byte) 1, mutNum.byteValue() );
@@ -152,7 +152,7 @@ public class MutableDoubleTest {
public void testIncrement() {
final MutableDouble mutNum = new MutableDouble(1);
mutNum.increment();
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -181,7 +181,7 @@ public class MutableDoubleTest {
public void testDecrement() {
final MutableDouble mutNum = new MutableDouble(1);
mutNum.decrement();
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
@@ -210,7 +210,7 @@ public class MutableDoubleTest {
public void testAddValuePrimitive() {
final MutableDouble mutNum = new MutableDouble(1);
mutNum.add(1.1d);
-
+
assertEquals(2.1d, mutNum.doubleValue(), 0.01d);
}
@@ -218,7 +218,7 @@ public class MutableDoubleTest {
public void testAddValueObject() {
final MutableDouble mutNum = new MutableDouble(1);
mutNum.add(Double.valueOf(1.1d));
-
+
assertEquals(2.1d, mutNum.doubleValue(), 0.01d);
}
@@ -262,7 +262,7 @@ public class MutableDoubleTest {
public void testSubtractValuePrimitive() {
final MutableDouble mutNum = new MutableDouble(1);
mutNum.subtract(0.9d);
-
+
assertEquals(0.1d, mutNum.doubleValue(), 0.01d);
}
@@ -270,7 +270,7 @@ public class MutableDoubleTest {
public void testSubtractValueObject() {
final MutableDouble mutNum = new MutableDouble(1);
mutNum.subtract(Double.valueOf(0.9d));
-
+
assertEquals(0.1d, mutNum.doubleValue(), 0.01d);
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java
index af4abd8..169763a 100644
--- a/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java
+++ b/src/test/java/org/apache/commons/lang3/mutable/MutableFloatTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
/**
* JUnit tests.
- *
+ *
* @see MutableFloat
*/
public class MutableFloatTest {
@@ -33,9 +33,9 @@ public class MutableFloatTest {
@Test
public void testConstructors() {
assertEquals(0f, new MutableFloat().floatValue(), 0.0001f);
-
+
assertEquals(1f, new MutableFloat(1f).floatValue(), 0.0001f);
-
+
assertEquals(2f, new MutableFloat(Float.valueOf(2f)).floatValue(), 0.0001f);
assertEquals(3f, new MutableFloat(new MutableFloat(3f)).floatValue(), 0.0001f);
@@ -53,15 +53,15 @@ public class MutableFloatTest {
final MutableFloat mutNum = new MutableFloat(0f);
assertEquals(0f, new MutableFloat().floatValue(), 0.0001f);
assertEquals(Float.valueOf(0), new MutableFloat().getValue());
-
+
mutNum.setValue(1);
assertEquals(1f, mutNum.floatValue(), 0.0001f);
assertEquals(Float.valueOf(1f), mutNum.getValue());
-
+
mutNum.setValue(Float.valueOf(2f));
assertEquals(2f, mutNum.floatValue(), 0.0001f);
assertEquals(Float.valueOf(2f), mutNum.getValue());
-
+
mutNum.setValue(new MutableFloat(3f));
assertEquals(3f, mutNum.floatValue(), 0.0001f);
assertEquals(Float.valueOf(3f), mutNum.getValue());
@@ -77,10 +77,10 @@ public class MutableFloatTest {
public void testNanInfinite() {
MutableFloat mutNum = new MutableFloat(Float.NaN);
assertTrue(mutNum.isNaN());
-
+
mutNum = new MutableFloat(Float.POSITIVE_INFINITY);
assertTrue(mutNum.isInfinite());
-
+
mutNum = new MutableFloat(Float.NEGATIVE_INFINITY);
assertTrue(mutNum.isInfinite());
}
@@ -133,7 +133,7 @@ public class MutableFloatTest {
@Test
public void testPrimitiveValues() {
final MutableFloat mutNum = new MutableFloat(1.7F);
-
+
assertEquals( 1, mutNum.intValue() );
assertEquals( 1.7, mutNum.doubleValue(), 0.00001 );
assertEquals( (byte) 1, mutNum.byteValue() );
@@ -152,7 +152,7 @@ public class MutableFloatTest {
public void testIncrement() {
final MutableFloat mutNum = new MutableFloat(1);
mutNum.increment();
-
+
assertEquals(2, mutNum.intValue());
assertEquals(2L, mutNum.longValue());
}
@@ -181,7 +181,7 @@ public class MutableFloatTest {
public void testDecrement() {
final MutableFloat mutNum = new MutableFloat(1);
mutNum.decrement();
-
+
assertEquals(0, mutNum.intValue());
assertEquals(0L, mutNum.longValue());
}
@@ -210,7 +210,7 @@ public class MutableFloatTest {
public void testAddValuePrimitive() {
final MutableFloat mutNum = new MutableFloat(1);
mutNum.add(1.1f);
-
+
assertEquals(2.1f, mutNum.floatValue(), 0.01f);
}
@@ -218,7 +218,7 @@ public class MutableFloatTest {
public void testAddValueObject() {
final MutableFloat mutNum = new MutableFloat(1);
mutNum.add(Float.valueOf(1.1f));
-
+
assertEquals(2.1f, mutNum.floatValue(), 0.01f);
}
@@ -262,7 +262,7 @@ public class MutableFloatTest {
public void testSubtractValuePrimitive() {
final MutableFloat mutNum = new MutableFloat(1);
mutNum.subtract(0.9f);
-
+
assertEquals(0.1f, mutNum.floatValue(), 0.01f);
}
@@ -270,7 +270,7 @@ public class MutableFloatTest {
public void testSubtractValueObject() {
final MutableFloat mutNum = new MutableFloat(1);
mutNum.subtract(Float.valueOf(0.9f));
-
+
assertEquals(0.1f, mutNum.floatValue(), 0.01f);
}
[14/48] [lang] Don't allow package-info.html
Posted by br...@apache.org.
Don't allow package-info.html
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/f21c32a0
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/f21c32a0
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/f21c32a0
Branch: refs/heads/release
Commit: f21c32a05920a678a094ad3b245f8663a8f7b747
Parents: 5511012
Author: Benedikt Ritter <br...@apache.org>
Authored: Tue Jun 6 15:02:09 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Tue Jun 6 15:02:09 2017 +0200
----------------------------------------------------------------------
checkstyle.xml | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/f21c32a0/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 6f03c44..3963bfc 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -23,10 +23,7 @@ limitations under the License.
<!-- commons lang customization of default Checkstyle behavior -->
<module name="Checker">
<property name="localeLanguage" value="en"/>
- <module name="JavadocPackage">
- <!-- setting allowLegacy means it will check for package.html instead of just package-info.java -->
- <property name="allowLegacy" value="true"/>
- </module>
+ <module name="JavadocPackage"/>
<module name="FileTabCharacter">
<property name="fileExtensions" value="java,xml"/>
</module>
[30/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
Make sure lines in files don't have trailing white spaces and remove all trailing white spaces
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/1da8ccdb
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/1da8ccdb
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/1da8ccdb
Branch: refs/heads/release
Commit: 1da8ccdbfe2faa3e6801fe44eaf3c336aab48bec
Parents: fa91c1b
Author: Benedikt Ritter <br...@apache.org>
Authored: Tue Jun 6 15:12:06 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Tue Jun 6 15:12:06 2017 +0200
----------------------------------------------------------------------
checkstyle.xml | 5 +
.../org/apache/commons/lang3/ArrayUtils.java | 140 ++--
.../java/org/apache/commons/lang3/BitField.java | 32 +-
.../org/apache/commons/lang3/BooleanUtils.java | 2 +-
.../org/apache/commons/lang3/CharRange.java | 34 +-
.../apache/commons/lang3/CharSequenceUtils.java | 2 +-
.../java/org/apache/commons/lang3/CharSet.java | 34 +-
.../org/apache/commons/lang3/CharSetUtils.java | 10 +-
.../org/apache/commons/lang3/CharUtils.java | 112 ++--
.../org/apache/commons/lang3/ClassUtils.java | 26 +-
.../org/apache/commons/lang3/Conversion.java | 88 +--
.../org/apache/commons/lang3/EnumUtils.java | 2 +-
.../org/apache/commons/lang3/JavaVersion.java | 10 +-
.../org/apache/commons/lang3/LocaleUtils.java | 16 +-
.../commons/lang3/NotImplementedException.java | 26 +-
.../org/apache/commons/lang3/ObjectUtils.java | 10 +-
.../apache/commons/lang3/RandomStringUtils.java | 44 +-
.../org/apache/commons/lang3/RandomUtils.java | 30 +-
.../java/org/apache/commons/lang3/Range.java | 28 +-
.../commons/lang3/SerializationException.java | 6 +-
.../commons/lang3/SerializationUtils.java | 16 +-
.../apache/commons/lang3/StringEscapeUtils.java | 206 +++---
.../org/apache/commons/lang3/StringUtils.java | 70 +-
.../org/apache/commons/lang3/SystemUtils.java | 6 +-
.../apache/commons/lang3/arch/Processor.java | 24 +-
.../apache/commons/lang3/builder/Builder.java | 44 +-
.../commons/lang3/builder/CompareToBuilder.java | 56 +-
.../org/apache/commons/lang3/builder/Diff.java | 20 +-
.../commons/lang3/builder/DiffBuilder.java | 68 +-
.../commons/lang3/builder/DiffResult.java | 26 +-
.../apache/commons/lang3/builder/Diffable.java | 6 +-
.../commons/lang3/builder/EqualsBuilder.java | 56 +-
.../commons/lang3/builder/HashCodeBuilder.java | 10 +-
.../org/apache/commons/lang3/builder/IDKey.java | 20 +-
.../MultilineRecursiveToStringStyle.java | 22 +-
.../lang3/builder/RecursiveToStringStyle.java | 8 +-
.../lang3/builder/ReflectionDiffBuilder.java | 10 +-
.../builder/ReflectionToStringBuilder.java | 20 +-
.../lang3/builder/StandardToStringStyle.java | 70 +-
.../commons/lang3/builder/ToStringStyle.java | 6 +-
.../lang3/concurrent/BasicThreadFactory.java | 4 +-
.../commons/lang3/concurrent/Computable.java | 2 +-
.../lang3/concurrent/ConcurrentUtils.java | 2 +-
.../commons/lang3/concurrent/Memoizer.java | 2 +-
.../lang3/exception/CloneFailedException.java | 12 +-
.../lang3/exception/ContextedException.java | 26 +-
.../exception/ContextedRuntimeException.java | 26 +-
.../exception/DefaultExceptionContext.java | 12 +-
.../lang3/exception/ExceptionContext.java | 20 +-
.../commons/lang3/exception/ExceptionUtils.java | 14 +-
.../org/apache/commons/lang3/math/Fraction.java | 48 +-
.../commons/lang3/math/IEEE754rUtils.java | 50 +-
.../apache/commons/lang3/math/NumberUtils.java | 134 ++--
.../apache/commons/lang3/mutable/Mutable.java | 12 +-
.../commons/lang3/mutable/MutableBoolean.java | 38 +-
.../commons/lang3/mutable/MutableByte.java | 38 +-
.../commons/lang3/mutable/MutableDouble.java | 46 +-
.../commons/lang3/mutable/MutableFloat.java | 46 +-
.../commons/lang3/mutable/MutableInt.java | 38 +-
.../commons/lang3/mutable/MutableLong.java | 38 +-
.../commons/lang3/mutable/MutableObject.java | 22 +-
.../commons/lang3/mutable/MutableShort.java | 38 +-
.../commons/lang3/reflect/ConstructorUtils.java | 10 +-
.../commons/lang3/reflect/FieldUtils.java | 66 +-
.../commons/lang3/reflect/MethodUtils.java | 40 +-
.../commons/lang3/reflect/TypeLiteral.java | 2 +-
.../apache/commons/lang3/reflect/TypeUtils.java | 10 +-
.../org/apache/commons/lang3/reflect/Typed.java | 2 +-
.../commons/lang3/text/CompositeFormat.java | 18 +-
.../lang3/text/ExtendedMessageFormat.java | 2 +-
.../commons/lang3/text/FormatFactory.java | 6 +-
.../commons/lang3/text/FormattableUtils.java | 16 +-
.../apache/commons/lang3/text/StrBuilder.java | 92 +--
.../apache/commons/lang3/text/StrMatcher.java | 6 +-
.../commons/lang3/text/StrSubstitutor.java | 4 +-
.../apache/commons/lang3/text/StrTokenizer.java | 44 +-
.../apache/commons/lang3/text/WordUtils.java | 60 +-
.../text/translate/AggregateTranslator.java | 14 +-
.../text/translate/CharSequenceTranslator.java | 26 +-
.../text/translate/CodePointTranslator.java | 16 +-
.../text/translate/JavaUnicodeEscaper.java | 14 +-
.../lang3/text/translate/LookupTranslator.java | 4 +-
.../text/translate/NumericEntityUnescaper.java | 16 +-
.../lang3/text/translate/OctalUnescaper.java | 8 +-
.../lang3/text/translate/UnicodeEscaper.java | 2 +-
.../lang3/text/translate/UnicodeUnescaper.java | 10 +-
.../UnicodeUnpairedSurrogateRemover.java | 4 +-
.../commons/lang3/time/DateFormatUtils.java | 44 +-
.../apache/commons/lang3/time/DateParser.java | 42 +-
.../apache/commons/lang3/time/DatePrinter.java | 4 +-
.../apache/commons/lang3/time/DateUtils.java | 494 +++++++--------
.../commons/lang3/time/DurationFormatUtils.java | 116 ++--
.../commons/lang3/time/FastDateFormat.java | 20 +-
.../commons/lang3/time/FastDateParser.java | 32 +-
.../commons/lang3/time/FastDatePrinter.java | 36 +-
.../apache/commons/lang3/time/FormatCache.java | 46 +-
.../apache/commons/lang3/time/StopWatch.java | 88 +--
.../commons/lang3/tuple/ImmutablePair.java | 12 +-
.../commons/lang3/tuple/ImmutableTriple.java | 12 +-
.../apache/commons/lang3/tuple/MutablePair.java | 12 +-
.../org/apache/commons/lang3/tuple/Pair.java | 36 +-
.../commons/lang3/AnnotationUtilsTest.java | 2 +-
.../apache/commons/lang3/ArrayUtilsAddTest.java | 2 +-
.../commons/lang3/ArrayUtilsInsertTest.java | 162 ++---
.../lang3/ArrayUtilsRemoveMultipleTest.java | 4 +-
.../commons/lang3/ArrayUtilsRemoveTest.java | 54 +-
.../apache/commons/lang3/ArrayUtilsTest.java | 632 +++++++++----------
.../org/apache/commons/lang3/BitFieldTest.java | 4 +-
.../apache/commons/lang3/BooleanUtilsTest.java | 168 ++---
.../apache/commons/lang3/CharEncodingTest.java | 6 +-
.../org/apache/commons/lang3/CharRangeTest.java | 6 +-
.../commons/lang3/CharSequenceUtilsTest.java | 18 +-
.../org/apache/commons/lang3/CharSetTest.java | 158 ++---
.../apache/commons/lang3/CharSetUtilsTest.java | 66 +-
.../apache/commons/lang3/CharUtilsPerfRun.java | 6 +-
.../org/apache/commons/lang3/CharUtilsTest.java | 72 +--
.../apache/commons/lang3/ClassUtilsTest.java | 30 +-
.../org/apache/commons/lang3/EnumUtilsTest.java | 30 +-
.../commons/lang3/HashSetvBitSetTest.java | 8 +-
.../apache/commons/lang3/LocaleUtilsTest.java | 54 +-
.../lang3/NotImplementedExceptionTest.java | 4 +-
.../apache/commons/lang3/ObjectUtilsTest.java | 46 +-
.../commons/lang3/RandomStringUtilsTest.java | 78 +--
.../apache/commons/lang3/RandomUtilsTest.java | 30 +-
.../org/apache/commons/lang3/RangeTest.java | 4 +-
.../commons/lang3/SerializationUtilsTest.java | 28 +-
.../commons/lang3/StringEscapeUtilsTest.java | 40 +-
.../commons/lang3/StringUtilsContainsTest.java | 2 +-
.../lang3/StringUtilsEmptyBlankTest.java | 4 +-
.../lang3/StringUtilsEqualsIndexOfTest.java | 6 +-
.../apache/commons/lang3/StringUtilsIsTest.java | 6 +-
.../lang3/StringUtilsStartsEndsWithTest.java | 8 +-
.../commons/lang3/StringUtilsSubstringTest.java | 52 +-
.../apache/commons/lang3/StringUtilsTest.java | 14 +-
.../commons/lang3/StringUtilsTrimStripTest.java | 48 +-
.../apache/commons/lang3/SystemUtilsTest.java | 2 +-
.../lang3/builder/CompareToBuilderTest.java | 104 +--
.../lang3/builder/DefaultToStringStyleTest.java | 12 +-
.../commons/lang3/builder/DiffBuilderTest.java | 140 ++--
.../apache/commons/lang3/builder/DiffTest.java | 18 +-
.../lang3/builder/EqualsBuilderTest.java | 76 +--
.../HashCodeBuilderAndEqualsBuilderTest.java | 8 +-
.../lang3/builder/HashCodeBuilderTest.java | 12 +-
.../lang3/builder/JsonToStringStyleTest.java | 10 +-
.../builder/MultiLineToStringStyleTest.java | 10 +-
.../MultilineRecursiveToStringStyleTest.java | 176 +++---
.../builder/NoClassNameToStringStyleTest.java | 4 +-
.../builder/NoFieldNamesToStringStyleTest.java | 12 +-
.../builder/RecursiveToStringStyleTest.java | 20 +-
...eflectionToStringBuilderConcurrencyTest.java | 2 +-
...ionToStringBuilderExcludeNullValuesTest.java | 44 +-
.../ReflectionToStringBuilderExcludeTest.java | 4 +-
...oStringBuilderExcludeWithAnnotationTest.java | 4 +-
...ringBuilderMutateInspectConcurrencyTest.java | 6 +-
.../builder/ShortPrefixToStringStyleTest.java | 14 +-
.../lang3/builder/SimpleToStringStyleTest.java | 12 +-
.../builder/StandardToStringStyleTest.java | 16 +-
.../lang3/builder/ToStringBuilderTest.java | 6 +-
.../builder/ToStringStyleConcurrencyTest.java | 2 +-
.../lang3/builder/ToStringStyleTest.java | 6 +-
.../CallableBackgroundInitializerTest.java | 2 +-
.../CircuitBreakingExceptionTest.java | 24 +-
.../lang3/event/EventListenerSupportTest.java | 4 +-
.../commons/lang3/event/EventUtilsTest.java | 4 +-
.../exception/AbstractExceptionContextTest.java | 10 +-
.../lang3/exception/AbstractExceptionTest.java | 6 +-
.../exception/CloneFailedExceptionTest.java | 18 +-
.../lang3/exception/ContextedExceptionTest.java | 12 +-
.../ContextedRuntimeExceptionTest.java | 14 +-
.../exception/DefaultExceptionContextTest.java | 8 +-
.../lang3/exception/ExceptionUtilsTest.java | 78 +--
.../apache/commons/lang3/math/FractionTest.java | 448 ++++++-------
.../commons/lang3/math/IEEE754rUtilsTest.java | 6 +-
.../commons/lang3/math/NumberUtilsTest.java | 10 +-
.../lang3/mutable/MutableBooleanTest.java | 10 +-
.../commons/lang3/mutable/MutableByteTest.java | 30 +-
.../lang3/mutable/MutableDoubleTest.java | 36 +-
.../commons/lang3/mutable/MutableFloatTest.java | 34 +-
.../commons/lang3/mutable/MutableIntTest.java | 30 +-
.../commons/lang3/mutable/MutableLongTest.java | 28 +-
.../lang3/mutable/MutableObjectTest.java | 14 +-
.../commons/lang3/mutable/MutableShortTest.java | 30 +-
.../commons/lang3/reflect/FieldUtilsTest.java | 2 +-
.../commons/lang3/reflect/TypeUtilsTest.java | 4 +-
.../commons/lang3/test/SystemDefaults.java | 4 +-
.../lang3/test/SystemDefaultsSwitch.java | 14 +-
.../lang3/test/SystemDefaultsSwitchTest.java | 4 +-
.../commons/lang3/text/CompositeFormatTest.java | 6 +-
.../lang3/text/ExtendedMessageFormatTest.java | 12 +-
.../lang3/text/StrBuilderAppendInsertTest.java | 30 +-
.../commons/lang3/text/StrBuilderTest.java | 354 +++++------
.../commons/lang3/text/StrMatcherTest.java | 4 +-
.../commons/lang3/text/StrTokenizerTest.java | 50 +-
.../commons/lang3/text/WordUtilsTest.java | 68 +-
.../lang3/text/translate/EntityArraysTest.java | 14 +-
.../text/translate/LookupTranslatorTest.java | 4 +-
.../translate/NumericEntityEscaperTest.java | 4 +-
.../translate/NumericEntityUnescaperTest.java | 4 +-
.../text/translate/OctalUnescaperTest.java | 4 +-
.../text/translate/UnicodeEscaperTest.java | 4 +-
.../text/translate/UnicodeUnescaperTest.java | 4 +-
.../UnicodeUnpairedSurrogateRemoverTest.java | 8 +-
.../commons/lang3/time/DateFormatUtilsTest.java | 32 +-
.../lang3/time/DateUtilsFragmentTest.java | 54 +-
.../lang3/time/DateUtilsRoundingTest.java | 186 +++---
.../commons/lang3/time/DateUtilsTest.java | 108 ++--
.../lang3/time/DurationFormatUtilsTest.java | 90 +--
.../commons/lang3/time/FastDateFormatTest.java | 16 +-
.../lang3/time/FastDateParserSDFTest.java | 12 +-
.../commons/lang3/time/FastDateParserTest.java | 22 +-
.../time/FastDateParser_MoreOrLessTest.java | 24 +-
.../commons/lang3/time/FastDatePrinterTest.java | 20 +-
.../commons/lang3/time/StopWatchTest.java | 22 +-
.../commons/lang3/tuple/ImmutablePairTest.java | 16 +-
.../lang3/tuple/ImmutableTripleTest.java | 10 +-
.../commons/lang3/tuple/MutablePairTest.java | 2 +-
.../commons/lang3/tuple/MutableTripleTest.java | 2 +-
217 files changed, 4111 insertions(+), 4106 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 7070d0b..82dfec9 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -30,6 +30,11 @@ limitations under the License.
<module name="FileTabCharacter">
<property name="fileExtensions" value="java,xml"/>
</module>
+ <module name="RegexpSingleline">
+ <!-- \s matches whitespace character, $ matches end of line. -->
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
<module name="TreeWalker">
<property name="cacheFile" value="target/cachefile"/>
<module name="AvoidStarImport"/>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/ArrayUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index f0e9f6b..35172fc 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -480,9 +480,9 @@ public class ArrayUtils {
return type.cast(Array.newInstance(type.getComponentType(), 0));
}
return array;
- }
-
-
+ }
+
+
/**
* <p>Defensive programming technique to change a {@code null}
* reference to an empty one.
@@ -1536,10 +1536,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1569,10 +1569,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1602,10 +1602,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1635,10 +1635,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1668,10 +1668,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1701,10 +1701,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1734,10 +1734,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1767,10 +1767,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1800,10 +1800,10 @@ public class ArrayUtils {
/**
* <p>
* Reverses the order of the given array in the given range.
- *
+ *
* <p>
* This method does nothing for a {@code null} input array.
- *
+ *
* @param array
* the array to reverse, may be {@code null}
* @param startIndexInclusive
@@ -1838,7 +1838,7 @@ public class ArrayUtils {
* <p>There is no special handling for multi-dimensional arrays. This method
* does nothing for a {@code null} or empty input array or for overflow indices.
* Negative indices are promoted to 0(zero).</p>
- *
+ *
* Examples:
* <ul>
* <li>ArrayUtils.swap(["1", "2", "3"], 0, 2) -> ["3", "2", "1"]</li>
@@ -1951,7 +1951,7 @@ public class ArrayUtils {
* <p>There is no special handling for multi-dimensional arrays. This method
* does nothing for a {@code null} or empty input array or for overflow indices.
* Negative indices are promoted to 0(zero).</p>
- *
+ *
* Examples:
* <ul>
* <li>ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]</li>
@@ -2093,7 +2093,7 @@ public class ArrayUtils {
* of the sub-arrays to swap falls outside of the given array, then the
* swap is stopped at the end of the array and as many as possible elements
* are swapped.</p>
- *
+ *
* Examples:
* <ul>
* <li>ArrayUtils.swap([true, false, true, false], 0, 2, 1) -> [true, false, true, false]</li>
@@ -2177,7 +2177,7 @@ public class ArrayUtils {
* of the sub-arrays to swap falls outside of the given array, then the
* swap is stopped at the end of the array and as many as possible elements
* are swapped.</p>
- *
+ *
* Examples:
* <ul>
* <li>ArrayUtils.swap([1, 2, 3, 4], 0, 2, 1) -> [3, 2, 1, 4]</li>
@@ -2645,7 +2645,7 @@ public class ArrayUtils {
*
* <p>There is no special handling for multi-dimensional arrays. This method
* does nothing for {@code null} or empty input arrays.</p>
- *
+ *
* @param array
* the array to shift, may be {@code null}
* @param startIndexInclusive
@@ -2668,10 +2668,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -2684,7 +2684,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -2705,7 +2705,7 @@ public class ArrayUtils {
*
* <p>There is no special handling for multi-dimensional arrays. This method
* does nothing for {@code null} or empty input arrays.</p>
- *
+ *
* @param array
* the array to shift, may be {@code null}
* @param startIndexInclusive
@@ -2728,10 +2728,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -2744,7 +2744,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -2788,10 +2788,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -2804,7 +2804,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -2848,10 +2848,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -2864,7 +2864,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -2908,10 +2908,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -2924,7 +2924,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -2968,10 +2968,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -2984,7 +2984,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -3028,10 +3028,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -3044,7 +3044,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -3088,10 +3088,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -3104,7 +3104,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -3148,10 +3148,10 @@ public class ArrayUtils {
}
if (startIndexInclusive < 0) {
startIndexInclusive = 0;
- }
+ }
if (endIndexExclusive >= array.length) {
endIndexExclusive = array.length;
- }
+ }
int n = endIndexExclusive - startIndexInclusive;
if (n <= 1) {
return;
@@ -3164,7 +3164,7 @@ public class ArrayUtils {
// see https://beradrian.wordpress.com/2015/04/07/shift-an-array-in-on-in-place/
while (n > 1 && offset > 0) {
final int n_offset = n - offset;
-
+
if (offset > n_offset) {
swap(array, startIndexInclusive, startIndexInclusive + n - n_offset, n_offset);
n = offset;
@@ -7428,7 +7428,7 @@ public class ArrayUtils {
/**
* Removes multiple array elements specified by indices.
- *
+ *
* @param array source
* @param indices to remove
* @return new array of same type minus elements specified by the set bits in {@code indices}
@@ -7440,7 +7440,7 @@ public class ArrayUtils {
// 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();
-// if (maxIndex > srcLength) {
+// if (maxIndex > srcLength) {
// throw new IndexOutOfBoundsException("Index: " + (maxIndex-1) + ", Length: " + srcLength);
// }
final int removals = indices.cardinality(); // true bits are items to remove
@@ -7459,13 +7459,13 @@ public class ArrayUtils {
}
count = srcLength - srcIndex;
if (count > 0) {
- System.arraycopy(array, srcIndex, result, destIndex, count);
+ System.arraycopy(array, srcIndex, result, destIndex, count);
}
return result;
}
/**
- * <p>This method checks whether the provided array is sorted according to the class's
+ * <p>This method checks whether the provided array is sorted according to the class's
* {@code compareTo} method.
*
* @param array the array to check
@@ -7481,7 +7481,7 @@ public class ArrayUtils {
}
});
}
-
+
/**
* <p>This method checks whether the provided array is sorted according to the provided {@code Comparator}.
@@ -7496,7 +7496,7 @@ public class ArrayUtils {
if (comparator == null) {
throw new IllegalArgumentException("Comparator should not be null.");
}
-
+
if (array == null || array.length < 2) {
return true;
}
@@ -8050,7 +8050,7 @@ public class ArrayUtils {
final String[] result = new String[array.length];
for (int i = 0; i < array.length; i++) {
- final Object object = array[i];
+ final Object object = array[i];
result[i] = (object == null ? valueForNullElements : object.toString());
}
@@ -8072,7 +8072,7 @@ public class ArrayUtils {
* @param array the array to insert the values into, may be {@code null}
* @param values the new values to insert, may be {@code null}
* @return The new array.
- * @throws IndexOutOfBoundsException if {@code array} is provided
+ * @throws IndexOutOfBoundsException if {@code array} is provided
* and either {@code index < 0} or {@code index > array.length}
* @since 3.6
*/
@@ -8114,7 +8114,7 @@ public class ArrayUtils {
* @param array the array to insert the values into, may be {@code null}
* @param values the new values to insert, may be {@code null}
* @return The new array.
- * @throws IndexOutOfBoundsException if {@code array} is provided
+ * @throws IndexOutOfBoundsException if {@code array} is provided
* and either {@code index < 0} or {@code index > array.length}
* @since 3.6
*/
@@ -8156,7 +8156,7 @@ public class ArrayUtils {
* @param array the array to insert the values into, may be {@code null}
* @param values the new values to insert, may be {@code null}
* @return The new array.
- * @throws IndexOutOfBoundsException if {@code array} is provided
+ * @throws IndexOutOfBoundsException if {@code array} is provided
* and either {@code index < 0} or {@code index > array.length}
* @since 3.6
*/
@@ -8198,7 +8198,7 @@ public class ArrayUtils {
* @param array the array to insert the values into, may be {@code null}
* @param values the new values to insert, may be {@code null}
* @return The new array.
- * @throws IndexOutOfBoundsException if {@code array} is provided
+ * @throws IndexOutOfBoundsException if {@code array} is provided
* and either {@code index < 0} or {@code index > array.length}
* @since 3.6
*/
@@ -8240,7 +8240,7 @@ public class ArrayUtils {
* @param array the array to insert the values into, may be {@code null}
* @param values the new values to insert, may be {@code null}
* @return The new array.
- * @throws IndexOutOfBoundsException if {@code array} is provided
+ * @throws IndexOutOfBoundsException if {@code array} is provided
* and either {@code index < 0} or {@code index > array.length}
* @since 3.6
*/
@@ -8282,7 +8282,7 @@ public class ArrayUtils {
* @param array the array to insert the values into, may be {@code null}
* @param values the new values to insert, may be {@code null}
* @return The new array.
- * @throws IndexOutOfBoundsException if {@code array} is provided
+ * @throws IndexOutOfBoundsException if {@code array} is provided
* and either {@code index < 0} or {@code index > array.length}
* @since 3.6
*/
@@ -8324,7 +8324,7 @@ public class ArrayUtils {
* @param array the array to insert the values into, may be {@code null}
* @param values the new values to insert, may be {@code null}
* @return The new array.
- * @throws IndexOutOfBoundsException if {@code array} is provided
+ * @throws IndexOutOfBoundsException if {@code array} is provided
* and either {@code index < 0} or {@code index > array.length}
* @since 3.6
*/
@@ -8366,7 +8366,7 @@ public class ArrayUtils {
* @param array the array to insert the values into, may be {@code null}
* @param values the new values to insert, may be {@code null}
* @return The new array.
- * @throws IndexOutOfBoundsException if {@code array} is provided
+ * @throws IndexOutOfBoundsException if {@code array} is provided
* and either {@code index < 0} or {@code index > array.length}
* @since 3.6
*/
@@ -8417,7 +8417,7 @@ public class ArrayUtils {
public static <T> T[] insert(final int index, final T[] array, final T... values) {
/*
* Note on use of @SafeVarargs:
- *
+ *
* By returning null when 'array' is null, we avoid returning the vararg
* array to the caller. We also avoid relying on the type of the vararg
* array, by inspecting the component type of 'array'.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/BitField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/BitField.java b/src/main/java/org/apache/commons/lang3/BitField.java
index 65b465e..bc2147e 100644
--- a/src/main/java/org/apache/commons/lang3/BitField.java
+++ b/src/main/java/org/apache/commons/lang3/BitField.java
@@ -5,9 +5,9 @@
* 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.
@@ -17,28 +17,28 @@
package org.apache.commons.lang3;
/**
- * <p>Supports operations on bit-mapped fields. Instances of this class can be
- * used to store a flag or data within an {@code int}, {@code short} or
+ * <p>Supports operations on bit-mapped fields. Instances of this class can be
+ * used to store a flag or data within an {@code int}, {@code short} or
* {@code byte}.</p>
- *
+ *
* <p>Each {@code BitField} is constructed with a mask value, which indicates
- * the bits that will be used to store and retrieve the data for that field.
- * For instance, the mask {@code 0xFF} indicates the least-significant byte
+ * the bits that will be used to store and retrieve the data for that field.
+ * For instance, the mask {@code 0xFF} indicates the least-significant byte
* should be used to store the data.</p>
- *
+ *
* <p>As an example, consider a car painting machine that accepts
* paint instructions as integers. Bit fields can be used to encode this:</p>
*
*<pre>
- * // blue, green and red are 1 byte values (0-255) stored in the three least
+ * // blue, green and red are 1 byte values (0-255) stored in the three least
* // significant bytes
* BitField blue = new BitField(0xFF);
* BitField green = new BitField(0xFF00);
* BitField red = new BitField(0xFF0000);
- *
+ *
* // anyColor is a flag triggered if any color is used
* BitField anyColor = new BitField(0xFFFFFF);
- *
+ *
* // isMetallic is a single bit flag
* BitField isMetallic = new BitField(0x1000000);
*</pre>
@@ -54,24 +54,24 @@ package org.apache.commons.lang3;
*</pre>
*
* <p>Flags and data can be retrieved from the integer:</p>
- *
+ *
*<pre>
* // Prints true if red, green or blue is non-zero
* System.out.println(anyColor.isSet(paintInstruction)); // prints true
- *
+ *
* // Prints value of red, green and blue
* System.out.println(red.getValue(paintInstruction)); // prints 35
* System.out.println(green.getValue(paintInstruction)); // prints 100
* System.out.println(blue.getValue(paintInstruction)); // prints 255
- *
- * // Prints true if isMetallic was set
+ *
+ * // Prints true if isMetallic was set
* System.out.println(isMetallic.isSet(paintInstruction)); // prints false
*</pre>
*
* @since 2.0
*/
public class BitField {
-
+
private final int _mask;
private final int _shift_count;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/BooleanUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/BooleanUtils.java b/src/main/java/org/apache/commons/lang3/BooleanUtils.java
index 9a21289..fdeff74 100644
--- a/src/main/java/org/apache/commons/lang3/BooleanUtils.java
+++ b/src/main/java/org/apache/commons/lang3/BooleanUtils.java
@@ -699,7 +699,7 @@ public class BooleanUtils {
* BooleanUtils.toBooleanObject("y") = true
* BooleanUtils.toBooleanObject("n") = false
* BooleanUtils.toBooleanObject("t") = true
- * BooleanUtils.toBooleanObject("f") = false
+ * BooleanUtils.toBooleanObject("f") = false
* </pre>
*
* @param str the String to check
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/CharRange.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharRange.java b/src/main/java/org/apache/commons/lang3/CharRange.java
index bf82805..b395306 100644
--- a/src/main/java/org/apache/commons/lang3/CharRange.java
+++ b/src/main/java/org/apache/commons/lang3/CharRange.java
@@ -5,9 +5,9 @@
* 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.
@@ -22,30 +22,30 @@ import java.util.NoSuchElementException;
/**
* <p>A contiguous range of characters, optionally negated.</p>
- *
+ *
* <p>Instances are immutable.</p>
*
* <p>#ThreadSafe#</p>
* @since 1.0
*/
-// TODO: This is no longer public and will be removed later as CharSet is moved
+// TODO: This is no longer public and will be removed later as CharSet is moved
// to depend on Range.
final class CharRange implements Iterable<Character>, Serializable {
/**
- * Required for serialization support. Lang version 2.0.
- *
+ * Required for serialization support. Lang version 2.0.
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 8270183163158333422L;
-
+
/** The first character, inclusive, in the range. */
private final char start;
/** The last character, inclusive, in the range. */
private final char end;
/** True if the range is everything except the characters specified. */
private final boolean negated;
-
+
/** Cached toString. */
private transient String iToString;
@@ -55,7 +55,7 @@ final class CharRange implements Iterable<Character>, Serializable {
*
* <p>A negated range includes everything except that defined by the
* start and end characters.</p>
- *
+ *
* <p>If start and end are in the wrong order, they are reversed.
* Thus {@code a-e} is the same as {@code e-a}.</p>
*
@@ -70,7 +70,7 @@ final class CharRange implements Iterable<Character>, Serializable {
start = end;
end = temp;
}
-
+
this.start = start;
this.end = end;
this.negated = negated;
@@ -130,7 +130,7 @@ final class CharRange implements Iterable<Character>, Serializable {
//-----------------------------------------------------------------------
/**
* <p>Gets the start character for this character range.</p>
- *
+ *
* @return the start char (inclusive)
*/
public char getStart() {
@@ -139,7 +139,7 @@ final class CharRange implements Iterable<Character>, Serializable {
/**
* <p>Gets the end character for this character range.</p>
- *
+ *
* @return the end char (inclusive)
*/
public char getEnd() {
@@ -148,7 +148,7 @@ final class CharRange implements Iterable<Character>, Serializable {
/**
* <p>Is this {@code CharRange} negated.</p>
- *
+ *
* <p>A negated range includes everything except that defined by the
* start and end characters.</p>
*
@@ -197,7 +197,7 @@ final class CharRange implements Iterable<Character>, Serializable {
/**
* <p>Compares two CharRange objects, returning true if they represent
* exactly the same range of characters defined in the same way.</p>
- *
+ *
* @param obj the object to compare to
* @return true if equal
*/
@@ -215,17 +215,17 @@ final class CharRange implements Iterable<Character>, Serializable {
/**
* <p>Gets a hashCode compatible with the equals method.</p>
- *
+ *
* @return a suitable hashCode
*/
@Override
public int hashCode() {
return 83 + start + 7 * end + (negated ? 1 : 0);
}
-
+
/**
* <p>Gets a string representation of the character range.</p>
- *
+ *
* @return string representation of this range
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java b/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
index e35f5aa..9bac1c5 100644
--- a/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
@@ -50,7 +50,7 @@ public class CharSequenceUtils {
* @param cs the specified subsequence, null returns null
* @param start the start index, inclusive, valid
* @return a new subsequence, may be null
- * @throws IndexOutOfBoundsException if {@code start} is negative or if
+ * @throws IndexOutOfBoundsException if {@code start} is negative or if
* {@code start} is greater than {@code length()}
*/
public static CharSequence subSequence(final CharSequence cs, final int start) {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/CharSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharSet.java b/src/main/java/org/apache/commons/lang3/CharSet.java
index 150f850..70f9509 100644
--- a/src/main/java/org/apache/commons/lang3/CharSet.java
+++ b/src/main/java/org/apache/commons/lang3/CharSet.java
@@ -5,9 +5,9 @@
* 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.
@@ -34,37 +34,37 @@ import java.util.Set;
public class CharSet implements Serializable {
/**
- * Required for serialization support. Lang version 2.0.
- *
+ * Required for serialization support. Lang version 2.0.
+ *
* @see java.io.Serializable
*/
private static final long serialVersionUID = 5947847346149275958L;
- /**
- * A CharSet defining no characters.
+ /**
+ * A CharSet defining no characters.
* @since 2.0
*/
public static final CharSet EMPTY = new CharSet((String) null);
- /**
+ /**
* A CharSet defining ASCII alphabetic characters "a-zA-Z".
* @since 2.0
*/
public static final CharSet ASCII_ALPHA = new CharSet("a-zA-Z");
- /**
+ /**
* A CharSet defining ASCII alphabetic characters "a-z".
* @since 2.0
*/
public static final CharSet ASCII_ALPHA_LOWER = new CharSet("a-z");
- /**
+ /**
* A CharSet defining ASCII alphabetic characters "A-Z".
* @since 2.0
*/
public static final CharSet ASCII_ALPHA_UPPER = new CharSet("A-Z");
- /**
+ /**
* A CharSet defining ASCII alphabetic characters "0-9".
* @since 2.0
*/
@@ -76,7 +76,7 @@ public class CharSet implements Serializable {
* @since 2.0
*/
protected static final Map<String, CharSet> COMMON = Collections.synchronizedMap(new HashMap<String, CharSet>());
-
+
static {
COMMON.put(null, EMPTY);
COMMON.put(StringUtils.EMPTY, EMPTY);
@@ -114,7 +114,7 @@ public class CharSet implements Serializable {
* <li>Negated single character, such as "^a"
* <li>Ordinary single character, such as "a"
* </ol>
- *
+ *
* <p>Matching works left to right. Once a match is found the
* search starts again from the next character.</p>
*
@@ -128,7 +128,7 @@ public class CharSet implements Serializable {
* as the "a-e" and "e-a" are the same.</p>
*
* <p>The set of characters represented is the union of the specified ranges.</p>
- *
+ *
* <p>There are two ways to add a literal negation character ({@code ^}):</p>
* <ul>
* <li>As the last character in a string, e.g. {@code CharSet.getInstance("a-z^")}</li>
@@ -141,11 +141,11 @@ public class CharSet implements Serializable {
* CharSet.getInstance("^a-c").contains('d') = true
* CharSet.getInstance("^^a-c").contains('a') = true // (only '^' is negated)
* CharSet.getInstance("^^a-c").contains('^') = false
- * CharSet.getInstance("^a-cd-f").contains('d') = true
+ * CharSet.getInstance("^a-cd-f").contains('d') = true
* CharSet.getInstance("a-c^").contains('^') = true
* CharSet.getInstance("^", "a-c").contains('^') = true
* </pre>
- *
+ *
* <p>All CharSet objects returned by this method will be immutable.</p>
*
* @param setStrs Strings to merge into the set, may be null
@@ -162,7 +162,7 @@ public class CharSet implements Serializable {
return common;
}
}
- return new CharSet(setStrs);
+ return new CharSet(setStrs);
}
//-----------------------------------------------------------------------
@@ -222,7 +222,7 @@ public class CharSet implements Serializable {
* @return an array of immutable CharRange objects
* @since 2.0
*/
-// NOTE: This is no longer public as CharRange is no longer a public class.
+// NOTE: This is no longer public as CharRange is no longer a public class.
// It may be replaced when CharSet moves to Range.
/*public*/ CharRange[] getCharRanges() {
return set.toArray(new CharRange[set.size()]);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/CharSetUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharSetUtils.java b/src/main/java/org/apache/commons/lang3/CharSetUtils.java
index 015eeb8..4ad4e67 100644
--- a/src/main/java/org/apache/commons/lang3/CharSetUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharSetUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -22,7 +22,7 @@ package org.apache.commons.lang3;
* <p>This class handles {@code null} input gracefully.
* An exception will not be thrown for a {@code null} input.
* Each method documents its behaviour in more detail.</p>
- *
+ *
* <p>#ThreadSafe#</p>
* @see CharSet
* @since 1.0
@@ -240,8 +240,8 @@ public class CharSetUtils {
return buffer.toString();
}
- /**
- * Determines whether or not all the Strings in an array are
+ /**
+ * Determines whether or not all the Strings in an array are
* empty or not.
*
* @param strings String[] whose elements are being checked for emptiness
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/CharUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharUtils.java b/src/main/java/org/apache/commons/lang3/CharUtils.java
index bb45e5f..f697c08 100644
--- a/src/main/java/org/apache/commons/lang3/CharUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -22,19 +22,19 @@ package org.apache.commons.lang3;
* <p>This class tries to handle {@code null} input gracefully.
* An exception will not be thrown for a {@code null} input.
* Each method documents its behaviour in more detail.</p>
- *
+ *
* <p>#ThreadSafe#</p>
* @since 2.1
*/
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'};
/**
* {@code \u000a} linefeed LF ('\n').
- *
+ *
* @see <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.6">JLF: Escape Sequences
* for Character and String Literals</a>
* @since 2.2
@@ -43,13 +43,13 @@ public class CharUtils {
/**
* {@code \u000d} carriage return CR ('\r').
- *
+ *
* @see <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.6">JLF: Escape Sequences
* for Character and String Literals</a>
* @since 2.2
*/
public static final char CR = '\r';
-
+
static {
for (char c = 0; c < CHAR_STRING_ARRAY.length; c++) {
@@ -71,7 +71,7 @@ public class CharUtils {
//-----------------------------------------------------------------------
/**
* <p>Converts the character to a Character.</p>
- *
+ *
* <p>For ASCII 7 bit characters, this uses a cache that will return the
* same Character object each time.</p>
*
@@ -88,14 +88,14 @@ public class CharUtils {
public static Character toCharacterObject(final char ch) {
return Character.valueOf(ch);
}
-
+
/**
* <p>Converts the String to a Character using the first character, returning
* null for empty Strings.</p>
- *
+ *
* <p>For ASCII 7 bit characters, this uses a cache that will return the
* same Character object each time.</p>
- *
+ *
* <pre>
* CharUtils.toCharacterObject(null) = null
* CharUtils.toCharacterObject("") = null
@@ -112,11 +112,11 @@ public class CharUtils {
}
return Character.valueOf(str.charAt(0));
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Converts the Character to a char throwing an exception for {@code null}.</p>
- *
+ *
* <pre>
* CharUtils.toChar(' ') = ' '
* CharUtils.toChar('A') = 'A'
@@ -131,10 +131,10 @@ public class CharUtils {
Validate.isTrue(ch != null, "The Character must not be null");
return ch.charValue();
}
-
+
/**
* <p>Converts the Character to a char handling {@code null}.</p>
- *
+ *
* <pre>
* CharUtils.toChar(null, 'X') = 'X'
* CharUtils.toChar(' ', 'X') = ' '
@@ -151,12 +151,12 @@ public class CharUtils {
}
return ch.charValue();
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Converts the String to a char using the first character, throwing
* an exception on empty Strings.</p>
- *
+ *
* <pre>
* CharUtils.toChar("A") = 'A'
* CharUtils.toChar("BA") = 'B'
@@ -172,11 +172,11 @@ public class CharUtils {
Validate.isTrue(StringUtils.isNotEmpty(str), "The String must not be empty");
return str.charAt(0);
}
-
+
/**
* <p>Converts the String to a char using the first character, defaulting
* the value on empty Strings.</p>
- *
+ *
* <pre>
* CharUtils.toChar(null, 'X') = 'X'
* CharUtils.toChar("", 'X') = 'X'
@@ -194,12 +194,12 @@ public class CharUtils {
}
return str.charAt(0);
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Converts the character to the Integer it represents, throwing an
* exception if the character is not numeric.</p>
- *
+ *
* <p>This method coverts the char '1' to the int 1 and so on.</p>
*
* <pre>
@@ -217,11 +217,11 @@ public class CharUtils {
}
return ch - 48;
}
-
+
/**
* <p>Converts the character to the Integer it represents, throwing an
* exception if the character is not numeric.</p>
- *
+ *
* <p>This method coverts the char '1' to the int 1 and so on.</p>
*
* <pre>
@@ -239,11 +239,11 @@ public class CharUtils {
}
return ch - 48;
}
-
+
/**
* <p>Converts the character to the Integer it represents, throwing an
* exception if the character is not numeric.</p>
- *
+ *
* <p>This method coverts the char '1' to the int 1 and so on.</p>
*
* <pre>
@@ -260,11 +260,11 @@ public class CharUtils {
Validate.isTrue(ch != null, "The character must not be null");
return toIntValue(ch.charValue());
}
-
+
/**
* <p>Converts the character to the Integer it represents, throwing an
* exception if the character is not numeric.</p>
- *
+ *
* <p>This method coverts the char '1' to the int 1 and so on.</p>
*
* <pre>
@@ -283,11 +283,11 @@ public class CharUtils {
}
return toIntValue(ch.charValue(), defaultValue);
}
-
+
//-----------------------------------------------------------------------
/**
* <p>Converts the character to a String that contains the one character.</p>
- *
+ *
* <p>For ASCII 7 bit characters, this uses a cache that will return the
* same String object each time.</p>
*
@@ -305,13 +305,13 @@ public class CharUtils {
}
return new String(new char[] {ch});
}
-
+
/**
* <p>Converts the character to a String that contains the one character.</p>
- *
+ *
* <p>For ASCII 7 bit characters, this uses a cache that will return the
* same String object each time.</p>
- *
+ *
* <p>If {@code null} is passed in, {@code null} will be returned.</p>
*
* <pre>
@@ -329,18 +329,18 @@ public class CharUtils {
}
return toString(ch.charValue());
}
-
+
//--------------------------------------------------------------------------
/**
* <p>Converts the string to the Unicode format '\u0020'.</p>
- *
+ *
* <p>This format is the Java source code format.</p>
*
* <pre>
* CharUtils.unicodeEscaped(' ') = "\u0020"
* CharUtils.unicodeEscaped('A') = "\u0041"
* </pre>
- *
+ *
* @param ch the character to convert
* @return the escaped Unicode string
*/
@@ -353,12 +353,12 @@ public class CharUtils {
sb.append(HEX_DIGITS[(ch) & 15]);
return sb.toString();
}
-
+
/**
* <p>Converts the string to the Unicode format '\u0020'.</p>
- *
+ *
* <p>This format is the Java source code format.</p>
- *
+ *
* <p>If {@code null} is passed in, {@code null} will be returned.</p>
*
* <pre>
@@ -366,7 +366,7 @@ public class CharUtils {
* CharUtils.unicodeEscaped(' ') = "\u0020"
* CharUtils.unicodeEscaped('A') = "\u0041"
* </pre>
- *
+ *
* @param ch the character to convert, may be null
* @return the escaped Unicode string, null if null input
*/
@@ -376,7 +376,7 @@ public class CharUtils {
}
return unicodeEscaped(ch.charValue());
}
-
+
//--------------------------------------------------------------------------
/**
* <p>Checks whether the character is ASCII 7 bit.</p>
@@ -389,14 +389,14 @@ public class CharUtils {
* CharUtils.isAscii('\n') = true
* CharUtils.isAscii('©') = false
* </pre>
- *
+ *
* @param ch the character to check
* @return true if less than 128
*/
public static boolean isAscii(final char ch) {
return ch < 128;
}
-
+
/**
* <p>Checks whether the character is ASCII 7 bit printable.</p>
*
@@ -408,14 +408,14 @@ public class CharUtils {
* CharUtils.isAsciiPrintable('\n') = false
* CharUtils.isAsciiPrintable('©') = false
* </pre>
- *
+ *
* @param ch the character to check
* @return true if between 32 and 126 inclusive
*/
public static boolean isAsciiPrintable(final char ch) {
return ch >= 32 && ch < 127;
}
-
+
/**
* <p>Checks whether the character is ASCII 7 bit control.</p>
*
@@ -427,14 +427,14 @@ public class CharUtils {
* CharUtils.isAsciiControl('\n') = true
* CharUtils.isAsciiControl('©') = false
* </pre>
- *
+ *
* @param ch the character to check
* @return true if less than 32 or equals 127
*/
public static boolean isAsciiControl(final char ch) {
return ch < 32 || ch == 127;
}
-
+
/**
* <p>Checks whether the character is ASCII 7 bit alphabetic.</p>
*
@@ -446,14 +446,14 @@ public class CharUtils {
* CharUtils.isAsciiAlpha('\n') = false
* CharUtils.isAsciiAlpha('©') = false
* </pre>
- *
+ *
* @param ch the character to check
* @return true if between 65 and 90 or 97 and 122 inclusive
*/
public static boolean isAsciiAlpha(final char ch) {
return isAsciiAlphaUpper(ch) || isAsciiAlphaLower(ch);
}
-
+
/**
* <p>Checks whether the character is ASCII 7 bit alphabetic upper case.</p>
*
@@ -465,14 +465,14 @@ public class CharUtils {
* CharUtils.isAsciiAlphaUpper('\n') = false
* CharUtils.isAsciiAlphaUpper('©') = false
* </pre>
- *
+ *
* @param ch the character to check
* @return true if between 65 and 90 inclusive
*/
public static boolean isAsciiAlphaUpper(final char ch) {
return ch >= 'A' && ch <= 'Z';
}
-
+
/**
* <p>Checks whether the character is ASCII 7 bit alphabetic lower case.</p>
*
@@ -484,14 +484,14 @@ public class CharUtils {
* CharUtils.isAsciiAlphaLower('\n') = false
* CharUtils.isAsciiAlphaLower('©') = false
* </pre>
- *
+ *
* @param ch the character to check
* @return true if between 97 and 122 inclusive
*/
public static boolean isAsciiAlphaLower(final char ch) {
return ch >= 'a' && ch <= 'z';
}
-
+
/**
* <p>Checks whether the character is ASCII 7 bit numeric.</p>
*
@@ -503,14 +503,14 @@ public class CharUtils {
* CharUtils.isAsciiNumeric('\n') = false
* CharUtils.isAsciiNumeric('©') = false
* </pre>
- *
+ *
* @param ch the character to check
* @return true if between 48 and 57 inclusive
*/
public static boolean isAsciiNumeric(final char ch) {
return ch >= '0' && ch <= '9';
}
-
+
/**
* <p>Checks whether the character is ASCII 7 bit numeric.</p>
*
@@ -522,7 +522,7 @@ public class CharUtils {
* CharUtils.isAsciiAlphanumeric('\n') = false
* CharUtils.isAsciiAlphanumeric('©') = false
* </pre>
- *
+ *
* @param ch the character to check
* @return true if between 48 and 57 or 65 and 90 or 97 and 122 inclusive
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/ClassUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index 60395ef..e0b4d72 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -1252,51 +1252,51 @@ public class ClassUtils {
*/
public static Iterable<Class<?>> hierarchy(final Class<?> type, final Interfaces interfacesBehavior) {
final Iterable<Class<?>> classes = new Iterable<Class<?>>() {
-
+
@Override
public Iterator<Class<?>> iterator() {
final MutableObject<Class<?>> next = new MutableObject<Class<?>>(type);
return new Iterator<Class<?>>() {
-
+
@Override
public boolean hasNext() {
return next.getValue() != null;
}
-
+
@Override
public Class<?> next() {
final Class<?> result = next.getValue();
next.setValue(result.getSuperclass());
return result;
}
-
+
@Override
public void remove() {
throw new UnsupportedOperationException();
}
-
+
};
}
-
+
};
if (interfacesBehavior != Interfaces.INCLUDE) {
return classes;
}
return new Iterable<Class<?>>() {
-
+
@Override
public Iterator<Class<?>> iterator() {
final Set<Class<?>> seenInterfaces = new HashSet<>();
final Iterator<Class<?>> wrapped = classes.iterator();
-
+
return new Iterator<Class<?>>() {
Iterator<Class<?>> interfaces = Collections.<Class<?>> emptySet().iterator();
-
+
@Override
public boolean hasNext() {
return interfaces.hasNext() || wrapped.hasNext();
}
-
+
@Override
public Class<?> next() {
if (interfaces.hasNext()) {
@@ -1310,7 +1310,7 @@ public class ClassUtils {
interfaces = currentInterfaces.iterator();
return nextSuperclass;
}
-
+
private void walkInterfaces(final Set<Class<?>> addTo, final Class<?> c) {
for (final Class<?> iface : c.getInterfaces()) {
if (!seenInterfaces.contains(iface)) {
@@ -1319,12 +1319,12 @@ public class ClassUtils {
walkInterfaces(addTo, iface);
}
}
-
+
@Override
public void remove() {
throw new UnsupportedOperationException();
}
-
+
};
}
};
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/Conversion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/Conversion.java b/src/main/java/org/apache/commons/lang3/Conversion.java
index 6d381c0..d177cc4 100644
--- a/src/main/java/org/apache/commons/lang3/Conversion.java
+++ b/src/main/java/org/apache/commons/lang3/Conversion.java
@@ -59,12 +59,12 @@ import java.util.UUID;
* Development status: work on going, only a part of the little endian, Lsb0 methods implemented
* so far.
* </p>
- *
+ *
* @since Lang 3.2
*/
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 };
@@ -89,7 +89,7 @@ public class Conversion {
* <p>
* '1' is converted to 1
* </p>
- *
+ *
* @param hexDigit the hexadecimal digit to convert
* @return an int equals to {@code hexDigit}
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
@@ -109,7 +109,7 @@ public class Conversion {
* <p>
* '1' is converted to 8
* </p>
- *
+ *
* @param hexDigit the hexadecimal digit to convert
* @return an int equals to {@code hexDigit}
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
@@ -167,7 +167,7 @@ public class Conversion {
* <p>
* '1' is converted as follow: (1, 0, 0, 0)
* </p>
- *
+ *
* @param hexDigit the hexadecimal digit to convert
* @return a boolean array with the binary representation of {@code hexDigit}
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
@@ -225,7 +225,7 @@ public class Conversion {
* <p>
* '1' is converted as follow: (0, 0, 0, 1)
* </p>
- *
+ *
* @param hexDigit the hexadecimal digit to convert
* @return a boolean array with the binary representation of {@code hexDigit}
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
@@ -283,7 +283,7 @@ public class Conversion {
* <p>
* (1, 0, 0, 0) is converted as follow: '1'
* </p>
- *
+ *
* @param src the binary to convert
* @return a hexadecimal digit representing the selected bits
* @throws IllegalArgumentException if {@code src} is empty
@@ -301,7 +301,7 @@ public class Conversion {
* <p>
* (1, 0, 0, 0) is converted as follow: '1'
* </p>
- *
+ *
* @param src the binary to convert
* @param srcPos the position of the lsb to start the conversion
* @return a hexadecimal digit representing the selected bits
@@ -344,7 +344,7 @@ public class Conversion {
* <p>
* (1, 0, 0, 0) is converted as follow: '8'
* </p>
- *
+ *
* @param src the binary to convert
* @return a hexadecimal digit representing the selected bits
* @throws IllegalArgumentException if {@code src} is empty, {@code src.length < 4} or
@@ -364,7 +364,7 @@ public class Conversion {
* (1, 0, 0, 0) is converted as follow: '8' (1,0,0,1,1,0,1,0) with srcPos = 3 is converted
* to 'D'
* </p>
- *
+ *
* @param src the binary to convert
* @param srcPos the position of the lsb to start the conversion
* @return a hexadecimal digit representing the selected bits
@@ -412,7 +412,7 @@ public class Conversion {
* (1, 0, 0, 0) is converted as follow: '8' (1,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,0) is converted
* to '4'
* </p>
- *
+ *
* @param src the binary to convert
* @return a hexadecimal digit representing the selected bits
* @throws IllegalArgumentException if {@code src} is empty
@@ -431,7 +431,7 @@ public class Conversion {
* (1, 0, 0, 0) with srcPos = 0 is converted as follow: '8' (1,0,0,0,0,0,0,0,
* 0,0,0,1,0,1,0,0) with srcPos = 2 is converted to '5'
* </p>
- *
+ *
* @param src the binary to convert
* @param srcPos the position of the lsb to start the conversion
* @return a hexadecimal digit representing the selected bits
@@ -485,7 +485,7 @@ public class Conversion {
* <p>
* 10 returns 'A' and so on...
* </p>
- *
+ *
* @param nibble the 4 bits to convert
* @return a hexadecimal digit representing the 4 lsb of {@code nibble}
* @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
@@ -511,7 +511,7 @@ public class Conversion {
* <p>
* 10 returns '5' and so on...
* </p>
- *
+ *
* @param nibble the 4 bits to convert
* @return a hexadecimal digit representing the 4 lsb of {@code nibble}
* @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
@@ -560,7 +560,7 @@ public class Conversion {
* Converts an array of int into a long using the default (little endian, Lsb0) byte and bit
* ordering.
* </p>
- *
+ *
* @param src the int array to convert
* @param srcPos the position in {@code src}, in int unit, from where to start the
* conversion
@@ -595,7 +595,7 @@ public class Conversion {
* Converts an array of short into a long using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the short array to convert
* @param srcPos the position in {@code src}, in short unit, from where to start the
* conversion
@@ -630,7 +630,7 @@ public class Conversion {
* Converts an array of short into an int using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the short array to convert
* @param srcPos the position in {@code src}, in short unit, from where to start the
* conversion
@@ -665,7 +665,7 @@ public class Conversion {
* Converts an array of byte into a long using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the byte array to convert
* @param srcPos the position in {@code src}, in byte unit, from where to start the
* conversion
@@ -700,7 +700,7 @@ public class Conversion {
* Converts an array of byte into an int using the default (little endian, Lsb0) byte and bit
* ordering.
* </p>
- *
+ *
* @param src the byte array to convert
* @param srcPos the position in {@code src}, in byte unit, from where to start the
* conversion
@@ -735,7 +735,7 @@ public class Conversion {
* Converts an array of byte into a short using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the byte array to convert
* @param srcPos the position in {@code src}, in byte unit, from where to start the
* conversion
@@ -770,7 +770,7 @@ public class Conversion {
* Converts an array of Char into a long using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the hex string to convert
* @param srcPos the position in {@code src}, in Char unit, from where to start the
* conversion
@@ -803,7 +803,7 @@ public class Conversion {
* Converts an array of Char into an int using the default (little endian, Lsb0) byte and bit
* ordering.
* </p>
- *
+ *
* @param src the hex string to convert
* @param srcPos the position in {@code src}, in Char unit, from where to start the
* conversion
@@ -835,7 +835,7 @@ public class Conversion {
* Converts an array of Char into a short using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the hex string to convert
* @param srcPos the position in {@code src}, in Char unit, from where to start the
* conversion
@@ -868,7 +868,7 @@ public class Conversion {
* Converts an array of Char into a byte using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the hex string to convert
* @param srcPos the position in {@code src}, in Char unit, from where to start the
* conversion
@@ -901,7 +901,7 @@ public class Conversion {
* Converts binary (represented as boolean array) into a long using the default (little
* endian, Lsb0) byte and bit ordering.
* </p>
- *
+ *
* @param src the binary to convert
* @param srcPos the position in {@code src}, in boolean unit, from where to start the
* conversion
@@ -936,7 +936,7 @@ public class Conversion {
* Converts binary (represented as boolean array) into an int using the default (little
* endian, Lsb0) byte and bit ordering.
* </p>
- *
+ *
* @param src the binary to convert
* @param srcPos the position in {@code src}, in boolean unit, from where to start the
* conversion
@@ -971,7 +971,7 @@ public class Conversion {
* Converts binary (represented as boolean array) into a short using the default (little
* endian, Lsb0) byte and bit ordering.
* </p>
- *
+ *
* @param src the binary to convert
* @param srcPos the position in {@code src}, in boolean unit, from where to start the
* conversion
@@ -1006,7 +1006,7 @@ public class Conversion {
* Converts binary (represented as boolean array) into a byte using the default (little
* endian, Lsb0) byte and bit ordering.
* </p>
- *
+ *
* @param src the binary to convert
* @param srcPos the position in {@code src}, in boolean unit, from where to start the
* conversion
@@ -1041,7 +1041,7 @@ public class Conversion {
* Converts a long into an array of int using the default (little endian, Lsb0) byte and bit
* ordering.
* </p>
- *
+ *
* @param src the long to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1073,7 +1073,7 @@ public class Conversion {
* Converts a long into an array of short using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the long to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1105,7 +1105,7 @@ public class Conversion {
* Converts an int into an array of short using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the int to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1137,7 +1137,7 @@ public class Conversion {
* Converts a long into an array of byte using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the long to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1169,7 +1169,7 @@ public class Conversion {
* Converts an int into an array of byte using the default (little endian, Lsb0) byte and bit
* ordering.
* </p>
- *
+ *
* @param src the int to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1201,7 +1201,7 @@ public class Conversion {
* Converts a short into an array of byte using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the short to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1233,7 +1233,7 @@ public class Conversion {
* Converts a long into an array of Char using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the long to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dstInit the initial value for the result String
@@ -1272,7 +1272,7 @@ public class Conversion {
* Converts an int into an array of Char using the default (little endian, Lsb0) byte and bit
* ordering.
* </p>
- *
+ *
* @param src the int to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dstInit the initial value for the result String
@@ -1311,7 +1311,7 @@ public class Conversion {
* Converts a short into an array of Char using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the short to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dstInit the initial value for the result String
@@ -1350,7 +1350,7 @@ public class Conversion {
* Converts a byte into an array of Char using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the byte to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dstInit the initial value for the result String
@@ -1389,7 +1389,7 @@ public class Conversion {
* Converts a long into an array of boolean using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the long to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1421,7 +1421,7 @@ public class Conversion {
* Converts an int into an array of boolean using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the int to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1453,7 +1453,7 @@ public class Conversion {
* Converts a short into an array of boolean using the default (little endian, Lsb0) byte
* and bit ordering.
* </p>
- *
+ *
* @param src the short to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1486,7 +1486,7 @@ public class Conversion {
* Converts a byte into an array of boolean using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the byte to convert
* @param srcPos the position in {@code src}, in bits, from where to start the conversion
* @param dst the destination array
@@ -1518,7 +1518,7 @@ public class Conversion {
* Converts UUID into an array of byte using the default (little endian, Lsb0) byte and bit
* ordering.
* </p>
- *
+ *
* @param src the UUID to convert
* @param dst the destination array
* @param dstPos the position in {@code dst} where to copy the result
@@ -1548,7 +1548,7 @@ public class Conversion {
* Converts bytes from an array into a UUID using the default (little endian, Lsb0) byte and
* bit ordering.
* </p>
- *
+ *
* @param src the byte array to convert
* @param srcPos the position in {@code src} where to copy the result from
* @return a UUID
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/EnumUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/EnumUtils.java b/src/main/java/org/apache/commons/lang3/EnumUtils.java
index d6bcdc0..84e93e2 100644
--- a/src/main/java/org/apache/commons/lang3/EnumUtils.java
+++ b/src/main/java/org/apache/commons/lang3/EnumUtils.java
@@ -289,7 +289,7 @@ public class EnumUtils {
*/
private static <E extends Enum<E>> Class<E> checkBitVectorable(final Class<E> enumClass) {
final E[] constants = asEnum(enumClass).getEnumConstants();
- Validate.isTrue(constants.length <= Long.SIZE, CANNOT_STORE_S_S_VALUES_IN_S_BITS,
+ Validate.isTrue(constants.length <= Long.SIZE, CANNOT_STORE_S_S_VALUES_IN_S_BITS,
Integer.valueOf(constants.length), enumClass.getSimpleName(), Integer.valueOf(Long.SIZE));
return enumClass;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/JavaVersion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java
index 8c992f2..e464043 100644
--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java
+++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java
@@ -26,12 +26,12 @@ import org.apache.commons.lang3.math.NumberUtils;
* @since 3.0
*/
public enum JavaVersion {
-
+
/**
* The Java version reported by Android. This is not an official Java version number.
*/
JAVA_0_9(1.5f, "0.9"),
-
+
/**
* Java 1.1.
*/
@@ -74,7 +74,7 @@ public enum JavaVersion {
/**
* Java 1.9.
- *
+ *
* @deprecated As of release 3.5, replaced by {@link #JAVA_9}
*/
@Deprecated
@@ -198,7 +198,7 @@ public enum JavaVersion {
/**
* Gets the Java Version from the system or 99.0 if the {@code java.specification.version} system property is not set.
- *
+ *
* @return the value of {@code java.specification.version} system property or 99.0 if it is not set.
*/
private static float maxVersion() {
@@ -211,7 +211,7 @@ public enum JavaVersion {
/**
* Parses a float value from a String.
- *
+ *
* @param value the String to parse.
* @return the float value represented by the string or -1 if the given String can not be parsed.
*/
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/main/java/org/apache/commons/lang3/LocaleUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
index af0731f..51bbf5f 100644
--- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java
+++ b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
@@ -5,9 +5,9 @@
* 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.
@@ -38,11 +38,11 @@ import java.util.concurrent.ConcurrentMap;
public class LocaleUtils {
/** Concurrent map of language locales by country. */
- private static final ConcurrentMap<String, List<Locale>> cLanguagesByCountry =
+ private static final ConcurrentMap<String, List<Locale>> cLanguagesByCountry =
new ConcurrentHashMap<>();
/** Concurrent map of country locales by language. */
- private static final ConcurrentMap<String, List<Locale>> cCountriesByLanguage =
+ private static final ConcurrentMap<String, List<Locale>> cCountriesByLanguage =
new ConcurrentHashMap<>();
/**
@@ -243,7 +243,7 @@ public class LocaleUtils {
//-----------------------------------------------------------------------
/**
* <p>Obtains an unmodifiable list of installed locales.</p>
- *
+ *
* <p>This method is a wrapper around {@link Locale#getAvailableLocales()}.
* It is more efficient, as the JDK method must create a new array each
* time it is called.</p>
@@ -257,7 +257,7 @@ public class LocaleUtils {
//-----------------------------------------------------------------------
/**
* <p>Obtains an unmodifiable set of installed locales.</p>
- *
+ *
* <p>This method is a wrapper around {@link Locale#getAvailableLocales()}.
* It is more efficient, as the JDK method must create a new array each
* time it is called.</p>
@@ -314,7 +314,7 @@ public class LocaleUtils {
//-----------------------------------------------------------------------
/**
* <p>Obtains the list of countries supported for a given language.</p>
- *
+ *
* <p>This method takes a language code and searches to find the
* countries available for that language. Variant locales are removed.</p>
*
@@ -351,7 +351,7 @@ public class LocaleUtils {
private static final List<Locale> AVAILABLE_LOCALE_LIST;
/** Unmodifiable set of available locales. */
private static final Set<Locale> AVAILABLE_LOCALE_SET;
-
+
static {
final List<Locale> list = new ArrayList<>(Arrays.asList(Locale.getAvailableLocales())); // extra safe
AVAILABLE_LOCALE_LIST = Collections.unmodifiableList(list);
[42/48] [lang] LANG-1338: Add Automatic-Module-Name MANIFEST entry
for Java 9 compatibility.
Posted by br...@apache.org.
LANG-1338: Add Automatic-Module-Name MANIFEST entry for Java 9
compatibility.
This change duplicates adds some maven-jar-plugin configuration pom.
After we have implemented a solution for this in parent pom, this
confgiruation should be removed.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/8ec7e02e
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/8ec7e02e
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/8ec7e02e
Branch: refs/heads/release
Commit: 8ec7e02e753267c2470f76d9ed729e3ca7dfec6e
Parents: ad648cf
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed Jun 7 10:17:31 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Jun 8 08:14:32 2017 +0200
----------------------------------------------------------------------
pom.xml | 13 +++++++++++++
src/changes/changes.xml | 1 +
2 files changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8ec7e02e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 09b6aea..0459926 100644
--- a/pom.xml
+++ b/pom.xml
@@ -690,6 +690,19 @@
<excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile>
</configuration>
</plugin>
+
+ <!-- Temporary fix for LANG-1338, remove this after this has implemented in parent pom -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive combine.children="append">
+ <manifestEntries>
+ <Automatic-Module-Name>org.apache.commons.lang3</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8ec7e02e/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b005ab6..56c2071 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="3.6" date="2017-MM-DD" description="TBD">
+ <action issue="LANG-1338" type="update" dev="britter">Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility</action>
<action issue="LANG-1336" type="add" dev="britter" due-to="Beluga Behr">Add NUL Byte To CharUtils</action>
<action issue="LANG-1337" type="fix" dev="kinow">Fix test failures in IBM JDK 8 for ToStringBuilderTest</action>
<action issue="LANG-1304" type="add" dev="pschumacher" due-to="Andy Klimczak">Add method in StringUtils to determine if string contains both mixed cased characters</action>
[37/48] [lang] Make sure placement of curly braces is consistent
Posted by br...@apache.org.
Make sure placement of curly braces is consistent
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/309b34f0
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/309b34f0
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/309b34f0
Branch: refs/heads/release
Commit: 309b34f0573d0ec593c17008e8ef4151dfc35a12
Parents: 3a818ed
Author: Benedikt Ritter <br...@apache.org>
Authored: Tue Jun 6 22:14:47 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Tue Jun 6 22:14:47 2017 +0200
----------------------------------------------------------------------
checkstyle.xml | 3 +
.../org/apache/commons/lang3/ObjectUtils.java | 36 +-
.../org/apache/commons/lang3/StringUtils.java | 5 +-
.../commons/lang3/builder/EqualsBuilder.java | 9 +-
.../commons/lang3/reflect/MemberUtils.java | 23 +-
.../lang3/text/translate/EntityArrays.java | 50 +-
.../text/translate/NumericEntityUnescaper.java | 3 +-
.../apache/commons/lang3/time/DateUtils.java | 3 +-
.../commons/lang3/time/FastDateParser.java | 6 +-
.../apache/commons/lang3/time/FormatCache.java | 6 +-
.../apache/commons/lang3/time/StopWatch.java | 60 +-
.../apache/commons/lang3/ArrayUtilsTest.java | 1551 +++++++++---------
.../apache/commons/lang3/ClassUtilsTest.java | 3 +-
.../commons/lang3/SerializationUtilsTest.java | 6 +-
.../org/apache/commons/lang3/ValidateTest.java | 92 +-
.../lang3/builder/EqualsBuilderTest.java | 79 +-
.../commons/lang3/event/EventUtilsTest.java | 118 +-
.../lang3/exception/ExceptionUtilsTest.java | 46 +-
.../commons/lang3/reflect/MethodUtilsTest.java | 204 ++-
.../lang3/text/ExtendedMessageFormatTest.java | 8 +-
.../commons/lang3/text/StrBuilderTest.java | 12 +-
.../commons/lang3/time/FastDateParserTest.java | 3 +-
.../FastDateParser_TimeZoneStrategyTest.java | 3 +-
.../commons/lang3/time/StopWatchTest.java | 94 +-
24 files changed, 1290 insertions(+), 1133 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 7d3d3a6..d912028 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -49,5 +49,8 @@ limitations under the License.
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="UpperEll" />
+ <module name="LeftCurly"/>
+ <module name="NeedBraces"/>
+ <module name="RightCurly"/>
</module>
</module>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 146556b..5d86293 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -805,7 +805,9 @@ public class ObjectUtils {
* @return the boolean v, unchanged
* @since 3.2
*/
- public static boolean CONST(final boolean v) { return v; }
+ public static boolean CONST(final boolean v) {
+ return v;
+ }
/**
* This method returns the provided value unchanged.
@@ -824,7 +826,9 @@ public class ObjectUtils {
* @return the byte v, unchanged
* @since 3.2
*/
- public static byte CONST(final byte v) { return v; }
+ public static byte CONST(final byte v) {
+ return v;
+ }
/**
* This method returns the provided value unchanged.
@@ -870,7 +874,9 @@ public class ObjectUtils {
* @return the char v, unchanged
* @since 3.2
*/
- public static char CONST(final char v) { return v; }
+ public static char CONST(final char v) {
+ return v;
+ }
/**
* This method returns the provided value unchanged.
@@ -889,7 +895,9 @@ public class ObjectUtils {
* @return the short v, unchanged
* @since 3.2
*/
- public static short CONST(final short v) { return v; }
+ public static short CONST(final short v) {
+ return v;
+ }
/**
* This method returns the provided value unchanged.
@@ -936,7 +944,9 @@ public class ObjectUtils {
* @return the int v, unchanged
* @since 3.2
*/
- public static int CONST(final int v) { return v; }
+ public static int CONST(final int v) {
+ return v;
+ }
/**
* This method returns the provided value unchanged.
@@ -955,7 +965,9 @@ public class ObjectUtils {
* @return the long v, unchanged
* @since 3.2
*/
- public static long CONST(final long v) { return v; }
+ public static long CONST(final long v) {
+ return v;
+ }
/**
* This method returns the provided value unchanged.
@@ -974,7 +986,9 @@ public class ObjectUtils {
* @return the float v, unchanged
* @since 3.2
*/
- public static float CONST(final float v) { return v; }
+ public static float CONST(final float v) {
+ return v;
+ }
/**
* This method returns the provided value unchanged.
@@ -993,7 +1007,9 @@ public class ObjectUtils {
* @return the double v, unchanged
* @since 3.2
*/
- public static double CONST(final double v) { return v; }
+ public static double CONST(final double v) {
+ return v;
+ }
/**
* This method returns the provided value unchanged.
@@ -1013,6 +1029,8 @@ public class ObjectUtils {
* @return the genericized Object v, unchanged (typically a String).
* @since 3.2
*/
- public static <T> T CONST(final T v) { return v; }
+ public static <T> T CONST(final T v) {
+ return v;
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 442e285..f98433a 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -8188,9 +8188,8 @@ public class StringUtils {
return m <= threshold ? m : -1;
} else if (m == 0) {
return n <= threshold ? n : -1;
- }
- // no need to calculate the distance if the length difference is greater than the threshold
- else if (Math.abs(n - m) > threshold) {
+ } else if (Math.abs(n - m) > threshold) {
+ // no need to calculate the distance if the length difference is greater than the threshold
return -1;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
----------------------------------------------------------------------
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 a07ea27..4e24bc5 100644
--- a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
@@ -627,13 +627,12 @@ public class EqualsBuilder implements Builder<Boolean> {
* @param rhs the right hand object
*/
private void appendArray(final Object lhs, final Object rhs) {
+ // First we compare different dimensions, for example: a boolean[][] to a boolean[]
+ // then we 'Switch' on type of array, to dispatch to the correct handler
+ // This handles multi dimensional arrays of the same depth
if (lhs.getClass() != rhs.getClass()) {
- // Here when we compare different dimensions, for example: a boolean[][] to a boolean[]
this.setEquals(false);
- }
- // 'Switch' on type of array, to dispatch to the correct handler
- // This handles multi dimensional arrays of the same depth
- else if (lhs instanceof long[]) {
+ } else if (lhs instanceof long[]) {
append((long[]) lhs, (long[]) rhs);
} else if (lhs instanceof int[]) {
append((int[]) lhs, (int[]) rhs);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
----------------------------------------------------------------------
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 f54e84a..86c5411 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
@@ -169,12 +169,10 @@ abstract class MemberUtils {
if (noVarArgsPassed) {
// When no varargs passed, the best match is the most generic matching type, not the most specific.
totalCost += getObjectTransformationCost(destClass, Object.class) + varArgsCost;
- }
- else if (explicitArrayForVarags) {
+ } else if (explicitArrayForVarags) {
final Class<?> sourceClass = srcArgs[srcArgs.length-1].getComponentType();
totalCost += getObjectTransformationCost(sourceClass, destClass) + varArgsCost;
- }
- else {
+ } else {
// This is typical varargs case.
for (int i = destArgs.length-1; i < srcArgs.length; i++) {
final Class<?> srcClass = srcArgs[i];
@@ -283,8 +281,13 @@ abstract class MemberUtils {
private final Class<?>[] parameterTypes;
private final boolean isVarArgs;
- private static Executable of(final Method method) { return new Executable(method); }
- private static Executable of(final Constructor<?> constructor) { return new Executable(constructor); }
+ private static Executable of(final Method method) {
+ return new Executable(method);
+ }
+
+ private static Executable of(final Constructor<?> constructor) {
+ return new Executable(constructor);
+ }
private Executable(final Method method) {
parameterTypes = method.getParameterTypes();
@@ -296,9 +299,13 @@ abstract class MemberUtils {
isVarArgs = constructor.isVarArgs();
}
- public Class<?>[] getParameterTypes() { return parameterTypes; }
+ public Class<?>[] getParameterTypes() {
+ return parameterTypes;
+ }
- public boolean isVarArgs() { return isVarArgs; }
+ public boolean isVarArgs() {
+ return isVarArgs;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java b/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java
index 276f0b1..d4357f6 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/EntityArrays.java
@@ -34,7 +34,10 @@ public class EntityArrays {
* characters to their named HTML 3.x equivalents.
* @return the mapping table
*/
- public static String[][] ISO8859_1_ESCAPE() { return ISO8859_1_ESCAPE.clone(); }
+ public static String[][] ISO8859_1_ESCAPE() {
+ return ISO8859_1_ESCAPE.clone();
+ }
+
private static final String[][] ISO8859_1_ESCAPE = {
{"\u00A0", " "}, // non-breaking space
{"\u00A1", "¡"}, // inverted exclamation mark
@@ -138,7 +141,10 @@ public class EntityArrays {
* Reverse of {@link #ISO8859_1_ESCAPE()} for unescaping purposes.
* @return the mapping table
*/
- public static String[][] ISO8859_1_UNESCAPE() { return ISO8859_1_UNESCAPE.clone(); }
+ public static String[][] ISO8859_1_UNESCAPE() {
+ return ISO8859_1_UNESCAPE.clone();
+ }
+
private static final String[][] ISO8859_1_UNESCAPE = invert(ISO8859_1_ESCAPE);
/**
@@ -147,7 +153,10 @@ public class EntityArrays {
* HTML 4.0 character entities.
* @return the mapping table
*/
- public static String[][] HTML40_EXTENDED_ESCAPE() { return HTML40_EXTENDED_ESCAPE.clone(); }
+ public static String[][] HTML40_EXTENDED_ESCAPE() {
+ return HTML40_EXTENDED_ESCAPE.clone();
+ }
+
private static final String[][] HTML40_EXTENDED_ESCAPE = {
// <!-- Latin Extended-B -->
{"\u0192", "ƒ"}, // latin small f with hook = function= florin, U+0192 ISOtech -->
@@ -349,7 +358,10 @@ public class EntityArrays {
* Reverse of {@link #HTML40_EXTENDED_ESCAPE()} for unescaping purposes.
* @return the mapping table
*/
- public static String[][] HTML40_EXTENDED_UNESCAPE() { return HTML40_EXTENDED_UNESCAPE.clone(); }
+ public static String[][] HTML40_EXTENDED_UNESCAPE() {
+ return HTML40_EXTENDED_UNESCAPE.clone();
+ }
+
private static final String[][] HTML40_EXTENDED_UNESCAPE = invert(HTML40_EXTENDED_ESCAPE);
/**
@@ -358,7 +370,10 @@ public class EntityArrays {
* Namely: {@code " & < >}
* @return the mapping table
*/
- public static String[][] BASIC_ESCAPE() { return BASIC_ESCAPE.clone(); }
+ public static String[][] BASIC_ESCAPE() {
+ return BASIC_ESCAPE.clone();
+ }
+
private static final String[][] BASIC_ESCAPE = {
{"\"", """}, // " - double-quote
{"&", "&"}, // & - ampersand
@@ -370,14 +385,20 @@ public class EntityArrays {
* Reverse of {@link #BASIC_ESCAPE()} for unescaping purposes.
* @return the mapping table
*/
- public static String[][] BASIC_UNESCAPE() { return BASIC_UNESCAPE.clone(); }
+ public static String[][] BASIC_UNESCAPE() {
+ return BASIC_UNESCAPE.clone();
+ }
+
private static final String[][] BASIC_UNESCAPE = invert(BASIC_ESCAPE);
/**
* Mapping to escape the apostrophe character to its XML character entity.
* @return the mapping table
*/
- public static String[][] APOS_ESCAPE() { return APOS_ESCAPE.clone(); }
+ public static String[][] APOS_ESCAPE() {
+ return APOS_ESCAPE.clone();
+ }
+
private static final String[][] APOS_ESCAPE = {
{"'", "'"}, // XML apostrophe
};
@@ -386,7 +407,10 @@ public class EntityArrays {
* Reverse of {@link #APOS_ESCAPE()} for unescaping purposes.
* @return the mapping table
*/
- public static String[][] APOS_UNESCAPE() { return APOS_UNESCAPE.clone(); }
+ public static String[][] APOS_UNESCAPE() {
+ return APOS_UNESCAPE.clone();
+ }
+
private static final String[][] APOS_UNESCAPE = invert(APOS_ESCAPE);
/**
@@ -395,7 +419,10 @@ public class EntityArrays {
* Namely: {@code \b \n \t \f \r}
* @return the mapping table
*/
- public static String[][] JAVA_CTRL_CHARS_ESCAPE() { return JAVA_CTRL_CHARS_ESCAPE.clone(); }
+ public static String[][] JAVA_CTRL_CHARS_ESCAPE() {
+ return JAVA_CTRL_CHARS_ESCAPE.clone();
+ }
+
private static final String[][] JAVA_CTRL_CHARS_ESCAPE = {
{"\b", "\\b"},
{"\n", "\\n"},
@@ -408,7 +435,10 @@ public class EntityArrays {
* Reverse of {@link #JAVA_CTRL_CHARS_ESCAPE()} for unescaping purposes.
* @return the mapping table
*/
- public static String[][] JAVA_CTRL_CHARS_UNESCAPE() { return JAVA_CTRL_CHARS_UNESCAPE.clone(); }
+ public static String[][] JAVA_CTRL_CHARS_UNESCAPE() {
+ return JAVA_CTRL_CHARS_UNESCAPE.clone();
+ }
+
private static final String[][] JAVA_CTRL_CHARS_UNESCAPE = invert(JAVA_CTRL_CHARS_ESCAPE);
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java b/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
index 71209ad..91e2e98 100644
--- a/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
+++ b/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
@@ -100,8 +100,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator {
// Note that this supports character codes without a ; on the end
while(end < seqEnd && ( input.charAt(end) >= '0' && input.charAt(end) <= '9' ||
input.charAt(end) >= 'a' && input.charAt(end) <= 'f' ||
- input.charAt(end) >= 'A' && input.charAt(end) <= 'F' ) )
- {
+ input.charAt(end) >= 'A' && input.charAt(end) <= 'F' ) ) {
end++;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/time/DateUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/DateUtils.java b/src/main/java/org/apache/commons/lang3/time/DateUtils.java
index 7e5e4f6..9d708c3 100644
--- a/src/main/java/org/apache/commons/lang3/time/DateUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/DateUtils.java
@@ -380,8 +380,7 @@ public class DateUtils {
if (fdp.parse(str, pos, calendar) && pos.getIndex()==str.length()) {
return calendar.getTime();
}
- }
- catch(final IllegalArgumentException ignore) {
+ } catch(final IllegalArgumentException ignore) {
// leniency is preventing calendar from being set
}
pos.setIndex(0);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
index ee48179..ac60d21 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
@@ -138,11 +138,9 @@ public class FastDateParser implements DateParser, Serializable {
if(centuryStart!=null) {
definingCalendar.setTime(centuryStart);
centuryStartYear= definingCalendar.get(Calendar.YEAR);
- }
- else if(locale.equals(JAPANESE_IMPERIAL)) {
+ } else if(locale.equals(JAPANESE_IMPERIAL)) {
centuryStartYear= 0;
- }
- else {
+ } else {
// from 80 years ago to 20 years from now
definingCalendar.setTime(new Date());
centuryStartYear= definingCalendar.get(Calendar.YEAR)-80;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/time/FormatCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FormatCache.java b/src/main/java/org/apache/commons/lang3/time/FormatCache.java
index 23c08e6..1cb711a 100644
--- a/src/main/java/org/apache/commons/lang3/time/FormatCache.java
+++ b/src/main/java/org/apache/commons/lang3/time/FormatCache.java
@@ -196,11 +196,9 @@ abstract class FormatCache<F extends Format> {
DateFormat formatter;
if (dateStyle == null) {
formatter = DateFormat.getTimeInstance(timeStyle.intValue(), locale);
- }
- else if (timeStyle == null) {
+ } else if (timeStyle == null) {
formatter = DateFormat.getDateInstance(dateStyle.intValue(), locale);
- }
- else {
+ } else {
formatter = DateFormat.getDateTimeInstance(dateStyle.intValue(), timeStyle.intValue(), locale);
}
pattern = ((SimpleDateFormat)formatter).toPattern();
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/309b34f0/src/main/java/org/apache/commons/lang3/time/StopWatch.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/StopWatch.java b/src/main/java/org/apache/commons/lang3/time/StopWatch.java
index 573fa86..feb2388 100644
--- a/src/main/java/org/apache/commons/lang3/time/StopWatch.java
+++ b/src/main/java/org/apache/commons/lang3/time/StopWatch.java
@@ -80,24 +80,60 @@ public class StopWatch {
private enum State {
UNSTARTED {
- @Override boolean isStarted() { return false; }
- @Override boolean isStopped() { return true; }
- @Override boolean isSuspended() { return false; }
+ @Override
+ boolean isStarted() {
+ return false;
+ }
+ @Override
+ boolean isStopped() {
+ return true;
+ }
+ @Override
+ boolean isSuspended() {
+ return false;
+ }
},
RUNNING {
- @Override boolean isStarted() { return true; }
- @Override boolean isStopped() { return false; }
- @Override boolean isSuspended() { return false; }
+ @Override
+ boolean isStarted() {
+ return true;
+ }
+ @Override
+ boolean isStopped() {
+ return false;
+ }
+ @Override
+ boolean isSuspended() {
+ return false;
+ }
},
STOPPED {
- @Override boolean isStarted() { return false; }
- @Override boolean isStopped() { return true; }
- @Override boolean isSuspended() { return false; }
+ @Override
+ boolean isStarted() {
+ return false;
+ }
+ @Override
+ boolean isStopped() {
+ return true;
+ }
+ @Override
+ boolean isSuspended() {
+ return false;
+ }
},
SUSPENDED {
- @Override boolean isStarted() { return true; }
- @Override boolean isStopped() { return false; }
- @Override boolean isSuspended() { return true; }
+ @Override
+ boolean isStarted() {
+ return true;
+ }
+ @Override
+ boolean isStopped() {
+ return false;
+ }
+ @Override
+ boolean isSuspended() {
+ return true;
+ }
};
/**
[38/48] [lang] Remove magical number,
using a local final variable (following current approach)
Posted by br...@apache.org.
Remove magical number, using a local final variable (following current approach)
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/0344ca3f
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/0344ca3f
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/0344ca3f
Branch: refs/heads/release
Commit: 0344ca3f2d43e3732bf16370262303be8761a523
Parents: 65b08c4
Author: Bruno P. Kinoshita <ki...@apache.org>
Authored: Wed Jun 7 18:50:19 2017 +1200
Committer: Bruno P. Kinoshita <ki...@apache.org>
Committed: Wed Jun 7 18:50:19 2017 +1200
----------------------------------------------------------------------
.../org/apache/commons/lang3/builder/ToStringBuilderTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/0344ca3f/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
index f0c5af7..c49426d 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
@@ -36,6 +36,7 @@ import org.junit.Test;
*/
public class ToStringBuilderTest {
+ private final Integer arraylistInitialCapacity = Integer.valueOf(10);
private final Integer base = Integer.valueOf(5);
private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
@@ -316,7 +317,7 @@ public class ToStringBuilderTest {
// representation different for IBM JDK 1.6.0, LANG-727
assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION));
assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0);
- final List<Object> list = new ArrayList<>(10);
+ final List<Object> list = new ArrayList<>(arraylistInitialCapacity);
final String baseString = this.toBaseString(list);
final String expectedWithTransients = baseString + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]";
final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true);
[41/48] [lang] LANG-1336: Add NUL Byte To CharUtils. Thanks to Beluga
Behr.
Posted by br...@apache.org.
LANG-1336: Add NUL Byte To CharUtils. Thanks to Beluga Behr.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/ad648cf8
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/ad648cf8
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/ad648cf8
Branch: refs/heads/release
Commit: ad648cf8a8a90bdee129266ca7b686a5b9a87561
Parents: 21bab1d
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed Jun 7 09:54:34 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed Jun 7 09:59:12 2017 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/lang3/CharUtils.java | 6 ++++++
src/main/java/org/apache/commons/lang3/StringUtils.java | 6 +++---
.../java/org/apache/commons/lang3/text/StrBuilder.java | 3 ++-
.../java/org/apache/commons/lang3/StringUtilsTest.java | 10 +++++-----
5 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ad648cf8/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4496b9b..b005ab6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="3.6" date="2017-MM-DD" description="TBD">
+ <action issue="LANG-1336" type="add" dev="britter" due-to="Beluga Behr">Add NUL Byte To CharUtils</action>
<action issue="LANG-1337" type="fix" dev="kinow">Fix test failures in IBM JDK 8 for ToStringBuilderTest</action>
<action issue="LANG-1304" type="add" dev="pschumacher" due-to="Andy Klimczak">Add method in StringUtils to determine if string contains both mixed cased characters</action>
<action issue="LANG-1334" type="update" dev="djones">Deprecate CharEncoding in favour of java.nio.charset.StandardCharsets</action>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ad648cf8/src/main/java/org/apache/commons/lang3/CharUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharUtils.java b/src/main/java/org/apache/commons/lang3/CharUtils.java
index f697c08..51b347a 100644
--- a/src/main/java/org/apache/commons/lang3/CharUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharUtils.java
@@ -50,6 +50,12 @@ public class CharUtils {
*/
public static final char CR = '\r';
+ /**
+ * {@code \u0000} null control character ('\0'), abbreviated NUL.
+ *
+ * @since 3.6
+ */
+ public static final char NUL = '\0';
static {
for (char c = 0; c < CHAR_STRING_ARRAY.length; c++) {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ad648cf8/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index f98433a..97a073f 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -9009,7 +9009,7 @@ public class StringUtils {
*/
public static String wrap(final String str, final char wrapWith) {
- if (isEmpty(str) || wrapWith == '\0') {
+ if (isEmpty(str) || wrapWith == CharUtils.NUL) {
return str;
}
@@ -9080,7 +9080,7 @@ public class StringUtils {
* @since 3.5
*/
public static String wrapIfMissing(final String str, final char wrapWith) {
- if (isEmpty(str) || wrapWith == '\0') {
+ if (isEmpty(str) || wrapWith == CharUtils.NUL) {
return str;
}
final StringBuilder builder = new StringBuilder(str.length() + 2);
@@ -9205,7 +9205,7 @@ public class StringUtils {
* @since 3.6
*/
public static String unwrap(final String str, final char wrapChar) {
- if (isEmpty(str) || wrapChar == '\0') {
+ if (isEmpty(str) || wrapChar == CharUtils.NUL) {
return str;
}
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ad648cf8/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
index 4e69cd5..cf42495 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.CharUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.Builder;
@@ -213,7 +214,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
final int newEnd = length;
size = length;
for (int i = oldEnd; i < newEnd; i++) {
- buffer[i] = '\0';
+ buffer[i] = CharUtils.NUL;
}
}
return this;
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ad648cf8/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index aa9ec73..615030e 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -3106,10 +3106,10 @@ public class StringUtilsTest {
@Test
public void testWrap_StringChar() {
- assertNull(StringUtils.wrap(null, '\0'));
+ assertNull(StringUtils.wrap(null, CharUtils.NUL));
assertNull(StringUtils.wrap(null, '1'));
- assertEquals("", StringUtils.wrap("", '\0'));
+ assertEquals("", StringUtils.wrap("", CharUtils.NUL));
assertEquals("xabx", StringUtils.wrap("ab", 'x'));
assertEquals("\"ab\"", StringUtils.wrap("ab", '\"'));
assertEquals("\"\"ab\"\"", StringUtils.wrap("\"ab\"", '\"'));
@@ -3121,10 +3121,10 @@ public class StringUtilsTest {
@Test
public void testWrapIfMissing_StringChar() {
- assertNull(StringUtils.wrapIfMissing(null, '\0'));
+ assertNull(StringUtils.wrapIfMissing(null, CharUtils.NUL));
assertNull(StringUtils.wrapIfMissing(null, '1'));
- assertEquals("", StringUtils.wrapIfMissing("", '\0'));
+ assertEquals("", StringUtils.wrapIfMissing("", CharUtils.NUL));
assertEquals("xabx", StringUtils.wrapIfMissing("ab", 'x'));
assertEquals("\"ab\"", StringUtils.wrapIfMissing("ab", '\"'));
assertEquals("\"ab\"", StringUtils.wrapIfMissing("\"ab\"", '\"'));
@@ -3202,7 +3202,7 @@ public class StringUtilsTest {
@Test
public void testUnwrap_StringChar() {
assertNull(StringUtils.unwrap(null, null));
- assertNull(StringUtils.unwrap(null, '\0'));
+ assertNull(StringUtils.unwrap(null, CharUtils.NUL));
assertNull(StringUtils.unwrap(null, '1'));
assertEquals("abc", StringUtils.unwrap("abc", null));
[23/48] [lang] Make sure lines in files don't have trailing white
spaces and remove all trailing white spaces
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index a2d3a21..cffae29 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -5,9 +5,9 @@
* 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.
@@ -52,7 +52,7 @@ public class ArrayUtilsTest {
assertTrue(Modifier.isPublic(ArrayUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(ArrayUtils.class.getModifiers()));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testToString() {
@@ -61,7 +61,7 @@ public class ArrayUtilsTest {
assertEquals("{}", ArrayUtils.toString(new String[0]));
assertEquals("{<null>}", ArrayUtils.toString(new String[] {null}));
assertEquals("{pink,blue}", ArrayUtils.toString(new String[] {"pink","blue"}));
-
+
assertEquals("<empty>", ArrayUtils.toString(null, "<empty>"));
assertEquals("{}", ArrayUtils.toString(new Object[0], "<empty>"));
assertEquals("{}", ArrayUtils.toString(new String[0], "<empty>"));
@@ -76,12 +76,12 @@ public class ArrayUtilsTest {
final long[][] array2 = new long[][] {{2,5}, {4,6}};
assertTrue(ArrayUtils.hashCode(array1) == ArrayUtils.hashCode(array1));
assertFalse(ArrayUtils.hashCode(array1) == ArrayUtils.hashCode(array2));
-
+
final Object[] array3 = new Object[] {new String(new char[] {'A', 'B'})};
final Object[] array4 = new Object[] {"AB"};
assertTrue(ArrayUtils.hashCode(array3) == ArrayUtils.hashCode(array3));
assertTrue(ArrayUtils.hashCode(array3) == ArrayUtils.hashCode(array4));
-
+
final Object[] arrayA = new Object[] {new boolean[] {true, false}, new int[] {6, 7}};
final Object[] arrayB = new Object[] {new boolean[] {true, false}, new int[] {6, 7}};
assertTrue(ArrayUtils.hashCode(arrayB) == ArrayUtils.hashCode(arrayA));
@@ -150,7 +150,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.isEquals(null, null));
assertFalse(ArrayUtils.isEquals(null, array4));
}
-
+
//-----------------------------------------------------------------------
/**
* Tests generic array creation with parameters of same type.
@@ -223,15 +223,15 @@ public class ArrayUtilsTest {
{
return ArrayUtils.toArray(items);
}
-
+
//-----------------------------------------------------------------------
@Test
public void testToMap() {
Map<?, ?> map = ArrayUtils.toMap(new String[][] {{"foo", "bar"}, {"hello", "world"}});
-
+
assertEquals("bar", map.get("foo"));
assertEquals("world", map.get("hello"));
-
+
assertEquals(null, ArrayUtils.toMap(null));
try {
ArrayUtils.toMap(new String[][] {{"foo", "bar"}, {"short"}});
@@ -245,7 +245,7 @@ public class ArrayUtilsTest {
ArrayUtils.toMap(new Object[] {new Object[] {"foo", "bar"}, null});
fail("exception expected");
} catch (final IllegalArgumentException ex) {}
-
+
map = ArrayUtils.toMap(new Object[] {new Map.Entry<Object, Object>() {
@Override
public Object getKey() {
@@ -279,7 +279,7 @@ public class ArrayUtilsTest {
Object[] cloned1 = ArrayUtils.clone(original1);
assertTrue(Arrays.equals(original1, cloned1));
assertTrue(original1 != cloned1);
-
+
final StringBuilder builder = new StringBuilder("pick");
original1 = new Object[] {builder, "a", new String[] {"stick"}};
cloned1 = ArrayUtils.clone(original1);
@@ -298,7 +298,7 @@ public class ArrayUtilsTest {
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
}
-
+
@Test
public void testCloneLong() {
assertEquals(null, ArrayUtils.clone((long[]) null));
@@ -307,7 +307,7 @@ public class ArrayUtilsTest {
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
}
-
+
@Test
public void testCloneInt() {
assertEquals(null, ArrayUtils.clone((int[]) null));
@@ -316,7 +316,7 @@ public class ArrayUtilsTest {
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
}
-
+
@Test
public void testCloneShort() {
assertEquals(null, ArrayUtils.clone((short[]) null));
@@ -325,7 +325,7 @@ public class ArrayUtilsTest {
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
}
-
+
@Test
public void testCloneChar() {
assertEquals(null, ArrayUtils.clone((char[]) null));
@@ -334,7 +334,7 @@ public class ArrayUtilsTest {
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
}
-
+
@Test
public void testCloneByte() {
assertEquals(null, ArrayUtils.clone((byte[]) null));
@@ -343,7 +343,7 @@ public class ArrayUtilsTest {
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
}
-
+
@Test
public void testCloneDouble() {
assertEquals(null, ArrayUtils.clone((double[]) null));
@@ -352,7 +352,7 @@ public class ArrayUtilsTest {
assertTrue(Arrays.equals(original, cloned));
assertTrue(original != cloned);
}
-
+
@Test
public void testCloneFloat() {
assertEquals(null, ArrayUtils.clone((float[]) null));
@@ -365,36 +365,36 @@ public class ArrayUtilsTest {
//-----------------------------------------------------------------------
private class TestClass{}
-
+
@Test
public void testNullToEmptyGenericNull() {
final TestClass[] output = ArrayUtils.nullToEmpty(null, TestClass[].class);
-
+
assertTrue(output != null);
assertTrue(output.length == 0);
}
-
+
@Test
public void testNullToEmptyGenericEmpty() {
final TestClass[] input = new TestClass[]{};
final TestClass[] output = ArrayUtils.nullToEmpty(input, TestClass[].class);
-
+
assertSame(input, output);
}
-
+
@Test
public void testNullToEmptyGeneric() {
final TestClass[] input = new TestClass[]{new TestClass(), new TestClass()};
final TestClass[] output = ArrayUtils.nullToEmpty(input, TestClass[].class);
-
+
assertSame(input, output);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testNullToEmptyGenericNullType() {
final TestClass[] input = new TestClass[]{};
ArrayUtils.nullToEmpty(input, null);
- }
+ }
@Test
public void testNullToEmptyBooleanNull() throws Exception {
@@ -790,7 +790,7 @@ public class ArrayUtilsTest {
StringUtils.join(ArrayUtils.subarray(objectArray, 2, 33)));
assertEquals("start undershoot, end overshoot", "abcdef",
StringUtils.join(ArrayUtils.subarray(objectArray, -2, 12)));
-
+
// array type tests
final Date[] dateArray = { new java.sql.Date(new Date().getTime()),
new Date(), new Date(), new Date(), new Date() };
@@ -1431,7 +1431,7 @@ public class ArrayUtilsTest {
ArrayUtils.subarray(array, 2, 4).getClass().getComponentType());
}
-
+
//-----------------------------------------------------------------------
@Test
public void testSameLength() {
@@ -1439,22 +1439,22 @@ public class ArrayUtilsTest {
final Object[] emptyArray = new Object[0];
final Object[] oneArray = new Object[] {"pick"};
final Object[] twoArray = new Object[] {"pick", "stick"};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
@@ -1467,224 +1467,224 @@ public class ArrayUtilsTest {
final boolean[] emptyArray = new boolean[0];
final boolean[] oneArray = new boolean[] {true};
final boolean[] twoArray = new boolean[] {true, false};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
}
-
+
@Test
public void testSameLengthLong() {
final long[] nullArray = null;
final long[] emptyArray = new long[0];
final long[] oneArray = new long[] {0L};
final long[] twoArray = new long[] {0L, 76L};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
}
-
+
@Test
public void testSameLengthInt() {
final int[] nullArray = null;
final int[] emptyArray = new int[0];
final int[] oneArray = new int[] {4};
final int[] twoArray = new int[] {5, 7};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
}
-
+
@Test
public void testSameLengthShort() {
final short[] nullArray = null;
final short[] emptyArray = new short[0];
final short[] oneArray = new short[] {4};
final short[] twoArray = new short[] {6, 8};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
}
-
+
@Test
public void testSameLengthChar() {
final char[] nullArray = null;
final char[] emptyArray = new char[0];
final char[] oneArray = new char[] {'f'};
final char[] twoArray = new char[] {'d', 't'};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
}
-
+
@Test
public void testSameLengthByte() {
final byte[] nullArray = null;
final byte[] emptyArray = new byte[0];
final byte[] oneArray = new byte[] {3};
final byte[] twoArray = new byte[] {4, 6};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
}
-
+
@Test
public void testSameLengthDouble() {
final double[] nullArray = null;
final double[] emptyArray = new double[0];
final double[] oneArray = new double[] {1.3d};
final double[] twoArray = new double[] {4.5d, 6.3d};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
}
-
+
@Test
public void testSameLengthFloat() {
final float[] nullArray = null;
final float[] emptyArray = new float[0];
final float[] oneArray = new float[] {2.5f};
final float[] twoArray = new float[] {6.4f, 5.8f};
-
+
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
-
+
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
-
+
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testSameType() {
@@ -1700,14 +1700,14 @@ public class ArrayUtilsTest {
ArrayUtils.isSameType(new Object[0], null);
fail();
} catch (final IllegalArgumentException ex) {}
-
+
assertTrue(ArrayUtils.isSameType(new Object[0], new Object[0]));
assertFalse(ArrayUtils.isSameType(new String[0], new Object[0]));
assertTrue(ArrayUtils.isSameType(new String[0][0], new String[0][0]));
assertFalse(ArrayUtils.isSameType(new String[0], new String[0][0]));
assertFalse(ArrayUtils.isSameType(new String[0][0], new String[0]));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testReverse() {
@@ -1715,13 +1715,13 @@ public class ArrayUtilsTest {
final String str2 = "a";
final String[] str3 = new String[] {"stick"};
final String str4 = "up";
-
+
Object[] array = new Object[] {str1, str2, str3};
ArrayUtils.reverse(array);
assertEquals(array[0], str3);
assertEquals(array[1], str2);
assertEquals(array[2], str1);
-
+
array = new Object[] {str1, str2, str3, str4};
ArrayUtils.reverse(array);
assertEquals(array[0], str4);
@@ -1746,7 +1746,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array);
assertEquals(null, array);
}
-
+
@Test
public void testReverseInt() {
int[] array = new int[] {1, 2, 3};
@@ -1759,7 +1759,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array);
assertEquals(null, array);
}
-
+
@Test
public void testReverseShort() {
short[] array = new short[] {1, 2, 3};
@@ -1772,7 +1772,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array);
assertEquals(null, array);
}
-
+
@Test
public void testReverseChar() {
char[] array = new char[] {'a', 'f', 'C'};
@@ -1785,7 +1785,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array);
assertEquals(null, array);
}
-
+
@Test
public void testReverseByte() {
byte[] array = new byte[] {2, 3, 4};
@@ -1798,7 +1798,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array);
assertEquals(null, array);
}
-
+
@Test
public void testReverseDouble() {
double[] array = new double[] {0.3d, 0.4d, 0.5d};
@@ -1811,7 +1811,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array);
assertEquals(null, array);
}
-
+
@Test
public void testReverseFloat() {
float[] array = new float[] {0.3f, 0.4f, 0.5f};
@@ -1824,7 +1824,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array);
assertEquals(null, array);
}
-
+
@Test
public void testReverseBoolean() {
boolean[] array = new boolean[] {false, false, true};
@@ -1837,7 +1837,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array);
assertEquals(null, array);
}
-
+
@Test
public void testReverseBooleanRange() {
boolean[] array = new boolean[] {false, false, true};
@@ -1869,7 +1869,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
@Test
public void testReverseByteRange() {
byte[] array = new byte[] {1, 2, 3};
@@ -1901,7 +1901,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
@Test
public void testReverseCharRange() {
char[] array = new char[] {1, 2, 3};
@@ -1933,7 +1933,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
@Test
public void testReverseDoubleRange() {
double[] array = new double[] {1, 2, 3};
@@ -1965,7 +1965,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
@Test
public void testReverseFloatRange() {
float[] array = new float[] {1, 2, 3};
@@ -1997,7 +1997,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
@Test
public void testReverseIntRange() {
int[] array = new int[] {1, 2, 3};
@@ -2029,7 +2029,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
@Test
public void testReverseLongRange() {
long[] array = new long[] {1, 2, 3};
@@ -2061,7 +2061,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
@Test
public void testReverseShortRange() {
short[] array = new short[] {1, 2, 3};
@@ -2093,7 +2093,7 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
@Test
public void testReverseObjectRange() {
String[] array = new String[] {"1", "2", "3"};
@@ -2125,23 +2125,23 @@ public class ArrayUtilsTest {
ArrayUtils.reverse(array, 0, 3);
assertEquals(null, array);
}
-
+
//-----------------------------------------------------------------------
@Test
public void testSwapChar() {
char[] array = new char[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2);
assertArrayEquals(new char[] {3, 2, 1}, array);
-
+
array = new char[] {1, 2, 3};
ArrayUtils.swap(array, 0, 0);
assertArrayEquals(new char[] {1, 2, 3}, array);
-
+
array = new char[] {1, 2, 3};
ArrayUtils.swap(array, 1, 0);
assertArrayEquals(new char[] {2, 1, 3}, array);
}
-
+
@Test
public void testSwapCharRange() {
char[] array = new char[] {1, 2, 3, 4};
@@ -2156,32 +2156,32 @@ public class ArrayUtilsTest {
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new char[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new char[] {1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new char[] {1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new char[] {1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
}
-
+
@Test
public void testSwapByte() {
final byte[] array = new byte[] {1, 2, 3};
@@ -2190,21 +2190,21 @@ public class ArrayUtilsTest {
assertEquals(2, array[1]);
assertEquals(1, array[2]);
}
-
+
@Test
public void testSwapNullByteArray() {
final byte[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyByteArray() {
final byte[] array = new byte[0];
ArrayUtils.swap(array, 0, 2);
assertEquals(0, array.length);
}
-
+
@Test
public void testSwapByteRange() {
byte[] array = new byte[] {1, 2, 3, 4};
@@ -2213,38 +2213,38 @@ public class ArrayUtilsTest {
assertEquals(4, array[1]);
assertEquals(1, array[2]);
assertEquals(2, array[3]);
-
+
array = new byte[] {1, 2, 3};
ArrayUtils.swap(array, 0, 3);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new byte[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new byte[] {1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new byte[] {1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new byte[] {1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
}
-
+
@Test
public void testSwapFloat() {
final float[] array = new float[] {1, 2, 3};
@@ -2253,14 +2253,14 @@ public class ArrayUtilsTest {
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
}
-
+
@Test
public void testSwapNullFloatArray() {
final float[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyFloatArray() {
final float[] array = new float[0];
@@ -2282,32 +2282,32 @@ public class ArrayUtilsTest {
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
-
+
array = new float[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
-
+
array = new float[] {1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
-
+
array = new float[] {1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
-
+
array = new float[] {1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
}
-
+
@Test
public void testSwapDouble() {
final double[] array = new double[] {1, 2, 3};
@@ -2316,14 +2316,14 @@ public class ArrayUtilsTest {
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
}
-
+
@Test
public void testSwapNullDoubleArray() {
final double[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyDoubleArray() {
final double[] array = new double[0];
@@ -2345,32 +2345,32 @@ public class ArrayUtilsTest {
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
-
+
array = new double[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
-
+
array = new double[] {1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(1, array[2], 0);
-
+
array = new double[] {1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
-
+
array = new double[] {1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0], 0);
assertEquals(2, array[1], 0);
assertEquals(3, array[2], 0);
}
-
+
@Test
public void testSwapInt() {
final int[] array = new int[] {1, 2, 3};
@@ -2379,14 +2379,14 @@ public class ArrayUtilsTest {
assertEquals(2, array[1]);
assertEquals(1, array[2]);
}
-
+
@Test
public void testSwapNullIntArray() {
final int[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyIntArray() {
final int[] array = new int[0];
@@ -2402,50 +2402,50 @@ public class ArrayUtilsTest {
assertEquals(4, array[1]);
assertEquals(1, array[2]);
assertEquals(2, array[3]);
-
+
array = new int[] {1, 2, 3};
ArrayUtils.swap(array, 3, 0);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new int[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new int[] {1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new int[] {1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new int[] {1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
}
-
+
@Test
public void testSwapIntExchangedOffsets() {
int[] array;
array = new int[] {1, 2, 3};
ArrayUtils.swap(array, 0, 1, 2);
assertArrayEquals(new int[] {2, 3, 1}, array);
-
+
array = new int[] {1, 2, 3};
ArrayUtils.swap(array, 1, 0, 2);
assertArrayEquals(new int[] {2, 3, 1}, array);
}
-
+
@Test
public void testSwapShort() {
final short[] array = new short[] {1, 2, 3};
@@ -2454,21 +2454,21 @@ public class ArrayUtilsTest {
assertEquals(2, array[1]);
assertEquals(1, array[2]);
}
-
+
@Test
public void testSwapNullShortArray() {
final short[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyShortArray() {
final short[] array = new short[0];
ArrayUtils.swap(array, 0, 2);
assertEquals(0, array.length);
}
-
+
@Test
public void testSwapShortRange() {
short[] array = new short[] {1, 2, 3, 4};
@@ -2477,45 +2477,45 @@ public class ArrayUtilsTest {
assertEquals(4, array[1]);
assertEquals(1, array[2]);
assertEquals(2, array[3]);
-
+
array = new short[] {1, 2, 3};
ArrayUtils.swap(array, 3, 0);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new short[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new short[] {1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new short[] {1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new short[] {1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
}
-
+
@Test
public void testSwapNullCharArray() {
final char[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyCharArray() {
final char[] array = new char[0];
@@ -2531,14 +2531,14 @@ public class ArrayUtilsTest {
assertEquals(2, array[1]);
assertEquals(1, array[2]);
}
-
+
@Test
public void testSwapNullLongArray() {
final long[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyLongArray() {
final long[] array = new long[0];
@@ -2554,38 +2554,38 @@ public class ArrayUtilsTest {
assertEquals(4, array[1]);
assertEquals(1, array[2]);
assertEquals(2, array[3]);
-
+
array = new long[] {1, 2, 3};
ArrayUtils.swap(array, 0, 3);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new long[] {1, 2, 3};
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new long[] {1, 2, 3};
ArrayUtils.swap(array, -1, 2, 2);
assertEquals(3, array[0]);
assertEquals(2, array[1]);
assertEquals(1, array[2]);
-
+
array = new long[] {1, 2, 3};
ArrayUtils.swap(array, 0, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
-
+
array = new long[] {1, 2, 3};
ArrayUtils.swap(array, -1, -1, 2);
assertEquals(1, array[0]);
assertEquals(2, array[1]);
assertEquals(3, array[2]);
}
-
+
@Test
public void testSwapBoolean() {
final boolean[] array = new boolean[] {true, false, false};
@@ -2594,21 +2594,21 @@ public class ArrayUtilsTest {
assertFalse(array[1]);
assertTrue(array[2]);
}
-
+
@Test
public void testSwapNullBooleanArray() {
final boolean[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyBooleanArray() {
final boolean[] array = new boolean[0];
ArrayUtils.swap(array, 0, 2);
assertEquals(0, array.length);
}
-
+
@Test
public void testSwapBooleanRange() {
boolean[] array = new boolean[] {false, false, true, true};
@@ -2617,31 +2617,31 @@ public class ArrayUtilsTest {
assertTrue(array[1]);
assertFalse(array[2]);
assertFalse(array[3]);
-
+
array = new boolean[] {false, true, false};
ArrayUtils.swap(array, 0, 3);
assertFalse(array[0]);
assertTrue(array[1]);
assertFalse(array[2]);
-
+
array = new boolean[] {true, true, false};
ArrayUtils.swap(array, 0, 2, 2);
assertFalse(array[0]);
assertTrue(array[1]);
assertTrue(array[2]);
-
+
array = new boolean[] {true, true, false};
ArrayUtils.swap(array, -1, 2, 2);
assertFalse(array[0]);
assertTrue(array[1]);
assertTrue(array[2]);
-
+
array = new boolean[] {true, true, false};
ArrayUtils.swap(array, 0, -1, 2);
assertTrue(array[0]);
assertTrue(array[1]);
assertFalse(array[2]);
-
+
array = new boolean[] {true, true, false};
ArrayUtils.swap(array, -1, -1, 2);
assertTrue(array[0]);
@@ -2657,14 +2657,14 @@ public class ArrayUtilsTest {
assertEquals("2", array[1]);
assertEquals("1", array[2]);
}
-
+
@Test
public void testSwapNullObjectArray() {
final String[] array = null;
ArrayUtils.swap(array, 0, 2);
assertNull(array);
}
-
+
@Test
public void testSwapEmptyObjectArray() {
final String[] array = new String[0];
@@ -2695,7 +2695,7 @@ public class ArrayUtilsTest {
assertEquals("5", array[2]);
assertEquals("2", array[3]);
assertEquals("1", array[4]);
-
+
array = new String[] {"1", "2", "3", "4", "5"};
ArrayUtils.swap(array, 2, -2, 3);
assertEquals("3", array[0]);
@@ -2703,11 +2703,11 @@ public class ArrayUtilsTest {
assertEquals("5", array[2]);
assertEquals("2", array[3]);
assertEquals("1", array[4]);
-
+
array = new String[0];
ArrayUtils.swap(array, 0, 2, 2);
assertEquals(0, array.length);
-
+
array = null;
ArrayUtils.swap(array, 0, 2, 2);
assertNull(array);
@@ -2765,18 +2765,18 @@ public class ArrayUtilsTest {
assertEquals(3, array[2], 0);
assertEquals(4, array[3], 0);
}
-
+
@Test
public void testShiftRangeNullDouble() {
final double[] array = null;
ArrayUtils.shift(array, 1, 1, 1);
assertNull(array);
}
-
+
@Test
public void testShiftNullDouble() {
final double[] array = null;
-
+
ArrayUtils.shift(array, 1);
assertNull(array);
}
@@ -2795,7 +2795,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2], 0);
assertEquals(4, array[3], 0);
}
-
+
@Test
public void testShiftFloat() {
final float[] array = new float[] {1, 2, 3, 4};
@@ -2847,18 +2847,18 @@ public class ArrayUtilsTest {
assertEquals(3, array[2], 0);
assertEquals(4, array[3], 0);
}
-
+
@Test
public void testShiftRangeNullFloat() {
final float[] array = null;
ArrayUtils.shift(array, 1, 1, 1);
assertNull(array);
}
-
+
@Test
public void testShiftNullFloat() {
final float[] array = null;
-
+
ArrayUtils.shift(array, 1);
assertNull(array);
}
@@ -2877,7 +2877,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2], 0);
assertEquals(4, array[3], 0);
}
-
+
@Test
public void testShiftShort() {
short[] array = new short[] {1, 2, 3, 4};
@@ -2909,11 +2909,11 @@ public class ArrayUtilsTest {
assertEquals(2, array[3]);
assertEquals(3, array[4]);
}
-
+
@Test
public void testShiftNullShort() {
final short[] array = null;
-
+
ArrayUtils.shift(array, 1);
assertNull(array);
}
@@ -2944,11 +2944,11 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftRangeNullShort() {
final short[] array = null;
-
+
ArrayUtils.shift(array, 1, 1, 1);
assertNull(array);
}
@@ -2967,7 +2967,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftByte() {
final byte[] array = new byte[] {1, 2, 3, 4};
@@ -3019,7 +3019,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftRangeNullByte() {
final byte[] array = null;
@@ -3041,7 +3041,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftChar() {
final char[] array = new char[] {1, 2, 3, 4};
@@ -3093,7 +3093,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftRangeNullChar() {
final char[] array = null;
@@ -3115,7 +3115,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftLong() {
final long[] array = new long[] {1, 2, 3, 4};
@@ -3167,18 +3167,18 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftRangeNullLong() {
final long[] array = null;
ArrayUtils.shift(array, 1, 1, 1);
assertNull(array);
}
-
+
@Test
public void testShiftNullLong() {
final long[] array = null;
-
+
ArrayUtils.shift(array, 1);
assertNull(array);
}
@@ -3197,7 +3197,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftInt() {
final int[] array = new int[] {1, 2, 3, 4};
@@ -3222,11 +3222,11 @@ public class ArrayUtilsTest {
assertEquals(1, array[2]);
assertEquals(2, array[3]);
}
-
+
@Test
public void testShiftNullInt() {
final int[] array = null;
-
+
ArrayUtils.shift(array, 1);
assertNull(array);
}
@@ -3257,7 +3257,7 @@ public class ArrayUtilsTest {
assertEquals(3, array[2]);
assertEquals(4, array[3]);
}
-
+
@Test
public void testShiftRangeNullInt() {
final int[] array = null;
@@ -3304,11 +3304,11 @@ public class ArrayUtilsTest {
assertEquals("1", array[2]);
assertEquals("2", array[3]);
}
-
+
@Test
public void testShiftNullObject() {
final String[] array = null;
-
+
ArrayUtils.shift(array, 1);
assertNull(array);
}
@@ -3339,7 +3339,7 @@ public class ArrayUtilsTest {
assertEquals("3", array[2]);
assertEquals("4", array[3]);
}
-
+
@Test
public void testShiftRangeNullObject() {
final String[] array = null;
@@ -3361,44 +3361,44 @@ public class ArrayUtilsTest {
assertEquals("3", array[2]);
assertEquals("4", array[3]);
}
-
+
@Test
public void testShiftBoolean() {
final boolean[] array = new boolean[] {true, true, false, false};
-
+
ArrayUtils.shift(array, 1);
assertFalse(array[0]);
assertTrue(array[1]);
assertTrue(array[2]);
assertFalse(array[3]);
-
+
ArrayUtils.shift(array, -1);
assertTrue(array[0]);
assertTrue(array[1]);
assertFalse(array[2]);
assertFalse(array[3]);
-
+
ArrayUtils.shift(array, 5);
assertFalse(array[0]);
assertTrue(array[1]);
assertTrue(array[2]);
assertFalse(array[3]);
-
+
ArrayUtils.shift(array, -3);
assertFalse(array[0]);
assertFalse(array[1]);
assertTrue(array[2]);
assertTrue(array[3]);
}
-
+
@Test
public void testShiftNullBoolean() {
final boolean[] array = null;
-
+
ArrayUtils.shift(array, 1);
assertNull(array);
}
-
+
//-----------------------------------------------------------------------
@Test
public void testIndexOf() {
@@ -3426,7 +3426,7 @@ public class ArrayUtilsTest {
assertEquals(3, ArrayUtils.indexOf(array, "3", 2));
assertEquals(4, ArrayUtils.indexOf(array, null, 2));
assertEquals(-1, ArrayUtils.indexOf(array, "notInArray", 2));
-
+
assertEquals(4, ArrayUtils.indexOf(array, null, -1));
assertEquals(-1, ArrayUtils.indexOf(array, null, 8));
assertEquals(-1, ArrayUtils.indexOf(array, "0", 8));
@@ -3458,7 +3458,7 @@ public class ArrayUtilsTest {
assertEquals(4, ArrayUtils.lastIndexOf(array, null, 5));
assertEquals(-1, ArrayUtils.lastIndexOf(array, null, 2));
assertEquals(-1, ArrayUtils.lastIndexOf(array, "notInArray", 5));
-
+
assertEquals(-1, ArrayUtils.lastIndexOf(array, null, -1));
assertEquals(5, ArrayUtils.lastIndexOf(array, "0", 88));
}
@@ -3556,7 +3556,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.contains(array, 3));
assertFalse(ArrayUtils.contains(array, 99));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testIndexOfInt() {
@@ -3621,7 +3621,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.contains(array, 3));
assertFalse(ArrayUtils.contains(array, 99));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testIndexOfShort() {
@@ -3686,7 +3686,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.contains(array, (short) 3));
assertFalse(ArrayUtils.contains(array, (short) 99));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testIndexOfChar() {
@@ -3751,7 +3751,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.contains(array, 'd'));
assertFalse(ArrayUtils.contains(array, 'e'));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testIndexOfByte() {
@@ -3816,7 +3816,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.contains(array, (byte) 3));
assertFalse(ArrayUtils.contains(array, (byte) 99));
}
-
+
//-----------------------------------------------------------------------
@SuppressWarnings("cast")
@Test
@@ -3863,7 +3863,7 @@ public class ArrayUtilsTest {
assertEquals(-1, ArrayUtils.indexOf(array, (double) 99, 0));
assertEquals(-1, ArrayUtils.indexOf(array, (double) 0, 6));
}
-
+
@SuppressWarnings("cast")
@Test
public void testIndexOfDoubleWithStartIndexTolerance() {
@@ -3970,7 +3970,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.contains(array, 2.5, 0.50));
assertTrue(ArrayUtils.contains(array, 2.5, 0.51));
}
-
+
//-----------------------------------------------------------------------
@SuppressWarnings("cast")
@Test
@@ -4048,7 +4048,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.contains(array, (float) 3));
assertFalse(ArrayUtils.contains(array, (float) 99));
}
-
+
//-----------------------------------------------------------------------
@Test
public void testIndexOfBoolean() {
@@ -4119,7 +4119,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.contains(array, true));
assertFalse(ArrayUtils.contains(array, false));
}
-
+
// testToPrimitive/Object for boolean
// -----------------------------------------------------------------------
@Test
@@ -4173,12 +4173,12 @@ public class ArrayUtilsTest {
public void testToPrimitive_char() {
final Character[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b));
-
+
assertSame(ArrayUtils.EMPTY_CHAR_ARRAY, ArrayUtils.toPrimitive(new Character[0]));
-
+
assertTrue(Arrays.equals(
new char[] {Character.MIN_VALUE, Character.MAX_VALUE, '0'},
- ArrayUtils.toPrimitive(new Character[] {new Character(Character.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Character[] {new Character(Character.MIN_VALUE),
new Character(Character.MAX_VALUE), new Character('0')}))
);
@@ -4192,20 +4192,20 @@ public class ArrayUtilsTest {
public void testToPrimitive_char_char() {
final Character[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b, Character.MIN_VALUE));
-
- assertSame(ArrayUtils.EMPTY_CHAR_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_CHAR_ARRAY,
ArrayUtils.toPrimitive(new Character[0], (char)0));
-
+
assertTrue(Arrays.equals(
new char[] {Character.MIN_VALUE, Character.MAX_VALUE, '0'},
- ArrayUtils.toPrimitive(new Character[] {new Character(Character.MIN_VALUE),
- new Character(Character.MAX_VALUE), new Character('0')},
+ ArrayUtils.toPrimitive(new Character[] {new Character(Character.MIN_VALUE),
+ new Character(Character.MAX_VALUE), new Character('0')},
Character.MIN_VALUE))
);
-
+
assertTrue(Arrays.equals(
new char[] {Character.MIN_VALUE, Character.MAX_VALUE, '0'},
- ArrayUtils.toPrimitive(new Character[] {new Character(Character.MIN_VALUE), null,
+ ArrayUtils.toPrimitive(new Character[] {new Character(Character.MIN_VALUE), null,
new Character('0')}, Character.MAX_VALUE))
);
}
@@ -4214,30 +4214,30 @@ public class ArrayUtilsTest {
public void testToObject_char() {
final char[] b = null;
assertArrayEquals(null, ArrayUtils.toObject(b));
-
- assertSame(ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY,
ArrayUtils.toObject(new char[0]));
-
+
assertTrue(Arrays.equals(
- new Character[] {new Character(Character.MIN_VALUE),
+ new Character[] {new Character(Character.MIN_VALUE),
new Character(Character.MAX_VALUE), new Character('0')},
- ArrayUtils.toObject(new char[] {Character.MIN_VALUE, Character.MAX_VALUE,
+ ArrayUtils.toObject(new char[] {Character.MIN_VALUE, Character.MAX_VALUE,
'0'} ))
);
}
-
+
// testToPrimitive/Object for byte
// -----------------------------------------------------------------------
@Test
public void testToPrimitive_byte() {
final Byte[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b));
-
+
assertSame(ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.toPrimitive(new Byte[0]));
-
+
assertTrue(Arrays.equals(
new byte[] {Byte.MIN_VALUE, Byte.MAX_VALUE, (byte)9999999},
- ArrayUtils.toPrimitive(new Byte[] {Byte.valueOf(Byte.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Byte[] {Byte.valueOf(Byte.MIN_VALUE),
Byte.valueOf(Byte.MAX_VALUE), Byte.valueOf((byte)9999999)}))
);
@@ -4251,20 +4251,20 @@ public class ArrayUtilsTest {
public void testToPrimitive_byte_byte() {
final Byte[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b, Byte.MIN_VALUE));
-
- assertSame(ArrayUtils.EMPTY_BYTE_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_BYTE_ARRAY,
ArrayUtils.toPrimitive(new Byte[0], (byte)1));
-
+
assertTrue(Arrays.equals(
new byte[] {Byte.MIN_VALUE, Byte.MAX_VALUE, (byte)9999999},
- ArrayUtils.toPrimitive(new Byte[] {Byte.valueOf(Byte.MIN_VALUE),
- Byte.valueOf(Byte.MAX_VALUE), Byte.valueOf((byte)9999999)},
+ ArrayUtils.toPrimitive(new Byte[] {Byte.valueOf(Byte.MIN_VALUE),
+ Byte.valueOf(Byte.MAX_VALUE), Byte.valueOf((byte)9999999)},
Byte.MIN_VALUE))
);
-
+
assertTrue(Arrays.equals(
new byte[] {Byte.MIN_VALUE, Byte.MAX_VALUE, (byte)9999999},
- ArrayUtils.toPrimitive(new Byte[] {Byte.valueOf(Byte.MIN_VALUE), null,
+ ArrayUtils.toPrimitive(new Byte[] {Byte.valueOf(Byte.MIN_VALUE), null,
Byte.valueOf((byte)9999999)}, Byte.MAX_VALUE))
);
}
@@ -4273,14 +4273,14 @@ public class ArrayUtilsTest {
public void testToObject_byte() {
final byte[] b = null;
assertArrayEquals(null, ArrayUtils.toObject(b));
-
- assertSame(ArrayUtils.EMPTY_BYTE_OBJECT_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_BYTE_OBJECT_ARRAY,
ArrayUtils.toObject(new byte[0]));
-
+
assertTrue(Arrays.equals(
- new Byte[] {Byte.valueOf(Byte.MIN_VALUE),
+ new Byte[] {Byte.valueOf(Byte.MIN_VALUE),
Byte.valueOf(Byte.MAX_VALUE), Byte.valueOf((byte)9999999)},
- ArrayUtils.toObject(new byte[] {Byte.MIN_VALUE, Byte.MAX_VALUE,
+ ArrayUtils.toObject(new byte[] {Byte.MIN_VALUE, Byte.MAX_VALUE,
(byte)9999999}))
);
}
@@ -4291,12 +4291,12 @@ public class ArrayUtilsTest {
public void testToPrimitive_short() {
final Short[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b));
-
+
assertSame(ArrayUtils.EMPTY_SHORT_ARRAY, ArrayUtils.toPrimitive(new Short[0]));
-
+
assertTrue(Arrays.equals(
new short[] {Short.MIN_VALUE, Short.MAX_VALUE, (short)9999999},
- ArrayUtils.toPrimitive(new Short[] {Short.valueOf(Short.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Short[] {Short.valueOf(Short.MIN_VALUE),
Short.valueOf(Short.MAX_VALUE), Short.valueOf((short)9999999)}))
);
@@ -4310,19 +4310,19 @@ public class ArrayUtilsTest {
public void testToPrimitive_short_short() {
final Short[] s = null;
assertEquals(null, ArrayUtils.toPrimitive(s, Short.MIN_VALUE));
-
- assertSame(ArrayUtils.EMPTY_SHORT_ARRAY, ArrayUtils.toPrimitive(new Short[0],
+
+ assertSame(ArrayUtils.EMPTY_SHORT_ARRAY, ArrayUtils.toPrimitive(new Short[0],
Short.MIN_VALUE));
-
+
assertTrue(Arrays.equals(
new short[] {Short.MIN_VALUE, Short.MAX_VALUE, (short)9999999},
- ArrayUtils.toPrimitive(new Short[] {Short.valueOf(Short.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Short[] {Short.valueOf(Short.MIN_VALUE),
Short.valueOf(Short.MAX_VALUE), Short.valueOf((short)9999999)}, Short.MIN_VALUE))
);
-
+
assertTrue(Arrays.equals(
new short[] {Short.MIN_VALUE, Short.MAX_VALUE, (short)9999999},
- ArrayUtils.toPrimitive(new Short[] {Short.valueOf(Short.MIN_VALUE), null,
+ ArrayUtils.toPrimitive(new Short[] {Short.valueOf(Short.MIN_VALUE), null,
Short.valueOf((short)9999999)}, Short.MAX_VALUE))
);
}
@@ -4331,14 +4331,14 @@ public class ArrayUtilsTest {
public void testToObject_short() {
final short[] b = null;
assertArrayEquals(null, ArrayUtils.toObject(b));
-
- assertSame(ArrayUtils.EMPTY_SHORT_OBJECT_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_SHORT_OBJECT_ARRAY,
ArrayUtils.toObject(new short[0]));
-
+
assertTrue(Arrays.equals(
- new Short[] {Short.valueOf(Short.MIN_VALUE), Short.valueOf(Short.MAX_VALUE),
+ new Short[] {Short.valueOf(Short.MIN_VALUE), Short.valueOf(Short.MAX_VALUE),
Short.valueOf((short)9999999)},
- ArrayUtils.toObject(new short[] {Short.MIN_VALUE, Short.MAX_VALUE,
+ ArrayUtils.toObject(new short[] {Short.MIN_VALUE, Short.MAX_VALUE,
(short)9999999}))
);
}
@@ -4352,7 +4352,7 @@ public class ArrayUtilsTest {
assertSame(ArrayUtils.EMPTY_INT_ARRAY, ArrayUtils.toPrimitive(new Integer[0]));
assertTrue(Arrays.equals(
new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
Integer.valueOf(Integer.MAX_VALUE), Integer.valueOf(9999999)}))
);
@@ -4366,19 +4366,19 @@ public class ArrayUtilsTest {
public void testToPrimitive_int_int() {
final Long[] l = null;
assertEquals(null, ArrayUtils.toPrimitive(l, Integer.MIN_VALUE));
- assertSame(ArrayUtils.EMPTY_INT_ARRAY,
+ assertSame(ArrayUtils.EMPTY_INT_ARRAY,
ArrayUtils.toPrimitive(new Integer[0], 1));
assertTrue(Arrays.equals(
new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
Integer.valueOf(Integer.MAX_VALUE), Integer.valueOf(9999999)},1)));
assertTrue(Arrays.equals(
new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
null, Integer.valueOf(9999999)}, Integer.MAX_VALUE))
);
}
-
+
@Test
public void testToPrimitive_intNull() {
final Integer[] iArray = null;
@@ -4389,11 +4389,11 @@ public class ArrayUtilsTest {
public void testToObject_int() {
final int[] b = null;
assertArrayEquals(null, ArrayUtils.toObject(b));
-
+
assertSame(
ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY,
ArrayUtils.toObject(new int[0]));
-
+
assertTrue(
Arrays.equals(
new Integer[] {
@@ -4410,13 +4410,13 @@ public class ArrayUtilsTest {
public void testToPrimitive_long() {
final Long[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b));
-
- assertSame(ArrayUtils.EMPTY_LONG_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.toPrimitive(new Long[0]));
-
+
assertTrue(Arrays.equals(
new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
Long.valueOf(Long.MAX_VALUE), Long.valueOf(9999999)}))
);
@@ -4430,31 +4430,31 @@ public class ArrayUtilsTest {
public void testToPrimitive_long_long() {
final Long[] l = null;
assertEquals(null, ArrayUtils.toPrimitive(l, Long.MIN_VALUE));
-
- assertSame(ArrayUtils.EMPTY_LONG_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.toPrimitive(new Long[0], 1));
-
+
assertTrue(Arrays.equals(
new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
Long.valueOf(Long.MAX_VALUE), Long.valueOf(9999999)},1)));
-
+
assertTrue(Arrays.equals(
new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
null, Long.valueOf(9999999)}, Long.MAX_VALUE))
);
}
-
+
@Test
public void testToObject_long() {
final long[] b = null;
assertArrayEquals(null, ArrayUtils.toObject(b));
-
+
assertSame(
ArrayUtils.EMPTY_LONG_OBJECT_ARRAY,
ArrayUtils.toObject(new long[0]));
-
+
assertTrue(
Arrays.equals(
new Long[] {
@@ -4471,13 +4471,13 @@ public class ArrayUtilsTest {
public void testToPrimitive_float() {
final Float[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b));
-
- assertSame(ArrayUtils.EMPTY_FLOAT_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.toPrimitive(new Float[0]));
-
+
assertTrue(Arrays.equals(
new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
Float.valueOf(Float.MAX_VALUE), Float.valueOf(9999999)}))
);
@@ -4491,31 +4491,31 @@ public class ArrayUtilsTest {
public void testToPrimitive_float_float() {
final Float[] l = null;
assertEquals(null, ArrayUtils.toPrimitive(l, Float.MIN_VALUE));
-
- assertSame(ArrayUtils.EMPTY_FLOAT_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.toPrimitive(new Float[0], 1));
-
+
assertTrue(Arrays.equals(
new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
Float.valueOf(Float.MAX_VALUE), Float.valueOf(9999999)},1)));
-
+
assertTrue(Arrays.equals(
new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
null, Float.valueOf(9999999)}, Float.MAX_VALUE))
);
}
-
+
@Test
public void testToObject_float() {
final float[] b = null;
assertArrayEquals(null, ArrayUtils.toObject(b));
-
+
assertSame(
ArrayUtils.EMPTY_FLOAT_OBJECT_ARRAY,
ArrayUtils.toObject(new float[0]));
-
+
assertTrue(
Arrays.equals(
new Float[] {
@@ -4532,13 +4532,13 @@ public class ArrayUtilsTest {
public void testToPrimitive_double() {
final Double[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b));
-
- assertSame(ArrayUtils.EMPTY_DOUBLE_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.toPrimitive(new Double[0]));
-
+
assertTrue(Arrays.equals(
new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
Double.valueOf(Double.MAX_VALUE), Double.valueOf(9999999)}))
);
@@ -4552,31 +4552,31 @@ public class ArrayUtilsTest {
public void testToPrimitive_double_double() {
final Double[] l = null;
assertEquals(null, ArrayUtils.toPrimitive(l, Double.MIN_VALUE));
-
- assertSame(ArrayUtils.EMPTY_DOUBLE_ARRAY,
+
+ assertSame(ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.toPrimitive(new Double[0], 1));
-
+
assertTrue(Arrays.equals(
new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
Double.valueOf(Double.MAX_VALUE), Double.valueOf(9999999)},1)));
-
+
assertTrue(Arrays.equals(
new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999},
- ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
+ ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
null, Double.valueOf(9999999)}, Double.MAX_VALUE))
);
}
-
+
@Test
public void testToObject_double() {
final double[] b = null;
assertArrayEquals(null, ArrayUtils.toObject(b));
-
+
assertSame(
ArrayUtils.EMPTY_DOUBLE_OBJECT_ARRAY,
ArrayUtils.toObject(new double[0]));
-
+
assertTrue(
Arrays.equals(
new Double[] {
@@ -4660,7 +4660,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.isEmpty(emptyBooleanArray));
assertFalse(ArrayUtils.isEmpty(notEmptyBooleanArray));
}
-
+
/**
* Test for {@link ArrayUtils#isNotEmpty(java.lang.Object[])}.
*/
@@ -4737,13 +4737,13 @@ public class ArrayUtilsTest {
@Test
public void testGetLength() {
assertEquals(0, ArrayUtils.getLength(null));
-
+
final Object[] emptyObjectArray = new Object[0];
final Object[] notEmptyObjectArray = new Object[] {"aValue"};
assertEquals(0, ArrayUtils.getLength((Object[]) null));
assertEquals(0, ArrayUtils.getLength(emptyObjectArray));
assertEquals(1, ArrayUtils.getLength(notEmptyObjectArray));
-
+
final int[] emptyIntArray = new int[] {};
final int[] notEmptyIntArray = new int[] { 1 };
assertEquals(0, ArrayUtils.getLength((int[]) null));
@@ -4785,7 +4785,7 @@ public class ArrayUtilsTest {
assertEquals(0, ArrayUtils.getLength((boolean[]) null));
assertEquals(0, ArrayUtils.getLength(emptyBooleanArray));
assertEquals(1, ArrayUtils.getLength(notEmptyBooleanArray));
-
+
try {
ArrayUtils.getLength("notAnArray");
fail("IllegalArgumentException should have been thrown");
@@ -4828,7 +4828,7 @@ public class ArrayUtilsTest {
array = new Integer[]{1,3,2};
assertFalse(ArrayUtils.isSorted(array, c));
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testIsSortedNullComparator() throws Exception {
ArrayUtils.isSorted(null, null);
@@ -5006,7 +5006,7 @@ public class ArrayUtilsTest {
public void testShuffleBoolean() {
boolean[] array1 = new boolean[]{true, false, true, true, false, false, true, false, false, true};
boolean[] array2 = ArrayUtils.clone(array1);
-
+
ArrayUtils.shuffle(array1);
Assert.assertFalse(Arrays.equals(array1, array2));
Assert.assertEquals(5, ArrayUtils.removeAllOccurences(array1, true).length);
@@ -5016,7 +5016,7 @@ public class ArrayUtilsTest {
public void testShuffleByte() {
byte[] array1 = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
byte[] array2 = ArrayUtils.clone(array1);
-
+
ArrayUtils.shuffle(array1);
Assert.assertFalse(Arrays.equals(array1, array2));
for (byte element : array2) {
@@ -5028,7 +5028,7 @@ public class ArrayUtilsTest {
public void testShuffleChar() {
char[] array1 = new char[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
char[] array2 = ArrayUtils.clone(array1);
-
+
ArrayUtils.shuffle(array1);
Assert.assertFalse(Arrays.equals(array1, array2));
for (char element : array2) {
@@ -5040,7 +5040,7 @@ public class ArrayUtilsTest {
public void testShuffleShort() {
short[] array1 = new short[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
short[] array2 = ArrayUtils.clone(array1);
-
+
ArrayUtils.shuffle(array1);
Assert.assertFalse(Arrays.equals(array1, array2));
for (short element : array2) {
@@ -5052,7 +5052,7 @@ public class ArrayUtilsTest {
public void testShuffleInt() {
int[] array1 = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int[] array2 = ArrayUtils.clone(array1);
-
+
ArrayUtils.shuffle(array1);
Assert.assertFalse(Arrays.equals(array1, array2));
for (int element : array2) {
@@ -5064,7 +5064,7 @@ public class ArrayUtilsTest {
public void testShuffleLong() {
long[] array1 = new long[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
long[] array2 = ArrayUtils.clone(array1);
-
+
ArrayUtils.shuffle(array1);
Assert.assertFalse(Arrays.equals(array1, array2));
for (long element : array2) {
@@ -5076,7 +5076,7 @@ public class ArrayUtilsTest {
public void testShuffleFloat() {
float[] array1 = new float[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
float[] array2 = ArrayUtils.clone(array1);
-
+
ArrayUtils.shuffle(array1);
Assert.assertFalse(Arrays.equals(array1, array2));
for (float element : array2) {
@@ -5088,7 +5088,7 @@ public class ArrayUtilsTest {
public void testShuffleDouble() {
double[] array1 = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
double[] array2 = ArrayUtils.clone(array1);
-
+
ArrayUtils.shuffle(array1);
Assert.assertFalse(Arrays.equals(array1, array2));
for (double element : array2) {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/BitFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/BitFieldTest.java b/src/test/java/org/apache/commons/lang3/BitFieldTest.java
index 7d4ae9a..b621c89 100644
--- a/src/test/java/org/apache/commons/lang3/BitFieldTest.java
+++ b/src/test/java/org/apache/commons/lang3/BitFieldTest.java
@@ -5,9 +5,9 @@
* 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.