svn commit: r1199651 - in /commons/proper/lang/trunk: default.properties pom.xml
Author: bayard Date: Wed Nov 9 08:43:48 2011 New Revision: 1199651 URL: http://svn.apache.org/viewvc?rev=1199651&view=rev Log: Moving to snapshot to avoid any accidental 3.0.2 builds Modified: commons/proper/lang/trunk/default.properties commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/default.properties URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/default.properties?rev=1199651&r1=1199650&r2=1199651&view=diff == --- commons/proper/lang/trunk/default.properties (original) +++ commons/proper/lang/trunk/default.properties Wed Nov 9 08:43:48 2011 @@ -39,7 +39,7 @@ component.package = org.apache.commons.l component.title = Core Language Utilities # The current version number of this component -component.version = 3.0.2 +component.version = 3.0.2-SNAPSHOT # The name that is used to create the jar file final.name = ${component.name}-${component.version} Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1199651&r1=1199650&r2=1199651&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Wed Nov 9 08:43:48 2011 @@ -27,7 +27,7 @@ 4.0.0 org.apache.commons commons-lang3 - 3.0.2 + 3.0.2-SNAPSHOT Commons Lang 2001
svn commit: r1199663 - /commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4
Author: mturk Date: Wed Nov 9 08:59:08 2011 New Revision: 1199663 URL: http://svn.apache.org/viewvc?rev=1199663&view=rev Log: DAEMON-227 make sure ia64 target works on non HP-UX systems Modified: commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4 Modified: commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4 URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4?rev=1199663&r1=1199662&r2=1199663&view=diff == --- commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4 (original) +++ commons/proper/daemon/trunk/src/native/unix/support/apsupport.m4 Wed Nov 9 08:59:08 2011 @@ -126,9 +126,16 @@ AC_DEFUN(AP_SUPPORTED_HOST,[ fi HOST_CPU=ia64;; ia64|ia64n) -CFLAGS="$CFLAGS -milp32 -DCPU=\\\"IA64N\\\" -DSO_EXT=\\\"so\\\"" -LDFLAGS="$LDFLAGS -milp32" -HOST_CPU=IA64N;; +if test "$supported_os" = "hp-ux" +then +CFLAGS="$CFLAGS -milp32 -DCPU=\\\"IA64N\\\" -DSO_EXT=\\\"so\\\"" +LDFLAGS="$LDFLAGS -milp32" +HOST_CPU=IA64N +else +CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\"" +HOST_CPU=ia64 +fi +;; s390) CFLAGS="$CFLAGS -DCPU=\\\"s390\\\"" supported_os="s390"
svn commit: r1199691 - in /commons/sandbox/csv/trunk: pom.xml src/java/ src/main/ src/main/java/ src/test/java/ src/test/java/org/ src/test/org/
Author: ebourg Date: Wed Nov 9 10:38:54 2011 New Revision: 1199691 URL: http://svn.apache.org/viewvc?rev=1199691&view=rev Log: Moved the directories to match the Maven layout Added: commons/sandbox/csv/trunk/src/main/ commons/sandbox/csv/trunk/src/main/java/ (props changed) - copied from r1199685, commons/sandbox/csv/trunk/src/java/ commons/sandbox/csv/trunk/src/test/java/ commons/sandbox/csv/trunk/src/test/java/org/ (props changed) - copied from r1199685, commons/sandbox/csv/trunk/src/test/org/ Removed: commons/sandbox/csv/trunk/src/java/ commons/sandbox/csv/trunk/src/test/org/ Modified: commons/sandbox/csv/trunk/pom.xml Modified: commons/sandbox/csv/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/pom.xml?rev=1199691&r1=1199690&r2=1199691&view=diff == --- commons/sandbox/csv/trunk/pom.xml (original) +++ commons/sandbox/csv/trunk/pom.xml Wed Nov 9 10:38:54 2011 @@ -63,11 +63,6 @@ 12311182 - - src/java - src/test - - Propchange: commons/sandbox/csv/trunk/src/main/java/ -- svn:mergeinfo = Propchange: commons/sandbox/csv/trunk/src/test/java/org/ -- svn:mergeinfo =
svn commit: r1199697 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Author: ebourg Date: Wed Nov 9 11:17:33 2011 New Revision: 1199697 URL: http://svn.apache.org/viewvc?rev=1199697&view=rev Log: Optimized imports Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVStrategyTest.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1199697&r1=1199696&r2=1199697&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 11:17:33 2011 @@ -17,9 +17,9 @@ package org.apache.commons.csv; import java.io.IOException; -import java.io.Reader; -import java.io.InputStreamReader; import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; import java.util.ArrayList; Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1199697&r1=1199696&r2=1199697&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Wed Nov 9 11:17:33 2011 @@ -14,11 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.csv; import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; import java.io.Writer; /** Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java?rev=1199697&r1=1199696&r2=1199697&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java Wed Nov 9 11:17:33 2011 @@ -16,9 +16,9 @@ */ package org.apache.commons.csv; -import java.io.StringWriter; -import java.io.StringReader; import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; /** * Utility methods for dealing with CSV files Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1199697&r1=1199696&r2=1199697&view=diff == --- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original) +++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Wed Nov 9 11:17:33 2011 @@ -19,12 +19,9 @@ package org.apache.commons.csv; import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; -import java.util.Arrays; import java.util.Random; -import junit.framework.Test; import junit.framework.TestCase; -import junit.framework.TestSuite; /** * CSVPrinterTest Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVStrategyTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVStrategyTest.java?rev=1199697&r1=1199696&r2=1199697&view=diff == --- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVStrategyTest.java (original) +++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVStrategyTest.java Wed Nov 9 11:17:33 2011 @@ -16,8 +16,6 @@ */ package org.apache.commons.csv; -import java.io.StringReader; - import junit.framework.TestCase; /** Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java?rev=1199697&r1=1199696&r2=1199697&view=diff == -
svn commit: r1199718 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java
Author: sebb Date: Wed Nov 9 12:43:20 2011 New Revision: 1199718 URL: http://svn.apache.org/viewvc?rev=1199718&view=rev Log: Suppress generic warning Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java?rev=1199718&r1=1199717&r2=1199718&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java Wed Nov 9 12:43:20 2011 @@ -89,7 +89,9 @@ public class SerializationUtils { * it is reasonable to assume the deserialized object * is of the same type as the original serialized object */ -return (T) in.readObject(); +@SuppressWarnings("unchecked") // see above +T readObject = (T) in.readObject(); +return readObject; } catch (ClassNotFoundException ex) { throw new SerializationException("ClassNotFoundException while reading cloned object data", ex);
svn commit: r1199724 - in /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3: ./ builder/ reflect/ tuple/
Author: sebb Date: Wed Nov 9 12:51:52 2011 New Revision: 1199724 URL: http://svn.apache.org/viewvc?rev=1199724&view=rev Log: Avoid boolean boxing in asserts where possible Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/CharUtilsTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/PairTest.java Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java?rev=1199724&r1=1199723&r2=1199724&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java Wed Nov 9 12:51:52 2011 @@ -36,9 +36,9 @@ public class BooleanUtilsTest { assertNotNull(new BooleanUtils()); Constructor[] cons = BooleanUtils.class.getDeclaredConstructors(); assertEquals(1, cons.length); -assertEquals(true, Modifier.isPublic(cons[0].getModifiers())); -assertEquals(true, Modifier.isPublic(BooleanUtils.class.getModifiers())); -assertEquals(false, Modifier.isFinal(BooleanUtils.class.getModifiers())); +assertTrue(Modifier.isPublic(cons[0].getModifiers())); +assertTrue(Modifier.isPublic(BooleanUtils.class.getModifiers())); +assertFalse(Modifier.isFinal(BooleanUtils.class.getModifiers())); } //--- @@ -52,58 +52,58 @@ public class BooleanUtilsTest { //--- @Test public void test_isTrue_Boolean() { -assertEquals(true, BooleanUtils.isTrue(Boolean.TRUE)); -assertEquals(false, BooleanUtils.isTrue(Boolean.FALSE)); -assertEquals(false, BooleanUtils.isTrue((Boolean) null)); +assertTrue(BooleanUtils.isTrue(Boolean.TRUE)); +assertFalse(BooleanUtils.isTrue(Boolean.FALSE)); +assertFalse(BooleanUtils.isTrue((Boolean) null)); } @Test public void test_isNotTrue_Boolean() { -assertEquals(false, BooleanUtils.isNotTrue(Boolean.TRUE)); -assertEquals(true, BooleanUtils.isNotTrue(Boolean.FALSE)); -assertEquals(true, BooleanUtils.isNotTrue((Boolean) null)); +assertFalse(BooleanUtils.isNotTrue(Boolean.TRUE)); +assertTrue(BooleanUtils.isNotTrue(Boolean.FALSE)); +assertTrue(BooleanUtils.isNotTrue((Boolean) null)); } //--- @Test public void test_isFalse_Boolean() { -assertEquals(false, BooleanUtils.isFalse(Boolean.TRUE)); -assertEquals(true, BooleanUtils.isFalse(Boolean.FALSE)); -assertEquals(false, BooleanUtils.isFalse((Boolean) null)); +assertFalse(BooleanUtils.isFalse(Boolean.TRUE)); +assertTrue(BooleanUtils.isFalse(Boolean.FALSE)); +assertFalse(BooleanUtils.isFalse((Boolean) null)); } @Test public void test_isNotFalse_Boolean() { -assertEquals(true, BooleanUtils.isNotFalse(Boolean.TRUE)); -assertEquals(false, BooleanUtils.isNotFalse(Boolean.FALSE)); -assertEquals(true, BooleanUtils.isNotFalse((Boolean) null)); +assertTrue(BooleanUtils.isNotFalse(Boolean.TRUE)); +assertFalse(BooleanUtils.isNotFalse(Boolean.FALSE)); +assertTrue(BooleanUtils.isNotFalse((Boolean) null)); } //--- @Test public void test_toBoolean_Boolean() { -assertEquals(true, BooleanUtils.toBoolean(Boolean.TRUE)); -assertEquals(false, BooleanUtils.toBoolean(Boolean.FALSE)); -assertEquals(false, BooleanUtils.toBoolean((Boolean) null)); +assertTrue(BooleanUtils.toBoolean(Boolean.TRUE)); +assertFalse(BooleanUtils.toBoolean(Boolean.FALSE)); +assertFalse(BooleanUtils.toBoolean((Boolean) null)); } @Test public void test_toBooleanDefaultIfNull_Boolean_boolean() { -assertEquals(true, BooleanUtils.toBooleanDefaultIfNul
svn commit: r1199726 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java
Author: sebb Date: Wed Nov 9 12:59:24 2011 New Revision: 1199726 URL: http://svn.apache.org/viewvc?rev=1199726&view=rev Log: Unnecessary Integer creation; actually wants long Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java?rev=1199726&r1=1199725&r2=1199726&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java Wed Nov 9 12:59:24 2011 @@ -65,9 +65,9 @@ public class ValidateTest extends TestCa //--- public void testIsTrue3() { -Validate.isTrue(true, "MSG", Integer.valueOf(6)); +Validate.isTrue(true, "MSG", 6); try { -Validate.isTrue(false, "MSG", Integer.valueOf(6)); +Validate.isTrue(false, "MSG", 6); fail("Expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) { assertEquals("MSG", ex.getMessage());
svn commit: r1199730 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
Author: sebb Date: Wed Nov 9 13:00:47 2011 New Revision: 1199730 URL: http://svn.apache.org/viewvc?rev=1199730&view=rev Log: Unnecessary semi-colons Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java?rev=1199730&r1=1199729&r2=1199730&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java Wed Nov 9 13:00:47 2011 @@ -64,7 +64,7 @@ public class ClassUtilsTest extends Test assertEquals("", ClassUtils.getShortClassName(null, "")); // Inner types -class Named extends Object {}; +class Named extends Object {} assertEquals("ClassUtilsTest.1", ClassUtils.getShortClassName(new Object(){}, "")); assertEquals("ClassUtilsTest.1Named", ClassUtils.getShortClassName(new Named(), "")); assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(new Inner(), "")); @@ -105,7 +105,7 @@ public class ClassUtilsTest extends Test assertEquals("String[][][][]", ClassUtils.getShortClassName(String[][][][].class)); // Inner types -class Named extends Object {}; +class Named extends Object {} assertEquals("ClassUtilsTest.2", ClassUtils.getShortClassName(new Object(){}.getClass())); assertEquals("ClassUtilsTest.2Named", ClassUtils.getShortClassName(Named.class)); assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(Inner.class)); @@ -155,7 +155,7 @@ public class ClassUtilsTest extends Test assertEquals("String[][][][]", ClassUtils.getSimpleName(String[][][][].class)); // On-the-fly types -class Named extends Object {}; +class Named extends Object {} assertEquals("", ClassUtils.getSimpleName(new Object(){}.getClass())); assertEquals("Named", ClassUtils.getSimpleName(Named.class)); } @@ -198,7 +198,7 @@ public class ClassUtilsTest extends Test assertEquals("java.lang", ClassUtils.getPackageName(String[][][][].class)); // On-the-fly types -class Named extends Object {}; +class Named extends Object {} assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new Object(){}.getClass())); assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(Named.class)); } @@ -1074,7 +1074,7 @@ public class ClassUtilsTest extends Test assertEquals("int[][]", ClassUtils.getShortCanonicalName(new int[0][0], "")); // Inner types -class Named extends Object {}; +class Named extends Object {} assertEquals("ClassUtilsTest.6", ClassUtils.getShortCanonicalName(new Object(){}, "")); assertEquals("ClassUtilsTest.5Named", ClassUtils.getShortCanonicalName(new Named(), "")); assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortCanonicalName(new Inner(), "")); @@ -1088,7 +1088,7 @@ public class ClassUtilsTest extends Test assertEquals("int[][]", ClassUtils.getShortCanonicalName(int[][].class)); // Inner types -class Named extends Object {}; +class Named extends Object {} assertEquals("ClassUtilsTest.7", ClassUtils.getShortCanonicalName(new Object(){}.getClass())); assertEquals("ClassUtilsTest.6Named", ClassUtils.getShortCanonicalName(Named.class)); assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortCanonicalName(Inner.class)); @@ -1120,7 +1120,7 @@ public class ClassUtilsTest extends Test assertEquals("", ClassUtils.getPackageCanonicalName(new int[0][0], "")); // Inner types -class Named extends Object {}; +class Named extends Object {} assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Object(){}, "")); assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Named(), "")); assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Inner(), "")); @@ -1134,7 +1134,7 @@ public class ClassUtilsTest extends Test assertEquals("", ClassUtils.getPackageCanonicalName(int[][].class)); // Inner types -class Named extends Object {}; +class Named extends Object {} assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Object(){}.getClass())); assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(Named.class)); assertEquals("org.apache.commons.lang3", ClassUtils.getPac
svn commit: r1199735 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
Author: sebb Date: Wed Nov 9 13:11:07 2011 New Revision: 1199735 URL: http://svn.apache.org/viewvc?rev=1199735&view=rev Log: Javadoc Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java?rev=1199735&r1=1199734&r2=1199735&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java Wed Nov 9 13:11:07 2011 @@ -997,19 +997,20 @@ public class CompareToBuilder implements * side. * * @return final comparison result + * @see #build() */ public int toComparison() { return comparison; } /** - * Returns a negative integer, a positive integer, or zero as + * Returns a negative Integer, a positive Integer, or zero as * the builder has judged the "left-hand" side * as less than, greater than, or equal to the "right-hand" * side. * - * @return final comparison result - * + * @return final comparison result as an Integer + * @see #toComparison() * @since 3.0 */ public Integer build() {
svn commit: r1199749 - /commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java
Author: ebourg Date: Wed Nov 9 13:40:16 2011 New Revision: 1199749 URL: http://svn.apache.org/viewvc?rev=1199749&view=rev Log: CharBuffer is now package private Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java?rev=1199749&r1=1199748&r2=1199749&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java Wed Nov 9 13:40:16 2011 @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.commons.csv; /** @@ -26,7 +27,7 @@ package org.apache.commons.csv; * * @author Ortwin Gl�ck */ -public class CharBuffer { +class CharBuffer { private char[] c;
svn commit: r1199761 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/ExtendedBufferedReader.java test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java
Author: ebourg Date: Wed Nov 9 13:56:16 2011 New Revision: 1199761 URL: http://svn.apache.org/viewvc?rev=1199761&view=rev Log: Removed an unused constructor in ExtendedBufferedReader Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java?rev=1199761&r1=1199760&r2=1199761&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java Wed Nov 9 13:56:16 2011 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.csv; import java.io.BufferedReader; @@ -32,28 +33,21 @@ import java.io.Reader; */ class ExtendedBufferedReader extends BufferedReader { - -/** - * the end of stream symbol - */ +/** The end of stream symbol */ public static final int END_OF_STREAM = -1; -/** - * undefined state for the lookahead char - */ + +/** Undefined state for the lookahead char */ public static final int UNDEFINED = -2; -/** - * the lookahead chars - */ +/** The lookahead chars */ private int lookaheadChar = UNDEFINED; -/** - * the last char returned - */ + +/** The last char returned */ private int lastChar = UNDEFINED; -/** - * the line counter - */ + +/** The line counter */ private int lineCounter = 0; + private CharBuffer line = new CharBuffer(); /** @@ -67,16 +61,6 @@ class ExtendedBufferedReader extends Buf } /** - * Create extended buffered reader using the given buffer-size - */ -public ExtendedBufferedReader(Reader r, int bufSize) { -super(r, bufSize); -/* note uh: do not fetch the first char here, -* because this might block the method! -*/ -} - -/** * Reads the next char from the input stream. * * @return the next char or END_OF_STREAM if end of stream has been reached. Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java?rev=1199761&r1=1199760&r2=1199761&view=diff == --- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java (original) +++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java Wed Nov 9 13:56:16 2011 @@ -26,15 +26,6 @@ import junit.framework.TestCase; */ public class ExtendedBufferedReaderTest extends TestCase { -// == -// the test cases -// == - -public void testConstructors() { -ExtendedBufferedReader br = new ExtendedBufferedReader(new StringReader("")); -br = new ExtendedBufferedReader(new StringReader(""), 10); -} - public void testReadLookahead1() throws Exception { assertEquals(ExtendedBufferedReader.END_OF_STREAM, getEBR("").read());
svn commit: r1199768 - /commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java
Author: ebourg Date: Wed Nov 9 14:16:22 2011 New Revision: 1199768 URL: http://svn.apache.org/viewvc?rev=1199768&view=rev Log: Made the static fields final in CSVStrategy Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java?rev=1199768&r1=1199767&r2=1199768&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java Wed Nov 9 14:16:22 2011 @@ -41,16 +41,13 @@ public class CSVStrategy implements Clon // an EOF signal (-1), and because \ufffe in UTF-16 would be // encoded as two chars (using surrogates) and thus there should never // be a collision with a real text char. -public static char COMMENTS_DISABLED = (char) -2; -public static char ESCAPE_DISABLED = (char) -2; -public static char ENCAPSULATOR_DISABLED = (char) -2; - -public static CSVStrategy DEFAULT_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, -true, false, true); -public static CSVStrategy EXCEL_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, -false, false, false); -public static CSVStrategy TDF_STRATEGY = new CSVStrategy('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, -true, false, true); +public static final char COMMENTS_DISABLED = (char) -2; +public static final char ESCAPE_DISABLED = (char) -2; +public static final char ENCAPSULATOR_DISABLED = (char) -2; + +public static final CSVStrategy DEFAULT_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true); +public static final CSVStrategy EXCEL_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, false, false, false); +public static final CSVStrategy TDF_STRATEGY = new CSVStrategy('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true); public CSVStrategy(char delimiter, char encapsulator, char commentStart) { @@ -58,37 +55,34 @@ public class CSVStrategy implements Clon } /** - * Customized CSV strategy setter. + * Customized CSV strategy constructor. * - * @param delimitera Char used for value separation - * @param encapsulator a Char used as value encapsulation marker - * @param commentStart a Char used for comment identification - * @param escape a Char used to escape special characters in values - * @param ignoreLeadingWhitespace TRUE when leading whitespaces should be - * ignored - * @param ignoreTrailingWhitespace TRUE when trailing whitespaces should be - * ignored - * @param interpretUnicodeEscapes TRUE when unicode escapes should be - * interpreted - * @param ignoreEmptyLines TRUE when the parser should skip emtpy lines + * @param delimiter a char used for value separation + * @param encapsulator a char used as value encapsulation marker + * @param commentStart a char used for comment identification + * @param escapea char used to escape special characters in values + * @param ignoreLeadingWhitespaces TRUE when leading whitespaces should be ignored + * @param ignoreTrailingWhitespaces TRUE when trailing whitespaces should be ignored + * @param interpretUnicodeEscapes TRUE when unicode escapes should be interpreted + * @param ignoreEmptyLines TRUE when the parser should skip emtpy lines */ public CSVStrategy( char delimiter, char encapsulator, char commentStart, char escape, -boolean ignoreLeadingWhitespace, -boolean ignoreTrailingWhitespace, +boolean ignoreLeadingWhitespaces, +boolean ignoreTrailingWhitespaces, boolean interpretUnicodeEscapes, boolean ignoreEmptyLines) { -setDelimiter(delimiter); -setEncapsulator(encapsulator); -setCommentStart(commentStart); -setEscape(escape); -setIgnoreLeadingWhitespaces(ignoreLeadingWhitespace); -setIgnoreTrailingWhitespaces(ignoreTrailingWhitespace); -setUnicodeEscapeInterpretation(interpretUnicodeEscapes); -setIgnoreEmptyLines(ignoreEmptyLines); +this.delimiter = delimiter; +this.encapsulator = encapsulator; +this.commentStart = commentStart; +this.escape =
svn commit: r1199769 - /commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
Author: ebourg Date: Wed Nov 9 14:26:09 2011 New Revision: 1199769 URL: http://svn.apache.org/viewvc?rev=1199769&view=rev Log: Changed the visibility of the Token types and the protected methods to package private Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1199769&r1=1199768&r2=1199769&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 14:26:09 2011 @@ -21,6 +21,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; +import java.util.List; /** @@ -51,32 +52,23 @@ import java.util.ArrayList; */ public class CSVParser { -/** - * length of the initial token (content-)buffer - */ +/** length of the initial token (content-)buffer */ private static final int INITIAL_TOKEN_LENGTH = 50; // the token types -/** - * Token has no valid content, i.e. is in its initialized state. - */ -protected static final int TT_INVALID = -1; -/** - * Token with content, at beginning or in the middle of a line. - */ -protected static final int TT_TOKEN = 0; -/** - * Token (which can have content) when end of file is reached. - */ -protected static final int TT_EOF = 1; -/** - * Token with content when end of a line is reached. - */ -protected static final int TT_EORECORD = 2; +/** Token has no valid content, i.e. is in its initialized state. */ +static final int TT_INVALID = -1; + +/** Token with content, at beginning or in the middle of a line. */ +static final int TT_TOKEN = 0; + +/** Token (which can have content) when end of file is reached. */ +static final int TT_EOF = 1; + +/** Token with content when end of a line is reached. */ +static final int TT_EORECORD = 2; -/** - * Immutable empty String array. - */ +/** Immutable empty String array. */ private static final String[] EMPTY_STRING_ARRAY = new String[0]; // the input stream @@ -88,7 +80,7 @@ public class CSVParser { /** * A record buffer for getLine(). Grows as necessary and is reused. */ -private final ArrayList record = new ArrayList(); +private final List record = new ArrayList(); private final Token reusableToken = new Token(); private final CharBuffer wsBuf = new CharBuffer(); private final CharBuffer code = new CharBuffer(4); @@ -202,7 +194,7 @@ public class CSVParser { * @throws IOException on parse error or input read-failure */ public String[][] getAllValues() throws IOException { -ArrayList records = new ArrayList(); +List records = new ArrayList(); String[] values; String[][] ret = null; while ((values = getLine()) != null) { @@ -307,7 +299,7 @@ public class CSVParser { /** * Convenience method for nextToken(null). */ -protected Token nextToken() throws IOException { +Token nextToken() throws IOException { return nextToken(new Token()); } @@ -322,7 +314,7 @@ public class CSVParser { * @return the next token found * @throws IOException on stream access error */ -protected Token nextToken(Token tkn) throws IOException { +Token nextToken(Token tkn) throws IOException { wsBuf.clear(); // reuse // get the last read char (required for empty line detection) @@ -538,7 +530,7 @@ public class CSVParser { * @return the decoded character * @throws IOException on wrong unicode escape sequence or read error */ -protected int unicodeEscapeLexer(int c) throws IOException { +private int unicodeEscapeLexer(int c) throws IOException { int ret = 0; // ignore 'u' (assume c==\ now) and read 4 hex digits c = in.read();
svn commit: r1199772 - in /commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv: CSVParser.java CSVStrategy.java
Author: ebourg Date: Wed Nov 9 14:31:40 2011 New Revision: 1199772 URL: http://svn.apache.org/viewvc?rev=1199772&view=rev Log: Removed the deprecated constructors Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1199772&r1=1199771&r2=1199772&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 14:31:40 2011 @@ -14,11 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.csv; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; import java.util.List; @@ -118,16 +117,6 @@ public class CSVParser { // == /** - * Default strategy for the parser follows the default {@link CSVStrategy}. - * - * @param input an InputStream containing "csv-formatted" stream - * @deprecated use {@link #CSVParser(Reader)}. - */ -public CSVParser(InputStream input) { -this(new InputStreamReader(input)); -} - -/** * CSV parser using the default {@link CSVStrategy}. * * @param input a Reader containing "csv-formatted" input @@ -137,37 +126,6 @@ public class CSVParser { } /** - * Customized value delimiter parser. - * - * The parser follows the default {@link CSVStrategy} - * except for the delimiter setting. - * - * @param input a Reader based on "csv-formatted" input - * @param delimiter a Char used for value separation - * @deprecated use {@link #CSVParser(Reader, CSVStrategy)}. - */ -public CSVParser(Reader input, char delimiter) { -this(input, delimiter, '"', CSVStrategy.COMMENTS_DISABLED); -} - -/** - * Customized csv parser. - * - * The parser parses according to the given CSV dialect settings. - * Leading whitespaces are truncated, unicode escapes are - * not interpreted and empty lines are ignored. - * - * @param inputa Reader based on "csv-formatted" input - * @param delimitera Char used for value separation - * @param encapsulator a Char used as value encapsulation marker - * @param commentStart a Char used for comment identification - * @deprecated use {@link #CSVParser(Reader, CSVStrategy)}. - */ -public CSVParser(Reader input, char delimiter, char encapsulator, char commentStart) { -this(input, new CSVStrategy(delimiter, encapsulator, commentStart)); -} - -/** * Customized CSV parser using the given {@link CSVStrategy} * * @param inputa Reader containing "csv-formatted" input Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java?rev=1199772&r1=1199771&r2=1199772&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java Wed Nov 9 14:31:40 2011 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.csv; import java.io.Serializable; @@ -51,7 +52,7 @@ public class CSVStrategy implements Clon public CSVStrategy(char delimiter, char encapsulator, char commentStart) { -this(delimiter, encapsulator, commentStart, true, false, true); +this(delimiter, encapsulator, commentStart, ESCAPE_DISABLED, true, true, false, true); } /** @@ -85,20 +86,6 @@ public class CSVStrategy implements Clon this.ignoreEmptyLines = ignoreEmptyLines; } -/** - * @deprecated - */ -public CSVStrategy( -char delimiter, -char encapsulator, -char commentStart, -boolean ignoreLeadingWhitespaces, -boolean interpretUnicodeEscapes, -boolean ignoreEmptyLines) { -this(delimiter, encapsulator, commentStart, CSVStrategy.ESCAPE_DISABLED, ignoreLeadingWhitespaces, -true, interpretUnicodeEscapes, ignoreEmptyLines); -} - public void setDelimiter(char delimiter) { this.delimiter = delimiter
svn commit: r1199773 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java
Author: ggregory Date: Wed Nov 9 14:34:43 2011 New Revision: 1199773 URL: http://svn.apache.org/viewvc?rev=1199773&view=rev Log: [LANG-762] Handle or document ReflectionToStringBuilder and ToStringBuilder for collections that are not thread safe. Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java?rev=1199773&view=auto == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java (added) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java Wed Nov 9 14:34:43 2011 @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.builder; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.junit.Test; + +/** + * Tests concurrent access for the default {@link ToStringStyle}. + * + * 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. + * + * + * This test passes but only tests one aspect of the issue. + * + * + * @see https://issues.apache.org/jira/browse/LANG-762";>[LANG-762] Handle or document ReflectionToStringBuilder + * and ToStringBuilder for collections that are not thread safe + * @since 3.0.2 + */ +public class ToStringStyleConcurrencyTest { + +static class CollectionHolder> { +T collection; + +CollectionHolder(T collection) { +this.collection = collection; +} +} + +private static final List LIST; +private static final int LIST_SIZE = 10; +private static final int REPEAT = 100; + +static { +LIST = new ArrayList(LIST_SIZE); +for (int i = 0; i < LIST_SIZE; i++) { +LIST.add(Integer.valueOf(i)); +} +} + +@Test +public void testLinkedList() throws InterruptedException, ExecutionException { +this.testConcurrency(new CollectionHolder>(new LinkedList())); +} + +@Test +public void testArrayList() throws InterruptedException, ExecutionException { +this.testConcurrency(new CollectionHolder>(new ArrayList())); +} + +@Test +public void testCopyOnWriteArrayList() throws InterruptedException, ExecutionException { +this.testConcurrency(new CollectionHolder>(new CopyOnWriteArrayList())); +} + +private void testConcurrency(final CollectionHolder> holder) throws InterruptedException, +ExecutionException { +final List list = holder.collection; +// make a big array that takes a long time to toString() +list.addAll(LIST); +// Create a thread pool with two threads to cause the most contention on the underlying resource. +final ExecutorService threadPool = Executors.newFixedThreadPool(2); +// Consumes toStrings +Callable consumer = new Callable() { +public Integer call() { +for (int i = 0; i < REPEAT; i++) { +// Calls ToStringStyle +new ToStringBuilder(holder).append(holder.collection); +} +return REPEAT; +} +}; +Collection> tasks = new ArrayList>(); +tasks.add(consumer); +tasks.add(consumer); +final List> futures = threadPool.invokeAll(tasks); +for (Future future : futures) { +future.get(); +} +} +}
svn commit: r1199775 - /commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
Author: ebourg Date: Wed Nov 9 14:42:58 2011 New Revision: 1199775 URL: http://svn.apache.org/viewvc?rev=1199775&view=rev Log: Made the protected fields in CSVPrinter private Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1199775&r1=1199774&r2=1199775&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Wed Nov 9 14:42:58 2011 @@ -25,18 +25,15 @@ import java.io.Writer; */ public class CSVPrinter { -/** - * The place that the values get written. - */ -protected final Writer out; -protected final CSVStrategy strategy; +/** The place that the values get written. */ +private final Writer out; +private final CSVStrategy strategy; -/** - * True if we just began a new line. - */ -protected boolean newLine = true; +/** True if we just began a new line. */ +private boolean newLine = true; -protected char[] buf = new char[0]; // temporary buffer +/** Temporary buffer */ +private char[] buf = new char[0]; /** * Create a printer that will print values to the given
svn commit: r1199780 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/CSVParser.java test/java/org/apache/commons/csv/CSVParserTest.java
Author: ebourg Date: Wed Nov 9 14:54:05 2011 New Revision: 1199780 URL: http://svn.apache.org/viewvc?rev=1199780&view=rev Log: Removed CSVParser.nextValue() (SANDBOX-220) Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1199780&r1=1199779&r2=1199780&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 14:54:05 2011 @@ -166,35 +166,6 @@ public class CSVParser { } /** - * Parses the CSV according to the given strategy - * and returns the next csv-value as string. - * - * @return next value in the input stream ('null' when end of file) - * @throws IOException on parse error or input read-failure - */ -public String nextValue() throws IOException { -Token tkn = nextToken(); -String ret = null; -switch (tkn.type) { -case TT_TOKEN: -case TT_EORECORD: -ret = tkn.content.toString(); -break; -case TT_EOF: -ret = null; -break; -case TT_INVALID: -default: -// error no token available (or error) -throw new IOException( -"(line " + getLineNumber() -+ ") invalid parse sequence"); -// unreachable: break; -} -return ret; -} - -/** * Parses from the current point in the stream til * the end of the current line. * Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1199780&r1=1199779&r2=1199780&view=diff == --- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original) +++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Wed Nov 9 14:54:05 2011 @@ -221,19 +221,6 @@ public class CSVParserTest extends TestC assertTrue(tmp == null); } -public void testNextValue() throws IOException { -CSVParser parser = new CSVParser(new StringReader(code)); -String tmp = null; -for (int i = 0; i < res.length; i++) { -for (int j = 0; j < res[i].length; j++) { -tmp = parser.nextValue(); -assertEquals(res[i][j], tmp); -} -} -tmp = parser.nextValue(); -assertTrue(tmp == null); -} - public void testGetAllValues() throws IOException { CSVParser parser = new CSVParser(new StringReader(code)); String[][] tmp = parser.getAllValues(); @@ -571,20 +558,6 @@ public class CSVParserTest extends TestC assertEquals(3, data.length); } -public void testLineTokenConsistency() throws IOException { -String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; -CSVParser parser = new CSVParser(new StringReader(code)); -String[][] data = parser.getAllValues(); -parser = new CSVParser(new StringReader(code)); -CSVParser parser1 = new CSVParser(new StringReader(code)); -for (int i = 0; i < data.length; i++) { -assertTrue(Arrays.equals(parser1.getLine(), data[i])); -for (int j = 0; j < data[i].length; j++) { -assertEquals(parser.nextValue(), data[i][j]); -} -} -} - // From SANDBOX-153 public void testDelimiterIsWhitespace() throws IOException { String code = "one\ttwo\t\tfour \t five\t six";
svn commit: r1199786 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
Author: ggregory Date: Wed Nov 9 15:07:16 2011 New Revision: 1199786 URL: http://svn.apache.org/viewvc?rev=1199786&view=rev Log: [LANG-762] Handle or document ReflectionToStringBuilder and ToStringBuilder for collections that are not thread safe. Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java?rev=1199786&view=auto == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java (added) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java Wed Nov 9 15:07:16 2011 @@ -0,0 +1,116 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.builder; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import junit.framework.Assert; + +import org.junit.Ignore; +import org.junit.Test; + +/** + * Tests concurrent access for {@link ReflectionToStringBuilder}. + * + * 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. + * + * + * The tests on the non-thread-safe collections do not pass. + * + * + * @see https://issues.apache.org/jira/browse/LANG-762";>[LANG-762] Handle or document ReflectionToStringBuilder + * and ToStringBuilder for collections that are not thread safe + * @since 3.0.2 + */ +public class ReflectionToStringBuilderConcurrencyTest { + +static class CollectionHolder> { +T collection; + +CollectionHolder(T collection) { +this.collection = collection; +} +} + +private static final int DATA_SIZE = 10; +private static final int REPEAT = 100; + +@Test +@Ignore +public void testLinkedList() throws InterruptedException, ExecutionException { +this.testConcurrency(new CollectionHolder>(new LinkedList())); +} + +@Test +@Ignore +public void testArrayList() throws InterruptedException, ExecutionException { +this.testConcurrency(new CollectionHolder>(new ArrayList())); +} + +@Test +public void testCopyOnWriteArrayList() throws InterruptedException, ExecutionException { +this.testConcurrency(new CollectionHolder>(new CopyOnWriteArrayList())); +} + +private void testConcurrency(final CollectionHolder> holder) throws InterruptedException, +ExecutionException { +final List list = holder.collection; +// make a big array that takes a long time to toString() +for (int i = 0; i < DATA_SIZE; i++) { +list.add(Integer.valueOf(i)); +} +// Create a thread pool with two threads to cause the most contention on the underlying resource. +final ExecutorService threadPool = Executors.newFixedThreadPool(2); +// Consumes toStrings +Callable consumer = new Callable() { +public Integer call() { +for (int i = 0; i < REPEAT; i++) { +String s = ReflectionToStringBuilder.toString(holder); +Assert.assertNotNull(s); +} +return REPEAT; +} +}; +// Produces changes in the list +Callable producer = new Callable() { +public Integer call() { +for (int i = 0; i < DATA_SIZE; i++) { +list.remove(list.get(0)); +
svn commit: r1199788 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java
Author: ggregory Date: Wed Nov 9 15:10:00 2011 New Revision: 1199788 URL: http://svn.apache.org/viewvc?rev=1199788&view=rev Log: @version $Id$ Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java (contents, props changed) Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java?rev=1199788&r1=1199787&r2=1199788&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java Wed Nov 9 15:10:00 2011 @@ -43,6 +43,7 @@ import org.junit.Test; * @see https://issues.apache.org/jira/browse/LANG-762";>[LANG-762] Handle or document ReflectionToStringBuilder * and ToStringBuilder for collections that are not thread safe * @since 3.0.2 + * @version $Id$ */ public class ToStringStyleConcurrencyTest { Propchange: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java -- svn:keywords = Id
svn commit: r1199789 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
Author: ggregory Date: Wed Nov 9 15:10:20 2011 New Revision: 1199789 URL: http://svn.apache.org/viewvc?rev=1199789&view=rev Log: @version $Id$ Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java (contents, props changed) Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java?rev=1199789&r1=1199788&r2=1199789&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java Wed Nov 9 15:10:20 2011 @@ -46,6 +46,7 @@ import org.junit.Test; * @see https://issues.apache.org/jira/browse/LANG-762";>[LANG-762] Handle or document ReflectionToStringBuilder * and ToStringBuilder for collections that are not thread safe * @since 3.0.2 + * @version $Id$ */ public class ReflectionToStringBuilderConcurrencyTest { Propchange: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java -- svn:keywords = Id
svn commit: r1199790 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
Author: ggregory Date: Wed Nov 9 15:13:05 2011 New Revision: 1199790 URL: http://svn.apache.org/viewvc?rev=1199790&view=rev Log: [LANG-762] Handle or document ReflectionToStringBuilder and ToStringBuilder for collections that are not thread safe. Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java?rev=1199790&view=auto == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java (added) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java Wed Nov 9 15:13:05 2011 @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.builder; + +import java.util.LinkedList; +import java.util.Random; + +import org.junit.Ignore; +import org.junit.Test; + +/** + * Tests concurrent access for {@link ReflectionToStringBuilder}. + * + * 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. + * + * + * @see https://issues.apache.org/jira/browse/LANG-762";>[LANG-762] Handle or document ReflectionToStringBuilder + * and ToStringBuilder for collections that are not thread safe + * @since 3.0.2 + * @version $Id$ + */ +public class ReflectionToStringBuilderMutateInspectConcurrencyTest { + +class TestFixture { +final private LinkedList listField = new LinkedList(); +final private Random random = new Random(); +private int N = 100; + +public TestFixture() { +synchronized (this) { +for (int i = 0; i < N; i++) { +listField.add(Integer.valueOf(i)); +} +} +} + +public synchronized void add() { +listField.add(Integer.valueOf(random.nextInt(N))); +} + +public synchronized void delete() { + listField.removeFirstOccurrence(Integer.valueOf(random.nextInt(N))); +} +} + +class MutatingClient implements Runnable { +final private TestFixture testFixture; +final private Random random = new Random(); + +public MutatingClient(TestFixture testFixture) { +this.testFixture = testFixture; +} + +public void run() { +if (random.nextBoolean()) { +testFixture.add(); +} else { +testFixture.delete(); +} +} +} + +class InspectingClient implements Runnable { +final private TestFixture testFixture; +final private Random random = new Random(); + +public InspectingClient(TestFixture testFixture) { +this.testFixture = testFixture; +} + +public void run() { +ReflectionToStringBuilder.toString(testFixture); +} +} + +@Test +@Ignore +public void testConcurrency() throws Exception { +TestFixture testFixture = new TestFixture(); +final int numMutators = 10; +final int numIterations = 10; +for (int i = 0; i < numIterations; i++) { +for (int j = 0; j < numMutators; j++) { +Thread t = new Thread(new MutatingClient(testFixture)); +t.start(); +Thread s = new Thread(new InspectingClient(testFixture)); +s.start(); +} +} +} +}
svn commit: r1199798 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java
Author: ggregory Date: Wed Nov 9 15:32:12 2011 New Revision: 1199798 URL: http://svn.apache.org/viewvc?rev=1199798&view=rev Log: Use Java 5 LinkedList API, not Java 6. Note that removeFirstOccurrence(Object) delegates to remove(Object) in Java 6. Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java?rev=1199798&r1=1199797&r2=1199798&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java Wed Nov 9 15:32:12 2011 @@ -55,7 +55,7 @@ public class ReflectionToStringBuilderMu } public synchronized void delete() { - listField.removeFirstOccurrence(Integer.valueOf(random.nextInt(N))); +listField.remove(Integer.valueOf(random.nextInt(N))); } }
svn commit: r1199800 - /commons/proper/lang/trunk/pom.xml
Author: ggregory Date: Wed Nov 9 15:36:25 2011 New Revision: 1199800 URL: http://svn.apache.org/viewvc?rev=1199800&view=rev Log: Fix Clirr reporting, now picks up correct version. Modified: commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1199800&r1=1199799&r2=1199800&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Wed Nov 9 15:36:25 2011 @@ -1,20 +1,10 @@ - + http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; @@ -483,21 +473,9 @@ - + @@ -577,13 +555,9 @@ clirr-maven-plugin 2.3 - - - org.apache.commons - commons-lang3 - 3.0.1 - - + +3.0.1 + info
svn commit: r1199805 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
Author: bodewig Date: Wed Nov 9 15:43:47 2011 New Revision: 1199805 URL: http://svn.apache.org/viewvc?rev=1199805&view=rev Log: make XZInputStream default to not support concatenated streams to be consistent with bzip2 and soon gzip Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java?rev=1199805&r1=1199804&r2=1199805&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java Wed Nov 9 15:43:47 2011 @@ -53,7 +53,8 @@ public class XZCompressorInputStream ext /** * Creates a new input stream that decompresses XZ-compressed data - * from the specified input stream. This supports concatenated .xz files. + * from the specified input stream. This doesn't support + * concatenated .xz files. * * @param inputStream where to read the compressed data * @@ -65,7 +66,7 @@ public class XZCompressorInputStream ext */ public XZCompressorInputStream(InputStream inputStream) throws IOException { -this(inputStream, true); +this(inputStream, false); } /**
svn commit: r1199812 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
Author: bodewig Date: Wed Nov 9 15:55:10 2011 New Revision: 1199812 URL: http://svn.apache.org/viewvc?rev=1199812&view=rev Log: support for concatenated streams in Gzip input. COMPRESS-154. Submitted by Lasse Collin Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java?rev=1199812&r1=1199811&r2=1199812&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java Wed Nov 9 15:55:10 2011 @@ -19,71 +19,282 @@ package org.apache.commons.compress.compressors.gzip; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; -import java.util.zip.GZIPInputStream; +import java.io.DataInputStream; +import java.io.BufferedInputStream; +import java.util.zip.DataFormatException; +import java.util.zip.Inflater; +import java.util.zip.CRC32; import org.apache.commons.compress.compressors.CompressorInputStream; /** - * Implements the "gz" compression format as an input stream. - * This classes wraps the standard java classes for working with gz. + * Input stream that decompresses .gz files. + * This supports decompressing concatenated .gz files which is important + * when decompressing standalone .gz files. + * + * {@link java.util.zip.GZIPInputStream} doesn't decompress concatenated .gz + * files: it stops after the first member and silently ignores the rest. + * It doesn't leave the read position to point to the beginning of the next + * member, which makes it difficult workaround the lack of concatenation + * support. + * + * Instead of using GZIPInputStream, this class has its own .gz + * container format decoder. The actual decompression is done with + * {@link java.util.zip.Inflater}. */ public class GzipCompressorInputStream extends CompressorInputStream { -/* reference to the compressed stream */ -private final GZIPInputStream in; +// Header flags +// private static final int FTEXT = 0x01; // Uninteresting for us +private static final int FHCRC = 0x02; +private static final int FEXTRA = 0x04; +private static final int FNAME = 0x08; +private static final int FCOMMENT = 0x10; +private static final int FRESERVED = 0xE0; + +// Compressed input stream, possibly wrapped in a BufferedInputStream +private final InputStream in; + +// True if decompressing multimember streams. +private final boolean decompressConcatenated; + +// Buffer to hold the input data +private final byte[] buf = new byte[8192]; + +// Amount of data in buf. +private int bufUsed = 0; + +// Decompressor +private Inflater inf = new Inflater(true); + +// CRC32 from uncompressed data +private CRC32 crc = new CRC32(); + +private int memberSize; + +// True once everything has been decompressed +private boolean endReached = false; /** - * Constructs a new GZip compressed input stream by the referenced - * InputStream. - * - * @param inputStream the InputStream from which this object should be created of + * Constructs a new input stream that decompresses gzip-compressed data + * from the specified input stream. + * + * This is equivalent to + * GzipCompressorInputStream(inputStream, false) and thus + * will not decompress concatenated .gz files. + * + * @param inputStream the InputStream from which this object should + * be created of + * * @throws IOException if the stream could not be created */ -public GzipCompressorInputStream(InputStream inputStream) throws IOException { -in = new GZIPInputStream(inputStream); +public GzipCompressorInputStream(InputStream inputStream) +throws IOException { +this(inputStream, false); +} + +/** + * Constructs a new input stream that decompresses gzip-compressed data + * from the specified input stream. + * + * If decompressConcatenated is false: + * This decompressor might read more input than it will actually use. + * If inputStream supports mark and + * reset, then the input position will be adjusted + * so that it is right after the last byte of the compressed stream. + * If mark isn't supported, the input position will be + * undefined. + * + * @param inputStream the InputStream from which this object should + * be
svn commit: r1199814 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
Author: bodewig Date: Wed Nov 9 16:05:11 2011 New Revision: 1199814 URL: http://svn.apache.org/viewvc?rev=1199814&view=rev Log: some '@Override's that have been removed by accident Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java?rev=1199814&r1=1199813&r2=1199814&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java Wed Nov 9 16:05:11 2011 @@ -198,6 +198,7 @@ public class GzipCompressorInputStream e } /** {@inheritDoc} */ +@Override public int read() throws IOException { byte[] buf = new byte[1]; return read(buf, 0, 1) == -1 ? -1 : (buf[0] & 0xFF); @@ -208,6 +209,7 @@ public class GzipCompressorInputStream e * * @since Apache Commons Compress 1.1 */ +@Override public int read(byte[] b, int off, int len) throws IOException { if (endReached) return -1; @@ -319,6 +321,7 @@ public class GzipCompressorInputStream e * * @since 1.2 */ +@Override public void close() throws IOException { if (inf != null) { inf.end();
svn commit: r1199816 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/ main/java/org/apache/commons/lang3/math/ test/java/org/apache/commons/lang3/builder/
Author: bayard Date: Wed Nov 9 16:11:34 2011 New Revision: 1199816 URL: http://svn.apache.org/viewvc?rev=1199816&view=rev Log: Changing @since 3.0.2 to @since 3.1 Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java?rev=1199816&r1=1199815&r2=1199816&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java Wed Nov 9 16:11:34 2011 @@ -531,7 +531,7 @@ public class ClassUtils { *The class to query or null. * @return true if the given {@code type} is a primitive or primitive wrapper ({@link Boolean}, {@link Byte}, {@link Character}, * {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}). - * @since 3.0.2 + * @since 3.1 */ public static boolean isPrimitiveOrWrapper(Class type) { if (type == null) { @@ -548,7 +548,7 @@ public class ClassUtils { *The class to query or null. * @return true if the given {@code type} is a primitive wrapper ({@link Boolean}, {@link Byte}, {@link Character}, {@link Short}, * {@link Integer}, {@link Long}, {@link Double}, {@link Float}). - * @since 3.0.2 + * @since 3.1 */ public static boolean isPrimitiveWrapper(Class type) { return wrapperPrimitiveMap.containsKey(type); Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java?rev=1199816&r1=1199815&r2=1199816&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java Wed Nov 9 16:11:34 2011 @@ -1009,7 +1009,7 @@ public class SystemUtils { * The field will return {@code false} if {@code OS_NAME} is {@code null}. * * - * @since 3.0.2 + * @since 3.1 */ public static final boolean IS_OS_FREE_BSD = getOSMatchesName("FreeBSD"); @@ -1021,7 +1021,7 @@ public class SystemUtils { * The field will return {@code false} if {@code OS_NAME} is {@code null}. * * - * @since 3.0.2 + * @since 3.1 */ public static final boolean IS_OS_OPEN_BSD = getOSMatchesName("OpenBSD"); @@ -1033,7 +1033,7 @@ public class SystemUtils { * The field will return {@code false} if {@code OS_NAME} is {@code null}. * * - * @since 3.0.2 + * @since 3.1 */ public static final boolean IS_OS_NET_BSD = getOSMatchesName("NetBSD"); Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java?rev=1199816&r1=1199815&r2=1199816&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java Wed Nov 9 16:11:34 2011 @@ -666,7 +666,7 @@ public class NumberUtils { /** * Convert a String to a Long; - * since 3.0.2 it handles hex and octal notations. + * since 3.1 it handles hex and octal notations. * * Returns null if the string is null. * Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java?rev=1199816&r1=1199815&r2=1199816&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStrin
svn commit: r1199817 - /commons/proper/lang/trunk/pom.xml
Author: bayard Date: Wed Nov 9 16:11:44 2011 New Revision: 1199817 URL: http://svn.apache.org/viewvc?rev=1199817&view=rev Log: Updating dependencies Modified: commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1199817&r1=1199816&r2=1199817&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Wed Nov 9 16:11:44 2011 @@ -434,14 +434,14 @@ commons-io commons-io - 2.0.1 + 2.1 test org.easymock easymock - 2.5.2 + 3.0 test
svn commit: r1199820 - in /commons/proper/lang/trunk: RELEASE-NOTES.txt default.properties pom.xml src/site/changes/changes.xml src/site/xdoc/download_lang.xml src/site/xdoc/index.xml
Author: bayard Date: Wed Nov 9 16:14:52 2011 New Revision: 1199820 URL: http://svn.apache.org/viewvc?rev=1199820&view=rev Log: Changing planned version from 3.0.2 to 3.1 Modified: commons/proper/lang/trunk/RELEASE-NOTES.txt commons/proper/lang/trunk/default.properties commons/proper/lang/trunk/pom.xml commons/proper/lang/trunk/src/site/changes/changes.xml commons/proper/lang/trunk/src/site/xdoc/download_lang.xml commons/proper/lang/trunk/src/site/xdoc/index.xml Modified: commons/proper/lang/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/RELEASE-NOTES.txt?rev=1199820&r1=1199819&r2=1199820&view=diff == --- commons/proper/lang/trunk/RELEASE-NOTES.txt (original) +++ commons/proper/lang/trunk/RELEASE-NOTES.txt Wed Nov 9 16:14:52 2011 @@ -1,13 +1,13 @@ $Id$ Commons Lang Package -Version 3.0.2 +Version 3.1 Release Notes INTRODUCTION: -This document contains the release notes for the 3.0.2 version of Apache Commons Lang. +This document contains the release notes for the 3.1 version of Apache Commons Lang. Commons Lang is a set of utility functions and reusable components that should be of use in any Java environment. @@ -18,7 +18,7 @@ For the advice on upgrading from 2.x to http://commons.apache.org/lang/article3_0.html -CHANGES IN 3.0.2 +CHANGES IN 3.1 [LANG-760] Add API StringUtils.toString(byte[] intput, String charsetName) @@ -30,7 +30,7 @@ CHANGES IN 3.0.2 [LANG-736] CharUtils static final array CHAR_STRING is not needed to compute CHAR_STRING_ARRAY [LANG-695] SystemUtils.IS_OS_UNIX doesn't recognize FreeBSD as a Unix system -BUG FIXES IN 3.0.2 +BUG FIXES IN 3.1 == [LANG-749] Incorrect Bundle-SymbolicName in Manifest Modified: commons/proper/lang/trunk/default.properties URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/default.properties?rev=1199820&r1=1199819&r2=1199820&view=diff == --- commons/proper/lang/trunk/default.properties (original) +++ commons/proper/lang/trunk/default.properties Wed Nov 9 16:14:52 2011 @@ -39,7 +39,7 @@ component.package = org.apache.commons.l component.title = Core Language Utilities # The current version number of this component -component.version = 3.0.2-SNAPSHOT +component.version = 3.1-SNAPSHOT # The name that is used to create the jar file final.name = ${component.name}-${component.version} Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1199820&r1=1199819&r2=1199820&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Wed Nov 9 16:14:52 2011 @@ -17,7 +17,7 @@ 4.0.0 org.apache.commons commons-lang3 - 3.0.2-SNAPSHOT + 3.1-SNAPSHOT Commons Lang 2001 @@ -452,7 +452,7 @@ 1.5 1.5 lang3 -3.0.2 +3.1 (Java 5.0+) LANG 12310481 Modified: commons/proper/lang/trunk/src/site/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/site/changes/changes.xml?rev=1199820&r1=1199819&r2=1199820&view=diff == --- commons/proper/lang/trunk/src/site/changes/changes.xml (original) +++ commons/proper/lang/trunk/src/site/changes/changes.xml Wed Nov 9 16:14:52 2011 @@ -21,7 +21,7 @@ - + Add API StringUtils.toString(byte[] intput, String charsetName) Add an example with whitespace in StringUtils.defaultIfEmpty Add APIs ClassUtils.isPrimitiveWrapper(Class>) and isPrimitiveOrWrapper(Class>) Modified: commons/proper/lang/trunk/src/site/xdoc/download_lang.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/site/xdoc/download_lang.xml?rev=1199820&r1=1199819&r2=1199820&view=diff == --- commons/proper/lang/trunk/src/site/xdoc/download_lang.xml (original) +++ commons/proper/lang/trunk/src/site/xdoc/download_lang.xml Wed Nov 9 16:14:52 2011 @@ -95,32 +95,32 @@ limitations under the License. - + - commons-lang3-3.0.2-bin.tar.gz - http://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.0.2-bin.tar.gz.md5";>md5 - http://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.0.2-bin.tar.gz.asc";>pgp + commons-lang3-3.1-bin.tar.gz + http://www.apache.org/dist/commons/lang/binaries/commons-lang3-3.1-bin.tar.gz.md5";>md5 + http://www.apache.org/
svn commit: r1199823 - in /commons/proper/compress/trunk/src: changes/changes.xml site/xdoc/examples.xml site/xdoc/index.xml
Author: bodewig Date: Wed Nov 9 16:18:05 2011 New Revision: 1199823 URL: http://svn.apache.org/viewvc?rev=1199823&view=rev Log: document support for concatenated streams Modified: commons/proper/compress/trunk/src/changes/changes.xml commons/proper/compress/trunk/src/site/xdoc/examples.xml commons/proper/compress/trunk/src/site/xdoc/index.xml Modified: commons/proper/compress/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1199823&r1=1199822&r2=1199823&view=diff == --- commons/proper/compress/trunk/src/changes/changes.xml (original) +++ commons/proper/compress/trunk/src/changes/changes.xml Wed Nov 9 16:18:05 2011 @@ -53,6 +53,10 @@ The type attribute can be add,u BZip2CompressorInputStream now optionally supports reading of concatenated .bz2 files. + +GZipCompressorInputStream now optionally supports reading of +concatenated .gz files. + Modified: commons/proper/compress/trunk/src/site/xdoc/examples.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/site/xdoc/examples.xml?rev=1199823&r1=1199822&r2=1199823&view=diff == --- commons/proper/compress/trunk/src/site/xdoc/examples.xml (original) +++ commons/proper/compress/trunk/src/site/xdoc/examples.xml Wed Nov 9 16:18:05 2011 @@ -71,6 +71,17 @@ ArchiveInputStream input = new ArchiveSt + +For the bzip2, gzip and xz formats a single compressed file +may actually consist of several streams that will be +concatenated by the commnd line utilities when decompressing +them. Starting with Commons Compress 1.4 the +*CompressorInputStreams for these formats support +concatenating streams as well, but they won't do so by +default. You must use the two-arg constructor and explicitly +enable the support. + + In addition to the information stored Modified: commons/proper/compress/trunk/src/site/xdoc/index.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/site/xdoc/index.xml?rev=1199823&r1=1199822&r2=1199823&view=diff == --- commons/proper/compress/trunk/src/site/xdoc/index.xml (original) +++ commons/proper/compress/trunk/src/site/xdoc/index.xml Wed Nov 9 16:18:05 2011 @@ -62,7 +62,7 @@ usually correspond to single files or directories. Currently the bzip2, Pack200, XZ and gzip formats are -supported as compressors where gzip support is provided by +supported as compressors where gzip support is mostly provided by the java.util.zip package and Pack200 support by the java.util.jar package of the Java class library. XZ support is provided by the public
svn commit: r1199827 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Author: ebourg Date: Wed Nov 9 16:21:23 2011 New Revision: 1199827 URL: http://svn.apache.org/viewvc?rev=1199827&view=rev Log: CSVStrategy is now immutable (SANDBOX-279) Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVStrategyTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1199827&r1=1199826&r2=1199827&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 16:21:23 2011 @@ -122,7 +122,7 @@ public class CSVParser { * @param input a Reader containing "csv-formatted" input */ public CSVParser(Reader input) { -this(input, (CSVStrategy) CSVStrategy.DEFAULT_STRATEGY.clone()); +this(input, CSVStrategy.DEFAULT_STRATEGY); } /** @@ -260,7 +260,7 @@ public class CSVParser { c = in.readAgain(); // empty line detection: eol AND (last char was EOL or beginning) -while (strategy.getIgnoreEmptyLines() && eol +while (strategy.isEmptyLinesIgnored() && eol && (lastChar == '\n' || lastChar == '\r' || lastChar == ExtendedBufferedReader.UNDEFINED) @@ -286,7 +286,7 @@ public class CSVParser { // important: make sure a new char gets consumed in each iteration while (!tkn.isReady && tkn.type != TT_EOF) { // ignore whitespaces at beginning of a token -while (strategy.getIgnoreLeadingWhitespaces() && isWhitespace(c) && !eol) { +while (strategy.isLeadingSpacesIgnored() && isWhitespace(c) && !eol) { wsBuf.append((char) c); c = in.read(); eol = isEndOfLine(c); @@ -316,7 +316,7 @@ public class CSVParser { } else { // next token must be a simple token // add removed blanks when not ignoring whitespace chars... -if (!strategy.getIgnoreLeadingWhitespaces()) { +if (!strategy.isLeadingSpacesIgnored()) { tkn.content.append(wsBuf); } simpleTokenLexer(tkn, c); @@ -359,7 +359,7 @@ public class CSVParser { tkn.type = TT_TOKEN; tkn.isReady = true; break; -} else if (c == '\\' && strategy.getUnicodeEscapeInterpretation() && in.lookAhead() == 'u') { +} else if (c == '\\' && strategy.isUnicodeEscapesInterpreted() && in.lookAhead() == 'u') { // interpret unicode escaped chars (like \u0070 -> p) tkn.content.append((char) unicodeEscapeLexer(c)); } else if (c == strategy.getEscape()) { @@ -371,7 +371,7 @@ public class CSVParser { c = in.read(); } -if (strategy.getIgnoreTrailingWhitespaces()) { +if (strategy.isTrailingSpacesIgnored()) { tkn.content.trimTrailingWhitespace(); } @@ -400,7 +400,7 @@ public class CSVParser { for (; ;) { c = in.read(); -if (c == '\\' && strategy.getUnicodeEscapeInterpretation() && in.lookAhead() == 'u') { +if (c == '\\' && strategy.isUnicodeEscapesInterpreted() && in.lookAhead() == 'u') { tkn.content.append((char) unicodeEscapeLexer(c)); } else if (c == strategy.getEscape()) { tkn.content.append((char) readEscape(c)); Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1199827&r1=1199826&r2=1199827&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Wed Nov 9 16:21:23 2011 @@ -58,7 +58,7 @@ public class CSVPrinter { * Output a blank line */ public void println() throws IOException { -out.write(strategy.getPrinterNewline()); +out.write(strategy.getLineSeparator()); newLine = true; } Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java URL: http://svn.apache.org/viewvc/com
svn commit: r1199842 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Author: ebourg Date: Wed Nov 9 16:54:09 2011 New Revision: 1199842 URL: http://svn.apache.org/viewvc?rev=1199842&view=rev Log: Renamed CSVStrategy to CSVFormat Added: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (contents, props changed) - copied, changed from r1199827, commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java (contents, props changed) - copied, changed from r1199827, commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVStrategyTest.java Removed: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVStrategyTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVUtilsTest.java Copied: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (from r1199827, commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java) URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?p2=commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java&p1=commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java&r1=1199827&r2=1199842&rev=1199842&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Wed Nov 9 16:54:09 2011 @@ -20,11 +20,11 @@ package org.apache.commons.csv; import java.io.Serializable; /** - * CSVStrategy + * The format specification of a CSV file. * - * Represents the strategy for a CSV. + * This class is immutable. */ -public class CSVStrategy implements Cloneable, Serializable { +public class CSVFormat implements Cloneable, Serializable { private char delimiter = ','; private char encapsulator = '"'; @@ -45,27 +45,27 @@ public class CSVStrategy implements Clon public static final char ENCAPSULATOR_DISABLED = (char) -2; /** Standard comma separated format. */ -public static final CSVStrategy DEFAULT_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true); +public static final CSVFormat DEFAULT = new CSVFormat(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true); /** Excel file format (using a comma as the value delimiter). */ -public static final CSVStrategy EXCEL_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, false, false, false); +public static final CSVFormat EXCEL = new CSVFormat(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, false, false, false); /** Tabulation delimited format. */ -public static final CSVStrategy TDF_STRATEGY = new CSVStrategy('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true); +public static final CSVFormat TDF = new CSVFormat('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true); /** - * Creates a CSVStrategy with the default parameters. + * Creates a CSVFormat with the default parameters. */ -public CSVStrategy() { +public CSVFormat() { } -public CSVStrategy(char delimiter, char encapsulator, char commentStart) { +public CSVFormat(char delimiter, char encapsulator, char commentStart) { this(delimiter, encapsulator, commentStart, ESCAPE_DISABLED, true, true, false, true); } /** - * Customized CSV strategy constructor. + * Customized CSV format constructor. * * @param delimiter a char used for value separation * @param encapsulator a char used as value encapsulation marker @@ -76,7 +76,7 @@ public class CSVStrategy implements Clon * @param unicodeEscapesInterpreted TRUE when unicode escapes should be interpreted * @param emptyLinesIgnored TRUE when the parser should skip emtpy lines */ -public CSVStrategy( +public CSVFormat( char delimiter, char encapsulator, char commentStart, @@ -99,30 +99,30 @@ public class CSVStrategy implements Clon return delimiter; } -public CSVStrategy withDelimiter(char delimiter) { -CSVStrategy strategy = (CSVStrategy) c
svn commit: r1199845 - in /commons/sandbox/csv/trunk: pom.xml src/main/java/org/apache/commons/csv/CSVParser.java src/main/java/org/apache/commons/csv/CSVPrinter.java src/main/java/org/apache/commons/
Author: ebourg Date: Wed Nov 9 16:58:32 2011 New Revision: 1199845 URL: http://svn.apache.org/viewvc?rev=1199845&view=rev Log: Upgrading to Java 5 Modified: commons/sandbox/csv/trunk/pom.xml commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java Modified: commons/sandbox/csv/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/pom.xml?rev=1199845&r1=1199844&r2=1199845&view=diff == --- commons/sandbox/csv/trunk/pom.xml (original) +++ commons/sandbox/csv/trunk/pom.xml Wed Nov 9 16:58:32 2011 @@ -61,6 +61,8 @@ csv 12311182 +1.5 +1.5 Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1199845&r1=1199844&r2=1199845&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 16:58:32 2011 @@ -79,7 +79,7 @@ public class CSVParser { /** * A record buffer for getLine(). Grows as necessary and is reused. */ -private final List record = new ArrayList(); +private final List record = new ArrayList(); private final Token reusableToken = new Token(); private final CharBuffer wsBuf = new CharBuffer(); private final CharBuffer code = new CharBuffer(4); @@ -152,7 +152,7 @@ public class CSVParser { * @throws IOException on parse error or input read-failure */ public String[][] getAllValues() throws IOException { -List records = new ArrayList(); +List records = new ArrayList(); String[] values; String[][] ret = null; while ((values = getLine()) != null) { Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1199845&r1=1199844&r2=1199845&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Wed Nov 9 16:58:32 2011 @@ -74,8 +74,8 @@ public class CSVPrinter { * @param values values to be outputted. */ public void println(String[] values) throws IOException { -for (int i = 0; i < values.length; i++) { -print(values[i]); +for (String value : values) { +print(value); } println(); } Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java?rev=1199845&r1=1199844&r2=1199845&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java Wed Nov 9 16:58:32 2011 @@ -32,73 +32,49 @@ import java.util.List; */ public class CSVConfig { -/** - * specifies if it is a fixed width csv file * - */ +/** specifies if it is a fixed width csv file */ private boolean fixedWidth; -/** - * list of fields * - */ -private List fields; + +/** list of fields */ +private List fields; -/** - * Do no do any filling * - */ +/** Do no do any filling */ public static final int FILLNONE = 0; -/** - * Fill content the the left. Mainly usable together with fixedWidth * - */ + +/** Fill content the the left. Mainly usable together with fixedWidth */ public static final int FILLLEFT = 1; -/** - * Fill content to the right. Mainly usable together with fixedWidth * - */ + +/** Fill content to the right. Mainly usable together with fixedWidth */ public static final int FILLRIGHT = 2; -/** - * The fill pattern - */ +/** The fill pattern */ private int fill; -/** - * The fill char. Defaults to a space - */ + +/** The fill char. Defaults to a space */ private char fillChar = ' '; -/** - * The seperator character. Defaults to , - */ + +/** The seperator character. Defaults to ,*/ private char delimiter = ','; -/** - * The row separator. Defaults to \n -
svn commit: r1199872 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/CSVParser.java test/java/org/apache/commons/csv/CSVParserTest.java
Author: ebourg Date: Wed Nov 9 17:11:22 2011 New Revision: 1199872 URL: http://svn.apache.org/viewvc?rev=1199872&view=rev Log: Turned the token types into an Enum Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1199872&r1=1199871&r2=1199872&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 17:11:22 2011 @@ -22,6 +22,7 @@ import java.io.Reader; import java.util.ArrayList; import java.util.List; +import static org.apache.commons.csv.CSVParser.Token.Type.*; /** * Parses CSV files according to the specified configuration. @@ -54,19 +55,6 @@ public class CSVParser { /** length of the initial token (content-)buffer */ private static final int INITIAL_TOKEN_LENGTH = 50; -// the token types -/** Token has no valid content, i.e. is in its initialized state. */ -static final int TT_INVALID = -1; - -/** Token with content, at beginning or in the middle of a line. */ -static final int TT_TOKEN = 0; - -/** Token (which can have content) when end of file is reached. */ -static final int TT_EOF = 1; - -/** Token with content when end of a line is reached. */ -static final int TT_EORECORD = 2; - /** Immutable empty String array. */ private static final String[] EMPTY_STRING_ARRAY = new String[0]; @@ -91,22 +79,33 @@ public class CSVParser { * It is used as contract between the lexer and the parser. */ static class Token { -/** - * Token type, see TT_xxx constants. - */ -int type = TT_INVALID; -/** - * The content buffer. - */ + +enum Type { +/** Token has no valid content, i.e. is in its initialized state. */ +INVALID, + +/** Token with content, at beginning or in the middle of a line. */ +TOKEN, + +/** Token (which can have content) when end of file is reached. */ +EOF, + +/** Token with content when end of a line is reached. */ +EORECORD +} + +/** Token type */ +Type type = INVALID; + +/** The content buffer. */ CharBuffer content = new CharBuffer(INITIAL_TOKEN_LENGTH); -/** - * Token ready flag: indicates a valid token with content (ready for the parser). - */ + +/** Token ready flag: indicates a valid token with content (ready for the parser). */ boolean isReady; Token reset() { content.clear(); -type = TT_INVALID; +type = INVALID; isReady = false; return this; } @@ -180,26 +179,26 @@ public class CSVParser { reusableToken.reset(); nextToken(reusableToken); switch (reusableToken.type) { -case TT_TOKEN: +case TOKEN: record.add(reusableToken.content.toString()); break; -case TT_EORECORD: +case EORECORD: record.add(reusableToken.content.toString()); break; -case TT_EOF: +case EOF: if (reusableToken.isReady) { record.add(reusableToken.content.toString()); } else { ret = null; } break; -case TT_INVALID: +case INVALID: default: // error: throw IOException throw new IOException("(line " + getLineNumber() + ") invalid parse sequence"); // unreachable: break; } -if (reusableToken.type != TT_TOKEN) { +if (reusableToken.type != TOKEN) { break; } } @@ -272,19 +271,19 @@ public class CSVParser { c = in.readAgain(); // reached end of file without any content (empty line at the end) if (isEndOfFile(c)) { -tkn.type = TT_EOF; +tkn.type = EOF; return tkn; } } -// did we reach eof during the last iteration already ? TT_EOF +// did we reach eof during the last iteration already ? EOF if (isEndOfFile(lastChar) || (lastChar != format.get
svn commit: r1199877 - /commons/proper/lang/trunk/pom.xml
Author: bayard Date: Wed Nov 9 17:19:20 2011 New Revision: 1199877 URL: http://svn.apache.org/viewvc?rev=1199877&view=rev Log: Removing explicit definition of previous version of Lang per Sebb Modified: commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1199877&r1=1199876&r2=1199877&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Wed Nov 9 17:19:20 2011 @@ -555,9 +555,6 @@ clirr-maven-plugin 2.3 - -3.0.1 - info
svn commit: r1199878 - in /commons/proper/lang/trunk: default.properties pom.xml
Author: bayard Date: Wed Nov 9 17:21:38 2011 New Revision: 1199878 URL: http://svn.apache.org/viewvc?rev=1199878&view=rev Log: Setting version to 3.1 for release build Modified: commons/proper/lang/trunk/default.properties commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/default.properties URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/default.properties?rev=1199878&r1=1199877&r2=1199878&view=diff == --- commons/proper/lang/trunk/default.properties (original) +++ commons/proper/lang/trunk/default.properties Wed Nov 9 17:21:38 2011 @@ -39,7 +39,7 @@ component.package = org.apache.commons.l component.title = Core Language Utilities # The current version number of this component -component.version = 3.1-SNAPSHOT +component.version = 3.1 # The name that is used to create the jar file final.name = ${component.name}-${component.version} Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1199878&r1=1199877&r2=1199878&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Wed Nov 9 17:21:38 2011 @@ -17,7 +17,7 @@ 4.0.0 org.apache.commons commons-lang3 - 3.1-SNAPSHOT + 3.1 Commons Lang 2001
svn commit: r1199879 - /commons/proper/lang/tags/LANG_3_1_RC1/
Author: bayard Date: Wed Nov 9 17:21:52 2011 New Revision: 1199879 URL: http://svn.apache.org/viewvc?rev=1199879&view=rev Log: Tagging 3.1 rc1 Added: commons/proper/lang/tags/LANG_3_1_RC1/ - copied from r1199878, commons/proper/lang/trunk/
svn commit: r1199881 - in /commons/proper/lang/trunk: default.properties pom.xml
Author: bayard Date: Wed Nov 9 17:22:17 2011 New Revision: 1199881 URL: http://svn.apache.org/viewvc?rev=1199881&view=rev Log: Setting back to snapshot Modified: commons/proper/lang/trunk/default.properties commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/default.properties URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/default.properties?rev=1199881&r1=1199880&r2=1199881&view=diff == --- commons/proper/lang/trunk/default.properties (original) +++ commons/proper/lang/trunk/default.properties Wed Nov 9 17:22:17 2011 @@ -39,7 +39,7 @@ component.package = org.apache.commons.l component.title = Core Language Utilities # The current version number of this component -component.version = 3.1 +component.version = 3.1-SNAPSHOT # The name that is used to create the jar file final.name = ${component.name}-${component.version} Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1199881&r1=1199880&r2=1199881&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Wed Nov 9 17:22:17 2011 @@ -17,7 +17,7 @@ 4.0.0 org.apache.commons commons-lang3 - 3.1 + 3.1-SNAPSHOT Commons Lang 2001
svn commit: r1199882 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
Author: ggregory Date: Wed Nov 9 17:25:09 2011 New Revision: 1199882 URL: http://svn.apache.org/viewvc?rev=1199882&view=rev Log: Remove superfluous parens. Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java?rev=1199882&r1=1199881&r2=1199882&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java Wed Nov 9 17:25:09 2011 @@ -1018,7 +1018,7 @@ public class StrBuilder implements CharS */ public StrBuilder appendWithSeparators(Object[] array, String separator) { if (array != null && array.length > 0) { -separator = (separator == null ? "" : separator); +separator = separator == null ? "" : separator; append(array[0]); for (int i = 1; i < array.length; i++) { append(separator); @@ -1040,7 +1040,7 @@ public class StrBuilder implements CharS */ public StrBuilder appendWithSeparators(Iterable iterable, String separator) { if (iterable != null) { -separator = (separator == null ? "" : separator); +separator = separator == null ? "" : separator; Iterator it = iterable.iterator(); while (it.hasNext()) { append(it.next()); @@ -1064,7 +1064,7 @@ public class StrBuilder implements CharS */ public StrBuilder appendWithSeparators(Iterator it, String separator) { if (it != null) { -separator = (separator == null ? "" : separator); +separator = separator == null ? "" : separator; while (it.hasNext()) { append(it.next()); if (it.hasNext()) {
svn commit: r1199887 - /commons/proper/lang/trunk/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt
Author: bayard Date: Wed Nov 9 17:32:52 2011 New Revision: 1199887 URL: http://svn.apache.org/viewvc?rev=1199887&view=rev Log: Copying current rel notes into site Added: commons/proper/lang/trunk/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt (with props) Added: commons/proper/lang/trunk/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt?rev=1199887&view=auto == --- commons/proper/lang/trunk/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt (added) +++ commons/proper/lang/trunk/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt Wed Nov 9 17:32:52 2011 @@ -0,0 +1,40 @@ +$Id: RELEASE-NOTES.txt 1199820 2011-11-09 16:14:52Z bayard $ + +Commons Lang Package +Version 3.1 + Release Notes + + +INTRODUCTION: + +This document contains the release notes for the 3.1 version of Apache Commons Lang. +Commons Lang is a set of utility functions and reusable components that should be of use in any +Java environment. + +Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics, +variable arguments, autoboxing, concurrency and formatted output. + +For the advice on upgrading from 2.x to 3.x, see the following page: + +http://commons.apache.org/lang/article3_0.html + +CHANGES IN 3.1 + + +[LANG-760] Add API StringUtils.toString(byte[] intput, String charsetName) +[LANG-756] Add APIs ClassUtils.isPrimitiveWrapper(Class) and isPrimitiveOrWrapper(Class) +[LANG-758] Add an example with whitespace in StringUtils.defaultIfEmpty +[LANG-752] Fix createLong() so it behaves like createInteger() +[LANG-751] Include the actual type in the Validate.isInstance and isAssignableFrom exception messages +[LANG-748] Deprecating chomp(String, String) +[LANG-736] CharUtils static final array CHAR_STRING is not needed to compute CHAR_STRING_ARRAY +[LANG-695] SystemUtils.IS_OS_UNIX doesn't recognize FreeBSD as a Unix system + +BUG FIXES IN 3.1 +== + +[LANG-749] Incorrect Bundle-SymbolicName in Manifest +[LANG-746] NumberUtils does not handle upper-case hex: 0X and -0X +[LANG-744] StringUtils throws java.security.AccessControlException on Google App Engine +[LANG-741] Ant build has wrong component.name +[LANG-698] Document that the Mutable numbers don't work as expected with String.format Propchange: commons/proper/lang/trunk/src/site/resources/release-notes/RELEASE-NOTES-3.1.txt -- svn:eol-style = native
svn commit: r1199888 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
Author: ggregory Date: Wed Nov 9 17:35:01 2011 New Revision: 1199888 URL: http://svn.apache.org/viewvc?rev=1199888&view=rev Log: Eat own dog food: separator == null ? "" : separator -> ObjectUtils.toString(separator) Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java?rev=1199888&r1=1199887&r2=1199888&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java Wed Nov 9 17:35:01 2011 @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.List; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.SystemUtils; /** @@ -1018,7 +1019,7 @@ public class StrBuilder implements CharS */ public StrBuilder appendWithSeparators(Object[] array, String separator) { if (array != null && array.length > 0) { -separator = separator == null ? "" : separator; +separator = ObjectUtils.toString(separator); append(array[0]); for (int i = 1; i < array.length; i++) { append(separator); @@ -1040,7 +1041,7 @@ public class StrBuilder implements CharS */ public StrBuilder appendWithSeparators(Iterable iterable, String separator) { if (iterable != null) { -separator = separator == null ? "" : separator; +separator = ObjectUtils.toString(separator); Iterator it = iterable.iterator(); while (it.hasNext()) { append(it.next()); @@ -1064,7 +1065,7 @@ public class StrBuilder implements CharS */ public StrBuilder appendWithSeparators(Iterator it, String separator) { if (it != null) { -separator = separator == null ? "" : separator; +separator = ObjectUtils.toString(separator); while (it.hasNext()) { append(it.next()); if (it.hasNext()) {
svn commit: r1199893 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
Author: ggregory Date: Wed Nov 9 17:42:00 2011 New Revision: 1199893 URL: http://svn.apache.org/viewvc?rev=1199893&view=rev Log: Use blocks. Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java?rev=1199893&r1=1199892&r2=1199893&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java Wed Nov 9 17:42:00 2011 @@ -936,12 +936,15 @@ public class EqualsBuilderTest { @Override public boolean equals(Object o) { -if (o == this) +if (o == this) { return true; -if (o instanceof TestACanEqualB) +} +if (o instanceof TestACanEqualB) { return this.a == ((TestACanEqualB) o).getA(); -if (o instanceof TestBCanEqualA) +} +if (o instanceof TestBCanEqualA) { return this.a == ((TestBCanEqualA) o).getB(); +} return false; } @@ -959,12 +962,15 @@ public class EqualsBuilderTest { @Override public boolean equals(Object o) { -if (o == this) +if (o == this) { return true; -if (o instanceof TestACanEqualB) +} +if (o instanceof TestACanEqualB) { return this.b == ((TestACanEqualB) o).getA(); -if (o instanceof TestBCanEqualA) +} +if (o instanceof TestBCanEqualA) { return this.b == ((TestBCanEqualA) o).getB(); +} return false; }
svn commit: r1199898 - /commons/proper/compress/trunk/src/site/xdoc/examples.xml
Author: sebb Date: Wed Nov 9 18:16:28 2011 New Revision: 1199898 URL: http://svn.apache.org/viewvc?rev=1199898&view=rev Log: Typo Modified: commons/proper/compress/trunk/src/site/xdoc/examples.xml Modified: commons/proper/compress/trunk/src/site/xdoc/examples.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/site/xdoc/examples.xml?rev=1199898&r1=1199897&r2=1199898&view=diff == --- commons/proper/compress/trunk/src/site/xdoc/examples.xml (original) +++ commons/proper/compress/trunk/src/site/xdoc/examples.xml Wed Nov 9 18:16:28 2011 @@ -74,7 +74,7 @@ ArchiveInputStream input = new ArchiveSt For the bzip2, gzip and xz formats a single compressed file may actually consist of several streams that will be -concatenated by the commnd line utilities when decompressing +concatenated by the command line utilities when decompressing them. Starting with Commons Compress 1.4 the *CompressorInputStreams for these formats support concatenating streams as well, but they won't do so by
svn commit: r1199899 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java
Author: sebb Date: Wed Nov 9 18:19:15 2011 New Revision: 1199899 URL: http://svn.apache.org/viewvc?rev=1199899&view=rev Log: Unused imports Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java?rev=1199899&r1=1199898&r2=1199899&view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java Wed Nov 9 18:19:15 2011 @@ -18,12 +18,9 @@ */ package org.apache.commons.compress.compressors; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
svn commit: r1199901 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java
Author: sebb Date: Wed Nov 9 18:21:28 2011 New Revision: 1199901 URL: http://svn.apache.org/viewvc?rev=1199901&view=rev Log: Unnecessary @SuppressWarnings - fallthrough is commented Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java?rev=1199901&r1=1199900&r2=1199901&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java Wed Nov 9 18:21:28 2011 @@ -124,7 +124,6 @@ public class ExtraFieldUtils { * * @since Apache Commons Compress 1.1 */ -@SuppressWarnings("fallthrough") public static ZipExtraField[] parse(byte[] data, boolean local, UnparseableExtraField onUnparseableData) throws ZipException {
svn commit: r1199903 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
Author: sebb Date: Wed Nov 9 18:22:27 2011 New Revision: 1199903 URL: http://svn.apache.org/viewvc?rev=1199903&view=rev Log: Javadoc Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java?rev=1199903&r1=1199902&r2=1199903&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java Wed Nov 9 18:22:27 2011 @@ -115,8 +115,7 @@ public class BZip2CompressorInputStream * Constructs a new BZip2CompressorInputStream which decompresses bytes * read from the specified stream. * - * @param inputStream the InputStream from which this object should - * be created of + * @param in the InputStream from which this object should be created * @param decompressConcatenated * if true, decompress until the end of the input; * if false, stop after the first .bz2 stream and
svn commit: r1199904 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
Author: sebb Date: Wed Nov 9 18:23:54 2011 New Revision: 1199904 URL: http://svn.apache.org/viewvc?rev=1199904&view=rev Log: Avoid "empty flow control statement" warning Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java?rev=1199904&r1=1199903&r2=1199904&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java Wed Nov 9 18:23:54 2011 @@ -175,11 +175,11 @@ public class GzipCompressorInputStream e // Original file name, ignored if ((flg & FNAME) != 0) -while (inData.readUnsignedByte() != 0x00) ; +while (inData.readUnsignedByte() != 0x00) {} // Comment, ignored if ((flg & FCOMMENT) != 0) -while (inData.readUnsignedByte() != 0x00) ; +while (inData.readUnsignedByte() != 0x00) {} // Header "CRC16" which is actually a truncated CRC32 (which isn't // as good as real CRC16). I don't know if any encoder implementation
svn commit: r1199906 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors: pack200/Pack200Strategy.java xz/XZCompressorInputStream.java xz/XZCompressorOutputStream
Author: sebb Date: Wed Nov 9 18:26:00 2011 New Revision: 1199906 URL: http://svn.apache.org/viewvc?rev=1199906&view=rev Log: Missing @Override Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java?rev=1199906&r1=1199905&r2=1199906&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java Wed Nov 9 18:26:00 2011 @@ -29,12 +29,14 @@ import java.io.IOException; public enum Pack200Strategy { /** Cache output in memory */ IN_MEMORY() { +@Override StreamBridge newStreamBridge() { return new InMemoryCachingStreamBridge(); } }, /** Cache output in a temporary file */ TEMP_FILE() { +@Override StreamBridge newStreamBridge() throws IOException { return new TempFileCachingStreamBridge(); } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java?rev=1199906&r1=1199905&r2=1199906&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java Wed Nov 9 18:26:00 2011 @@ -96,6 +96,7 @@ public class XZCompressorInputStream ext } /** {@inheritDoc} */ +@Override public int read() throws IOException { int ret = in.read(); count(ret == -1 ? -1 : 1); @@ -103,6 +104,7 @@ public class XZCompressorInputStream ext } /** {@inheritDoc} */ +@Override public int read(byte[] buf, int off, int len) throws IOException { int ret = in.read(buf, off, len); count(ret); @@ -110,16 +112,19 @@ public class XZCompressorInputStream ext } /** {@inheritDoc} */ +@Override public long skip(long n) throws IOException { return in.skip(n); } /** {@inheritDoc} */ +@Override public int available() throws IOException { return in.available(); } /** {@inheritDoc} */ +@Override public void close() throws IOException { in.close(); } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java?rev=1199906&r1=1199905&r2=1199906&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorOutputStream.java Wed Nov 9 18:26:00 2011 @@ -60,11 +60,13 @@ public class XZCompressorOutputStream ex } /** {@inheritDoc} */ +@Override public void write(int b) throws IOException { out.write(b); } /** {@inheritDoc} */ +@Override public void write(byte[] buf, int off, int len) throws IOException { out.write(buf, off, len); } @@ -75,6 +77,7 @@ public class XZCompressorOutputStream ex * the output stream. Calling this function very often may increase * the compressed file size a lot. */ +@Override public void flush() throws IOException { out.flush(); } @@ -88,6 +91,7 @@ public class XZCompressorOutputStream ex } /** {@inheritDoc} */ +@Override public void close() throws IOException { out.close(); }
svn commit: r1199907 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java
Author: sebb Date: Wed Nov 9 18:26:32 2011 New Revision: 1199907 URL: http://svn.apache.org/viewvc?rev=1199907&view=rev Log: Unused imports Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java?rev=1199907&r1=1199906&r2=1199907&view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStreamTest.java Wed Nov 9 18:26:32 2011 @@ -21,7 +21,6 @@ package org.apache.commons.compress.arch import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.FileOutputStream; import java.io.InputStream; import org.apache.commons.compress.AbstractTestCase;
svn commit: r1199910 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
Author: sebb Date: Wed Nov 9 18:31:54 2011 New Revision: 1199910 URL: http://svn.apache.org/viewvc?rev=1199910&view=rev Log: Unused buffer Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java?rev=1199910&r1=1199909&r2=1199910&view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java Wed Nov 9 18:31:54 2011 @@ -1189,7 +1189,6 @@ public class Zip64SupportIT { throws IOException { zos.setUseZip64(Zip64Mode.Never); try { - byte[] buf = new byte[ONE_MILLION]; ZipArchiveEntry zae = new ZipArchiveEntry("0"); zae.setSize(FIVE_BILLION);
svn commit: r1199911 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java
Author: sebb Date: Wed Nov 9 18:35:06 2011 New Revision: 1199911 URL: http://svn.apache.org/viewvc?rev=1199911&view=rev Log: Remove unused variables Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java?rev=1199911&r1=1199910&r2=1199911&view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportIT.java Wed Nov 9 18:35:06 2011 @@ -343,7 +343,7 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); // skip first two entries a.skipBytes(2 * 47 /* CD entry of file with file name length 1 and no @@ -553,7 +553,7 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); // grab first entry, verify sizes are 0x // and it has a ZIP64 extended information extra @@ -792,7 +792,7 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); long cfhPos = a.getFilePointer(); // grab first entry, verify @@ -1034,9 +1034,8 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); -long cfhPos = a.getFilePointer(); // grab first entry, verify // sizes are 0x and // it has a ZIP64 extended @@ -1291,7 +1290,7 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); // grab first CF entry, verify sizes are 1e6 and it // has no ZIP64 extended information extra field @@ -1467,7 +1466,7 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); // grab first CF entry, verify sizes are 1e6 and it // has an empty ZIP64 extended information extra field @@ -1630,7 +1629,7 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); long cfhPos = a.getFilePointer(); // grab first entry, verify sizes are not @@ -1800,7 +1799,7 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); long cfhPos = a.getFilePointer(); // grab first entry, verify sizes are not @@ -1984,9 +1983,8 @@ public class Zip64SupportIT { RandomAccessFile a = new RandomAccessFile(f, "r"); try { -final long end = getLengthAndPositionAtCentralDirectory(a); +getLengthAndPositionAtCentralDirectory(a); -long cfhPos = a.getFilePointer(); // grab first CD entry, verify sizes are not // 0x and it has a no ZIP64 extended // information extra field @@ -2157,9 +2155,8 @@ public class Zip64SupportIT {
svn commit: r1199912 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump: Dirent.java DumpArchiveInputStream.java
Author: sebb Date: Wed Nov 9 18:35:53 2011 New Revision: 1199912 URL: http://svn.apache.org/viewvc?rev=1199912&view=rev Log: Explicit boxing Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java?rev=1199912&r1=1199911&r2=1199912&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/Dirent.java Wed Nov 9 18:35:53 2011 @@ -79,6 +79,6 @@ class Dirent { */ @Override public String toString() { -return String.format("[%d]: %s", ino, name); +return String.format("[%d]: %s", Integer.valueOf(ino), name); } } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java?rev=1199912&r1=1199911&r2=1199912&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java Wed Nov 9 18:35:53 2011 @@ -100,7 +100,7 @@ public class DumpArchiveInputStream exte // put in a dummy record for the root node. Dirent root = new Dirent(2, 2, 4, "."); -names.put(2, root); +names.put(Integer.valueOf(2), root); // use priority based on queue to ensure parent directories are // released first. @@ -281,7 +281,7 @@ public class DumpArchiveInputStream exte } entry.setName(path); -entry.setSimpleName(names.get(entry.getIno()).getName()); + entry.setSimpleName(names.get(Integer.valueOf(entry.getIno())).getName()); entry.setOffset(filepos); return entry; @@ -302,9 +302,9 @@ public class DumpArchiveInputStream exte raw.readRecord(); } -if (!names.containsKey(entry.getIno()) && +if (!names.containsKey(Integer.valueOf(entry.getIno())) && (DumpArchiveConstants.SEGMENT_TYPE.INODE == entry.getHeaderType())) { -pending.put(entry.getIno(), entry); +pending.put(Integer.valueOf(entry.getIno()), entry); } int datalen = DumpArchiveConstants.TP_SIZE * entry.getHeaderCount(); @@ -342,7 +342,7 @@ public class DumpArchiveInputStream exte } */ -names.put(ino, d); +names.put(Integer.valueOf(ino), d); // check whether this allows us to fill anything in the pending list. for (Map.Entry e : pending.entrySet()) { @@ -359,7 +359,7 @@ public class DumpArchiveInputStream exte // remove anything that we found. (We can't do it earlier // because of concurrent modification exceptions.) for (DumpArchiveEntry e : queue) { -pending.remove(e.getIno()); +pending.remove(Integer.valueOf(e.getIno())); } } @@ -388,12 +388,12 @@ public class DumpArchiveInputStream exte Dirent dirent = null; for (int i = entry.getIno();; i = dirent.getParentIno()) { -if (!names.containsKey(i)) { +if (!names.containsKey(Integer.valueOf(i))) { elements.clear(); break; } -dirent = names.get(i); +dirent = names.get(Integer.valueOf(i)); elements.push(dirent.getName()); if (dirent.getIno() == dirent.getParentIno()) { @@ -403,7 +403,7 @@ public class DumpArchiveInputStream exte // if an element is missing defer the work and read next entry. if (elements.isEmpty()) { -pending.put(entry.getIno(), entry); +pending.put(Integer.valueOf(entry.getIno()), entry); return null; }
svn commit: r1199983 - in /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3: Validate.java text/ExtendedMessageFormat.java
Author: ggregory Date: Wed Nov 9 21:41:24 2011 New Revision: 1199983 URL: http://svn.apache.org/viewvc?rev=1199983&view=rev Log: Use Collection.isEmpty() instead of size() == 0 Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java?rev=1199983&r1=1199982&r2=1199983&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java Wed Nov 9 21:41:24 2011 @@ -296,7 +296,7 @@ public class Validate { if (collection == null) { throw new NullPointerException(String.format(message, values)); } -if (collection.size() == 0) { +if (collection.isEmpty()) { throw new IllegalArgumentException(String.format(message, values)); } return collection; @@ -345,7 +345,7 @@ public class Validate { if (map == null) { throw new NullPointerException(String.format(message, values)); } -if (map.size() == 0) { +if (map.isEmpty()) { throw new IllegalArgumentException(String.format(message, values)); } return map; Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java?rev=1199983&r1=1199982&r2=1199983&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java Wed Nov 9 21:41:24 2011 @@ -522,7 +522,7 @@ public class ExtendedMessageFormat exten * @return true if some Object was found, false otherwise. */ private boolean containsElements(Collection coll) { -if (coll == null || coll.size() == 0) { +if (coll == null || coll.isEmpty()) { return false; } for (Object name : coll) {
svn commit: r1199986 - in /commons/proper/io/trunk/src/main/java/org/apache/commons/io: FileSystemUtils.java FilenameUtils.java filefilter/AndFileFilter.java
Author: ggregory Date: Wed Nov 9 21:43:44 2011 New Revision: 1199986 URL: http://svn.apache.org/viewvc?rev=1199986&view=rev Log: Use Collection.isEmpty() instead of size() == 0 Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java?rev=1199986&r1=1199985&r2=1199986&view=diff == --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java Wed Nov 9 21:43:44 2011 @@ -507,7 +507,7 @@ public class FileSystemUtils { "Command line returned OS error code '" + proc.exitValue() + "' for command " + Arrays.asList(cmdAttribs)); } -if (lines.size() == 0) { +if (lines.isEmpty()) { // unknown problem, throw exception throw new IOException( "Command line did not return any info " + Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java?rev=1199986&r1=1199985&r2=1199986&view=diff == --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java Wed Nov 9 21:43:44 2011 @@ -1350,7 +1350,7 @@ public class FilenameUtils { } if (array[i] == '?') { list.add("?"); -} else if (list.size() == 0 || +} else if (list.isEmpty() || (i > 0 && list.get(list.size() - 1).equals("*") == false)) { list.add("*"); } Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java?rev=1199986&r1=1199985&r2=1199986&view=diff == --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java Wed Nov 9 21:43:44 2011 @@ -116,7 +116,7 @@ public class AndFileFilter */ @Override public boolean accept(final File file) { -if (this.fileFilters.size() == 0) { +if (this.fileFilters.isEmpty()) { return false; } for (IOFileFilter fileFilter : fileFilters) { @@ -132,7 +132,7 @@ public class AndFileFilter */ @Override public boolean accept(final File file, final String name) { -if (this.fileFilters.size() == 0) { +if (this.fileFilters.isEmpty()) { return false; } for (IOFileFilter fileFilter : fileFilters) {
svn commit: r1199992 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
Author: ggregory Date: Wed Nov 9 21:56:44 2011 New Revision: 112 URL: http://svn.apache.org/viewvc?rev=112&view=rev Log: Use Collection.isEmpty() instead of size() == 0 Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java?rev=112&r1=111&r2=112&view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java Wed Nov 9 21:56:44 2011 @@ -1159,8 +1159,8 @@ public final class ChangeSetTestCase ext ChangeSetPerformer performer = new ChangeSetPerformer(changes); ChangeSetResults results = performer.perform(ais, out); assertTrue(results.getAddedFromStream().contains("testdata/test1.xml")); -assertTrue(results.getAddedFromChangeSet().size() == 0); -assertTrue(results.getDeleted().size() == 0); +assertTrue(results.getAddedFromChangeSet().isEmpty()); +assertTrue(results.getDeleted().isEmpty()); is.close(); } finally {
svn commit: r1199997 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Author: ebourg Date: Wed Nov 9 22:04:01 2011 New Revision: 117 URL: http://svn.apache.org/viewvc?rev=117&view=rev Log: Renamed CSVParser.getAllValues() to getRecords() Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=117&r1=116&r2=117&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 22:04:01 2011 @@ -33,13 +33,13 @@ import static org.apache.commons.csv.CSV * Parsing of a csv-string having tabs as separators, * '"' as an optional value encapsulator, and comments starting with '#': * - * String[][] data = + * String[][] record = * (new CSVParser(new StringReader("a\tb\nc\td"), new CSVFormat('\t','"','#'))).getAllValues(); * * * Parsing of a csv-string in Excel CSV format * - * String[][] data = + * String[][] record = * (new CSVParser(new StringReader("a;b\nc;d"), CSVFormat.EXCEL)).getAllValues(); * * @@ -150,7 +150,7 @@ public class CSVParser { * @return matrix of records x values ('null' when end of file) * @throws IOException on parse error or input read-failure */ -public String[][] getAllValues() throws IOException { +public String[][] getRecords() throws IOException { List records = new ArrayList(); String[] values; String[][] ret = null; Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java?rev=117&r1=116&r2=117&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java Wed Nov 9 22:04:01 2011 @@ -88,7 +88,7 @@ public class CSVUtils { if (s == null) { throw new IllegalArgumentException("Null argument not allowed."); } -String[][] result = (new CSVParser(new StringReader(s))).getAllValues(); +String[][] result = (new CSVParser(new StringReader(s))).getRecords(); if (result == null) { // since CSVFormat ignores empty lines an empty array is returned // (i.e. not "result = new String[][] {{""}};") Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=117&r1=116&r2=117&view=diff == --- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original) +++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Wed Nov 9 22:04:01 2011 @@ -221,7 +221,7 @@ public class CSVParserTest extends TestC public void testGetAllValues() throws IOException { CSVParser parser = new CSVParser(new StringReader(code)); -String[][] tmp = parser.getAllValues(); +String[][] tmp = parser.getRecords(); assertEquals(res.length, tmp.length); assertTrue(tmp.length > 0); for (int i = 0; i < res.length; i++) { @@ -241,7 +241,7 @@ public class CSVParserTest extends TestC {"\"hello\"", " \"world\"", "abc\ndef", ""} }; CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL); -String[][] tmp = parser.getAllValues(); +String[][] tmp = parser.getRecords(); assertEquals(res.length, tmp.length); assertTrue(tmp.length > 0); for (int i = 0; i < res.length; i++) { @@ -259,7 +259,7 @@ public class CSVParserTest extends TestC {"world", ""} }; CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL); -String[][] tmp = parser.getAllValues(); +String[][] tmp = parser.getRecords(); assertEquals(res.length, tmp.length); assertTrue(tmp.length > 0); for (int i = 0; i < res.length; i++) { @@ -286,7 +286,7 @@ public class CSVParserTest extends TestC for (String code : codes) { CSVParser parser = new C
svn commit: r1200015 - in /commons/proper/vfs/trunk: core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java src/changes/changes.xml
Author: ggregory Date: Wed Nov 9 22:45:41 2011 New Revision: 1200015 URL: http://svn.apache.org/viewvc?rev=1200015&view=rev Log: [VFS-382] SFTP getChildren() does not fail when called on a file. Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java commons/proper/vfs/trunk/src/changes/changes.xml Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java?rev=1200015&r1=1200014&r2=1200015&view=diff == --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java Wed Nov 9 22:45:41 2011 @@ -300,6 +300,10 @@ public class SftpFileObject extends Abst @Override protected FileObject[] doListChildrenResolved() throws Exception { +// should not require a round-trip because type is already set. +if (this.isFile()) { +return null; +} // List the contents of the folder Vector vector = null; final ChannelSftp channel = fileSystem.getChannel(); Modified: commons/proper/vfs/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1200015&r1=1200014&r2=1200015&view=diff == --- commons/proper/vfs/trunk/src/changes/changes.xml (original) +++ commons/proper/vfs/trunk/src/changes/changes.xml Wed Nov 9 22:45:41 2011 @@ -23,6 +23,12 @@ + +SFTP getChildren() does not fail when called on a file. + + +Iterate over a FileObject using the Java "foreach" statement, to provide all descendents of a FileObject. + FTP connect.error message used instead of SFTP connect.error message. @@ -47,6 +53,9 @@ Add constructors FileDepthSelector() and FileDepthSelector(int). + +Add FileObject API deleteAll(). + Add a FileExtensionSelector class.
svn commit: r1200017 - in /commons/proper/vfs/trunk: core/pom.xml core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java core/src/test/java/org/apache/commons/vfs2/uti
Author: ggregory Date: Wed Nov 9 22:47:15 2011 New Revision: 1200017 URL: http://svn.apache.org/viewvc?rev=1200017&view=rev Log: Tests with an embedded Apache SSHd (MINA) server unless the user provides a system property to a SSH server URL. Added: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java Modified: commons/proper/vfs/trunk/core/pom.xml commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java commons/proper/vfs/trunk/pom.xml Modified: commons/proper/vfs/trunk/core/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/pom.xml?rev=1200017&r1=1200016&r2=1200017&view=diff == --- commons/proper/vfs/trunk/core/pom.xml (original) +++ commons/proper/vfs/trunk/core/pom.xml Wed Nov 9 22:47:15 2011 @@ -97,6 +97,22 @@ slf4j-log4j12 test + + + org.apache.sshd + sshd-core + test + + + org.bouncycastle + bcprov-jdk15 + test + + + commons-io + commons-io + test + Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java?rev=1200017&r1=1200016&r2=1200017&view=diff == --- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java (original) +++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java Wed Nov 9 22:47:15 2011 @@ -16,6 +16,13 @@ */ package org.apache.commons.vfs2.provider.sftp.test; +import java.io.File; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.security.PublicKey; +import java.util.ArrayList; +import java.util.List; + import junit.framework.Test; import org.apache.commons.vfs2.FileObject; @@ -27,36 +34,250 @@ import org.apache.commons.vfs2.provider. import org.apache.commons.vfs2.provider.sftp.TrustEveryoneUserInfo; import org.apache.commons.vfs2.test.AbstractProviderTestConfig; import org.apache.commons.vfs2.test.ProviderTestSuite; +import org.apache.commons.vfs2.util.FreeSocketPortUtil; +import org.apache.ftpserver.ftplet.FtpException; +import org.apache.sshd.SshServer; +import org.apache.sshd.common.NamedFactory; +import org.apache.sshd.common.Session; +import org.apache.sshd.common.util.SecurityUtils; +import org.apache.sshd.server.Command; +import org.apache.sshd.server.FileSystemFactory; +import org.apache.sshd.server.FileSystemView; +import org.apache.sshd.server.ForwardingFilter; +import org.apache.sshd.server.PasswordAuthenticator; +import org.apache.sshd.server.PublickeyAuthenticator; +import org.apache.sshd.server.SshFile; +import org.apache.sshd.server.auth.UserAuthNone; +import org.apache.sshd.server.filesystem.NativeSshFile; +import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider; +import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; +import org.apache.sshd.server.session.ServerSession; +import org.apache.sshd.server.sftp.SftpSubsystem; /** - * Test cases for the SFTP provider. - * + * Tests cases for the SFTP provider. + * + * Starts and stops an embedded Apache SSHd (MINA) server. + * + * * @author mailto:adammurd...@apache.org";>Adam Murdoch */ -public class SftpProviderTestCase -extends AbstractProviderTestConfig +public class SftpProviderTestCase extends AbstractProviderTestConfig { +/** + * Implements FileSystemFactory because SSHd does not know about users and home directories. + */ +static final class TestFileSystemFactory implements FileSystemFactory +{ +/** + * Accepts only the known test user. + */ +public FileSystemView createFileSystemView(Session session) throws IOException +{ +final String userName = session.getUsername(); +if (!DEFAULT_USER.equals(userName)) +{ +return null; +} +return new TestFileSystemView(getTestDirectory(), userName); +} +} + +/** + * Implements FileSystemView because SSHd does not know about users and home directories. + */ +static final class TestFileSystemView implements FileSystemView +{ +private final String homeDirStr; + +private final String userName; + +// private boolean caseInsensitive; + +public TestFileSystemView(String homeDirStr, String userName) +{ +this.homeDirStr = new File(homeDirStr).getAbsolutePath(); +this.userName = userName; +} + +public SshFile getFile(SshFile baseDir
svn commit: r1200021 - in /commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider: ftp/test/FtpProviderTestCase.java sftp/test/SftpProviderTestCase.java
Author: ggregory Date: Wed Nov 9 22:57:53 2011 New Revision: 1200021 URL: http://svn.apache.org/viewvc?rev=1200021&view=rev Log: Testing FTP: Find a free socket port at runtime instead of hard-coding one. Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java?rev=1200021&r1=1200020&r2=1200021&view=diff == --- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java (original) +++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java Wed Nov 9 22:57:53 2011 @@ -16,6 +16,7 @@ */ package org.apache.commons.vfs2.provider.ftp.test; +import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -30,6 +31,7 @@ import org.apache.commons.vfs2.provider. import org.apache.commons.vfs2.test.AbstractProviderTestConfig; import org.apache.commons.vfs2.test.ProviderTestConfig; import org.apache.commons.vfs2.test.ProviderTestSuite; +import org.apache.commons.vfs2.util.FreeSocketPortUtil; import org.apache.ftpserver.FtpServer; import org.apache.ftpserver.FtpServerFactory; import org.apache.ftpserver.ftplet.FtpException; @@ -46,12 +48,12 @@ import org.junit.Assert; */ public class FtpProviderTestCase extends AbstractProviderTestConfig implements ProviderTestConfig { -private static final int DEFAULT_PORT = 2121; +private static int SocketPort; /** * Use %40 for @ in the FTP URL password */ -private static final String DEFAULT_URI = "ftp://test:test@localhost:"; + DEFAULT_PORT; +private static String ConnectionUri; private static FtpServer Server; @@ -89,7 +91,7 @@ public class FtpProviderTestCase extends serverFactory.setUserManager(userManager); ListenerFactory factory = new ListenerFactory(); // set the port of the listener -factory.setPort(DEFAULT_PORT); +factory.setPort(SocketPort); // replace the default listener serverFactory.addListener("default", factory.createListener()); @@ -136,6 +138,13 @@ public class FtpProviderTestCase extends } } +public FtpProviderTestCase() throws IOException +{ +SocketPort = FreeSocketPortUtil.findFreeLocalPort(); +// Use %40 for @ in the a URL a @ +ConnectionUri = "ftp://test:test@localhost:"; + SocketPort; +} + /** * Returns the base folder for tests. You can override the DEFAULT_URI by using the system property name defined by TEST_URI. */ @@ -145,7 +154,7 @@ public class FtpProviderTestCase extends String uri = getSystemTestUriOverride(); if (uri == null) { -uri = DEFAULT_URI; +uri = ConnectionUri; } FileSystemOptions opts = new FileSystemOptions(); FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true); Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java?rev=1200021&r1=1200020&r2=1200021&view=diff == --- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java (original) +++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpProviderTestCase.java Wed Nov 9 22:57:53 2011 @@ -276,7 +276,7 @@ public class SftpProviderTestCase extend public SftpProviderTestCase() throws IOException { SocketPort = FreeSocketPortUtil.findFreeLocalPort(); -// Use %40 for @ in the FTP URL password if you need a @ +// Use %40 for @ in the a URL a @ ConnectionUri = String.format("sftp://%s@localhost:%d";, DEFAULT_USER, SocketPort); }
svn commit: r1200024 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/CSVParser.java test/java/org/apache/commons/csv/CSVParserTest.java
Author: ebourg Date: Wed Nov 9 23:04:13 2011 New Revision: 1200024 URL: http://svn.apache.org/viewvc?rev=1200024&view=rev Log: Made CSVParser iterable to simplify the iteration over the records Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1200024&r1=1200023&r2=1200024&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov 9 23:04:13 2011 @@ -20,7 +20,9 @@ package org.apache.commons.csv; import java.io.IOException; import java.io.Reader; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; +import java.util.NoSuchElementException; import static org.apache.commons.csv.CSVParser.Token.Type.*; @@ -33,14 +35,18 @@ import static org.apache.commons.csv.CSV * Parsing of a csv-string having tabs as separators, * '"' as an optional value encapsulator, and comments starting with '#': * - * String[][] record = - * (new CSVParser(new StringReader("a\tb\nc\td"), new CSVFormat('\t','"','#'))).getAllValues(); + * CSVFormat format = new CSVFormat('\t', '"', '#'); + * Reader in = new StringReader("a\tb\nc\td"); + * String[][] records = new CSVParser(in, format).getRecords(); * * - * Parsing of a csv-string in Excel CSV format + * Parsing of a csv-string in Excel CSV format, using a for-each loop: * - * String[][] record = - * (new CSVParser(new StringReader("a;b\nc;d"), CSVFormat.EXCEL)).getAllValues(); + * Reader in = new StringReader("a;b\nc;d"); + * CSVParser parser = new CSVParser(in, CSVFormat.EXCEL); + * for (String[] record : parser) { + * ... + * } * * * @@ -50,7 +56,7 @@ import static org.apache.commons.csv.CSV * see package documentation * for more details */ -public class CSVParser { +public class CSVParser implements Iterable { /** length of the initial token (content-)buffer */ private static final int INITIAL_TOKEN_LENGTH = 50; @@ -172,7 +178,7 @@ public class CSVParser { * ('null' when end of file has been reached) * @throws IOException on parse error or input read-failure */ -public String[] getLine() throws IOException { +String[] getLine() throws IOException { String[] ret = EMPTY_STRING_ARRAY; record.clear(); while (true) { @@ -209,6 +215,49 @@ public class CSVParser { } /** + * Returns an iterator on the records. IOExceptions occuring + * during the iteration are wrapped in a RuntimeException. + */ +public Iterator iterator() { +return new Iterator() { +String[] current; + +public boolean hasNext() { +if (current == null) { +current = getNextLine(); +} + +return current != null; +} + +public String[] next() { +String[] next = current; +current = null; + +if (next == null) { +// hasNext() wasn't called before +next = getNextLine(); +if (next == null) { +throw new NoSuchElementException("No more CSV records available"); +} +} + +return next; +} + +private String[] getNextLine() { +try { +return getLine(); +} catch (IOException e) { +throw new RuntimeException(e); +} +} + +public void remove() { } +}; +} + +/** * Returns the current line number in the input stream. * * ATTENTION: in case your csv has multiline-values the returned Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1200024&r1=1200023&r2=1200024&view=diff == --- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original) +++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Wed Nov 9 23:04:13 2011 @@ -20,7 +20,11 @@ package org.apache.commons.csv; import java.io.IOException; import java.io.Reader; import java.io.StringReader; +import java.util.ArrayList; import java.util.Arrays; +
svn commit: r1200026 - /commons/proper/vfs/trunk/pom.xml
Author: ggregory Date: Wed Nov 9 23:09:47 2011 New Revision: 1200026 URL: http://svn.apache.org/viewvc?rev=1200026&view=rev Log: Format. Modified: commons/proper/vfs/trunk/pom.xml Modified: commons/proper/vfs/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/pom.xml?rev=1200026&r1=1200025&r2=1200026&view=diff == --- commons/proper/vfs/trunk/pom.xml (original) +++ commons/proper/vfs/trunk/pom.xml Wed Nov 9 23:09:47 2011 @@ -393,12 +393,12 @@ 1.46 test - - commons-io - commons-io - 2.1 - test - + +commons-io +commons-io +2.1 +test +
svn commit: r1200027 - /commons/proper/vfs/trunk/pom.xml
Author: ggregory Date: Wed Nov 9 23:11:09 2011 New Revision: 1200027 URL: http://svn.apache.org/viewvc?rev=1200027&view=rev Log: Add comments. Modified: commons/proper/vfs/trunk/pom.xml Modified: commons/proper/vfs/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/pom.xml?rev=1200027&r1=1200026&r2=1200027&view=diff == --- commons/proper/vfs/trunk/pom.xml (original) +++ commons/proper/vfs/trunk/pom.xml Wed Nov 9 23:11:09 2011 @@ -361,7 +361,7 @@ 4.10 test - + org.apache.ftpserver ftpserver-core @@ -380,7 +380,7 @@ 1.6.3 test - + org.apache.sshd sshd-core
svn commit: r1200028 - /commons/proper/vfs/trunk/core/pom.xml
Author: ggregory Date: Wed Nov 9 23:12:28 2011 New Revision: 1200028 URL: http://svn.apache.org/viewvc?rev=1200028&view=rev Log: Add comments. Modified: commons/proper/vfs/trunk/core/pom.xml Modified: commons/proper/vfs/trunk/core/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/pom.xml?rev=1200028&r1=1200027&r2=1200028&view=diff == --- commons/proper/vfs/trunk/core/pom.xml (original) +++ commons/proper/vfs/trunk/core/pom.xml Wed Nov 9 23:12:28 2011 @@ -81,7 +81,7 @@ junit test - + org.apache.ftpserver ftpserver-core @@ -97,7 +97,7 @@ slf4j-log4j12 test - + org.apache.sshd sshd-core
svn commit: r1200041 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/package.html site/xdoc/downloads.xml site/xdoc/mail-lists.xml
Author: ebourg Date: Wed Nov 9 23:39:17 2011 New Revision: 1200041 URL: http://svn.apache.org/viewvc?rev=1200041&view=rev Log: Removed the references to Jakarta and fixed some links Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/package.html commons/sandbox/csv/trunk/src/site/xdoc/downloads.xml commons/sandbox/csv/trunk/src/site/xdoc/mail-lists.xml Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/package.html URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/package.html?rev=1200041&r1=1200040&r2=1200041&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/package.html (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/package.html Wed Nov 9 23:39:17 2011 @@ -20,7 +20,7 @@ org.apache.commons.csv package -Jakarta-Commons CSV Format Support +Apache Commons CSV Format Support CSV (or its dialects) are widely used as interfaces to legacy systems or manual data-imports. Basically CSV stands for "Comma Separated Values" but Modified: commons/sandbox/csv/trunk/src/site/xdoc/downloads.xml URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/site/xdoc/downloads.xml?rev=1200041&r1=1200040&r2=1200041&view=diff == --- commons/sandbox/csv/trunk/src/site/xdoc/downloads.xml (original) +++ commons/sandbox/csv/trunk/src/site/xdoc/downloads.xml Wed Nov 9 23:39:17 2011 @@ -36,7 +36,7 @@ - http://people.apache.org/builds/jakarta-commons/nightly/commons-csv/";>Nightly Builds + https://repository.apache.org/content/groups/snapshots/org/apache/commons/commons-csv";>Nightly Builds are built once a day from the current SVN HEAD. This is (nearly) the latest code and so should be treated with caution. Modified: commons/sandbox/csv/trunk/src/site/xdoc/mail-lists.xml URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/site/xdoc/mail-lists.xml?rev=1200041&r1=1200040&r2=1200041&view=diff == --- commons/sandbox/csv/trunk/src/site/xdoc/mail-lists.xml (original) +++ commons/sandbox/csv/trunk/src/site/xdoc/mail-lists.xml Wed Nov 9 23:39:17 2011 @@ -188,7 +188,7 @@ limitations under the License. mailto:announce-subscr...@apache.org";>Subscribe mailto:announce-unsubscr...@apache.org";>Unsubscribe read only - http://mail-archives.apache.org/mod_mbox/announce/";>mail-archives.apache.org + http://mail-archives.apache.org/mod_mbox/www-announce/";>mail-archives.apache.org http://markmail.org/list/org.apache.announce/";>markmail.org http://old.nabble.com/Apache-News-and-Announce-f109.html";>old.nabble.com http://www.mail-archive.com/announce@apache.org/";>www.mail-archive.com
svn commit: r1200061 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Author: ebourg Date: Thu Nov 10 00:26:09 2011 New Revision: 1200061 URL: http://svn.apache.org/viewvc?rev=1200061&view=rev Log: Reduced the constants in CSVFormat for disabling the features to only one Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1200061&r1=1200060&r2=1200061&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Thu Nov 10 00:26:09 2011 @@ -28,30 +28,31 @@ public class CSVFormat implements Clonea private char delimiter = ','; private char encapsulator = '"'; -private char commentStart = COMMENTS_DISABLED; -private char escape = ESCAPE_DISABLED; +private char commentStart = DISABLED; +private char escape = DISABLED; private boolean leadingSpacesIgnored = true; private boolean trailingSpacesIgnored = true; private boolean unicodeEscapesInterpreted = false; private boolean emptyLinesIgnored = true; private String lineSeparator = "\n"; -// -2 is used to signal disabled, because it won't be confused with -// an EOF signal (-1), and because \ufffe in UTF-16 would be -// encoded as two chars (using surrogates) and thus there should never -// be a collision with a real text char. -public static final char COMMENTS_DISABLED = (char) -2; -public static final char ESCAPE_DISABLED = (char) -2; -public static final char ENCAPSULATOR_DISABLED = (char) -2; + +/** + * Constant char to be used for disabling comments, escapes and encapsulation. + * The value -2 is used because it won't be confused with an EOF signal (-1), + * and because the unicode value FFFE would be encoded as two chars (using surrogates) + * and thus there should never be a collision with a real text char. + */ +public static final char DISABLED = '\ufffe'; /** Standard comma separated format. */ -public static final CSVFormat DEFAULT = new CSVFormat(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true); - +public static final CSVFormat DEFAULT = new CSVFormat(',', '"', DISABLED, DISABLED, true, true, false, true); + /** Excel file format (using a comma as the value delimiter). */ -public static final CSVFormat EXCEL = new CSVFormat(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, false, false, false); - +public static final CSVFormat EXCEL = new CSVFormat(',', '"', DISABLED, DISABLED, false, false, false, false); + /** Tabulation delimited format. */ -public static final CSVFormat TDF = new CSVFormat('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true); +public static final CSVFormat TDF = new CSVFormat('\t', '"', DISABLED, DISABLED, true, true, false, true); /** @@ -61,7 +62,7 @@ public class CSVFormat implements Clonea } public CSVFormat(char delimiter, char encapsulator, char commentStart) { -this(delimiter, encapsulator, commentStart, ESCAPE_DISABLED, true, true, false, true); +this(delimiter, encapsulator, commentStart, DISABLED, true, true, false, true); } /** @@ -115,6 +116,10 @@ public class CSVFormat implements Clonea return format; } +boolean isEncapsulating() { +return this.encapsulator != DISABLED; +} + public char getCommentStart() { return commentStart; } @@ -126,7 +131,7 @@ public class CSVFormat implements Clonea } public boolean isCommentingDisabled() { -return this.commentStart == COMMENTS_DISABLED; +return this.commentStart == DISABLED; } public char getEscape() { @@ -139,6 +144,10 @@ public class CSVFormat implements Clonea return format; } +boolean isEscaping() { +return this.escape != DISABLED; +} + public boolean isLeadingSpacesIgnored() { return leadingSpacesIgnored; } Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1200061&r1=1200060&r2=1200061&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original) +++ commons/sand
svn commit: r1200065 - /commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java
Author: ebourg Date: Thu Nov 10 00:41:43 2011 New Revision: 1200065 URL: http://svn.apache.org/viewvc?rev=1200065&view=rev Log: Changed the signature of CSVUtils.printLine() to use varargs Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java?rev=1200065&r1=1200064&r2=1200065&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java Thu Nov 10 00:41:43 2011 @@ -48,7 +48,7 @@ public class CSVUtils { * @return the CSV string, will be an empty string if the length of the * value array is 0 */ -public static String printLine(String[] values, CSVFormat format) { +public static String printLine(CSVFormat format, String... values) { // set up a CSVUtils StringWriter stringWriter = new StringWriter(); CSVPrinter csvPrinter = new CSVPrinter(stringWriter, format);
svn commit: r1200096 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java
Author: ggregory Date: Thu Nov 10 02:07:43 2011 New Revision: 1200096 URL: http://svn.apache.org/viewvc?rev=1200096&view=rev Log: Turn off long-running test for now. Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java?rev=1200096&r1=1200095&r2=1200096&view=diff == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java Thu Nov 10 02:07:43 2011 @@ -74,6 +74,7 @@ public class ReflectionToStringBuilderCo } @Test +@Ignore public void testCopyOnWriteArrayList() throws InterruptedException, ExecutionException { this.testConcurrency(new CollectionHolder>(new CopyOnWriteArrayList())); }
svn commit: r1200097 - in /commons/proper/vfs/trunk: core/src/test/java/org/apache/http/ core/src/test/java/org/apache/http/examples/ core/src/test/java/org/apache/http/examples/nio/ pom.xml src/chang
Author: ggregory Date: Thu Nov 10 02:14:40 2011 New Revision: 1200097 URL: http://svn.apache.org/viewvc?rev=1200097&view=rev Log: [VFS-383] Update JSch to 0.1.45 from 0.1.42 for the SFTP provider. Added: commons/proper/vfs/trunk/core/src/test/java/org/apache/http/ commons/proper/vfs/trunk/core/src/test/java/org/apache/http/examples/ commons/proper/vfs/trunk/core/src/test/java/org/apache/http/examples/nio/ Modified: commons/proper/vfs/trunk/pom.xml commons/proper/vfs/trunk/src/changes/changes.xml Modified: commons/proper/vfs/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/pom.xml?rev=1200097&r1=1200096&r2=1200097&view=diff == --- commons/proper/vfs/trunk/pom.xml (original) +++ commons/proper/vfs/trunk/pom.xml Thu Nov 10 02:14:40 2011 @@ -343,7 +343,7 @@ com.jcraft jsch -0.1.42 +0.1.45 jcifs Modified: commons/proper/vfs/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1200097&r1=1200096&r2=1200097&view=diff == --- commons/proper/vfs/trunk/src/changes/changes.xml (original) +++ commons/proper/vfs/trunk/src/changes/changes.xml Thu Nov 10 02:14:40 2011 @@ -23,6 +23,9 @@ + +Update JSch to 0.1.45 from 0.1.42 for the SFTP provider. + SFTP getChildren() does not fail when called on a file.
svn commit: r1200099 - in /commons/proper/vfs/trunk: pom.xml src/changes/changes.xml
Author: ggregory Date: Thu Nov 10 02:19:28 2011 New Revision: 1200099 URL: http://svn.apache.org/viewvc?rev=1200099&view=rev Log: [VFS-384] Update Apache Commons Net to 3.0.1 from 2.2 for FTP and SFTP providers. Modified: commons/proper/vfs/trunk/pom.xml commons/proper/vfs/trunk/src/changes/changes.xml Modified: commons/proper/vfs/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/pom.xml?rev=1200099&r1=1200098&r2=1200099&view=diff == --- commons/proper/vfs/trunk/pom.xml (original) +++ commons/proper/vfs/trunk/pom.xml Thu Nov 10 02:19:28 2011 @@ -308,7 +308,7 @@ commons-net commons-net -2.2 +3.0.1 commons-collections Modified: commons/proper/vfs/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1200099&r1=1200098&r2=1200099&view=diff == --- commons/proper/vfs/trunk/src/changes/changes.xml (original) +++ commons/proper/vfs/trunk/src/changes/changes.xml Thu Nov 10 02:19:28 2011 @@ -23,6 +23,9 @@ + +Update Apache Commons Net to 3.0.1 from 2.2 for FTP and SFTP providers. + Update JSch to 0.1.45 from 0.1.42 for the SFTP provider.
svn commit: r1200112 - /commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java
Author: dbrosius Date: Thu Nov 10 03:37:47 2011 New Revision: 1200112 URL: http://svn.apache.org/viewvc?rev=1200112&view=rev Log: bad logic, should use || rather than &&, but instanceof covers the null case anyway Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java?rev=1200112&r1=1200111&r2=1200112&view=diff == --- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java (original) +++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/writer/CSVConfig.java Thu Nov 10 03:37:47 2011 @@ -283,7 +283,7 @@ public class CSVConfig { * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { -if (obj == null && !(obj instanceof CSVConfig)) { +if (!(obj instanceof CSVConfig)) { return false; } return super.equals(obj);
svn commit: r1200177 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
Author: ggregory Date: Thu Nov 10 06:14:33 2011 New Revision: 1200177 URL: http://svn.apache.org/viewvc?rev=1200177&view=rev Log: [LANG-762] Handle or document ReflectionToStringBuilder and ToStringBuilder for collections that are not thread safe. Better Javadocs. See Phil's comments in the Jira. Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java?rev=1200177&r1=1200176&r2=1200177&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java Thu Nov 10 06:14:33 2011 @@ -32,34 +32,33 @@ import org.apache.commons.lang3.ClassUti * * Assists in implementing {@link Object#toString()} methods using reflection. * - * * * This class uses reflection to determine the fields to append. Because these fields are usually private, the class * uses {@link java.lang.reflect.AccessibleObject#setAccessible(java.lang.reflect.AccessibleObject[], boolean)} to * change the visibility of the fields. This will fail under a security manager, unless the appropriate permissions are * set up correctly. * - * + * + * Using reflection to access (private) fields circumvents any synchronization protection guarding access to these + * fields. If a toString method cannot safely read a field, you should exclude it from the toString method, or use + * synchronization consistent with the class' lock management around the invocation of the method. Take special care to + * exclude non-thread-safe collection classes, because these classes may throw ConcurrentModificationException if + * modified while the toString method is executing. + * * * A typical invocation for this method would look like: * - * * * public String toString() { - * return ReflectionToStringBuilder.toString(this); - * } - * - * - * + * return ReflectionToStringBuilder.toString(this); + * } + * * * You can also use the builder to debug 3rd party objects: * - * * - * System.out.println("An object: " + ReflectionToStringBuilder.toString(anObject)); - * - * - * + * System.out.println("An object: " + ReflectionToStringBuilder.toString(anObject)); + * * * A subclass can control field output by overriding the methods: * @@ -68,26 +67,21 @@ import org.apache.commons.lang3.ClassUti * * * - * For example, this method does not include the password field in the returned - * String: + * For example, this method does not include the password field in the returned String: * - * * * public String toString() { * return (new ReflectionToStringBuilder(this) { * protected boolean accept(Field f) { - * return super.accept(f) && !f.getName().equals("password"); + * return super.accept(f) && !f.getName().equals("password"); * } * }).toString(); - * } - * - * - * + * } + * * - * The exact format of the toString is determined by the {@link ToStringStyle} passed into the - * constructor. + * The exact format of the toString is determined by the {@link ToStringStyle} passed into the constructor. * - * + * * @since 2.0 * @version $Id$ */
svn commit: r1200179 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/distribution/ test/java/org/apache/commons/math/distribution/
Author: celestin Date: Thu Nov 10 06:21:56 2011 New Revision: 1200179 URL: http://svn.apache.org/viewvc?rev=1200179&view=rev Log: Modifications to the hierarchy of distributions, according to MATH-692. Patch contributed by Christian Winter. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BetaDistributionImpl.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ContinuousDistribution.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/Distribution.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistributionImpl.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/TDistributionImpl.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/TDistributionTest.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java?rev=1200179&r1=1200178&r2=1200179&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java Thu Nov 10 06:21:56 2011 @@ -60,18 +60,21 @@ public abstract class AbstractContinuous /** * {@inheritDoc} + * + * For continuous distributions {@code P(X = x)} always evaluates to 0. + * + * @return 0 */ -public abstract double density(double x); +@Override +public final double probability(double x) { +return 0.0; +} /** - * For this distribution, {@code X}, this method returns the critical - * point {@code x}, such that {@code P(X < x) = p}. - * - * @param p Desired probability. - * @return {@code x}, such that {@code P(X < x) = p}. - * @throws OutOfRangeException if {@code p} is not a valid probability. + * {@inheritDoc} */ -public double inverseCumulativeProbability(final double p) { +@Override +public double inverseCumulativeProbability(final double p) throws OutOfRangeException { if (p < 0.0 || p > 1.0) { throw new OutOfRangeException(p, 0, 1); @@ -81,6 +84,7 @@ public abstract class AbstractContinuous // subclasses can override if there is a better method. UnivariateRealFunction rootFindingFunction = new UnivariateRealFunction() { +@Override public double value(double x) { return cumulativeProbability(x) - p; } @@ -124,6 +128,7 @@ public abstract class AbstractContinuous * @param seed New seed. * @since 2.2 */ +@Override public void reseedRandomGenerator(long seed) { randomData.reSeed(seed); } @@ -138,6 +143,7 @@ public abstract class AbstractContinuous * @return a random value. * @since 2.2 */ +@Override public double sample() { return randomData.nextInversionDeviate(this); } @@ -151,6 +157,7 @@ public abstract class AbstractContinuous * @throws NotStrictlyPositiveException if {@code sampleSize} is not positive. * @since 2.2 */ +@Override public double[] sample(int sampleSize) { if (sampleSize <= 0) { throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES, Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java?rev=1200179&r1=1200178&r2=12
svn commit: r1200187 - /commons/proper/lang/tags/LANG_3_1_RC1/
Author: bayard Date: Thu Nov 10 06:48:39 2011 New Revision: 1200187 URL: http://svn.apache.org/viewvc?rev=1200187&view=rev Log: Redoing Removed: commons/proper/lang/tags/LANG_3_1_RC1/
svn commit: r1200190 - in /commons/proper/lang/trunk: default.properties pom.xml
Author: bayard Date: Thu Nov 10 06:56:02 2011 New Revision: 1200190 URL: http://svn.apache.org/viewvc?rev=1200190&view=rev Log: Removing snapshot Modified: commons/proper/lang/trunk/default.properties commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/default.properties URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/default.properties?rev=1200190&r1=1200189&r2=1200190&view=diff == --- commons/proper/lang/trunk/default.properties (original) +++ commons/proper/lang/trunk/default.properties Thu Nov 10 06:56:02 2011 @@ -39,7 +39,7 @@ component.package = org.apache.commons.l component.title = Core Language Utilities # The current version number of this component -component.version = 3.1-SNAPSHOT +component.version = 3.1 # The name that is used to create the jar file final.name = ${component.name}-${component.version} Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1200190&r1=1200189&r2=1200190&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Thu Nov 10 06:56:02 2011 @@ -17,7 +17,7 @@ 4.0.0 org.apache.commons commons-lang3 - 3.1-SNAPSHOT + 3.1 Commons Lang 2001
svn commit: r1200191 - /commons/proper/lang/tags/LANG_3_1_RC1/
Author: bayard Date: Thu Nov 10 06:56:30 2011 New Revision: 1200191 URL: http://svn.apache.org/viewvc?rev=1200191&view=rev Log: Tagging 3.1 rc1 Added: commons/proper/lang/tags/LANG_3_1_RC1/ - copied from r1200190, commons/proper/lang/trunk/
svn commit: r1200192 - in /commons/proper/lang/trunk: default.properties pom.xml
Author: bayard Date: Thu Nov 10 06:57:01 2011 New Revision: 1200192 URL: http://svn.apache.org/viewvc?rev=1200192&view=rev Log: Returning to snapshots Modified: commons/proper/lang/trunk/default.properties commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/default.properties URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/default.properties?rev=1200192&r1=1200191&r2=1200192&view=diff == --- commons/proper/lang/trunk/default.properties (original) +++ commons/proper/lang/trunk/default.properties Thu Nov 10 06:57:01 2011 @@ -39,7 +39,7 @@ component.package = org.apache.commons.l component.title = Core Language Utilities # The current version number of this component -component.version = 3.1 +component.version = 3.1-SNAPSHOT # The name that is used to create the jar file final.name = ${component.name}-${component.version} Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1200192&r1=1200191&r2=1200192&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Thu Nov 10 06:57:01 2011 @@ -17,7 +17,7 @@ 4.0.0 org.apache.commons commons-lang3 - 3.1 + 3.1-SNAPSHOT Commons Lang 2001