svn commit: r492832 - in /jakarta/commons/proper/lang/trunk/xdocs: index.xml release2_0.xml

2007-01-04 Thread scolebourne
Author: scolebourne
Date: Thu Jan  4 16:21:33 2007
New Revision: 492832

URL: http://svn.apache.org/viewvc?view=revrev=492832
Log:
Rename releasenotes to release to match [collections] and fix text within

Added:
jakarta/commons/proper/lang/trunk/xdocs/release2_0.xml   (contents, props 
changed)
  - copied, changed from r492356, 
jakarta/commons/proper/lang/trunk/xdocs/releasenotes2_0.xml
Modified:
jakarta/commons/proper/lang/trunk/xdocs/index.xml

Modified: jakarta/commons/proper/lang/trunk/xdocs/index.xml
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/xdocs/index.xml?view=diffrev=492832r1=492831r2=492832
==
--- jakarta/commons/proper/lang/trunk/xdocs/index.xml (original)
+++ jakarta/commons/proper/lang/trunk/xdocs/index.xml Thu Jan  4 16:21:33 2007
@@ -51,7 +51,7 @@
 trtd2.3/tdtdPending/tdtda href=api-2.3/api-2.3/a/tdtda 
href=upgradeto2_3.htmlupgrade to 2.3/a/td/tr
 trtd2.2/tdtd04/Oct/06/tdtda 
href=api-2.2/api-2.2/a/tdtda href=upgradeto2_2.htmlupgrade to 
2.2/a/td/tr
 trtd2.1/tdtd13/Jun/06/tdtda 
href=api-2.1/api-2.1/a/tdtda href=upgradeto2_1.htmlupgrade to 
2.1/a/td/tr
-trtd2.0/tdtd02/Sep/03/tdtda 
href=api-2.0/api-2.0/a/tdtda href=releasenotes2_0.htmlrelease 
notes for 2.0/a/td/tr
+trtd2.0/tdtd02/Sep/03/tdtda 
href=api-2.0/api-2.0/a/tdtda href=release2_0.htmlrelease notes for 
2.0/a/td/tr
 trtd1.0.1/tdtd25/Nov/02/tdtda 
href=api-1.0.1/api-1.0.1/a/tdtda 
href=http://archive.apache.org/dist/jakarta/commons/lang/old/v1.0.1/RELEASE-NOTES.txt;upgrade
 to 1.0.1/a/td/tr
 trtd1.0/tdtd04/Oct/02/tdtda 
href=api-1.0/api-1.0/a/tdtda 
href=http://archive.apache.org/dist/jakarta/commons/lang/old/v1.0/RELEASE-NOTES.txt;release
 notes for 1.0/a/td/tr
 /table

Copied: jakarta/commons/proper/lang/trunk/xdocs/release2_0.xml (from r492356, 
jakarta/commons/proper/lang/trunk/xdocs/releasenotes2_0.xml)
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/xdocs/release2_0.xml?view=diffrev=492832p1=jakarta/commons/proper/lang/trunk/xdocs/releasenotes2_0.xmlr1=492356p2=jakarta/commons/proper/lang/trunk/xdocs/release2_0.xmlr2=492832
==
--- jakarta/commons/proper/lang/trunk/xdocs/releasenotes2_0.xml (original)
+++ jakarta/commons/proper/lang/trunk/xdocs/release2_0.xml Thu Jan  4 16:21:33 
2007
@@ -17,15 +17,14 @@
 --
 document
  properties
-  titleUpgrade from 2.0 to 2.1/title
+  titleRelease notes for 2.0/title
   author email=commons-dev@jakarta.apache.orgCommons Documentation 
Team/author
  /properties
 body
 
 section name=Upgrade
 p
-These are the release notes and advice for upgrading Commons-Lang from
-version 2.0 to version 2.1.
+These are the release notes and advice for Commons-Lang version 2.0.
 source
 INTRODUCTION:
 

Propchange: jakarta/commons/proper/lang/trunk/xdocs/release2_0.xml
--
svn:eol-style = native



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r492833 - in /jakarta/commons/proper/lang/trunk/xdocs: index.xml release2_0.xml releasenotes2_0.xml

2007-01-04 Thread scolebourne
Author: scolebourne
Date: Thu Jan  4 16:24:00 2007
New Revision: 492833

URL: http://svn.apache.org/viewvc?view=revrev=492833
Log:
Remove release2_0.xml as it duplicates upgradeto2_0.xml

Removed:
jakarta/commons/proper/lang/trunk/xdocs/release2_0.xml
jakarta/commons/proper/lang/trunk/xdocs/releasenotes2_0.xml
Modified:
jakarta/commons/proper/lang/trunk/xdocs/index.xml

Modified: jakarta/commons/proper/lang/trunk/xdocs/index.xml
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/xdocs/index.xml?view=diffrev=492833r1=492832r2=492833
==
--- jakarta/commons/proper/lang/trunk/xdocs/index.xml (original)
+++ jakarta/commons/proper/lang/trunk/xdocs/index.xml Thu Jan  4 16:24:00 2007
@@ -48,11 +48,11 @@
 
 table
 trthVersion/ththRelease date/ththJavadoc/ththRelease 
notes/th/tr
-trtd2.3/tdtdPending/tdtda href=api-2.3/api-2.3/a/tdtda 
href=upgradeto2_3.htmlupgrade to 2.3/a/td/tr
-trtd2.2/tdtd04/Oct/06/tdtda 
href=api-2.2/api-2.2/a/tdtda href=upgradeto2_2.htmlupgrade to 
2.2/a/td/tr
-trtd2.1/tdtd13/Jun/06/tdtda 
href=api-2.1/api-2.1/a/tdtda href=upgradeto2_1.htmlupgrade to 
2.1/a/td/tr
-trtd2.0/tdtd02/Sep/03/tdtda 
href=api-2.0/api-2.0/a/tdtda href=release2_0.htmlrelease notes for 
2.0/a/td/tr
-trtd1.0.1/tdtd25/Nov/02/tdtda 
href=api-1.0.1/api-1.0.1/a/tdtda 
href=http://archive.apache.org/dist/jakarta/commons/lang/old/v1.0.1/RELEASE-NOTES.txt;upgrade
 to 1.0.1/a/td/tr
+trtd2.3/tdtdPending/tdtda href=api-2.3/api-2.3/a/tdtda 
href=upgradeto2_3.htmlrelease notes 2.3/a/td/tr
+trtd2.2/tdtd04/Oct/06/tdtda 
href=api-2.2/api-2.2/a/tdtda href=upgradeto2_2.htmlrelease notes 
2.2/a/td/tr
+trtd2.1/tdtd13/Jun/06/tdtda 
href=api-2.1/api-2.1/a/tdtda href=upgradeto2_1.htmlrelease notes 
2.1/a/td/tr
+trtd2.0/tdtd02/Sep/03/tdtda 
href=api-2.0/api-2.0/a/tdtda href=upgradeto2_0.htmlrelease notes 
for 2.0/a/td/tr
+trtd1.0.1/tdtd25/Nov/02/tdtda 
href=api-1.0.1/api-1.0.1/a/tdtda 
href=http://archive.apache.org/dist/jakarta/commons/lang/old/v1.0.1/RELEASE-NOTES.txt;release
 notes for 1.0.1/a/td/tr
 trtd1.0/tdtd04/Oct/02/tdtda 
href=api-1.0/api-1.0/a/tdtda 
href=http://archive.apache.org/dist/jakarta/commons/lang/old/v1.0/RELEASE-NOTES.txt;release
 notes for 1.0/a/td/tr
 /table
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r492352 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java

2007-01-03 Thread scolebourne
Author: scolebourne
Date: Wed Jan  3 15:44:56 2007
New Revision: 492352

URL: http://svn.apache.org/viewvc?view=revrev=492352
Log:
Formatting changes only

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java?view=diffrev=492352r1=492351r2=492352
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
 Wed Jan  3 15:44:56 2007
@@ -1034,7 +1034,7 @@
 return str.indexOf(searchStr) = 0;
 }
 
- /**
+/**
  * pChecks if String contains a search String irrespective of case,
  * handling codenull/code. This method uses
  * [EMAIL PROTECTED] #contains(String, String)}./p
@@ -1052,8 +1052,8 @@
  * StringUtils.contains(abc, Z) = false
  * /pre
  *
- * @param str the String to check, may be null
- * @param searchStr the String to find, may be null
+ * @param str  the String to check, may be null
+ * @param searchStr  the String to find, may be null
  * @return true if the String contains the search String irrespective of
  * case or false if not or codenull/code string input
  */



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r492354 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java

2007-01-03 Thread scolebourne
Author: scolebourne
Date: Wed Jan  3 15:48:10 2007
New Revision: 492354

URL: http://svn.apache.org/viewvc?view=revrev=492354
Log:
Formatting changes only

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java?view=diffrev=492354r1=492353r2=492354
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
 Wed Jan  3 15:48:10 2007
@@ -118,8 +118,7 @@
 /**
  * pForwards to codeReflectionToStringBuilder/code./p
  * 
- * @param object
- *the Object to be output
+ * @param object  the Object to be output
  * @return the String result
  * @see ReflectionToStringBuilder#toString(Object)
  */
@@ -130,10 +129,8 @@
 /**
  * pForwards to codeReflectionToStringBuilder/code./p
  * 
- * @param object
- *the Object to be output
- * @param style
- *the style of the codetoString/code to create, may be 
codenull/code
+ * @param object  the Object to be output
+ * @param style  the style of the codetoString/code to create, may be 
codenull/code
  * @return the String result
  * @see ReflectionToStringBuilder#toString(Object,ToStringStyle)
  */
@@ -144,12 +141,9 @@
 /**
  * pForwards to codeReflectionToStringBuilder/code./p
  * 
- * @param object
- *the Object to be output
- * @param style
- *the style of the codetoString/code to create, may be 
codenull/code
- * @param outputTransients
- *whether to include transient fields
+ * @param object  the Object to be output
+ * @param style  the style of the codetoString/code to create, may be 
codenull/code
+ * @param outputTransients  whether to include transient fields
  * @return the String result
  * @see ReflectionToStringBuilder#toString(Object,ToStringStyle,boolean)
  */
@@ -160,14 +154,10 @@
 /**
  * pForwards to codeReflectionToStringBuilder/code./p
  * 
- * @param object
- *the Object to be output
- * @param style
- *the style of the codetoString/code to create, may be 
codenull/code
- * @param outputTransients
- *whether to include transient fields
- * @param reflectUpToClass
- *the superclass to reflect up to (inclusive), may be 
codenull/code
+ * @param object  the Object to be output
+ * @param style  the style of the codetoString/code to create, may be 
codenull/code
+ * @param outputTransients  whether to include transient fields
+ * @param reflectUpToClass  the superclass to reflect up to (inclusive), 
may be codenull/code
  * @return the String result
  * @see 
ReflectionToStringBuilder#toString(Object,ToStringStyle,boolean,boolean,Class)
  * @since 2.0



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r492361 - in /jakarta/commons/proper/lang/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/lang/BooleanUtils.java src/test/org/apache/commons/lang/BooleanUtilsTest.java

2007-01-03 Thread scolebourne
Author: scolebourne
Date: Wed Jan  3 16:10:13 2007
New Revision: 492361

URL: http://svn.apache.org/viewvc?view=revrev=492361
Log:
LANG-310 - BooleanUtils isNotTrue/isNotFalse

Modified:
jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java

Modified: jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt?view=diffrev=492361r1=492360r2=492361
==
--- jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt Wed Jan  3 16:10:13 2007
@@ -81,4 +81,5 @@
 * [LANG-291] - Null-safe comparison methods for finding most recent / 
least recent dates.
 * [LANG-282] - Create more tests to test out the +=31 replacement code in 
DurationFormatUtils.
 * [LANG-266] - Wish for StringUtils.join(Collection, *)
+* [LANG-310] - BooleanUtils isNotTrue/isNotFalse
 

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java?view=diffrev=492361r1=492360r2=492361
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
 Wed Jan  3 16:10:13 2007
@@ -70,7 +70,8 @@
 // boolean Boolean methods
 //---
 /**
- * pIs a Boolean value codetrue/code, handling codenull/code./p
+ * pChecks if a codeBoolean/code value is codetrue/code,
+ * handling codenull/code by returning codefalse/code./p
  *
  * pre
  *   BooleanUtils.isTrue(Boolean.TRUE)  = true
@@ -78,7 +79,7 @@
  *   BooleanUtils.isTrue(null)  = false
  * /pre
  *
- * @param bool  the boolean to convert
+ * @param bool  the boolean to check, null returns codefalse/code
  * @return codetrue/code only if the input is non-null and true
  * @since 2.1
  */
@@ -90,7 +91,26 @@
 }
 
 /**
- * pIs a Boolean value codefalse/code, handling 
codenull/code./p
+ * pChecks if a codeBoolean/code value is inot/i 
codetrue/code,
+ * handling codenull/code by returning codetrue/code./p
+ *
+ * pre
+ *   BooleanUtils.isNotTrue(Boolean.TRUE)  = false
+ *   BooleanUtils.isNotTrue(Boolean.FALSE) = true
+ *   BooleanUtils.isNotTrue(null)  = true
+ * /pre
+ *
+ * @param bool  the boolean to check, null returns codetrue/code
+ * @return codetrue/code if the input is null or false
+ * @since 2.3
+ */
+public static boolean isNotTrue(Boolean bool) {
+return !isTrue(bool);
+}
+
+/**
+ * pChecks if a codeBoolean/code value is codefalse/code,
+ * handling codenull/code by returning codefalse/code./p
  *
  * pre
  *   BooleanUtils.isFalse(Boolean.TRUE)  = false
@@ -98,7 +118,7 @@
  *   BooleanUtils.isFalse(null)  = false
  * /pre
  *
- * @param bool  the boolean to convert
+ * @param bool  the boolean to check, null returns codefalse/code
  * @return codetrue/code only if the input is non-null and false
  * @since 2.1
  */
@@ -109,6 +129,25 @@
 return bool.booleanValue() ? false : true;
 }
 
+/**
+ * pChecks if a codeBoolean/code value is inot/i 
codefalse/code,
+ * handling codenull/code by returning codetrue/code./p
+ *
+ * pre
+ *   BooleanUtils.isNotTrue(Boolean.TRUE)  = true
+ *   BooleanUtils.isNotTrue(Boolean.FALSE) = false
+ *   BooleanUtils.isNotTrue(null)  = true
+ * /pre
+ *
+ * @param bool  the boolean to check, null returns codetrue/code
+ * @return codetrue/code if the input is null or true
+ * @since 2.3
+ */
+public static boolean isNotFalse(Boolean bool) {
+return !isFalse(bool);
+}
+
+//---
 /**
  * pBoolean factory that avoids creating new Boolean objecs all the 
time./p
  * 

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java?view=diffrev=492361r1=492360r2=492361
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src

svn commit: r492369 - in /jakarta/commons/proper/lang/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/lang/text/StrBuilder.java src/test/org/apache/commons/lang/text/StrBuilderAppendInsertTest.ja

2007-01-03 Thread scolebourne
Author: scolebourne
Date: Wed Jan  3 16:35:45 2007
New Revision: 492369

URL: http://svn.apache.org/viewvc?view=revrev=492369
Log:
LANG-306 - StrBuilder appendln/appendAll/appendSeparator

Modified:
jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrBuilderAppendInsertTest.java

Modified: jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt?view=diffrev=492369r1=492368r2=492369
==
--- jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt Wed Jan  3 16:35:45 2007
@@ -56,9 +56,9 @@
 
 BUG FIXES IN 2.3:
 
-* [LANG-69 ] - [lang] ToStringBuilder throws StackOverflowError when an 
Object cycle exists
-* [LANG-102] - [lang] Refactor Entities methods
-* [LANG-153] - [lang] Can't XMLDecode an Enum
+* [LANG-69 ] - ToStringBuilder throws StackOverflowError when an Object 
cycle exists
+* [LANG-102] - Refactor Entities methods
+* [LANG-153] - Can't XMLDecode an Enum
 * [LANG-262] - Use of enum prevents a classloader from being garbage 
collected resuling in out of memory exceptions.
 * [LANG-279] - HashCodeBuilder throws java.lang.StackOverflowError when an 
object contains a cycle.
 * [LANG-281] - DurationFormatUtils returns wrong result
@@ -73,7 +73,6 @@
 
 IMPROVEMENTS IN 2.3:
 
-* [LANG-238] - [lang] Add equals(type[]) to NumberUtils
 * [LANG-258] - Enum JavaDoc
 * [LANG-268] - StringUtils.join should allow you to pass a range for it 
(so it only joins a part of the array)
 * [LANG-287] - Optimize StringEscapeUtils.unescapeXml(String)
@@ -82,4 +81,5 @@
 * [LANG-282] - Create more tests to test out the +=31 replacement code in 
DurationFormatUtils.
 * [LANG-266] - Wish for StringUtils.join(Collection, *)
 * [LANG-310] - BooleanUtils isNotTrue/isNotFalse
+* [LANG-306] - StrBuilder appendln/appendAll/appendSeparator
 

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java?view=diffrev=492369r1=492368r2=492369
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
 Wed Jan  3 16:35:45 2007
@@ -733,6 +733,227 @@
 
 //---
 /**
+ * Appends an object followed by a new line to this string builder.
+ * Appending null will call [EMAIL PROTECTED] #appendNull()}.
+ *
+ * @param obj  the object to append
+ * @return this, to enable chaining
+ */
+public StrBuilder appendln(Object obj) {
+return append(obj).appendNewLine();
+}
+
+/**
+ * Appends a string followed by a new line to this string builder.
+ * Appending null will call [EMAIL PROTECTED] #appendNull()}.
+ *
+ * @param str  the string to append
+ * @return this, to enable chaining
+ */
+public StrBuilder appendln(String str) {
+return append(str).appendNewLine();
+}
+
+/**
+ * Appends part of a string followed by a new line to this string builder.
+ * Appending null will call [EMAIL PROTECTED] #appendNull()}.
+ *
+ * @param str  the string to append
+ * @param startIndex  the start index, inclusive, must be valid
+ * @param length  the length to append, must be valid
+ * @return this, to enable chaining
+ */
+public StrBuilder appendln(String str, int startIndex, int length) {
+return append(str, startIndex, length).appendNewLine();
+}
+
+/**
+ * Appends a string buffer followed by a new line to this string builder.
+ * Appending null will call [EMAIL PROTECTED] #appendNull()}.
+ *
+ * @param str  the string buffer to append
+ * @return this, to enable chaining
+ */
+public StrBuilder appendln(StringBuffer str) {
+return append(str).appendNewLine();
+}
+
+/**
+ * Appends part of a string buffer followed by a new line to this string 
builder.
+ * Appending null will call [EMAIL PROTECTED] #appendNull()}.
+ *
+ * @param str  the string to append
+ * @param startIndex  the start index, inclusive, must be valid
+ * @param length  the length to append, must be valid
+ * @return this, to enable chaining
+ */
+public StrBuilder appendln(StringBuffer str, int startIndex, int length) {
+return append(str, startIndex, length

svn commit: r492371 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java

2007-01-03 Thread scolebourne
Author: scolebourne
Date: Wed Jan  3 16:42:05 2007
New Revision: 492371

URL: http://svn.apache.org/viewvc?view=revrev=492371
Log:
Add since tags

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java?view=diffrev=492371r1=492370r2=492371
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
 Wed Jan  3 16:42:05 2007
@@ -738,6 +738,7 @@
  *
  * @param obj  the object to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(Object obj) {
 return append(obj).appendNewLine();
@@ -749,6 +750,7 @@
  *
  * @param str  the string to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(String str) {
 return append(str).appendNewLine();
@@ -762,6 +764,7 @@
  * @param startIndex  the start index, inclusive, must be valid
  * @param length  the length to append, must be valid
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(String str, int startIndex, int length) {
 return append(str, startIndex, length).appendNewLine();
@@ -773,6 +776,7 @@
  *
  * @param str  the string buffer to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(StringBuffer str) {
 return append(str).appendNewLine();
@@ -786,6 +790,7 @@
  * @param startIndex  the start index, inclusive, must be valid
  * @param length  the length to append, must be valid
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(StringBuffer str, int startIndex, int length) {
 return append(str, startIndex, length).appendNewLine();
@@ -797,6 +802,7 @@
  *
  * @param str  the string builder to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(StrBuilder str) {
 return append(str).appendNewLine();
@@ -810,6 +816,7 @@
  * @param startIndex  the start index, inclusive, must be valid
  * @param length  the length to append, must be valid
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(StrBuilder str, int startIndex, int length) {
 return append(str, startIndex, length).appendNewLine();
@@ -821,6 +828,7 @@
  *
  * @param chars  the char array to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(char[] chars) {
 return append(chars).appendNewLine();
@@ -834,6 +842,7 @@
  * @param startIndex  the start index, inclusive, must be valid
  * @param length  the length to append, must be valid
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(char[] chars, int startIndex, int length) {
 return append(chars, startIndex, length).appendNewLine();
@@ -844,6 +853,7 @@
  *
  * @param value  the value to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(boolean value) {
 return append(value).appendNewLine();
@@ -854,6 +864,7 @@
  *
  * @param ch  the value to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(char ch) {
 return append(ch).appendNewLine();
@@ -864,6 +875,7 @@
  *
  * @param value  the value to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(int value) {
 return append(value).appendNewLine();
@@ -874,6 +886,7 @@
  *
  * @param value  the value to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(long value) {
 return append(value).appendNewLine();
@@ -884,6 +897,7 @@
  *
  * @param value  the value to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(float value) {
 return append(value).appendNewLine();
@@ -894,6 +908,7 @@
  *
  * @param value  the value to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendln(double value) {
 return append(value).appendNewLine();
@@ -907,6 +922,7 @@
  *
  * @param array  the array to append
  * @return this, to enable chaining
+ * @since 2.3
  */
 public StrBuilder appendAll(Object

svn commit: r492377 - in /jakarta/commons/proper/lang/trunk: RELEASE-NOTES.txt project.xml src/java/org/apache/commons/lang/StringUtils.java src/test/org/apache/commons/lang/StringUtilsSubstringTest.j

2007-01-03 Thread scolebourne
Author: scolebourne
Date: Wed Jan  3 17:20:30 2007
New Revision: 492377

URL: http://svn.apache.org/viewvc?view=revrev=492377
Log:
LANG-275 - StringUtils substringsBetween, implemented by Dave Meikle

Modified:
jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt
jakarta/commons/proper/lang/trunk/project.xml

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java

Modified: jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt?view=diffrev=492377r1=492376r2=492377
==
--- jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt Wed Jan  3 17:20:30 2007
@@ -82,4 +82,5 @@
 * [LANG-266] - Wish for StringUtils.join(Collection, *)
 * [LANG-310] - BooleanUtils isNotTrue/isNotFalse
 * [LANG-306] - StrBuilder appendln/appendAll/appendSeparator
+* [LANG-275] - StringUtils substringsBetween
 

Modified: jakarta/commons/proper/lang/trunk/project.xml
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/project.xml?view=diffrev=492377r1=492376r2=492377
==
--- jakarta/commons/proper/lang/trunk/project.xml (original)
+++ jakarta/commons/proper/lang/trunk/project.xml Wed Jan  3 17:20:30 2007
@@ -271,6 +271,9 @@
 nameRand McNeely/name
 /contributor
 contributor
+nameDave Meikle/name
+/contributor
+contributor
 nameNikolay Metchev/name
 /contributor
 contributor

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java?view=diffrev=492377r1=492376r2=492377
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
 Wed Jan  3 17:20:30 2007
@@ -1859,14 +1859,16 @@
  *
  * pA codenull/code input String returns codenull/code.
  * A codenull/code open/close returns codenull/code (no match).
- * An empty () open/close returns an empty string./p
+ * An empty () open and close returns an empty string./p
  *
  * pre
+ * StringUtils.substringBetween(wx[b]yz, [, ]) = b
  * StringUtils.substringBetween(null, *, *)  = null
+ * StringUtils.substringBetween(*, null, *)  = null
+ * StringUtils.substringBetween(*, *, null)  = null
  * StringUtils.substringBetween(, , )  = 
- * StringUtils.substringBetween(, , tag)   = null
- * StringUtils.substringBetween(, tag, tag)= null
- * StringUtils.substringBetween(yabcz, null, null) = null
+ * StringUtils.substringBetween(, , ]) = null
+ * StringUtils.substringBetween(, [, ])= null
  * StringUtils.substringBetween(yabcz, , ) = 
  * StringUtils.substringBetween(yabcz, y, z)   = abc
  * StringUtils.substringBetween(yabczyabcz, y, z)   = abc
@@ -1890,6 +1892,60 @@
 }
 }
 return null;
+}
+
+/**
+ * pSearches a String for substrings delimited by a start and end tag,
+ * returning all matching substrings in an array./p
+ *
+ * pA codenull/code input String returns codenull/code.
+ * A codenull/code open/close returns codenull/code (no match).
+ * An empty () open/close returns codenull/code (no match)./p
+ *
+ * pre
+ * StringUtils.substringsBetween([a][b][c], [, ]) = [a,b,c]
+ * StringUtils.substringsBetween(null, *, *)= null
+ * StringUtils.substringsBetween(*, null, *)= null
+ * StringUtils.substringsBetween(*, *, null)= null
+ * StringUtils.substringsBetween(, [, ])  = []
+ * /pre
+ *
+ * @param str  the String containing the substrings, null returns null, 
empty returns empty
+ * @param open  the String identifying the start of the substring, empty 
returns null
+ * @param close  the String identifying the end of the substring, empty 
returns null
+ * @return a String Array of substrings, or codenull/code if no match
+ * @since 2.3
+ */
+public static String[] substringsBetween(String str, String open, String 
close) {
+if (str == null || isEmpty(open) || isEmpty(close)) {
+return null;
+}
+int strLen = str.length();
+if (strLen == 0) {
+return ArrayUtils.EMPTY_STRING_ARRAY;
+}
+int closeLen = close.length

svn commit: r492378 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java

2007-01-03 Thread scolebourne
Author: scolebourne
Date: Wed Jan  3 17:31:24 2007
New Revision: 492378

URL: http://svn.apache.org/viewvc?view=revrev=492378
Log:
Fix javadoc example

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java?view=diffrev=492378r1=492377r2=492378
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
 Wed Jan  3 17:31:24 2007
@@ -134,9 +134,9 @@
  * handling codenull/code by returning codetrue/code./p
  *
  * pre
- *   BooleanUtils.isNotTrue(Boolean.TRUE)  = true
- *   BooleanUtils.isNotTrue(Boolean.FALSE) = false
- *   BooleanUtils.isNotTrue(null)  = true
+ *   BooleanUtils.isNotFalse(Boolean.TRUE)  = true
+ *   BooleanUtils.isNotFalse(Boolean.FALSE) = false
+ *   BooleanUtils.isNotFalse(null)  = true
  * /pre
  *
  * @param bool  the boolean to check, null returns codetrue/code



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r490987 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 04:11:48 2006
New Revision: 490987

URL: http://svn.apache.org/viewvc?view=revrev=490987
Log:
Document synchronization

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java?view=diffrev=490987r1=490986r2=490987
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java 
Fri Dec 29 04:11:48 2006
@@ -49,7 +49,7 @@
 /**
  * Collection of codeTracker/code instances in existence.
  */
-static Collection /* Tracker */ trackers = new Vector();
+static Collection /* Tracker */ trackers = new Vector();  // synchronized
 /**
  * Whether to terminate the thread when the tracking is complete.
  */
@@ -128,6 +128,7 @@
  * @param deleteStrategy  the strategy to delete the file, null means 
normal
  */
 private static synchronized void addTracker(String path, Object marker, 
FileDeleteStrategy deleteStrategy) {
+// synchronized block protects reaper
 if (exitWhenFinished) {
 throw new IllegalStateException(No new trackers can be added once 
exitWhenFinished() is called);
 }
@@ -171,6 +172,7 @@
  * One called, no new objects can be tracked by the file cleaner.
  */
 public static synchronized void exitWhenFinished() {
+// synchronized block protects reaper
 exitWhenFinished = true;
 if (reaper != null) {
 synchronized (reaper) {
@@ -179,7 +181,7 @@
 }
 }
 
-// ---
+//---
 /**
  * The reaper thread.
  */



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r490988 - /jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 04:24:36 2006
New Revision: 490988

URL: http://svn.apache.org/viewvc?view=revrev=490988
Log:
IO-107 - Increase test robustness for openOutputStream

Modified:

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java

Modified: 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java?view=diffrev=490988r1=490987r2=490988
==
--- 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
 Fri Dec 29 04:24:36 2006
@@ -119,11 +119,14 @@
 public void test_openOutputStream_existsButIsDirectory() throws Exception {
 File directory = new File(getTestDirectory(), subdir);
 directory.mkdirs();
+FileOutputStream out = null;
 try {
-FileUtils.openOutputStream(directory);
+out = FileUtils.openOutputStream(directory);
 fail();
 } catch (IOException ioe) {
 // expected
+} finally {
+IOUtils.closeQuietly(out);
 }
 }
 
@@ -140,12 +143,23 @@
 }
 
 public void test_openOutputStream_notExistsCannotCreate() throws Exception 
{
-File file = new File(getTestDirectory(), a/:#$!/test.txt);  // empty 
path segment is bad directory name
+// according to Wikipedia, most filing systems have a 256 limit on 
filename
+String longStr =
+abcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyz +
+abcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyz +
+abcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyz +
+abcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyz +
+abcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyz +
+abcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyzabcdevwxyz;  // 300 chars
+File file = new File(getTestDirectory(), a/ + longStr + /test.txt);
+FileOutputStream out = null;
 try {
-FileUtils.openOutputStream(file);
+out = FileUtils.openOutputStream(file);
 fail();
 } catch (IOException ioe) {
 // expected
+} finally {
+IOUtils.closeQuietly(out);
 }
 }
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r490992 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 04:37:58 2006
New Revision: 490992

URL: http://svn.apache.org/viewvc?view=revrev=490992
Log:
Add since tag

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=diffrev=490992r1=490991r2=490992
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
Fri Dec 29 04:37:58 2006
@@ -122,6 +122,7 @@
  * @param file  the file to create, not null
  * @throws IOException if the file object is a directory
  * @throws IOException if a parent directory needs creating but that fails
+ * @since Commons IO 1.3
  */
 public static FileOutputStream openOutputStream(File file) throws 
IOException {
 if (file.exists()) {



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r490997 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileUtils.java src/test/org/apache/commons/io/FileUtilsTestCase.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 05:10:03 2006
New Revision: 490997

URL: http://svn.apache.org/viewvc?view=revrev=490997
Log:
IO-107 - Add FileUtils.openInputStream, with better error messages than the JDK

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=490997r1=490996r2=490997
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Fri Dec 29 05:10:03 2006
@@ -110,6 +110,8 @@
 - FileUtils.writeByteArrayToFile
 - FileUtils.writeLines
   - enhanced to create parent directories if required
+- FileUtils.openInputStream  [IO-107]
+  - new method to open a FileInputStream, providing better error messages than 
the JDK
 
 - FileUtils.isFileOlder
   - new methods to check if a file is older (i.e. isFileOlder()) - counterparts

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=diffrev=490997r1=490996r2=490997
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
Fri Dec 29 05:10:03 2006
@@ -25,6 +25,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
+import java.nio.channels.FileChannel;
 import java.util.Collection;
 import java.util.Date;
 import java.util.Iterator;
@@ -107,6 +108,38 @@
 
 //---
 /**
+ * Opens a [EMAIL PROTECTED] FileInputStream} for the specified file, 
providing better
+ * error messages than simply calling codenew 
FileInputStream(file)/code.
+ * p
+ * At the end of the method either the stream will be successfully opened,
+ * or an exception will have been thrown.
+ * p
+ * An exception is thrown if the file does not exist.
+ * An exception is thrown if the file object exists but is a directory.
+ * An exception is thrown if the file exists but cannot be read.
+ * 
+ * @param file  the file to open for input, not null
+ * @throws IOException if the file does not exist
+ * @throws IOException if the file object is a directory
+ * @throws IOException if the file cannot be read
+ * @since Commons IO 1.3
+ */
+public static FileInputStream openInputStream(File file) throws 
IOException {
+if (file.exists()) {
+if (file.isDirectory()) {
+throw new IOException(File ' + file + ' exists but is a 
directory);
+}
+if (file.canRead() == false) {
+throw new IOException(File ' + file + ' cannot be read);
+}
+} else {
+throw new IOException(File ' + file + ' does not exist);
+}
+return new FileInputStream(file);
+}
+
+//---
+/**
  * Opens a [EMAIL PROTECTED] FileOutputStream} for the specified file, 
checking and
  * creating the parent directory if it does not exist.
  * p
@@ -119,8 +152,9 @@
  * An exception is thrown if the file exists but cannot be written to.
  * An exception is thrown if the parent directory cannot be created.
  * 
- * @param file  the file to create, not null
+ * @param file  the file to open for output, not null
  * @throws IOException if the file object is a directory
+ * @throws IOException if the file cannot be written to
  * @throws IOException if a parent directory needs creating but that fails
  * @since Commons IO 1.3
  */
@@ -918,17 +952,16 @@
  * the default encoding can differ between platforms and will have
  * inconsistent results.
  *
- * @param file  the file to read
+ * @param file  the file to read, not null
  * @param encoding  the encoding to use, null means platform default
- * @return the file contents or null if read failed
+ * @return the file contents, never null
  * @throws IOException in case of an I/O error
  * @throws java.io.UnsupportedEncodingException if the encoding is not 
supported by the VM
  */
-public static String readFileToString(
-File file, String encoding) throws IOException {
+public static String readFileToString(File file, String encoding) throws 
IOException {
 InputStream in = null;
 try

svn commit: r491001 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 05:15:33 2006
New Revision: 491001

URL: http://svn.apache.org/viewvc?view=revrev=491001
Log:
IO-107 - Add FileUtils.openInputStream, with better error messages than the JDK

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=diffrev=491001r1=491000r2=491001
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
Fri Dec 29 05:15:33 2006
@@ -25,7 +25,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
-import java.nio.channels.FileChannel;
 import java.util.Collection;
 import java.util.Date;
 import java.util.Iterator;
@@ -119,7 +118,7 @@
  * An exception is thrown if the file exists but cannot be read.
  * 
  * @param file  the file to open for input, not null
- * @throws IOException if the file does not exist
+ * @throws FileNotFoundException if the file does not exist
  * @throws IOException if the file object is a directory
  * @throws IOException if the file cannot be read
  * @since Commons IO 1.3
@@ -133,7 +132,7 @@
 throw new IOException(File ' + file + ' cannot be read);
 }
 } else {
-throw new IOException(File ' + file + ' does not exist);
+throw new FileNotFoundException(File ' + file + ' does not 
exist);
 }
 return new FileInputStream(file);
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r491007 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/output/ByteArrayOutputStream.java src/test/org/apache/commons/io/output/ByteArrayOutputStrea

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 05:50:34 2006
New Revision: 491007

URL: http://svn.apache.org/viewvc?view=revrev=491007
Log:
IO-97 - ByteArrayOutputStream performance enhancements, from Holger Hoffstatte

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/ByteArrayOutputStreamTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=491007r1=491006r2=491007
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Fri Dec 29 05:50:34 2006
@@ -189,6 +189,9 @@
 - NullReader
   - New reader that emulates a reader of a specified size
 
+- ByteArrayOutputStream  [IO-97]
+  - Performance enhancements
+
 
 Feedback
 

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java?view=diffrev=491007r1=491006r2=491007
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
 Fri Dec 29 05:50:34 2006
@@ -44,14 +44,23 @@
  * deprecated toString(int) method that has been ignored.
  * 
  * @author a href=mailto:[EMAIL PROTECTED]Jeremias Maerki/a
+ * @author Holger Hoffstatte
  * @version $Id$
  */
 public class ByteArrayOutputStream extends OutputStream {
 
+/** A singleton empty byte array. */
+private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
+
+/** The list of buffers, which grows and never reduces. */
 private List buffers = new ArrayList();
+/** The index of the current buffer. */
 private int currentBufferIndex;
+/** The total count of bytes in all the filled buffers. */
 private int filledBufferSum;
+/** The current buffer. */
 private byte[] currentBuffer;
+/** The total count of bytes written. */
 private int count;
 
 /**
@@ -85,7 +94,7 @@
  * @return the buffer
  */
 private byte[] getBuffer(int index) {
-return (byte[])buffers.get(index);
+return (byte[]) buffers.get(index);
 }
 
 /**
@@ -123,7 +132,7 @@
 /**
  * @see java.io.OutputStream#write(byte[], int, int)
  */
-public synchronized void write(byte[] b, int off, int len) {
+public void write(byte[] b, int off, int len) {
 if ((off  0) 
 || (off  b.length) 
 || (len  0) 
@@ -133,34 +142,40 @@
 } else if (len == 0) {
 return;
 }
-int newcount = count + len;
-int remaining = len;
-int inBufferPos = count - filledBufferSum;
-while (remaining  0) {
-int part = Math.min(remaining, currentBuffer.length - inBufferPos);
-System.arraycopy(b, off + len - remaining, currentBuffer, 
inBufferPos, part);
-remaining -= part;
-if (remaining  0) {
-needNewBuffer(newcount);
-inBufferPos = 0;
+synchronized (this) {
+int newcount = count + len;
+int remaining = len;
+int inBufferPos = count - filledBufferSum;
+while (remaining  0) {
+int part = Math.min(remaining, currentBuffer.length - 
inBufferPos);
+System.arraycopy(b, off + len - remaining, currentBuffer, 
inBufferPos, part);
+remaining -= part;
+if (remaining  0) {
+needNewBuffer(newcount);
+inBufferPos = 0;
+}
 }
+count = newcount;
 }
-count = newcount;
 }
 
 /**
- * Calls the write(byte[]) method.
- *
  * @see java.io.OutputStream#write(int)
  */
 public synchronized void write(int b) {
-write(new byte[] {(byte)b}, 0, 1);
+int inBufferPos = count - filledBufferSum;
+if (inBufferPos == currentBuffer.length) {
+needNewBuffer(count + 1);
+inBufferPos = 0;
+}
+currentBuffer[inBufferPos] = (byte) b;
+count++;
 }
 
 /**
  * @see java.io.ByteArrayOutputStream#size()
  */
-public int size() {
+public synchronized int size() {
 return count;
 }
 
@@ -216,8 +231,11 @@
  */
 public synchronized byte[] toByteArray() {
 int remaining = count;
+if (remaining == 0) {
+return EMPTY_BYTE_ARRAY

svn commit: r491050 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/ObjectUtils.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 09:04:00 2006
New Revision: 491050

URL: http://svn.apache.org/viewvc?view=revrev=491050
Log:
LANG-291 - Move min/max methods above inner class, add javadoc and format

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/ObjectUtils.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/ObjectUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/ObjectUtils.java?view=diffrev=491050r1=491049r2=491050
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/ObjectUtils.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/ObjectUtils.java
 Fri Dec 29 09:04:00 2006
@@ -237,6 +237,50 @@
 return obj == null ? nullStr : obj.toString();
 }
 
+// Min/Max
+//---
+/**
+ * Null safe comparison of Comparables.
+ * 
+ * @param c1  the first comparable, may be null
+ * @param c2  the second comparable, may be null
+ * @return
+ *  ul
+ *   liIf both objects are non-null and unequal, the lesser object.
+ *   liIf both objects are non-null and equal, c1.
+ *   liIf one of the comparables is null, the non-null object.
+ *   liIf both the comparables are null, null is returned.
+ *  /ul
+ */
+public static Object min(Comparable c1, Comparable c2) {
+if (c1 != null  c2 != null) {
+return c1.compareTo(c2)  1 ? c1 : c2;
+} else {
+return c1 != null ? c1 : c2;
+}  
+}
+
+/**
+ * Null safe comparison of Comparables.
+ * 
+ * @param c1  the first comparable, may be null
+ * @param c2  the second comparable, may be null
+ * @return
+ *  ul
+ *   liIf both objects are non-null and unequal, the greater object.
+ *   liIf both objects are non-null and equal, c1.
+ *   liIf one of the comparables is null, the non-null object.
+ *   liIf both the comparables are null, null is returned.
+ *  /ul
+ */
+public static Object max(Comparable c1, Comparable c2) {
+if (c1 != null  c2 != null) {
+return c1.compareTo(c2) = 0 ? c1 : c2;
+} else {
+return c1 != null ? c1 : c2;
+}
+}
+
 // Null
 //---
 /**
@@ -277,52 +321,5 @@
 return ObjectUtils.NULL;
 }
 }
-
-
-/**
- * Null safe comparison of Comparables.
- * 
- * @param c1
- * @param c2
- * @return
- *  ul
- *   liIf both objects are non-null and unequal, the lesser object.
- *   liIf both objects are non-null and equal, c1.
- *   liIf one of the comparables is null, the non-null object.
- *   liIf both the comparables are null, null is returned.
- *  /ul
- */
-public static Object min( Comparable c1, Comparable c2 ) {
-if ( c1 != null  c2 != null ) {
-return c1.compareTo( c2 )  1 ? c1 : c2;
-}
-else {
-return c1 != null ? c1 : c2;
-}  
-}
-
-/**
- * Null safe comparison of Comparables.
- * 
- * @param c1
- * @param c2
- * @return
- *  ul
- *   liIf both objects are non-null and unequal, the greater object.
- *   liIf both objects are non-null and equal, c1.
- *   liIf one of the comparables is null, the non-null object.
- *   liIf both the comparables are null, null is returned.
- *  /ul
- */
-public static Object max( Comparable c1, Comparable c2 ) {
-if ( c1 != null  c2 != null ) {
-return c1.compareTo( c2 ) = 0 ? c1 : c2;
-}
-else {
-return c1 != null ? c1 : c2;
-}  
-}
-
-
-
+
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r491052 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 09:16:37 2006
New Revision: 491052

URL: http://svn.apache.org/viewvc?view=revrev=491052
Log:
Avoid new Boolean() via BooleanUtils

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java?view=diffrev=491052r1=491051r2=491052
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
 Fri Dec 29 09:16:37 2006
@@ -19,6 +19,8 @@
 
 import java.io.Serializable;
 
+import org.apache.commons.lang.BooleanUtils;
+
 /**
  * A mutable codeboolean/code wrapper.
  * 
@@ -121,9 +123,7 @@
  * @return the value as a Boolean
  */
 public Object getValue() {
-return new Boolean(this.value);
-// TODO: JDK 1.4+
-//return Boolean.valueOf(this.value);
+return BooleanUtils.toBooleanObject(this.value);
 }
 
 /**



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r491056 - /jakarta/commons/proper/io/trunk/project.xml

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 09:34:25 2006
New Revision: 491056

URL: http://svn.apache.org/viewvc?view=revrev=491056
Log:
IO-97 - ByteArrayOutputStream performance enhancements, from Holger Hoffstatte

Modified:
jakarta/commons/proper/io/trunk/project.xml

Modified: jakarta/commons/proper/io/trunk/project.xml
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/project.xml?view=diffrev=491056r1=491055r2=491056
==
--- jakarta/commons/proper/io/trunk/project.xml (original)
+++ jakarta/commons/proper/io/trunk/project.xml Fri Dec 29 09:34:25 2006
@@ -199,6 +199,9 @@
   nameJim Harrington/name
 /contributor
 contributor
+  nameHolger Hoffstatte/name
+/contributor
+contributor
   nameThomas Ledoux/name
 /contributor
 contributor



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r491059 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DurationFormatUtils.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 09:44:59 2006
New Revision: 491059

URL: http://svn.apache.org/viewvc?view=revrev=491059
Log:
Fix javadoc link

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DurationFormatUtils.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DurationFormatUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DurationFormatUtils.java?view=diffrev=491059r1=491058r2=491059
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DurationFormatUtils.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DurationFormatUtils.java
 Fri Dec 29 09:44:59 2006
@@ -261,8 +261,8 @@
  * choosing March - February = 1 month and then calculating days 
  * backwards. /p
  *
- * pFor more control, the Joda Time library is recommended
- * (a href=http://joda-time.sf.net/;). /p
+ * pFor more control, the a 
href=http://joda-time.sf.net/;Joda-Time/a
+ * library is recommended./p
  * 
  * @param startMillis  the start of the duration
  * @param endMillis  the end of the duration



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r491063 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java

2006-12-29 Thread scolebourne
Author: scolebourne
Date: Fri Dec 29 09:55:32 2006
New Revision: 491063

URL: http://svn.apache.org/viewvc?view=revrev=491063
Log:
LANG-301 - Document cloneReset()

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java?view=diffrev=491063r1=491062r2=491063
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 Fri Dec 29 09:55:32 2006
@@ -1099,6 +1099,7 @@
  * @throws CloneNotSupportedException if there is a problem cloning
  */
 Object cloneReset() throws CloneNotSupportedException {
+// this method exists to enable 100% test coverage
 StrTokenizer cloned = (StrTokenizer) super.clone();
 if (cloned.chars != null) {
 cloned.chars = (char[]) cloned.chars.clone();



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r490831 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileUtils.java

2006-12-28 Thread scolebourne
Author: scolebourne
Date: Thu Dec 28 13:32:16 2006
New Revision: 490831

URL: http://svn.apache.org/viewvc?view=revrev=490831
Log:
IO-104 - Add release notes for copyFileToDirectory(File, File, boolean)

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=490831r1=490830r2=490831
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Thu Dec 28 13:32:16 2006
@@ -109,6 +109,9 @@
 - FileUtils.checksum, FileUtils.checksumCRC32
   - add methods to create a checksum of a file
 
+- FileUtils.copyFileToDirectory  [IO-104]
+  - add variant that optionally retains the file date
+
 - FileDeleteStrategy
 - FileCleaner[IO-56,IO-70]
   - FileDeleteStrategy is a strategy for handling file deletion

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=diffrev=490831r1=490830r2=490831
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
Thu Dec 28 13:32:16 2006
@@ -500,6 +500,7 @@
  * @throws IOException if source or destination is invalid
  * @throws IOException if an IO error occurs during copying
  * @see #copyFile(File, File, boolean)
+ * @since Commons IO 1.3
  */
 public static void copyFileToDirectory(File srcFile, File destDir, boolean 
preserveFileDate) throws IOException {
 if (destDir == null) {



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r490858 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileUtils.java src/test/org/apache/commons/io/FileUtilsTestCase.java

2006-12-28 Thread scolebourne
Author: scolebourne
Date: Thu Dec 28 14:50:07 2006
New Revision: 490858

URL: http://svn.apache.org/viewvc?view=revrev=490858
Log:
IO-107 - Add FileUtils.openOutputStream, creating parent directories if required

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=490858r1=490857r2=490858
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Thu Dec 28 14:50:07 2006
@@ -102,6 +102,9 @@
   - wildcardMatch - new method that has IOCase as a parameter
   - equals - new method that has IOCase as a parameter
 
+- FileUtils.openOutputStream  [IO-107]
+  - new method to open a FileOutputStream, creating parent directories if 
required
+
 - FileUtils.isFileOlder
   - add methods to check if a file is older (i.e. isFileOlder()) - counterparts
 to the existing isFileNewer() methods.

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=diffrev=490858r1=490857r2=490858
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
Thu Dec 28 14:50:07 2006
@@ -107,6 +107,39 @@
 
 //---
 /**
+ * Opens a [EMAIL PROTECTED] FileOutputStream} for the specified file, 
checking and
+ * creating the parent directory if it does not exist.
+ * p
+ * At the end of the method either the stream will be successfully opened,
+ * or an exception will have been thrown.
+ * p
+ * The parent directory will be created if it does not exist.
+ * The file will be created if it does not exist.
+ * An exception is thrown if the file object exists but is a directory.
+ * An exception is thrown if the parent directory cannot be created.
+ * 
+ * @param file  the file to create, not null
+ * @throws IOException if the file object is a directory
+ * @throws IOException if a parent directory needs creating but that fails
+ */
+public static FileOutputStream openOutputStream(File file) throws 
IOException {
+if (file.exists()) {
+if (file.isDirectory()) {
+throw new IOException(File ' + file + ' exists but is a 
directory);
+}
+} else {
+File parent = file.getParentFile();
+if (parent.exists() == false) {
+if (parent.mkdirs() == false) {
+throw new IOException(File ' + file + ' could not be 
created);
+}
+}
+}
+return new FileOutputStream(file);
+}
+
+//---
+/**
  * Returns a human-readable version of the file size, where the input
  * represents a specific number of bytes.
  *

Modified: 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java?view=diffrev=490858r1=490857r2=490858
==
--- 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
 Thu Dec 28 14:50:07 2006
@@ -102,8 +102,55 @@
 FileUtils.deleteDirectory(getTestDirectory());
 }
 
-// byteCountToDisplaySize
+//---
+public void test_openOutputStream_exists() throws Exception {
+File file = new File(getTestDirectory(), test.txt);
+createLineBasedFile(file, new String[] {Hello});
+FileOutputStream out = null;
+try {
+out = FileUtils.openOutputStream(file);
+out.write(0);
+} finally {
+IOUtils.closeQuietly(out);
+}
+assertEquals(true, file.exists());
+}
+
+public void test_openOutputStream_existsButIsDirectory() throws Exception {
+File directory = new File(getTestDirectory(), subdir);
+directory.mkdirs();
+try {
+FileUtils.openOutputStream(directory);
+fail();
+} catch (IOException

svn commit: r490867 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileUtils.java

2006-12-28 Thread scolebourne
Author: scolebourne
Date: Thu Dec 28 15:13:32 2006
New Revision: 490867

URL: http://svn.apache.org/viewvc?view=revrev=490867
Log:
IO-107 - Use FileUtils.openOutputStream, thus creating parent directories if 
required

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=490867r1=490866r2=490867
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Thu Dec 28 15:13:32 2006
@@ -104,16 +104,22 @@
 
 - FileUtils.openOutputStream  [IO-107]
   - new method to open a FileOutputStream, creating parent directories if 
required
+- FileUtils.touch
+- FileUtils.copyURLToFile
+- FileUtils.writeStringToFile
+- FileUtils.writeByteArrayToFile
+- FileUtils.writeLines
+  - enhanced to create parent directories if required
 
 - FileUtils.isFileOlder
-  - add methods to check if a file is older (i.e. isFileOlder()) - counterparts
+  - new methods to check if a file is older (i.e. isFileOlder()) - counterparts
 to the existing isFileNewer() methods.
 
 - FileUtils.checksum, FileUtils.checksumCRC32
-  - add methods to create a checksum of a file
+  - new methods to create a checksum of a file
 
 - FileUtils.copyFileToDirectory  [IO-104]
-  - add variant that optionally retains the file date
+  - new variant that optionally retains the file date
 
 - FileDeleteStrategy
 - FileCleaner[IO-56,IO-70]

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=diffrev=490867r1=490866r2=490867
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
Thu Dec 28 15:13:32 2006
@@ -116,6 +116,7 @@
  * The parent directory will be created if it does not exist.
  * The file will be created if it does not exist.
  * An exception is thrown if the file object exists but is a directory.
+ * An exception is thrown if the file exists but cannot be written to.
  * An exception is thrown if the parent directory cannot be created.
  * 
  * @param file  the file to create, not null
@@ -127,6 +128,9 @@
 if (file.isDirectory()) {
 throw new IOException(File ' + file + ' exists but is a 
directory);
 }
+if (file.canWrite() == false) {
+throw new IOException(File ' + file + ' cannot be written 
to);
+}
 } else {
 File parent = file.getParentFile();
 if (parent.exists() == false) {
@@ -168,14 +172,15 @@
  * closed without modifying it, but updating the file date and time.
  * p
  * NOTE: As from v1.3, this method throws an IOException if the last
- * modified date of the file cannot be set
+ * modified date of the file cannot be set. Also, as from v1.3 this method
+ * creates parent directories if they do not exist.
  *
  * @param file  the File to touch
  * @throws IOException If an I/O problem occurs
  */
 public static void touch(File file) throws IOException {
 if (!file.exists()) {
-OutputStream out = new FileOutputStream(file);
+OutputStream out = openOutputStream(file);
 IOUtils.closeQuietly(out);
 }
 boolean success = file.setLastModified(System.currentTimeMillis());
@@ -790,34 +795,19 @@
  * will be created if they don't already exist. codedestination/code
  * will be overwritten if it already exists.
  *
- * @param source A codeURL/code to copy bytes from.
- * @param destination A non-directory codeFile/code to write bytes to
- * (possibly overwriting).
- *
- * @throws IOException if
- * ul
- *  licodesource/code URL cannot be opened/li
- *  licodedestination/code cannot be written to/li
- *  lian IO error occurs during copying/li
- * /ul
+ * @param source  the codeURL/code to copy bytes from, not null
+ * @param destination  the non-directory codeFile/code to write bytes 
to
+ *  (possibly overwriting), not null
+ * @throws IOException if codesource/code URL cannot be opened
+ * @throws IOException if codedestination/code is a directory
+ * @throws IOException if codedestination/code cannot be written
+ * @throws IOException if codedestination/code needs creating but 
can't be
+ * @throws IOException if an IO error occurs during copying
  */
 public static void

svn commit: r482423 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileUtils.java

2006-12-04 Thread scolebourne
Author: scolebourne
Date: Mon Dec  4 16:12:58 2006
New Revision: 482423

URL: http://svn.apache.org/viewvc?view=revrev=482423
Log:
IO-100 - FileUtils.touch now throws an exception if it fails

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=482423r1=482422r2=482423
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Mon Dec  4 16:12:58 2006
@@ -22,6 +22,7 @@
 Source compatible - Yes
 
 Semantic compatible - Yes
+  Check the bug fixes section for semantic bug fixes
 
 
 Deprecations from 1.2
@@ -55,6 +56,11 @@
   - Fixed resource leak leading to 'Too many open files' error
   - Previously did not destroy Process instances (as JDK Javadoc is so poor)
   - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4801027
+
+- FileUtils.touch [IO-100]
+  - The touch method previously gave no indication when the file could not
+be touched successfully (such as due to access restrictions) - it now
+throws an IOException if the last modified date cannot be changed
 
 - FileCleaner
   - This now handles the situation where an error occurs when deleting the file

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=diffrev=482423r1=482422r2=482423
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
Mon Dec  4 16:12:58 2006
@@ -133,6 +133,9 @@
  * Implements the same behaviour as the touch utility on Unix. It creates
  * a new file with size 0 or, if the file exists already, it is opened and
  * closed without modifying it, but updating the file date and time.
+ * p
+ * NOTE: As from v1.3, this method throws an IOException if the last
+ * modified date of the file cannot be set
  *
  * @param file  the File to touch
  * @throws IOException If an I/O problem occurs
@@ -143,7 +146,7 @@
 IOUtils.closeQuietly(out);
 }
 boolean success = file.setLastModified(System.currentTimeMillis());
-if(!success) {
+if (!success) {
 throw new IOException(Unable to set the last modification time 
for  + file);
 }
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r482437 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt project.xml src/java/org/apache/commons/io/FileCleaner.java src/test/org/apache/commons/io/FileCleanerTestCase.java

2006-12-04 Thread scolebourne
Author: scolebourne
Date: Mon Dec  4 17:13:05 2006
New Revision: 482437

URL: http://svn.apache.org/viewvc?view=revrev=482437
Log:
IO-99 - FileCleaner.exitWhenFinished, to allow the thread to be terminated
includes some code from Jochen Wiedmann

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
jakarta/commons/proper/io/trunk/project.xml

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileCleanerTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=482437r1=482436r2=482437
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Mon Dec  4 17:13:05 2006
@@ -110,6 +110,9 @@
   - This can be used as a calback in FileCleaner
   - Together these allow FileCleaner to do a forceDelete to kill directories
 
+- FileCleaner.exitWhenFinished [IO-99]
+  - A new method that allows the internal cleaner thread to be cleanly 
terminated
+
 - WildcardFileFilter
   - Replacement for WildcardFilter
   - Accepts both files and directories

Modified: jakarta/commons/proper/io/trunk/project.xml
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/project.xml?view=diffrev=482437r1=482436r2=482437
==
--- jakarta/commons/proper/io/trunk/project.xml (original)
+++ jakarta/commons/proper/io/trunk/project.xml Mon Dec  4 17:13:05 2006
@@ -224,6 +224,9 @@
   nameJames Urie/name
 /contributor
 contributor
+  nameJochen Wiedmann/name
+/contributor
+contributor
   nameFrank W. Zammetti/name
 /contributor
   /contributors

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java?view=diffrev=482437r1=482436r2=482437
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java 
Mon Dec  4 17:13:05 2006
@@ -29,6 +29,12 @@
  * This utility creates a background thread to handle file deletion.
  * Each file to be deleted is registered with a handler object.
  * When the handler object is garbage collected, the file is deleted.
+ * p
+ * In an environment with multiple class loaders (a servlet container, for
+ * example), you should consider stopping the background thread if it is no
+ * longer needed. This is done by invoking the method
+ * [EMAIL PROTECTED] [EMAIL PROTECTED] #exitWhenFinished}, typically in
+ * [EMAIL PROTECTED] javax.servlet.ServletContextListener#contextDestroyed} or 
similar.
  *
  * @author Noel Bergman
  * @author Martin Cooper
@@ -39,47 +45,19 @@
 /**
  * Queue of codeTracker/code instances being watched.
  */
-private static ReferenceQueue /* Tracker */ q = new ReferenceQueue();
-
+static ReferenceQueue /* Tracker */ q = new ReferenceQueue();
 /**
  * Collection of codeTracker/code instances in existence.
  */
-private static Collection /* Tracker */ trackers = new Vector();
-
+static Collection /* Tracker */ trackers = new Vector();
 /**
- * The thread that will clean up registered files.
+ * Whether to terminate the thread when the tracking is complete.
  */
-private static Thread reaper = new Thread(File Reaper) {
-
-/**
- * Run the reaper thread that will delete files as their associated
- * marker objects are reclaimed by the garbage collector.
- */
-public void run() {
-for (;;) {
-Tracker tracker = null;
-try {
-// Wait for a tracker to remove.
-tracker = (Tracker) q.remove();
-} catch (Exception e) {
-continue;
-}
-
-tracker.delete();
-tracker.clear();
-trackers.remove(tracker);
-}
-}
-};
-
+static volatile boolean exitWhenFinished = false;
 /**
- * The static initializer that starts the reaper thread.
+ * The thread that will clean up registered files.
  */
-static {
-reaper.setPriority(Thread.MAX_PRIORITY);
-reaper.setDaemon(true);
-reaper.start();
-}
+static Thread reaper;
 
 //---
 /**
@@ -109,7 +87,7 @@
 if (file == null) {
 throw new NullPointerException(The file must not be null);
 }
-trackers.add

svn commit: r481847 - in /jakarta/commons/proper/io/trunk/src: java/org/apache/commons/io/DirectoryWalker.java test/org/apache/commons/io/DirectoryWalkerTestCase.java

2006-12-03 Thread scolebourne
Author: scolebourne
Date: Sun Dec  3 10:05:37 2006
New Revision: 481847

URL: http://svn.apache.org/viewvc?view=revrev=481847
Log:
Add additional cancellation support, including checkIsCancelled() and 
handleIsCancelled()

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/DirectoryWalkerTestCase.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java?view=diffrev=481847r1=481846r2=481847
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 Sun Dec  3 10:05:37 2006
@@ -184,13 +184,15 @@
  * a name=external/a
  * h43.1 External / Multi-threaded/h4
  *
- * This example provides a codecancel()/code method for external processes 
to
- * indcate that processing must stop. Calling this method sets a
- * a 
href=http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#36930;volatile/a
- * flag to (hopefully) ensure it will work properly in
- * a multi-threaded environment. In this implementation the flag is checked in 
two
- * of the lifecycle methods using a convenience 
codecheckIfCancelled()/code method
- * which throws a [EMAIL PROTECTED] CancelException} if cancellation has been 
requested.
+ * This example provides a public codecancel()/code method that can be
+ * called by another thread to stop the processing. A typical example use-case
+ * would be a cancel button on a GUI. Calling this method sets a
+ * a 
href=http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#36930;
+ * volatile/a flag to ensure it will work properly in a multi-threaded 
environment.
+ * The flag is returned by the codehandleIsCancelled()/code method, which
+ * will cause the walk to stop immediately. The codehandleCancelled()/code
+ * method will be the next, and last, callback method received once 
cancellation
+ * has occurred.
  *
  * pre
  *  public class FooDirectoryWalker extends DirectoryWalker {
@@ -201,24 +203,12 @@
  *cancelled = true;
  *}
  *
- *protected boolean handleDirectory(File directory, int depth, Collection 
results) throws IOException {
- *checkIfCancelled(directory, depth); // Cancel Check
- *return true;
- *}
- *
- *protected void handleFile(File file, int depth, Collection results) 
throws IOException {
- *checkIfCancelled(file, depth);  // Cancel Check
- *results.add(file);
- *}
- *
- *private void checkIfCancelled(File file, int depth) throws 
CancelException {
- *if (cancelled) {
- *throw new CancelException(file, depth);
- *}
+ *private void handleIsCancelled(File file, int depth, Collection results) 
{
+ *return cancelled;
  *}
  *
  *protected void handleCancelled(File startDirectory, Collection results, 
CancelException cancel) {
- *// implement cancel processing here
+ *// implement processing required when a cancellation occurs
  *}
  *  }
  * /pre
@@ -250,7 +240,7 @@
  *}
  *
  *protected void handleCancelled(File startDirectory, Collection results, 
CancelException cancel) {
- *// implement cancel processing here
+ *// implement processing required when a cancellation occurs
  *}
  *  }
  * /pre
@@ -324,7 +314,7 @@
 /**
  * Internal method that walks the directory hierarchy in a depth-first 
manner.
  * p
- * Most users of this class do not need to call this method. This method 
will
+ * Users of this class do not need to call this method. This method will
  * be called automatically by another (public) method on the specific 
subclass.
  * p
  * Writers of subclasses should call this method to start the directory 
walk.
@@ -336,7 +326,7 @@
  * @throws NullPointerException if the start directory is null
  * @throws IOException if an I/O Error occurs
  */
-protected void walk(File startDirectory, Collection results) throws 
IOException {
+protected final void walk(File startDirectory, Collection results) throws 
IOException {
 if (startDirectory == null) {
 throw new NullPointerException(Start Directory is null);
 }
@@ -358,10 +348,12 @@
  * @throws IOException if an I/O Error occurs
  */
 private void walk(File directory, int depth, Collection results) throws 
IOException {
+checkIfCancelled(directory, depth, results);
 if (handleDirectory(directory, depth, results)) {
 handleDirectoryStart(directory, depth, results);
 int childDepth = depth + 1;
 if (depthLimit  0

svn commit: r481848 - /jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

2006-12-03 Thread scolebourne
Author: scolebourne
Date: Sun Dec  3 10:10:56 2006
New Revision: 481848

URL: http://svn.apache.org/viewvc?view=revrev=481848
Log:
IO-86 - Release notes for DirectoryWalker

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=481848r1=481847r2=481848
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Sun Dec  3 10:10:56 2006
@@ -78,6 +78,12 @@
 
 Enhancements from 1.2
 -
+- DirectoryWalker [IO-86]
+  - New class designed for subclassing to walk through a set of files.
+DirectoryWalker provides the walk of the directories, filtering of
+directories and files, and cancellation support. The subclass must provide
+the specific behaviour, such as text searching or image processing.
+
 - IOCase
   - New class/enumeration for case-sensitivity control
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r481854 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/IOUtils.java src/test/org/apache/commons/io/IOUtilsCopyTestCase.java

2006-12-03 Thread scolebourne
Author: scolebourne
Date: Sun Dec  3 10:30:07 2006
New Revision: 481854

URL: http://svn.apache.org/viewvc?view=revrev=481854
Log:
IO-84 - Make IOUtils.copy return -1 not an exception for large files, as more 
backwards compatible

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/IOUtilsCopyTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=481854r1=481853r2=481854
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Sun Dec  3 10:30:07 2006
@@ -60,15 +60,14 @@
   - This now handles the situation where an error occurs when deleting the file
 
 - IOUtils.copy [IO-84]
-  - The copy(InputStream, OutputStream) method now throws an exception if
-the count is greater than an int
-  - The copy(Reader, Writer) method now throws an exception if
-the count is greater than an int
+  - Copy methods could return inaccurate byte/char count for large streams
+  - The copy(InputStream, OutputStream) method now returns -1 if the count is 
greater than an int
+  - The copy(Reader, Writer) method now throws now returns -1 if the count is 
greater than an int
   - Added a new copyLarge(InputStream, OutputStream) method that returns a long
   - Added a new copyLarge(Reader, Writer) method that returns a long
 
 - CountingInputStream/CountingOutputStream [IO-84]
-  - methods were declared as int thus the count was innacurate for large 
streams
+  - Methods were declared as int thus the count was innacurate for large 
streams
   - new long based methods getByteCount()/resetByteCount() added
   - existing methods changed to throw an exception if the count is greater 
than an int
 

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=diffrev=481854r1=481853r2=481854
==
--- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java 
(original)
+++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java 
Sun Dec  3 10:30:07 2006
@@ -982,10 +982,10 @@
  * This method buffers the input internally, so there is no need to use a
  * codeBufferedInputStream/code.
  * p
- * Large streams (over 2GB) will throw an [EMAIL PROTECTED] 
ArithmeticException}
- * after the copy has completed since the correct number of bytes
- * cannot be returned as an int. For large streams use the
- * codecopyLarge(InputStream, OutputStream)/code method.
+ * Large streams (over 2GB) will return a bytes copied value of
+ * code-1/code after the copy has completed since the correct
+ * number of bytes cannot be returned as an int. For large streams
+ * use the codecopyLarge(InputStream, OutputStream)/code method.
  * 
  * @param input  the codeInputStream/code to read from
  * @param output  the codeOutputStream/code to write to
@@ -995,13 +995,12 @@
  * @throws ArithmeticException if the byte count is too large
  * @since Commons IO 1.1
  */
-public static int copy(InputStream input, OutputStream output)
-throws IOException {
+public static int copy(InputStream input, OutputStream output) throws 
IOException {
 long count = copyLarge(input, output);
 if (count  Integer.MAX_VALUE) {
-throw new ArithmeticException(The byte count  + count +  is too 
large to be converted to an int);
+return -1;
 }
-return (int)count;
+return (int) count;
 }
 
 /**
@@ -1088,10 +1087,10 @@
  * This method buffers the input internally, so there is no need to use a
  * codeBufferedReader/code.
  * p
- * Large streams (over 2GB) will throw an [EMAIL PROTECTED] 
ArithmeticException}
- * after the copy has completed since the correct number of characters
- * cannot be returned as an int. For large streams use the
- * codecopyLarge(Reader, Writer)/code method.
+ * Large streams (over 2GB) will return a chars copied value of
+ * code-1/code after the copy has completed since the correct
+ * number of chars cannot be returned as an int. For large streams
+ * use the codecopyLarge(Reader, Writer)/code method.
  *
  * @param input  the codeReader/code to read from
  * @param output  the codeWriter/code to write to
@@ -1104,9 +1103,9 @@
 public static int copy(Reader input, Writer output) throws IOException {
 long count = copyLarge(input, output);
 if (count

svn commit: r471498 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections: Closure.java Factory.java Predicate.java Transformer.java

2006-11-05 Thread scolebourne
Author: scolebourne
Date: Sun Nov  5 11:24:09 2006
New Revision: 471498

URL: http://svn.apache.org/viewvc?view=revrev=471498
Log:
Generify

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Closure.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Factory.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Predicate.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Transformer.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Closure.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Closure.java?view=diffrev=471498r1=471497r2=471498
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Closure.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Closure.java
 Sun Nov  5 11:24:09 2006
@@ -24,7 +24,8 @@
  * p
  * Standard implementations of common closures are provided by
  * [EMAIL PROTECTED] ClosureUtils}. These include method invokation and 
for/while loops.
- *  
+ * 
+ * @param T the type that the closure acts on
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
  *
@@ -32,7 +33,7 @@
  * @author Nicola Ken Barozzi
  * @author Stephen Colebourne
  */
-public interface Closure {
+public interface ClosureT {
 
 /**
  * Performs an action on the specified input object.
@@ -42,6 +43,6 @@
  * @throws IllegalArgumentException (runtime) if the input is invalid
  * @throws FunctorException (runtime) if any other error occurs
  */
-public void execute(Object input);
+public void execute(T input);
 
 }

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Factory.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Factory.java?view=diffrev=471498r1=471497r2=471498
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Factory.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Factory.java
 Sun Nov  5 11:24:09 2006
@@ -26,13 +26,14 @@
  * [EMAIL PROTECTED] FactoryUtils}. These include factories that return a 
constant,
  * a copy of a prototype or a new instance.
  * 
+ * @param T the type that the factory creates
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
  *
  * @author Arron Bates
  * @author Stephen Colebourne
  */
-public interface Factory {
+public interface FactoryT {
 
 /**
  * Create a new object.
@@ -40,6 +41,6 @@
  * @return a new object
  * @throws FunctorException (runtime) if the factory cannot create an 
object
  */
-public Object create();
+public T create();
 
 }

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Predicate.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Predicate.java?view=diffrev=471498r1=471497r2=471498
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Predicate.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Predicate.java
 Sun Nov  5 11:24:09 2006
@@ -28,13 +28,14 @@
  * [EMAIL PROTECTED] PredicateUtils}. These include true, false, instanceof, 
equals, and,
  * or, not, method invokation and null testing.
  * 
+ * @param T the type that the predicate queries
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
  * 
  * @author James Strachan
  * @author Stephen Colebourne
  */
-public interface Predicate {
+public interface PredicateT {
 
 /**
  * Use the specified parameter to perform a test that returns true or 
false.
@@ -45,6 +46,6 @@
  * @throws IllegalArgumentException (runtime) if the input is invalid
  * @throws FunctorException (runtime) if the predicate encounters a problem
  */
-public boolean evaluate(Object object);
+public boolean evaluate(T object);
 
 }

Modified: 
jakarta/commons/proper/collections/branches

svn commit: r471575 - /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/

2006-11-05 Thread scolebourne
Author: scolebourne
Date: Sun Nov  5 15:58:08 2006
New Revision: 471575

URL: http://svn.apache.org/viewvc?view=revrev=471575
Log:
Generify and remove AbstractSerializableCollectionDecorator

Removed:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractSerializableCollectionDecorator.java
Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/PredicatedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/TransformedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java?view=diffrev=471575r1=471574r2=471575
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
 Sun Nov  5 15:58:08 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.collections.collection;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -41,7 +42,11 @@
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public abstract class AbstractCollectionDecoratorE implements CollectionE {
+public abstract class AbstractCollectionDecoratorE
+implements CollectionE, Serializable {
+
+/** Serialization version */
+private static final long serialVersionUID = 6249888059822088500L;
 
 /** The collection being decorated */
 protected CollectionE collection;

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/PredicatedCollection.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/PredicatedCollection.java?view=diffrev=471575r1=471574r2=471575
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/PredicatedCollection.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/PredicatedCollection.java
 Sun Nov  5 15:58:08 2006
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.collection;
 
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.apache.commons.collections.Predicate;
 
@@ -34,19 +33,20 @@
  * p
  * This class is Serializable from Commons Collections 3.1.
  *
+ * @param E the type of the elements in the collection
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  * 
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public class PredicatedCollection extends 
AbstractSerializableCollectionDecorator {
+public class PredicatedCollectionE extends AbstractCollectionDecoratorE {
 
 /** Serialization version */
 private static final long serialVersionUID = -5259182142076705162L;
 
 /** The predicate to use */
-protected final Predicate predicate;
+protected final Predicate? super E predicate;
 
 /**
  * Factory method to create a predicated (validating) collection.
@@ -54,14 +54,15 @@
  * If there are any elements already in the collection being decorated, 
they
  * are validated.
  * 
+ * @param T the type of the elements in the collection
  * @param coll  the collection to decorate, must not be null
  * @param predicate  the predicate to use for validation, must not be null
  * @return a new predicated collection
  * @throws IllegalArgumentException if collection or predicate is null
  * @throws IllegalArgumentException if the collection contains

svn commit: r471578 - /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/

2006-11-05 Thread scolebourne
Author: scolebourne
Date: Sun Nov  5 16:11:13 2006
New Revision: 471578

URL: http://svn.apache.org/viewvc?view=revrev=471578
Log:
Generify

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java?view=diffrev=471578r1=471577r2=471578
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
 Sun Nov  5 16:11:13 2006
@@ -121,7 +121,7 @@
  * @author Neil O'Toole
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestCollection extends AbstractTestObject {
+public abstract class AbstractTestCollectionT extends AbstractTestObject {
 
 //
 // NOTE: 
@@ -140,7 +140,7 @@
 /** 
  *  A collection instance that will be used for testing.
  */
-public Collection collection;
+public CollectionT collection;
 
 /** 
  *  Confirmed collection.  This is an instance of a collection that is
@@ -150,7 +150,7 @@
  *  collection, and then calling verify() to make sure your collection
  *  still matches the confirmed collection.
  */
-public Collection confirmed;
+public CollectionT confirmed;
 
 /**
  * JUnit constructor.
@@ -262,7 +262,7 @@
 // copy each collection value into an array
 Object[] confirmedValues = new Object[confirmedSize];
 
-Iterator iter;
+IteratorT iter;
 
 iter = confirmed.iterator(); 
 int pos = 0;
@@ -340,7 +340,7 @@
  *
  *  @return a confirmed empty collection
  */
-public abstract Collection makeConfirmedCollection();
+public abstract CollectionT makeConfirmedCollection();
 
 /**
  *  Returns a confirmed full collection.
@@ -350,12 +350,12 @@
  *
  *  @return a confirmed full collection
  */
-public abstract Collection makeConfirmedFullCollection();
+public abstract CollectionT makeConfirmedFullCollection();
 
 /**
  * Return a new, empty [EMAIL PROTECTED] Collection} to be used for 
testing.
  */
-public abstract Collection makeCollection();
+public abstract CollectionT makeCollection();
 
 /**
  *  Returns a full collection to be used for testing.  The collection
@@ -365,8 +365,8 @@
  *  the results of [EMAIL PROTECTED] #getFullElements()}.  Override this 
default
  *  if your collection doesn't support addAll.
  */
-public Collection makeFullCollection() {
-Collection c = makeCollection();
+public CollectionT makeFullCollection() {
+CollectionT c = makeCollection();
 c.addAll(Arrays.asList(getFullElements()));
 return c;
 }
@@ -381,10 +381,10 @@
 /**
  * Creates a new Map Entry that is independent of the first and the map.
  */
-public Map.Entry cloneMapEntry(Map.Entry entry) {
-HashMap map = new HashMap();
+public Map.EntryT, T cloneMapEntry(Map.EntryT, T entry) {
+HashMapT, T map = new HashMapT, T();
 map.put(entry.getKey(), entry.getValue());
-return (Map.Entry) map.entrySet().iterator().next();
+return map.entrySet().iterator().next();
 }
 
 //---
@@ -398,14 +398,14 @@
  *  override [EMAIL PROTECTED] #makeFullCollection()}, you Imust/I 
override
  *  this method to reflect the contents of a full collection.
  */
-public Object[] getFullElements() {
+public T[] getFullElements() {
 if (isNullSupported()) {
-ArrayList list = new ArrayList();
+ArrayListT list = new ArrayListT();
 list.addAll(Arrays.asList(getFullNonNullElements()));
 list.add(4, null

svn commit: r471579 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer: AbstractBufferDecorator.java BlockingBuffer.java BoundedBu

2006-11-05 Thread scolebourne
Author: scolebourne
Date: Sun Nov  5 16:14:58 2006
New Revision: 471579

URL: http://svn.apache.org/viewvc?view=revrev=471579
Log:
Generify, remove getBuffer() - use covariant decorated()

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java?view=diffrev=471579r1=471578r2=471579
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
 Sun Nov  5 16:14:58 2006
@@ -24,12 +24,15 @@
  * p
  * Methods are forwarded directly to the decorated buffer.
  *
+ * @param E the type of the elements in the buffer
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractBufferDecorator extends 
AbstractCollectionDecorator implements Buffer {
+public abstract class AbstractBufferDecoratorE
+extends AbstractCollectionDecoratorE
+implements BufferE {
 
 /**
  * Constructor only used in deserialization, do not use otherwise.
@@ -45,7 +48,7 @@
  * @param buffer  the buffer to decorate, must not be null
  * @throws IllegalArgumentException if list is null
  */
-protected AbstractBufferDecorator(Buffer buffer) {
+protected AbstractBufferDecorator(BufferE buffer) {
 super(buffer);
 }
 
@@ -53,27 +56,17 @@
  * Gets the buffer being decorated.
  * 
  * @return the decorated buffer
- * @deprecated use decorated()
  */
-protected Buffer getBuffer() {
-return decorated();
-}
-
-/**
- * Gets the buffer being decorated.
- * 
- * @return the decorated buffer
- */
-protected Buffer decorated() {
-return (Buffer) super.decorated();
+protected BufferE decorated() {
+return (BufferE) super.decorated();
 }
 
 //---
-public Object get() {
+public E get() {
 return decorated().get();
 }
 
-public Object remove() {
+public E remove() {
 return decorated().remove();
 }
 

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java?view=diffrev=471579r1=471578r2=471579
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
 Sun Nov  5 16:14:58 2006
@@ -45,10 +45,11 @@
  * @author Janek Bogucki
  * @author Phil Steitz
  * @author James Carman
+ * @param E the type of the elements in the buffer
  * @version $Revision$ $Date$
  * @since Commons Collections 3.0
  */
-public class BlockingBuffer extends SynchronizedBuffer {
+public class BlockingBufferE extends SynchronizedBufferE {
 
 /** Serialization version. */
 private static final long serialVersionUID = 1719328905017860541L;
@@ -58,25 +59,27 @@
 /**
  * Factory method to create a blocking buffer.
  *
+ * @param t the type of the elements in the buffer
  * @param buffer the buffer to decorate, must not be null
  * @return a new blocking Buffer
  * @throws IllegalArgumentException if buffer is null
  */
-public static Buffer decorate(Buffer buffer) {
-return new BlockingBuffer(buffer);
+public static T BufferT decorate(BufferT buffer) {
+return new BlockingBufferT(buffer);
 }
 
 /**
  * Factory method to create a blocking buffer with a timeout value

svn commit: r471580 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src: java/org/apache/commons/collections/collection/ test/org/apache/commons/collections/collection/ test/

2006-11-05 Thread scolebourne
Author: scolebourne
Date: Sun Nov  5 16:22:53 2006
New Revision: 471580

URL: http://svn.apache.org/viewvc?view=revrev=471580
Log:
Generify CompositeCollection

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/collection/TestCompositeCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestCompositeSet.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java?view=diffrev=471580r1=471579r2=471580
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java
 Sun Nov  5 16:22:53 2006
@@ -21,6 +21,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.commons.collections.iterators.EmptyIterator;
 import org.apache.commons.collections.iterators.IteratorChain;
@@ -33,6 +34,7 @@
  * Add and remove operations require the use of a pluggable strategy. If no 
  * strategy is provided then add and remove are unsupported.
  *
+ * @param E the type of the elements in the collection
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
@@ -40,42 +42,61 @@
  * @author Stephen Colebourne
  * @author Phil Steitz
  */
-public class CompositeCollection implements Collection {
+public class CompositeCollectionE implements CollectionE {
 
 /** CollectionMutator to handle changes to the collection */
-protected CollectionMutator mutator;
+protected CollectionMutatorE mutator;
 /** Collections in the composite */
-protected Collection[] all;
+protected ListCollectionE all = new ArrayListCollectionE();
 
 /**
  * Create an empty CompositeCollection.
  */
 public CompositeCollection() {
 super();
-this.all = new Collection[0];
 }
 
 /**
- * Create a Composite Collection with only coll composited.
- * 
- * @param coll  a collection to decorate
+ * Create a Composite Collection with one collection.
+ *
+ * @param compositeCollection  the Collection to be appended to the 
composite
  */
-public CompositeCollection(Collection coll) {
-this();
-this.addComposited(coll);
+public CompositeCollection(CollectionE compositeCollection) {
+super();
+addComposited(compositeCollection);
 }
 
 /**
- * Create a CompositeCollection with colls as the initial list of
- * composited collections.
+ * Create a Composite Collection with two collections.
+ *
+ * @param compositeCollection1  the Collection to be appended to the 
composite
+ * @param compositeCollection2  the Collection to be appended to the 
composite
+ */
+public CompositeCollection(CollectionE compositeCollection1, 
CollectionE compositeCollection2) {
+super();
+addComposited(compositeCollection1, compositeCollection2);
+}
+
+/**
+ * Create a Composite Collection with an array of collections.
  * 
- * @param colls  an array of collections to decorate
+ * @param compositeCollections  the collections to composite
  */
-public CompositeCollection(Collection[] colls) {
-this();
-this.addComposited(colls);
+public CompositeCollection(CollectionE[] compositeCollections) {
+super();
+addComposited(compositeCollections);
 }
 
+///**
+// * Create a Composite Collection extracting the collections from an 
iterable.
+// * 
+// * @param compositeCollections  the collections to composite
+// */
+//public CompositeCollection(IterableCollectionE compositeCollections) 
{
+//super();
+//addComposited(compositeCollections);
+//}
+
 //---
 /**
  * Gets the size of this composite collection.
@@ -86,8 +107,8 @@
  */
 public int size() {
 int size = 0;
-for (int i = this.all.length - 1; i = 0; i--) {
-size += this.all[i].size();
+for (CollectionE item : all) {
+size += item.size();
 }
 return size;
 }
@@ -100,8 +121,8 @@
  * @return true if all of the contained

svn commit: r471163 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch: ./ src/java/org/apache/commons/collections/ src/test/org/apache/commons/collections/

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 02:56:39 2006
New Revision: 471163

URL: http://svn.apache.org/viewvc?view=revrev=471163
Log:
Remove FastArrayList, FastHashMap, FastTreeMap

Removed:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/FastArrayList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/FastHashMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/FastTreeMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestFastArrayList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestFastArrayList1.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestFastHashMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestFastHashMap1.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestFastTreeMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestFastTreeMap1.java
Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/MapPerformance.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestAll.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt?view=diffrev=471163r1=471162r2=471163
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
 Sat Nov  4 02:56:39 2006
@@ -28,6 +28,13 @@
 
 - Removed all deprecated classes and methods
 
+- Removed FastArrayList
+  - use CopyOnWriteList
+- Removed FastHashMap
+  - use ConcurrentHashMap, but beware null keys and values
+- Removed FastTreeSet
+  - no direct replacement - use ConcurrentHashMap or synchronized TreeMap
+
 
 Feedback
 

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/MapPerformance.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/MapPerformance.java?view=diffrev=471163r1=471162r2=471163
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/MapPerformance.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/MapPerformance.java
 Sat Nov  4 02:56:39 2006
@@ -52,7 +52,7 @@
 Map flatMap = new Flat3Map(hashMap);
 System.out.println(flatMap);
 Map unmodHashMap = Collections.unmodifiableMap(new HashMap(hashMap));
-Map fastHashMap = new FastHashMap(hashMap);
+//Map fastHashMap = new FastHashMap(hashMap);
 Map treeMap = new TreeMap(hashMap);
 //Map linkedMap = new LinkedHashMap(hashMap);
 //Map syncMap = Collections.unmodifiableMap(new HashMap(hashMap));

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestAll.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestAll.java?view=diffrev=471163r1=471162r2=471163
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestAll.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestAll.java
 Sat Nov  4 02:56:39 2006
@@ -50,15 +50,9 @@
 
 suite.addTest(TestArrayStack.suite());
 suite.addTest(TestExtendedProperties.suite());
-suite.addTest(TestFastArrayList.suite());
-suite.addTest(TestFastArrayList1.suite());
-suite.addTest(TestFastHashMap.suite());
-suite.addTest(TestFastHashMap1.suite());
-suite.addTest(TestFastTreeMap.suite());
-suite.addTest(TestFastTreeMap1.suite());
 return

svn commit: r471166 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch: ./ src/java/org/apache/commons/collections/ src/java/org/apache/commons/collections/bag/ src/java/org/apa

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 03:33:22 2006
New Revision: 471166

URL: http://svn.apache.org/viewvc?view=revrev=471166
Log:
Removed Typed* containers such as TypedList and TypedMap as generics now 
provides type safety

Removed:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/TypedBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/TypedSortedBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/TypedBuffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/TypedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/TypedList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/TypedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/TypedSortedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/TypedSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/TypedSortedSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/bag/TestTypedBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/bag/TestTypedSortedBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/list/TestTypedList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestTypedSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestTypedSortedSet.java
Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BagUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BufferUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/CollectionUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ListUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SetUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestBagUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestCollectionUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestMapUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/bag/TestAll.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/list/TestAll.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestAll.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt?view=diffrev=471166r1=471165r2=471166
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
 Sat Nov  4 03:33:22 2006
@@ -35,6 +35,9 @@
 - Removed FastTreeSet
   - no direct replacement - use ConcurrentHashMap or synchronized TreeMap
 
+- Removed Typed* containers such as TypedList and TypedMap
+  - use generics for type safety, or Collections.checked*()
+
 
 Feedback
 

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BagUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BagUtils.java?view=diffrev=471166r1=471165r2=471166

svn commit: r471173 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch: ./ src/java/org/apache/commons/collections/buffer/ src/java/org/apache/commons/collections/collection/ sr

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 04:07:39 2006
New Revision: 471173

URL: http://svn.apache.org/viewvc?view=revrev=471173
Log:
Abstract*Decorator - Generify and use covariant return types

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/AbstractListDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt?view=diffrev=471173r1=471172r2=471173
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
 Sat Nov  4 04:07:39 2006
@@ -38,6 +38,10 @@
 - Removed Typed* containers such as TypedList and TypedMap
   - use generics for type safety, or Collections.checked*()
 
+- Switch Abstract*Decorator classes to expose decorated() protected method
+  instead of the decorated collection directly. Each class overrides 
decorated()
+  to add its type covariantly, thus getList()/getSet() etc. methods are removed
+
 
 Feedback
 

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java?view=diffrev=471173r1=471172r2=471173
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
 Sat Nov  4 04:07:39 2006
@@ -53,18 +53,28 @@
  * Gets the buffer being decorated.
  * 
  * @return the decorated buffer
+ * @deprecated use decorated()
  */
 protected Buffer getBuffer() {
-return (Buffer) getCollection();
+return decorated();
+}
+
+/**
+ * Gets the buffer being decorated.
+ * 
+ * @return the decorated buffer
+ */
+protected Buffer decorated() {
+return (Buffer) super.decorated();
 }
 
 //---
 public Object get() {
-return getBuffer().get();
+return decorated().get();
 }
 
 public Object remove() {
-return getBuffer().remove();
+return decorated().remove();
 }
 
 }

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java?view=diffrev=471173r1=471172r2=471173
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
 Sat Nov  4 04:07:39 2006
@@ -34,16 +34,17 @@
  * wrapped collection. This may be undesirable, for example if you are trying
  * to write an unmodifiable implementation it might provide a loophole.
  *
+ * @param E the type of the elements in the collection
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  * 
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public abstract class AbstractCollectionDecorator implements Collection {
+public abstract class AbstractCollectionDecoratorE implements CollectionE {
 
 /** The collection being decorated */
-protected Collection collection;
+protected CollectionE

svn commit: r471180 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections: bidimap/ map/

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 05:27:44 2006
New Revision: 471180

URL: http://svn.apache.org/viewvc?view=revrev=471180
Log:
Abstract*Decorator - Generify and use covariant return types

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java?view=diffrev=471180r1=471179r2=471180
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
 Sat Nov  4 05:27:44 2006
@@ -38,8 +38,9 @@
  * @author Stephen Colebourne
  */
 public abstract class AbstractBidiMapDecorator
-extends AbstractMapDecorator implements BidiMap {
-
+extends AbstractMapDecorator
+implements BidiMap {
+
 /**
  * Constructor that wraps (not copies).
  *
@@ -54,26 +55,36 @@
  * Gets the map being decorated.
  * 
  * @return the decorated map
+ * @deprecated use decorated()
  */
 protected BidiMap getBidiMap() {
-return (BidiMap) map;
+return decorated();
+}
+
+/**
+ * Gets the map being decorated.
+ * 
+ * @return the decorated map
+ */
+protected BidiMap decorated() {
+return (BidiMap) super.decorated();
 }
 
 //---
 public MapIterator mapIterator() {
-return getBidiMap().mapIterator();
+return decorated().mapIterator();
 }
 
 public Object getKey(Object value) {
-return getBidiMap().getKey(value);
+return decorated().getKey(value);
 }
 
 public Object removeValue(Object value) {
-return getBidiMap().removeValue(value);
+return decorated().removeValue(value);
 }
 
 public BidiMap inverseBidiMap() {
-return getBidiMap().inverseBidiMap();
+return decorated().inverseBidiMap();
 }
 
 }

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java?view=diffrev=471180r1=471179r2=471180
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
 Sat Nov  4 05:27:44 2006
@@ -37,8 +37,9 @@
  * @author Stephen Colebourne
  */
 public abstract class AbstractOrderedBidiMapDecorator
-extends AbstractBidiMapDecorator implements OrderedBidiMap {
-
+extends AbstractBidiMapDecorator
+implements OrderedBidiMap {
+
 /**
  * Constructor that wraps (not copies).
  *
@@ -53,34 +54,44 @@
  * Gets the map being decorated.
  * 
  * @return the decorated map
+ * @deprecated use decorated()
  */
 protected OrderedBidiMap getOrderedBidiMap() {
-return (OrderedBidiMap) map;
+return decorated();
+}
+
+/**
+ * Gets the map being decorated.
+ * 
+ * @return the decorated map
+ */
+protected OrderedBidiMap decorated() {
+return (OrderedBidiMap) super.decorated

svn commit: r471186 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src: java/org/apache/commons/collections/set/ test/org/apache/commons/collections/set/

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 05:47:51 2006
New Revision: 471186

URL: http://svn.apache.org/viewvc?view=revrev=471186
Log:
Remove getSet() and getSortedSet() - use decorated()

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestListOrderedSet.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java?view=diffrev=471186r1=471185r2=471186
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
 Sat Nov  4 05:47:51 2006
@@ -57,16 +57,6 @@
  * Gets the set being decorated.
  * 
  * @return the decorated set
- * @deprecated use decorated()
- */
-protected SetE getSet() {
-return decorated();
-}
-
-/**
- * Gets the set being decorated.
- * 
- * @return the decorated set
  */
 protected SetE decorated() {
 return (SetE) super.decorated();

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java?view=diffrev=471186r1=471185r2=471186
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
 Sat Nov  4 05:47:51 2006
@@ -54,16 +54,6 @@
 }
 
 /**
- * Gets the sorted set being decorated.
- * 
- * @return the decorated set
- * @deprecated use decorated()
- */
-protected SortedSetE getSortedSet() {
-return decorated();
-}
-
-/**
  * Gets the set being decorated.
  * 
  * @return the decorated set

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java?view=diffrev=471186r1=471185r2=471186
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
 Sat Nov  4 05:47:51 2006
@@ -123,17 +123,17 @@
 
 //---
 public SortedSet subSet(Object fromElement, Object toElement) {
-SortedSet sub = getSortedSet().subSet(fromElement, toElement);
+SortedSet sub = decorated().subSet(fromElement, toElement);
 return new UnmodifiableSortedSet(sub);
 }
 
 public SortedSet headSet(Object toElement) {
-SortedSet sub = getSortedSet().headSet(toElement);
+SortedSet sub = decorated().headSet(toElement);
 return new UnmodifiableSortedSet(sub);
 }
 
 public SortedSet tailSet(Object fromElement) {
-SortedSet sub = getSortedSet().tailSet(fromElement);
+SortedSet sub = decorated().tailSet(fromElement);
 return new UnmodifiableSortedSet(sub);
 }
 

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestListOrderedSet.java?view=diffrev=471186r1=471185r2

svn commit: r471189 - /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 05:57:57 2006
New Revision: 471189

URL: http://svn.apache.org/viewvc?view=revrev=471189
Log:
Remove getMap(), getOrderedMap() and getSortedMap() - use decorated()

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/ListOrderedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/MultiValueMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/TransformedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/TransformedSortedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java?view=diffrev=471189r1=471188r2=471189
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
 Sat Nov  4 05:57:57 2006
@@ -71,16 +71,6 @@
  * Gets the map being decorated.
  * 
  * @return the decorated map
- * @deprecated use decorated()
- */
-protected MapK, V getMap() {
-return decorated();
-}
-
-/**
- * Gets the map being decorated.
- * 
- * @return the decorated map
  */
 protected MapK, V decorated() {
 return map;

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java?view=diffrev=471189r1=471188r2=471189
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
 Sat Nov  4 05:57:57 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.collections.map;
 
-import java.util.Map;
-
 import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.OrderedMapIterator;
@@ -59,16 +57,6 @@
  */
 public AbstractOrderedMapDecorator(OrderedMap map) {
 super(map);
-}
-
-/**
- * Gets the map being decorated.
- * 
- * @return the decorated map
- * @deprecated use decorated()
- */
-protected OrderedMap getOrderedMap() {
-return decorated();
 }
 
 /**

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java?view=diffrev=471189r1=471188r2=471189
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
 Sat Nov  4 05:57:57 2006
@@ -64,16 +64,6 @@
  * Gets the map being decorated.
  * 
  * @return the decorated map
- * @deprecated use decorated()
- */
-protected SortedMapK, V

svn commit: r471192 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list: AbstractListDecorator.java FixedSizeList.java GrowthList.jav

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 06:04:46 2006
New Revision: 471192

URL: http://svn.apache.org/viewvc?view=revrev=471192
Log:
Remove getList() - use decorated()

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/AbstractListDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/FixedSizeList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/GrowthList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/LazyList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/UnmodifiableList.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/AbstractListDecorator.java?view=diffrev=471192r1=471191r2=471192
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
 Sat Nov  4 06:04:46 2006
@@ -59,16 +59,6 @@
  * Gets the list being decorated.
  * 
  * @return the decorated list
- * @deprecated use decorated()
- */
-protected ListE getList() {
-return decorated();
-}
-
-/**
- * Gets the list being decorated.
- * 
- * @return the decorated list
  */
 protected ListE decorated() {
 return (ListE) super.decorated();

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/FixedSizeList.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/FixedSizeList.java?view=diffrev=471192r1=471191r2=471192
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/FixedSizeList.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/FixedSizeList.java
 Sat Nov  4 06:04:46 2006
@@ -89,27 +89,27 @@
 }
 
 public Object get(int index) {
-return getList().get(index);
+return decorated().get(index);
 }
 
 public int indexOf(Object object) {
-return getList().indexOf(object);
+return decorated().indexOf(object);
 }
 
 public Iterator iterator() {
-return UnmodifiableIterator.decorate(getCollection().iterator());
+return UnmodifiableIterator.decorate(decorated().iterator());
 }
 
 public int lastIndexOf(Object object) {
-return getList().lastIndexOf(object);
+return decorated().lastIndexOf(object);
 }
 
 public ListIterator listIterator() {
-return new FixedSizeListIterator(getList().listIterator(0));
+return new FixedSizeListIterator(decorated().listIterator(0));
 }
 
 public ListIterator listIterator(int index) {
-return new FixedSizeListIterator(getList().listIterator(index));
+return new FixedSizeListIterator(decorated().listIterator(index));
 }
 
 public Object remove(int index) {
@@ -129,11 +129,11 @@
 }
 
 public Object set(int index, Object object) {
-return getList().set(index, object);
+return decorated().set(index, object);
 }
 
 public List subList(int fromIndex, int toIndex) {
-List sub = getList().subList(fromIndex, toIndex);
+List sub = decorated().subList(fromIndex, toIndex);
 return new FixedSizeList(sub);
 }
 

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/GrowthList.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/GrowthList.java?view=diffrev=471192r1=471191r2=471192
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/GrowthList.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/GrowthList.java
 Sat Nov  4 06:04:46 2006
@@ -118,11

svn commit: r471201 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src: java/org/apache/commons/collections/bag/ test/org/apache/commons/collections/bag/

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 06:17:26 2006
New Revision: 471201

URL: http://svn.apache.org/viewvc?view=revrev=471201
Log:
Remove getBag() - use covariant decorated()

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/PredicatedBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java?view=diffrev=471201r1=471200r2=471201
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
 Sat Nov  4 06:17:26 2006
@@ -57,25 +57,25 @@
  * 
  * @return the decorated bag
  */
-protected Bag getBag() {
-return (Bag) getCollection();
+protected Bag decorated() {
+return (Bag) super.decorated();
 }
 
 //---
 public int getCount(Object object) {
-return getBag().getCount(object);
+return decorated().getCount(object);
 }
 
 public boolean add(Object object, int count) {
-return getBag().add(object, count);
+return decorated().add(object, count);
 }
 
 public boolean remove(Object object, int count) {
-return getBag().remove(object, count);
+return decorated().remove(object, count);
 }
 
 public Set uniqueSet() {
-return getBag().uniqueSet();
+return decorated().uniqueSet();
 }
 
 }

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java?view=diffrev=471201r1=471200r2=471201
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
 Sat Nov  4 06:17:26 2006
@@ -56,21 +56,21 @@
  * 
  * @return the decorated bag
  */
-protected SortedBag getSortedBag() {
-return (SortedBag) getCollection();
+protected SortedBag decorated() {
+return (SortedBag) super.decorated();
 }
 
 //---
 public Object first() {
-return getSortedBag().first();
+return decorated().first();
 }
 
 public Object last() {
-return getSortedBag().last();
+return decorated().last();
 }
 
 public Comparator comparator() {
-return getSortedBag().comparator();
+return decorated().comparator();
 }
 
 }

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/PredicatedBag.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/PredicatedBag.java?view=diffrev=471201r1=471200r2=471201
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bag/PredicatedBag.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons

svn commit: r471202 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src: java/org/apache/commons/collections/buffer/ java/org/apache/commons/collections/collection/ java/org/

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 06:21:44 2006
New Revision: 471202

URL: http://svn.apache.org/viewvc?view=revrev=471202
Log:
Remove getCollection() - use covariant decorated()

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/PredicatedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/TransformedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/PredicatedList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/list/UnmodifiableList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/PredicatedSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/UnmodifiableSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestPredicatedSet.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java?view=diffrev=471202r1=471201r2=471202
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
 Sat Nov  4 06:21:44 2006
@@ -81,17 +81,17 @@
  * 
  * @return the decorated buffer
  */
-protected Buffer getBuffer() {
-return (Buffer) getCollection();
+protected Buffer decorated() {
+return (Buffer) super.decorated();
 }
 
 //---
 public Object get() {
-return getBuffer().get();
+return decorated().get();
 }
 
 public Object remove() {
-return getBuffer().remove();
+return decorated().remove();
 }
 
 }

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java?view=diffrev=471202r1=471201r2=471202
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
 Sat Nov  4 06:21:44 2006
@@ -97,7 +97,7 @@
 
 //---
 public Iterator iterator() {
-return UnmodifiableIterator.decorate(getCollection().iterator());
+return UnmodifiableIterator.decorate(decorated().iterator());
 }
 
 public boolean add(Object object) {

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper

svn commit: r471203 - /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 06:28:02 2006
New Revision: 471203

URL: http://svn.apache.org/viewvc?view=revrev=471203
Log:
Whitespace change

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java?view=diffrev=471203r1=471202r2=471203
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/collection/CompositeCollection.java
 Sat Nov  4 06:28:02 2006
@@ -41,13 +41,12 @@
  * @author Phil Steitz
  */
 public class CompositeCollection implements Collection {
-
+
 /** CollectionMutator to handle changes to the collection */
 protected CollectionMutator mutator;
-
 /** Collections in the composite */
 protected Collection[] all;
-
+
 /**
  * Create an empty CompositeCollection.
  */
@@ -55,7 +54,7 @@
 super();
 this.all = new Collection[0];
 }
-
+
 /**
  * Create a Composite Collection with only coll composited.
  * 
@@ -65,7 +64,7 @@
 this();
 this.addComposited(coll);
 }
-
+
 /**
  * Create a CompositeCollection with colls as the initial list of
  * composited collections.
@@ -76,7 +75,7 @@
 this();
 this.addComposited(colls);
 }
-
+
 //---
 /**
  * Gets the size of this composite collection.
@@ -92,7 +91,7 @@
 }
 return size;
 }
-
+
 /**
  * Checks whether this composite collection is empty.
  * p
@@ -108,7 +107,7 @@
 }
 return true;
 }
-
+
 /**
  * Checks whether this composite collection contains the object.
  * p
@@ -125,7 +124,7 @@
 }
 return false;
 }
-
+
 /**
  * Gets an iterator over all the collections in this composite.
  * p
@@ -146,7 +145,7 @@
 }
 return chain;
 }
-
+
 /**
  * Returns an array containing all of the elements in this composite.
  *
@@ -160,7 +159,7 @@
 }
 return result;
 }
-
+
 /**
  * Returns an object array, populating the supplied array if possible.
  * See codeCollection/code interface for full details.
@@ -173,8 +172,7 @@
 Object[] result = null;
 if (array.length = size) {
 result = array;
-}
-else {
+} else {
 result = (Object[]) 
Array.newInstance(array.getClass().getComponentType(), size);
 }
 
@@ -189,7 +187,7 @@
 }
 return result;
 }
-
+
 /**
  * Adds an object to the collection, throwing UnsupportedOperationException
  * unless a CollectionMutator strategy is specified.
@@ -209,7 +207,7 @@
 }
 return this.mutator.add(this, this.all, obj);
 }
-
+
 /**
  * Removes an object from the collection, throwing 
UnsupportedOperationException
  * unless a CollectionMutator strategy is specified.
@@ -228,7 +226,7 @@
 }
 return this.mutator.remove(this, this.all, obj);
 }
-
+
 /**
  * Checks whether this composite contains all the elements in the 
specified collection.
  * p
@@ -246,7 +244,7 @@
 }
 return true;
 }
-
+
 /**
  * Adds a collection of elements to this collection, throwing
  * UnsupportedOperationException unless a CollectionMutator strategy is 
specified.
@@ -266,7 +264,7 @@
 }
 return this.mutator.addAll(this, this.all, coll);
 }
-
+
 /**
  * Removes the elements in the specified collection from this composite 
collection.
  * p
@@ -286,7 +284,7 @@
 }
 return changed;
 }
-
+
 /**
  * Retains all the elements in the specified collection in this composite 
collection,
  * removing all others.
@@ -304,7 +302,7 @@
 }
 return changed;
 }
-
+
 /**
  * Removes all of the elements from this collection .
  * p
@@ -317,7 +315,7 @@
 this.all[i].clear();
 }
 }
-
+
 //---
 /**
  * Specify a CollectionMutator strategy instance to handle changes.
@@ -327,7 +325,7 @@
 public void setMutator(CollectionMutator mutator

svn commit: r471214 - /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/

2006-11-04 Thread scolebourne
Author: scolebourne
Date: Sat Nov  4 07:21:01 2006
New Revision: 471214

URL: http://svn.apache.org/viewvc?view=revrev=471214
Log:
Generify

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BidiMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Buffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/KeyValue.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedBidiMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedIterator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMapIterator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableIterator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableListIterator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBidiMap.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java?view=diffrev=471214r1=471213r2=471214
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java
 Sat Nov  4 07:21:01 2006
@@ -38,13 +38,14 @@
  * In an ideal world, the interface would be changed to fix the problems, 
however
  * it has been decided to maintain backwards compatibility instead.
  *
+ * @param E the type held in the bag
  * @since Commons Collections 2.0
  * @version $Revision$ $Date$
  * 
  * @author Chuck Burdick
  * @author Stephen Colebourne
  */
-public interface Bag extends Collection {
+public interface BagE extends CollectionE {
 
 /**
  * Returns the number of occurrences (cardinality) of the given
@@ -54,7 +55,7 @@
  * @param object  the object to search for
  * @return the number of occurrences of the object, zero if not found
  */
-int getCount(Object object);
+int getCount(E object);
 
 /**
  * i(Violation)/i
@@ -72,7 +73,7 @@
  * @param object  the object to add
  * @return codetrue/code if the object was not already in the 
codeuniqueSet/code
  */
-boolean add(Object object);
+boolean add(E object);
 
 /**
  * Adds codenCopies/code copies of the specified object to the Bag.
@@ -85,7 +86,7 @@
  * @param nCopies  the number of copies to add
  * @return codetrue/code if the object was not already in the 
codeuniqueSet/code
  */
-boolean add(Object object, int nCopies);
+boolean add(E object, int nCopies);
 
 /**
  * i(Violation)/i
@@ -111,7 +112,7 @@
  * @param nCopies  the number of copies to remove
  * @return codetrue/code if this call changed the collection
  */
-boolean remove(Object object, int nCopies);
+boolean remove(E object, int nCopies);
 
 /**
  * Returns a [EMAIL PROTECTED] Set} of unique elements in the Bag.
@@ -120,7 +121,7 @@
  * 
  * @return the Set of unique Bag elements
  */
-Set uniqueSet();
+SetE uniqueSet();
 
 /**
  * Returns the total number of items in the bag across all types.
@@ -145,7 +146,7 @@
  * @param coll  the collection to check against
  * @return codetrue/code if the Bag contains all the collection
  */
-boolean containsAll(Collection coll);
+boolean containsAll(Collection? coll);
 
 /**
  * i(Violation)/i
@@ -163,7 +164,7 @@
  * @param coll  the collection to remove
  * @return codetrue/code if this call changed the collection
  */
-boolean removeAll(Collection

svn commit: r468684 - in /jakarta/commons/proper/collections/trunk: RELEASE-NOTES.html src/java/org/apache/commons/collections/map/MultiValueMap.java src/test/org/apache/commons/collections/map/TestMu

2006-10-28 Thread scolebourne
Author: scolebourne
Date: Sat Oct 28 05:27:01 2006
New Revision: 468684

URL: http://svn.apache.org/viewvc?view=revrev=468684
Log:
COLLECTIONS-228 - MultiValueMap put and putAll do not return the correct values

Modified:
jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html

jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java

jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiValueMap.java

Modified: jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html?view=diffrev=468684r1=468683r2=468684
==
--- jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html (original)
+++ jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html Sat Oct 28 
05:27:01 2006
@@ -57,6 +57,7 @@
 liFlat3Map - Fix setValue in MapIterator and EntrySetIterator to work 
correctly [COLLECTIONS-217]/li
 liExtendedProperties - Include property name had confused static/instance 
semantics [COLLECTIONS-214]/li
 liCollectionUtils - Fix removeAll() method which was completely broken 
[COLLECTIONS-219]/li
+liMultiValueMap - Fix put() and putAll() to return correct results 
[COLLECTIONS-228]/li
 /ul
 
 centerh3JAVADOC/h3/center

Modified: 
jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java?view=diffrev=468684r1=468683r2=468684
==
--- 
jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java
 (original)
+++ 
jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java
 Sat Oct 28 05:27:01 2006
@@ -205,12 +205,12 @@
 boolean result = false;
 Collection coll = getCollection(key);
 if (coll == null) {
-coll = createCollection(1);
-result = coll.add(value);
+coll = createCollection(1);  // might produce a non-empty 
collection
+coll.add(value);
 if (coll.size()  0) {
 // only add if non-zero size to maintain class state
 getMap().put(key, coll);
-result = false;
+result = true;  // map definitely changed
 }
 } else {
 result = coll.add(value);
@@ -307,19 +307,20 @@
 if (values == null || values.size() == 0) {
 return false;
 }
+boolean result = false;
 Collection coll = getCollection(key);
 if (coll == null) {
-coll = createCollection(values.size());
-boolean result = coll.addAll(values);
+coll = createCollection(values.size());  // might produce a 
non-empty collection
+coll.addAll(values);
 if (coll.size()  0) {
 // only add if non-zero size to maintain class state
 getMap().put(key, coll);
-result = false;
+result = true;  // map definitely changed
 }
-return result;
 } else {
-return coll.addAll(values);
+result = coll.addAll(values);
 }
+return result;
 }
 
 /**

Modified: 
jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiValueMap.java?view=diffrev=468684r1=468683r2=468684
==
--- 
jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
 (original)
+++ 
jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
 Sat Oct 28 05:27:01 2006
@@ -30,7 +30,6 @@
 
 import org.apache.commons.collections.IteratorUtils;
 import org.apache.commons.collections.MultiMap;
-import org.apache.commons.collections.TestMultiHashMap;
 
 /**
  * TestMultiValueMap.
@@ -46,11 +45,11 @@
 }
 
 public static Test suite() {
-return new TestSuite(TestMultiHashMap.class);
+return new TestSuite(TestMultiValueMap.class);
 }
 
 public static void main(String args[]) {
-String[] testCaseName = { TestMultiHashMap.class.getName()};
+String[] testCaseName = { TestMultiValueMap.class.getName()};
 junit.textui.TestRunner.main(testCaseName);
 }
 
@@ -201,9 +200,9 @@
 map.put(B, BC);
 assertEquals(2, map.size());
 map.remove(A);
-assertEquals(2, map.size

svn commit: r468685 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src: java/org/apache/commons/collections/map/MultiValueMap.java test/org/apache/commons/collections/map/Te

2006-10-28 Thread scolebourne
Author: scolebourne
Date: Sat Oct 28 05:30:27 2006
New Revision: 468685

URL: http://svn.apache.org/viewvc?view=revrev=468685
Log:
COLLECTIONS-228 - MultiValueMap put and putAll do not return the correct values

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/MultiValueMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/map/TestMultiValueMap.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/MultiValueMap.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/MultiValueMap.java?view=diffrev=468685r1=468684r2=468685
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/MultiValueMap.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/map/MultiValueMap.java
 Sat Oct 28 05:30:27 2006
@@ -206,12 +206,12 @@
 boolean result = false;
 Collection coll = getCollection(key);
 if (coll == null) {
-coll = createCollection(1);
-result = coll.add(value);
+coll = createCollection(1);  // might produce a non-empty 
collection
+coll.add(value);
 if (coll.size()  0) {
 // only add if non-zero size to maintain class state
 getMap().put(key, coll);
-result = false;
+result = true;  // map definitely changed
 }
 } else {
 result = coll.add(value);
@@ -308,19 +308,20 @@
 if (values == null || values.size() == 0) {
 return false;
 }
+boolean result = false;
 Collection coll = getCollection(key);
 if (coll == null) {
-coll = createCollection(values.size());
-boolean result = coll.addAll(values);
+coll = createCollection(values.size());  // might produce a 
non-empty collection
+coll.addAll(values);
 if (coll.size()  0) {
 // only add if non-zero size to maintain class state
 getMap().put(key, coll);
-result = false;
+result = true;  // map definitely changed
 }
-return result;
 } else {
-return coll.addAll(values);
+result = coll.addAll(values);
 }
+return result;
 }
 
 /**

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/map/TestMultiValueMap.java?view=diffrev=468685r1=468684r2=468685
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
 Sat Oct 28 05:30:27 2006
@@ -31,7 +31,6 @@
 
 import org.apache.commons.collections.IteratorUtils;
 import org.apache.commons.collections.MultiMap;
-import org.apache.commons.collections.TestMultiHashMap;
 
 /**
  * TestMultiValueMap.
@@ -47,11 +46,11 @@
 }
 
 public static Test suite() {
-return new TestSuite(TestMultiHashMap.class);
+return new TestSuite(TestMultiValueMap.class);
 }
 
 public static void main(String args[]) {
-String[] testCaseName = { TestMultiHashMap.class.getName()};
+String[] testCaseName = { TestMultiValueMap.class.getName()};
 junit.textui.TestRunner.main(testCaseName);
 }
 
@@ -202,9 +201,9 @@
 map.put(B, BC);
 assertEquals(2, map.size());
 map.remove(A);
-assertEquals(2, map.size());
+assertEquals(1, map.size());
 map.remove(B, BC);
-assertEquals(2, map.size());
+assertEquals(1, map.size());
 }
 
 public void testSize_Key() {
@@ -248,6 +247,25 @@
 map.put(A, AA);
 assertEquals(true, map.containsValue(A, AA));
 assertEquals(false, map.containsValue(A, AB));
+}
+
+public void testPutWithList() {
+MultiValueMap test = MultiValueMap.decorate(new HashMap(), 
ArrayList.class);
+assertEquals(a, test.put(A, a));
+assertEquals(b, test.put(A, b));
+assertEquals(1, test.size());
+assertEquals(2, test.size(A));
+assertEquals(2, test.totalSize

svn commit: r468687 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch: ./ data/test/ src/java/org/apache/commons/collections/ src/java/org/apache/commons/collections/iterators/

2006-10-28 Thread scolebourne
Author: scolebourne
Date: Sat Oct 28 05:53:28 2006
New Revision: 468687

URL: http://svn.apache.org/viewvc?view=revrev=468687
Log:
COLLECTIONS-229 - Remove deprecated classes and code

Added:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.txt
   (with props)
Removed:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.html

jakarta/commons/proper/collections/branches/collections_jdk5_branch/data/test/CursorableLinkedList.emptyCollection.version1.obj

jakarta/commons/proper/collections/branches/collections_jdk5_branch/data/test/CursorableLinkedList.fullCollection.version1.obj

jakarta/commons/proper/collections/branches/collections_jdk5_branch/data/test/LRUMap.emptyCollection.version2.obj

jakarta/commons/proper/collections/branches/collections_jdk5_branch/data/test/LRUMap.fullCollection.version2.obj

jakarta/commons/proper/collections/branches/collections_jdk5_branch/data/test/MultiHashMap.emptyCollection.version2.obj

jakarta/commons/proper/collections/branches/collections_jdk5_branch/data/test/MultiHashMap.fullCollection.version2.obj

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BeanMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BinaryHeap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BoundedFifoBuffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/CursorableLinkedList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/DefaultMapBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/DefaultMapEntry.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/DoubleOrderedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/HashBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/LRUMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MultiHashMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/PriorityQueue.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ProxyMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ReferenceMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SequencedHashMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/StaticBucketMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SynchronizedPriorityQueue.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/TreeBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/UnboundedFifoBuffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/iterators/ProxyIterator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/iterators/ProxyListIterator.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestBeanMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestBinaryHeap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestBoundedFifoBuffer2.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestCursorableLinkedList.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestDoubleOrderedMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestHashBag.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestLRUMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache

svn commit: r468690 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src: java/org/apache/commons/collections/ java/org/apache/commons/collections/bidimap/ test/org/apache/com

2006-10-28 Thread scolebourne
Author: scolebourne
Date: Sat Oct 28 06:03:11 2006
New Revision: 468690

URL: http://svn.apache.org/viewvc?view=revrev=468690
Log:
COLLECTIONS-229 - Remove deprecated classes and code

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/CollectionUtils.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/TestCollectionUtils.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/CollectionUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/CollectionUtils.java?view=diffrev=468690r1=468689r2=468690
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/CollectionUtils.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/CollectionUtils.java
 Sat Oct 28 06:03:11 2006
@@ -688,114 +688,7 @@
 collection.add(elements[i]);
 }
 }
-
-/**
- * Given an Object, and an index, returns the nth value in the
- * object.
- * ul
- * liIf obj is a Map, returns the nth value from the bkeySet/b 
iterator, unless 
- * the Map contains an Integer key with integer value = idx, in which 
case the
- * corresponding map entry value is returned.  If idx exceeds the 
number of entries in
- * the map, an empty Iterator is returned.
- * liIf obj is a List or an array, returns the nth value, throwing 
IndexOutOfBoundsException,
- * ArrayIndexOutOfBoundsException, resp. if the nth value does not 
exist.
- * liIf obj is an iterator, enumeration or Collection, returns the nth 
value from the iterator,
- * returning an empty Iterator (resp. Enumeration) if the nth value 
does not exist.
- * liReturns the original obj if it is null or not a Collection or 
Iterator.
- * /ul
- * 
- * @param obj  the object to get an index of, may be null
- * @param idx  the index to get
- * @throws IndexOutOfBoundsException
- * @throws ArrayIndexOutOfBoundsException
- *
- * @deprecated use [EMAIL PROTECTED] #get(Object, int)} instead. Will be 
removed in v4.0
- */
-public static Object index(Object obj, int idx) {
-return index(obj, new Integer(idx));
-}
-
-/**
- * Given an Object, and a key (index), returns the value associated with
- * that key in the Object. The following checks are made:
- * ul
- * liIf obj is a Map, use the index as a key to get a value. If no match 
continue.
- * liCheck key is an Integer. If not, return the object passed in.
- * liIf obj is a Map, get the nth value from the bkeySet/b iterator.
- * If the Map has fewer than n entries, return an empty Iterator.
- * liIf obj is a List or an array, get the nth value, throwing 
IndexOutOfBoundsException,
- * ArrayIndexOutOfBoundsException, resp. if the nth value does not 
exist.
- * liIf obj is an iterator, enumeration or Collection, get the nth value 
from the iterator,
- * returning an empty Iterator (resp. Enumeration) if the nth value 
does not exist.
- * liReturn the original obj.
- * /ul
- * 
- * @param obj  the object to get an index of
- * @param index  the index to get
- * @return the object at the specified index
- * @throws IndexOutOfBoundsException
- * @throws ArrayIndexOutOfBoundsException
- *
- * @deprecated use [EMAIL PROTECTED] #get(Object, int)} instead. Will be 
removed in v4.0
- */
-public static Object index(Object obj, Object index) {
-if(obj instanceof Map) {
-Map map = (Map)obj;
-if(map.containsKey(index)) {
-return map.get(index);
-}
-}
-int idx = -1;
-if(index instanceof Integer) {
-idx = ((Integer)index).intValue();
-}
-if(idx  0) {
-return obj;
-} 
-else if(obj instanceof Map) {
-Map map = (Map)obj;
-Iterator iterator = map.keySet().iterator();
-return index(iterator, idx);
-} 
-else if(obj instanceof List) {
-return ((List)obj).get(idx);
-} 
-else if(obj instanceof Object[]) {
-return ((Object[])obj)[idx];
-} 
-else if(obj instanceof Enumeration) {
-Enumeration it = (Enumeration)obj;
-while(it.hasMoreElements()) {
-idx--;
-if(idx == -1

svn commit: r468709 - /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java

2006-10-28 Thread scolebourne
Author: scolebourne
Date: Sat Oct 28 10:49:04 2006
New Revision: 468709

URL: http://svn.apache.org/viewvc?view=revrev=468709
Log:
Convert to generics

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java?view=diffrev=468709r1=468708r2=468709
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java
 Sat Oct 28 10:49:04 2006
@@ -45,8 +45,8 @@
  *
  * @author Stephen Colebourne
  */
-public interface MapIterator extends Iterator {
-
+public interface MapIteratorK, V extends IteratorK {
+
 /**
  * Checks to see if there are more entries still to be iterated.
  *
@@ -60,7 +60,7 @@
  * @return the next key in the iteration
  * @throws java.util.NoSuchElementException if the iteration is finished
  */
-Object next();
+K next();
 
 //---
 /**
@@ -70,7 +70,7 @@
  * @return the current key
  * @throws IllegalStateException if codenext()/code has not yet been 
called
  */
-Object getKey();
+K getKey();
 
 /**
  * Gets the current value, which is the value associated with the last key
@@ -79,7 +79,7 @@
  * @return the current value
  * @throws IllegalStateException if codenext()/code has not yet been 
called
  */
-Object getValue();
+V getValue();
 
 //---
 /**
@@ -93,7 +93,7 @@
  *  since the last call to codenext()/code
  */
 void remove();
-
+
 /**
  * Sets the value associated with the current key (optional operation).
  *
@@ -104,6 +104,6 @@
  * @throws IllegalStateException if coderemove()/code has been called 
since the
  *  last call to codenext()/code
  */
-Object setValue(Object value);
+V setValue(V value);
 
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r468599 - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch: DEVELOPERS-GUIDE.html NOTICE.txt PROPOSAL.html RELEASE-NOTES.html STATUS.html build.xml doap_collections.

2006-10-27 Thread scolebourne
Author: scolebourne
Date: Fri Oct 27 17:37:31 2006
New Revision: 468599

URL: http://svn.apache.org/viewvc?view=revrev=468599
Log:
Switch to new ASF licence format with copyright dates in NOTICE.txt

Modified:

jakarta/commons/proper/collections/branches/collections_jdk5_branch/DEVELOPERS-GUIDE.html

jakarta/commons/proper/collections/branches/collections_jdk5_branch/NOTICE.txt

jakarta/commons/proper/collections/branches/collections_jdk5_branch/PROPOSAL.html

jakarta/commons/proper/collections/branches/collections_jdk5_branch/RELEASE-NOTES.html

jakarta/commons/proper/collections/branches/collections_jdk5_branch/STATUS.html

jakarta/commons/proper/collections/branches/collections_jdk5_branch/build.xml

jakarta/commons/proper/collections/branches/collections_jdk5_branch/doap_collections.rdf

jakarta/commons/proper/collections/branches/collections_jdk5_branch/maven.xml

jakarta/commons/proper/collections/branches/collections_jdk5_branch/project.properties

jakarta/commons/proper/collections/branches/collections_jdk5_branch/project.xml

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/DEVELOPERS-GUIDE.html
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/DEVELOPERS-GUIDE.html?view=diffrev=468599r1=468598r2=468599
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/DEVELOPERS-GUIDE.html
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/DEVELOPERS-GUIDE.html
 Fri Oct 27 17:37:31 2006
@@ -1,18 +1,19 @@
- !--
-   Copyright 2002-2004 The Apache Software Foundation
+!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the License); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
 
-   Licensed under the Apache License, Version 2.0 (the License);
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
 
-   http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an AS IS BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-  --
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an AS IS BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+--
 html
 head
 titleDevelopers guide for Jakarta Commons Collections Package/title

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/NOTICE.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/NOTICE.txt?view=diffrev=468599r1=468598r2=468599
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/NOTICE.txt 
(original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/NOTICE.txt 
Fri Oct 27 17:37:31 2006
@@ -1,2 +1,5 @@
+Apache Jakarta Commons Collections
+Copyright 2001-2006 The Apache Software Foundation
+
 This product includes software developed by
 The Apache Software Foundation (http://www.apache.org/).

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/PROPOSAL.html
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/PROPOSAL.html?view=diffrev=468599r1=468598r2=468599
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/PROPOSAL.html
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/PROPOSAL.html
 Fri Oct 27 17:37:31 2006
@@ -1,18 +1,19 @@
- !--
-   Copyright 2001-2004 The Apache Software Foundation
+!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the License); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
 
-   Licensed under the Apache License, Version 2.0 (the License

svn commit: r468603 [13/13] - in /jakarta/commons/proper/collections/branches/collections_jdk5_branch/src: java/org/apache/commons/collections/ java/org/apache/commons/collections/bag/ java/org/apache

2006-10-27 Thread scolebourne
Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/AbstractTestSet.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/AbstractTestSet.java?view=diffrev=468603r1=468602r2=468603
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/AbstractTestSet.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/AbstractTestSet.java
 Fri Oct 27 17:52:37 2006
@@ -1,17 +1,18 @@
 /*
- *  Copyright 2001-2004 The Apache Software Foundation
- *
- *  Licensed under the Apache License, Version 2.0 (the License);
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
  *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an AS IS BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.commons.collections.set;
 

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java?view=diffrev=468603r1=468602r2=468603
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
 (original)
+++ 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
 Fri Oct 27 17:52:37 2006
@@ -1,17 +1,18 @@
 /*
- *  Copyright 2001-2004 The Apache Software Foundation
- *
- *  Licensed under the Apache License, Version 2.0 (the License);
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
  *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an AS IS BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.commons.collections.set;
 

Modified: 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestAll.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestAll.java?view=diffrev=468603r1=468602r2=468603
==
--- 
jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/test/org/apache/commons/collections/set/TestAll.java
 (original)
+++ 

svn commit: r463909 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java

2006-10-14 Thread scolebourne
Author: scolebourne
Date: Sat Oct 14 03:20:27 2006
New Revision: 463909

URL: http://svn.apache.org/viewvc?view=revrev=463909
Log:
Add serial version id and unify javadoc

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java?view=diffrev=463909r1=463908r2=463909
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 Sat Oct 14 03:20:27 2006
@@ -415,7 +415,7 @@
  *
  * @param startDirectory  the directory to start from
  * @param results  the collection of result objects, may be updated
- * @param cancel The exception throw to cancel further processing
+ * @param cancel  the exception throw to cancel further processing
  * containing details at the point of cancellation. 
  * @throws IOException if an I/O Error occurs
  */
@@ -431,15 +431,20 @@
  */
 public static class CancelException extends IOException {
 
+/** Serialization id. */
+private static final long serialVersionUID = 1347339620135041008L;
+
+/** The file being processed when the exception was thrown. */
 private File file;
+/** The file depth when the exception was thrown. */
 private int depth = -1;
 
 /**
  * Constructs a codeCancelException/code with
  * the file and depth when cancellation occurred.
  *
- * @param file The file when the operation was cancelled
- * @param depth The depth when the operation was cancelled
+ * @param file  the file when the operation was cancelled, may be null
+ * @param depth  the depth when the operation was cancelled, may be 
null
  */
 public CancelException(File file, int depth) {
 this(Operation Cancelled, file, depth);
@@ -450,9 +455,9 @@
  * an appropriate message and the file and depth when
  * cancellation occurred.
  *
- * @param message The detail message.
- * @param file The file when the operation was cancelled
- * @param depth The depth when the operation was cancelled
+ * @param message  the detail message
+ * @param file  the file when the operation was cancelled
+ * @param depth  the depth when the operation was cancelled
  */
 public CancelException(String message, File file, int depth) {
 super(message);
@@ -463,7 +468,7 @@
 /**
  * Return the file when the operation was cancelled.
  *
- * @return The file when the operation was cancelled
+ * @return the file when the operation was cancelled
  */
 public File getFile() {
 return file;
@@ -472,7 +477,7 @@
 /**
  * Return the depth when the operation was cancelled.
  *
- * @return The depth when the operation was cancelled
+ * @return the depth when the operation was cancelled
  */
 public int getDepth() {
 return depth;



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r463913 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java

2006-10-14 Thread scolebourne
Author: scolebourne
Date: Sat Oct 14 04:08:13 2006
New Revision: 463913

URL: http://svn.apache.org/viewvc?view=revrev=463913
Log:
Spelling, javadoc, variable names

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java?view=diffrev=463913r1=463912r2=463913
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 Sat Oct 14 04:08:13 2006
@@ -141,7 +141,7 @@
  * scenarios.
  *
  * a name=external/a
- * h43.1 External / Mult-threaded/h4
+ * h43.1 External / Multi-threaded/h4
  *
  * This example provides a codecancel()/code method for external processes 
to
  * indcate that processing must stop. Calling this method sets a
@@ -289,15 +289,16 @@
 handleDirectoryStart(directory, depth, results);
 int childDepth = depth + 1;
 if (depthLimit  0 || childDepth = depthLimit) {
-File[] files = (filter == null ? directory.listFiles() : 
directory.listFiles(filter));
-if (files == null) {
+File[] childFiles = (filter == null ? directory.listFiles() : 
directory.listFiles(filter));
+if (childFiles == null) {
 handleRestricted(directory, childDepth, results);
 } else {
-for (int i = 0; i  files.length; i++) {
-if (files[i].isDirectory()) {
-walk(files[i], childDepth, results);
+for (int i = 0; i  childFiles.length; i++) {
+File childFile = childFiles[i];
+if (childFile.isDirectory()) {
+walk(childFile, childDepth, results);
 } else {
-handleFile(files[i], childDepth, results);
+handleFile(childFile, childDepth, results);
 }
 }
 }
@@ -410,6 +411,8 @@
 
 /**
  * Overridable callback method invoked when the operation is cancelled.
+ * The file being processed when the cancellation occurred can be
+ * obtained from the exception.
  * p
  * This implementation just re-throws the [EMAIL PROTECTED] 
CancelException}.
  *
@@ -425,6 +428,7 @@
 throw cancel;
 }
 
+//---
 /**
  * CancelException is thrown in DirectoryWalker to cancel the current
  * processing.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r463940 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/filefilter/FileFilterUtils.java src/test/org/apache/commons/io/filefilter/FileFilterTestCase

2006-10-14 Thread scolebourne
Author: scolebourne
Date: Sat Oct 14 07:20:25 2006
New Revision: 463940

URL: http://svn.apache.org/viewvc?view=revrev=463940
Log:
FileFilterUtils.makeDirectoryOnly/makeFileOnly
- two new methods that decorate a file filter to make it apply to directories 
only or files only

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=463940r1=463939r2=463940
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Sat Oct 14 07:20:25 2006
@@ -139,9 +139,13 @@
 (whereas if everything uses INSTANCE, then they just clash)
   - The old INSTANCE constants are still present and have not been deprecated
 
-- FileFilterUtils
+- FileFilterUtils.sizeRangeFileFilter
   - new sizeRangeFileFilter(long minimumSize, long maximumSize) method which 
 creates a filter that accepts files within the specified size range.
+
+- FileFilterUtils.makeDirectoryOnly/makeFileOnly
+  - two new methods that decorate a file filter to make it apply to
+directories only or files only
 
 - NullWriter
   - New writer that acts as a sink for all data, as per /dev/null

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java?view=diffrev=463940r1=463939r2=463940
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
 Sat Oct 14 07:20:25 2006
@@ -218,7 +218,6 @@
 }
 
 //---
-
 /**
  * Returns a filter that returns true if the file was last modified after
  * the specified cutoff time.
@@ -330,6 +329,35 @@
 IOFileFilter minimumFilter = new SizeFileFilter(minSizeInclusive, 
true);
 IOFileFilter maximumFilter = new SizeFileFilter(maxSizeInclusive + 1L, 
false);
 return new AndFileFilter(minimumFilter, maximumFilter);
+}
+
+//---
+/**
+ * Decorates a filter so that it only applies to directories and not to 
files.
+ * 
+ * @param filter  the filter to decorate, null means an unrestricted filter
+ * @return the decorated filter, never null
+ * @since 1.3
+ */
+public static IOFileFilter makeDirectoryOnly(IOFileFilter filter) {
+if (filter == null) {
+return DirectoryFileFilter.DIRECTORY;
+}
+return new AndFileFilter(DirectoryFileFilter.DIRECTORY, filter);
+}
+
+/**
+ * Decorates a filter so that it only applies to files and not to 
directories.
+ * 
+ * @param filter  the filter to decorate, null means an unrestricted filter
+ * @return the decorated filter, never null
+ * @since 1.3
+ */
+public static IOFileFilter makeFileOnly(IOFileFilter filter) {
+if (filter == null) {
+return FileFileFilter.FILE;
+}
+return new AndFileFilter(FileFileFilter.FILE, filter);
 }
 
 }

Modified: 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java?view=diffrev=463940r1=463939r2=463940
==
--- 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
 Sat Oct 14 07:20:25 2006
@@ -736,5 +736,62 @@
 FileUtils.forceDelete(emptyDir);
 }
 
+//---
+public void testMakeDirectoryOnly() throws Exception {
+assertSame(DirectoryFileFilter.DIRECTORY, 
FileFilterUtils.makeDirectoryOnly(null));
+
+IOFileFilter filter = FileFilterUtils.makeDirectoryOnly(
+FileFilterUtils.nameFileFilter(B));
+
+File fileA = new File(getTestDirectory(), A);
+File fileB = new File(getTestDirectory(), B);
+
+fileA.mkdirs();
+fileB.mkdirs();
+
+assertFiltering(filter

svn commit: r463941 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java

2006-10-14 Thread scolebourne
Author: scolebourne
Date: Sat Oct 14 07:24:29 2006
New Revision: 463941

URL: http://svn.apache.org/viewvc?view=revrev=463941
Log:
Javadoc and Group filter decoration methods together in the source file

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java?view=diffrev=463941r1=463940r2=463941
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
 Sat Oct 14 07:24:29 2006
@@ -168,56 +168,6 @@
 }
 
 //---
-
-/* Constructed on demand and then cached */
-private static IOFileFilter cvsFilter;
-
-/* Constructed on demand and then cached */
-private static IOFileFilter svnFilter;
-
-/**
- * Returns an IOFileFilter that ignores CVS directories. You may optionally
- * pass in an existing IOFileFilter in which case it is extended to exclude
- * CVS directories.
- * @param filter IOFileFilter to wrap, null if a new IOFileFilter
- * should be created
- * @return the requested (combined) filter
- * @since 1.1 (method existed but had bug in 1.0)
- */
-public static IOFileFilter makeCVSAware(IOFileFilter filter) {
-if (cvsFilter == null) {
-cvsFilter = notFileFilter(
-andFileFilter(directoryFileFilter(), nameFileFilter(CVS)));
-}
-if (filter == null) {
-return cvsFilter;
-} else {
-return andFileFilter(filter, cvsFilter);
-}
-}
-
-/**
- * Returns an IOFileFilter that ignores SVN directories. You may optionally
- * pass in an existing IOFileFilter in which case it is extended to exclude
- * SVN directories.
- * @param filter IOFileFilter to wrap, null if a new IOFileFilter
- * should be created
- * @return the requested (combined) filter
- * @since 1.1
- */
-public static IOFileFilter makeSVNAware(IOFileFilter filter) {
-if (svnFilter == null) {
-svnFilter = notFileFilter(
-andFileFilter(directoryFileFilter(), nameFileFilter(.svn)));
-}
-if (filter == null) {
-return svnFilter;
-} else {
-return andFileFilter(filter, svnFilter);
-}
-}
-
-//---
 /**
  * Returns a filter that returns true if the file was last modified after
  * the specified cutoff time.
@@ -329,6 +279,55 @@
 IOFileFilter minimumFilter = new SizeFileFilter(minSizeInclusive, 
true);
 IOFileFilter maximumFilter = new SizeFileFilter(maxSizeInclusive + 1L, 
false);
 return new AndFileFilter(minimumFilter, maximumFilter);
+}
+
+//---
+/* Constructed on demand and then cached */
+private static IOFileFilter cvsFilter;
+
+/* Constructed on demand and then cached */
+private static IOFileFilter svnFilter;
+
+/**
+ * Decorates a filter to make it ignore CVS directories.
+ * Passing in codenull/code will return a filter that accepts 
everything
+ * except CVS directories.
+ * 
+ * @param filter  the filter to decorate, null means an unrestricted filter
+ * @return the decorated filter, never null
+ * @since 1.1 (method existed but had bug in 1.0)
+ */
+public static IOFileFilter makeCVSAware(IOFileFilter filter) {
+if (cvsFilter == null) {
+cvsFilter = notFileFilter(
+andFileFilter(directoryFileFilter(), nameFileFilter(CVS)));
+}
+if (filter == null) {
+return cvsFilter;
+} else {
+return andFileFilter(filter, cvsFilter);
+}
+}
+
+/**
+ * Decorates a filter to make it ignore SVN directories.
+ * Passing in codenull/code will return a filter that accepts 
everything
+ * except SVN directories.
+ * 
+ * @param filter  the filter to decorate, null means an unrestricted filter
+ * @return the decorated filter, never null
+ * @since 1.1
+ */
+public static IOFileFilter makeSVNAware(IOFileFilter filter) {
+if (svnFilter == null) {
+svnFilter = notFileFilter(
+andFileFilter(directoryFileFilter(), nameFileFilter(.svn)));
+}
+if (filter == null) {
+return svnFilter;
+} else {
+return andFileFilter(filter, svnFilter

svn commit: r463942 - in /jakarta/commons/proper/io/trunk/src: java/org/apache/commons/io/DirectoryWalker.java test/org/apache/commons/io/DirectoryWalkerTestCase.java

2006-10-14 Thread scolebourne
Author: scolebourne
Date: Sat Oct 14 07:26:28 2006
New Revision: 463942

URL: http://svn.apache.org/viewvc?view=revrev=463942
Log:
Add constructor to take directory and file filters separately

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/DirectoryWalkerTestCase.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java?view=diffrev=463942r1=463941r2=463942
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 Sat Oct 14 07:26:28 2006
@@ -21,6 +21,10 @@
 import java.io.IOException;
 import java.util.Collection;
 
+import org.apache.commons.io.filefilter.FileFilterUtils;
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+
 /**
  * Abstract class that walks through a directory hierarchy and provides
  * subclasses with convenient hooks to add specific behaviour.
@@ -80,14 +84,28 @@
  * a name=filter/a
  * h32. Filter Example/h3
  *
- * If you wanted all directories which are not hidden
- * and files which end in .txt - you could build a composite filter
- * using the filter implementations in the Commons IO
- * a href=filefilter/package-summary.htmlfilefilter/a package
- * in the following way:
- *
+ * Choosing which directories and files to process can be a key aspect
+ * of using this class. This information can be setup in three ways,
+ * via three different constructors.
+ * p
+ * The first option is to visit all directories and files.
+ * This is achieved via the no-args constructor.
+ * p
+ * The second constructor option is to supply a single [EMAIL PROTECTED] 
FileFilter}
+ * that describes the files and directories to visit. Care must be taken
+ * with this option as the same filter is used for both directories
+ * and files.
+ * p
+ * For example, if you wanted all directories which are not hidden
+ * and files which end in .txt:
  * pre
- *
+ *  public class FooDirectoryWalker extends DirectoryWalker {
+ *public FooDirectoryWalker(FileFilter filter) {
+ *  super(filter, -1);
+ *}
+ *  }
+ *  
+ *  // Build up the filters and create the walker
  *// Create a filter for Non-hidden directories
  *IOFileFilter fooDirFilter = 
  *FileFilterUtils.andFileFilter(FileFilterUtils.directoryFileFilter,
@@ -103,9 +121,32 @@
  *FileFilterUtils.orFileFilter(fooDirFilter, fooFileFilter);
  *
  *// Use the filter to construct a DirectoryWalker implementation
- *FooDirectoryWalker walker = new FooDirectoryWalker(fooFilter, -1);
- *
+ *FooDirectoryWalker walker = new FooDirectoryWalker(fooFilter);
  * /pre
+ * p
+ * The third constructor option is to specify separate filters, one for
+ * directories and one for files. These are combined internally to form
+ * the correct codeFileFilter/code, something which is very easy to
+ * get wrong when attempted manually, particularly when trying to
+ * express constructs like 'any file in directories named docs'.
+ * p
+ * For example, if you wanted all directories which are not hidden
+ * and files which end in .txt:
+ * pre
+ *  public class FooDirectoryWalker extends DirectoryWalker {
+ *public FooDirectoryWalker(IOFileFilter dirFilter, IOFileFilter 
fileFilter) {
+ *  super(dirFilter, fileFilter, -1);
+ *}
+ *  }
+ *  
+ *  // Use the filters to construct the walker
+ *  FooDirectoryWalker walker = new FooDirectoryWalker(
+ *HiddenFileFilter.VISIBLE,
+ *FileFilterUtils.suffixFileFilter(.txt),
+ *  );
+ * pre
+ * This is much simpler than the previous example, and is why it is the 
preferred
+ * option for filtering.
  *
  * a name=cancel/a
  * h33. Cancellation/h3
@@ -145,8 +186,8 @@
  *
  * This example provides a codecancel()/code method for external processes 
to
  * indcate that processing must stop. Calling this method sets a
- * a 
href=http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#36930;
- * volatile/a flag to (hopefully) ensure it will work properly in
+ * a 
href=http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#36930;volatile/a
+ * flag to (hopefully) ensure it will work properly in
  * a multi-threaded environment. In this implementation the flag is checked in 
two
  * of the lifecycle methods using a convenience 
codecheckIfCancelled()/code method
  * which throws a [EMAIL PROTECTED] CancelException} if cancellation has been 
requested.
@@ -237,13 +278,45 @@
 
 /**
  * Construct an instance with a filter and limit the idepth/i 
navigated to.
+ * p
+ * The filter controls which

svn commit: r462795 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java

2006-10-11 Thread scolebourne
Author: scolebourne
Date: Wed Oct 11 06:35:19 2006
New Revision: 462795

URL: http://svn.apache.org/viewvc?view=revrev=462795
Log:
Javadoc style (less loud) and Checkstyle spaces

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java?view=diffrev=462795r1=462794r2=462795
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
 Wed Oct 11 06:35:19 2006
@@ -95,7 +95,7 @@
  * @deprecated use codegetByteCount()/code - see issue IO-84
  */
 public int getCount() {
-return (int)getByteCount();
+return (int) getByteCount();
 }
 
 /** 
@@ -109,17 +109,16 @@
  * @deprecated use coderesetByteCount()/code - see issue IO-84
  */
 public synchronized int resetCount() {
-return (int)resetByteCount();
+return (int) resetByteCount();
 }
 
 /**
  * The number of bytes that have passed through this stream.
  * p
- * strongN.B./strong This method was introduced as an
- * alternative for the codegetCount()/code method
- * because that method returns an integer which will result
- * in incorrect count for files over 2GB being returned.
- * 
+ * NOTE: This method is a replacement for codegetCount()/code
+ * and was added because that method returns an integer which will
+ * result in incorrect count for files over 2GB.
+ *
  * @return the number of bytes accumulated
  */
 public long getByteCount() {
@@ -129,10 +128,9 @@
 /** 
  * Set the count back to 0. 
  * p
- * strongN.B./strong This method was introduced as an
- * alternative for the coderesetCount()/code method
- * because that method returns an integer which will result
- * in incorrect count for files over 2GB being returned.
+ * NOTE: This method is a replacement for coderesetCount()/code
+ * and was added because that method returns an integer which will
+ * result in incorrect count for files over 2GB.
  *
  * @return the count previous to resetting.
  */



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r462807 - in /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io: input/CountingInputStream.java output/CountingOutputStream.java

2006-10-11 Thread scolebourne
Author: scolebourne
Date: Wed Oct 11 07:05:02 2006
New Revision: 462807

URL: http://svn.apache.org/viewvc?view=revrev=462807
Log:
Javadoc, checkstyle and since tags

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/CountingOutputStream.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java?view=diffrev=462807r1=462806r2=462807
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
 Wed Oct 11 07:05:02 2006
@@ -20,8 +20,11 @@
 import java.io.InputStream;
 
 /**
- * A decorating input stream that counts the number of bytes that
- * have passed through so far.
+ * A decorating input stream that counts the number of bytes that have passed
+ * through the stream so far.
+ * p
+ * A typical use case would be during debugging, to ensure that data is being
+ * read as expected.
  *
  * @author Henri Yandell
  * @author Marcelo Liberato
@@ -34,15 +37,21 @@
 
 /**
  * Constructs a new CountingInputStream.
- * @param in InputStream to delegate to
+ *
+ * @param in  the InputStream to delegate to
  */
 public CountingInputStream(InputStream in) {
 super(in);
 }
 
+//---
 /**
- * Increases the count by super.read(b)'s return count
- * 
+ * Reads a number of bytes into the byte array, keeping count of the
+ * number read.
+ *
+ * @param b  the buffer into which the data is read, not null
+ * @return the total number of bytes read into the buffer, -1 if end of 
stream
+ * @throws IOException if an I/O error occurs
  * @see java.io.InputStream#read(byte[]) 
  */
 public int read(byte[] b) throws IOException {
@@ -52,8 +61,14 @@
 }
 
 /**
- * Increases the count by super.read(b, off, len)'s return count
+ * Reads a number of bytes into the byte array at a specific offset,
+ * keeping count of the number read.
  *
+ * @param b  the buffer into which the data is read, not null
+ * @param off  the start offset in the buffer
+ * @param len  the maximum number of bytes to read
+ * @return the total number of bytes read into the buffer, -1 if end of 
stream
+ * @throws IOException if an I/O error occurs
  * @see java.io.InputStream#read(byte[], int, int)
  */
 public int read(byte[] b, int off, int len) throws IOException {
@@ -63,8 +78,11 @@
 }
 
 /**
- * Increases the count by 1 if a byte is successfully read. 
+ * Reads the next byte of data adding to the count of bytes received
+ * if a byte is successfully read. 
  *
+ * @return the byte read, -1 if end of stream
+ * @throws IOException if an I/O error occurs
  * @see java.io.InputStream#read()
  */
 public int read() throws IOException {
@@ -72,10 +90,14 @@
 this.count += (found = 0) ? 1 : 0;
 return found;
 }
-
+
 /**
- * Increases the count by the number of skipped bytes.
- * 
+ * Skips the stream over the specified number of bytes, adding the skipped
+ * amount to the count.
+ *
+ * @param length  the number of bytes to skip
+ * @return the actual number of bytes skipped
+ * @throws IOException if an I/O error occurs
  * @see java.io.InputStream#skip(long)
  */
 public long skip(final long length) throws IOException {
@@ -84,6 +106,7 @@
 return skip;
 }
 
+//---
 /**
  * The number of bytes that have passed through this stream.
  * p
@@ -120,19 +143,21 @@
  * result in incorrect count for files over 2GB.
  *
  * @return the number of bytes accumulated
+ * @since Commons IO 1.3
  */
 public long getByteCount() {
 return this.count;
 }
 
 /** 
- * Set the count back to 0. 
+ * Set the byte count back to 0. 
  * p
  * NOTE: This method is a replacement for coderesetCount()/code
  * and was added because that method returns an integer which will
  * result in incorrect count for files over 2GB.
  *
- * @return the count previous to resetting.
+ * @return the count previous to resetting
+ * @since Commons IO 1.3
  */
 public synchronized long resetByteCount() {
 long tmp = this.count;

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/CountingOutputStream.java
URL: 
http

svn commit: r462818 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/input/CountingInputStream.java src/java/org/apache/commons/io/output/CountingOutputStream.ja

2006-10-11 Thread scolebourne
Author: scolebourne
Date: Wed Oct 11 07:44:17 2006
New Revision: 462818

URL: http://svn.apache.org/viewvc?view=revrev=462818
Log:
IO-84 - Change int methods from deprecated to exception throwng

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/CountingOutputStream.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=462818r1=462817r2=462818
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Wed Oct 11 07:44:17 2006
@@ -63,6 +63,11 @@
   - Comment about result byte/char count being limited to an int, thus
 being inacurate for large streams
 
+- CountingInputStream/CountingOutputStream [IO-84]
+  - methods were declared as int thus the count was innacurate for large 
streams
+  - new long based methods getByteCount()/resetByteCount() added
+  - existing methods changed to throw an exception if the count is greater 
than an int
+
 
 Enhancements from 1.2
 -

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java?view=diffrev=462818r1=462817r2=462818
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
 Wed Oct 11 07:44:17 2006
@@ -110,49 +110,57 @@
 /**
  * The number of bytes that have passed through this stream.
  * p
- * strongWARNING/strong This method will return an
- * incorrect count for files over 2GB - use
- * codegetByteCount()/code instead.
+ * NOTE: From v1.3 this method throws an ArithmeticException if the
+ * count is greater than can be expressed by an codeint/code.
+ * See [EMAIL PROTECTED] #getByteCount()} for a method using a 
codelong/code.
  *
  * @return the number of bytes accumulated
- * @deprecated use codegetByteCount()/code - see issue IO-84
+ * @throws ArithmeticException if the byte count is too large
  */
-public int getCount() {
-return (int) getByteCount();
+public synchronized int getCount() {
+long result = getByteCount();
+if (result  Integer.MAX_VALUE) {
+throw new ArithmeticException(The byte count  + result +  is 
too large to be converted to an int);
+}
+return (int) result;
 }
 
 /** 
- * Set the count back to 0. 
+ * Set the byte count back to 0. 
  * p
- * strongWARNING/strong This method will return an
- * incorrect count for files over 2GB - use
- * coderesetByteCount()/code instead.
+ * NOTE: From v1.3 this method throws an ArithmeticException if the
+ * count is greater than can be expressed by an codeint/code.
+ * See [EMAIL PROTECTED] #resetByteCount()} for a method using a 
codelong/code.
  *
- * @return the count previous to resetting.
- * @deprecated use coderesetByteCount()/code - see issue IO-84
+ * @return the count previous to resetting
+ * @throws ArithmeticException if the byte count is too large
  */
 public synchronized int resetCount() {
-return (int) resetByteCount();
+long result = resetByteCount();
+if (result  Integer.MAX_VALUE) {
+throw new ArithmeticException(The byte count  + result +  is 
too large to be converted to an int);
+}
+return (int) result;
 }
 
 /**
  * The number of bytes that have passed through this stream.
  * p
- * NOTE: This method is a replacement for codegetCount()/code
+ * NOTE: This method is an alternative for codegetCount()/code
  * and was added because that method returns an integer which will
  * result in incorrect count for files over 2GB.
  *
  * @return the number of bytes accumulated
  * @since Commons IO 1.3
  */
-public long getByteCount() {
+public synchronized long getByteCount() {
 return this.count;
 }
 
 /** 
  * Set the byte count back to 0. 
  * p
- * NOTE: This method is a replacement for coderesetCount()/code
+ * NOTE: This method is an alternative for coderesetCount()/code
  * and was added because that method returns an integer which will
  * result in incorrect count for files over 2GB.
  *

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output

svn commit: r462824 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java

2006-10-11 Thread scolebourne
Author: scolebourne
Date: Wed Oct 11 08:02:10 2006
New Revision: 462824

URL: http://svn.apache.org/viewvc?view=revrev=462824
Log:
Javadoc

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java?view=diffrev=462824r1=462823r2=462824
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
 Wed Oct 11 08:02:10 2006
@@ -19,6 +19,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -41,12 +42,13 @@
  * the contents don't have to be copied to the new buffer. This class is
  * designed to behave exactly like the original. The only exception is the
  * deprecated toString(int) method that has been ignored.
+ * 
  * @author a href=mailto:[EMAIL PROTECTED]Jeremias Maerki/a
  * @version $Id$
  */
 public class ByteArrayOutputStream extends OutputStream {
 
-private List buffers = new java.util.ArrayList();
+private List buffers = new ArrayList();
 private int currentBufferIndex;
 private int filledBufferSum;
 private byte[] currentBuffer;
@@ -166,7 +168,9 @@
  * Closing a ttByteArrayOutputStream/tt has no effect. The methods in
  * this class can be called after the stream has been closed without
  * generating an ttIOException/tt.
- * @throws IOException in case an I/O error occurs
+ *
+ * @throws IOException never (this method should not declare this exception
+ * but it has to now due to backwards compatability)
  */
 public void close() throws IOException {
 //nop
@@ -183,10 +187,11 @@
 }
 
 /**
- * @param out The OutputStream to write to.
- * @exception IOException
- *if an I/O error occurs. In particular, an 
codeIOException/code is thrown if the output
- *stream is closed.
+ * Writes the entire contents of this byte stream to the
+ * specified output stream.
+ *
+ * @param out  the output stream to write to
+ * @throws IOException if an I/O error occurs, such as if the stream is 
closed
  * @see java.io.ByteArrayOutputStream#writeTo(OutputStream)
  */
 public synchronized void writeTo(OutputStream out) throws IOException {
@@ -203,9 +208,13 @@
 }
 
 /**
+ * Gets the curent contents of this byte stream as a byte array.
+ * The result is independent of this stream.
+ *
+ * @return the current contents of this output stream, as a byte array
  * @see java.io.ByteArrayOutputStream#toByteArray()
  */
-public synchronized byte toByteArray()[] {
+public synchronized byte[] toByteArray() {
 int remaining = count;
 int pos = 0;
 byte newbuf[] = new byte[count];
@@ -223,6 +232,8 @@
 }
 
 /**
+ * Gets the curent contents of this byte stream as a string.
+ *
  * @see java.io.ByteArrayOutputStream#toString()
  */
 public String toString() {
@@ -230,10 +241,12 @@
 }
 
 /**
- * @param enc The name of the character encoding
- * @return String converted from the byte array.
- * @exception UnsupportedEncodingException
- *If the named charset is not supported
+ * Gets the curent contents of this byte stream as a string
+ * using the specified encoding.
+ *
+ * @param enc  the name of the character encoding
+ * @return the string converted from the byte array
+ * @throws UnsupportedEncodingException if the encoding is not supported
  * @see java.io.ByteArrayOutputStream#toString(String)
  */
 public String toString(String enc) throws UnsupportedEncodingException {



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r462832 - in /jakarta/commons/proper/io/trunk/src: java/org/apache/commons/io/output/NullWriter.java test/org/apache/commons/io/output/NullWriterTest.java

2006-10-11 Thread scolebourne
Author: scolebourne
Date: Wed Oct 11 08:48:09 2006
New Revision: 462832

URL: http://svn.apache.org/viewvc?view=revrev=462832
Log:
IO-95 - Remove throws IOException from methods

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/NullWriter.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/NullWriterTest.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/NullWriter.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/NullWriter.java?view=diffrev=462832r1=462831r2=462832
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/NullWriter.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/NullWriter.java
 Wed Oct 11 08:48:09 2006
@@ -16,13 +16,12 @@
  */
 package org.apache.commons.io.output;
 
-import java.io.IOException;
 import java.io.Writer;
 
 /**
  * This [EMAIL PROTECTED] Writer} writes all data to the famous 
b/dev/null/b.
  * p
- * This [EMAIL PROTECTED] Writer} has no destination (file/socket etc.) and all
+ * This codeWriter/code has no destination (file/socket etc.) and all
  * characters written to it are ignored and lost.
  * 
  * @version $Id$
@@ -36,37 +35,37 @@
 }
 
 /** @see java.io.Writer#write(int) */
-public void write(int idx) throws IOException {
+public void write(int idx) {
 //to /dev/null
 }
 
 /** @see java.io.Writer#write(char[]) */
-public void write(char[] chr) throws IOException {
+public void write(char[] chr) {
 //to /dev/null
 }
 
 /** @see java.io.Writer#write(char[], int, int) */
-public void write(char[] chr, int st, int end) throws IOException {
+public void write(char[] chr, int st, int end) {
 //to /dev/null
 }
 
 /** @see java.io.Writer#write(String) */
-public void write(String str) throws IOException {
+public void write(String str) {
 //to /dev/null
 }
 
 /** @see java.io.Writer#write(String, int, int) */
-public void write(String str, int st, int end) throws IOException {
+public void write(String str, int st, int end) {
 //to /dev/null
 }
 
 /** @see java.io.Writer#flush() */
-public void flush() throws IOException {
+public void flush() {
 //to /dev/null
 }
 
 /** @see java.io.Writer#close() */
-public void close() throws IOException {
+public void close() {
 //to /dev/null
 }
 

Modified: 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/NullWriterTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/NullWriterTest.java?view=diffrev=462832r1=462831r2=462832
==
--- 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/NullWriterTest.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/NullWriterTest.java
 Wed Oct 11 08:48:09 2006
@@ -16,26 +16,21 @@
  */
 package org.apache.commons.io.output;
 
-
-import java.io.IOException;
-
 import junit.framework.TestCase;
 
-
 /**
  * Really not a lot to do here, but checking that no 
  * Exceptions are thrown. 
  *
  * @version $Revision$
  */
-
 public class NullWriterTest extends TestCase {
 
 public NullWriterTest(String name) {
 super(name);
 }
 
-public void testNull() throws IOException {
+public void testNull() {
 char[] chars = new char[] {'A', 'B', 'C'};
 NullWriter writer = new NullWriter();
 writer.write(1);



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r462833 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/test/org/apache/commons/io/output/PackageTestSuite.java

2006-10-11 Thread scolebourne
Author: scolebourne
Date: Wed Oct 11 08:49:33 2006
New Revision: 462833

URL: http://svn.apache.org/viewvc?view=revrev=462833
Log:
IO-95 - Add NullWriter

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/PackageTestSuite.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=462833r1=462832r2=462833
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Wed Oct 11 08:49:33 2006
@@ -136,6 +136,9 @@
   - new sizeRangeFileFilter(long minimumSize, long maximumSize) method which 
 creates a filter that accepts files within the specified size range.
 
+- NullWriter
+  - New writer that acts as a sink for all data, as per /dev/null
+
 
 Feedback
 

Modified: 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/PackageTestSuite.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/PackageTestSuite.java?view=diffrev=462833r1=462832r2=462833
==
--- 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/PackageTestSuite.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/output/PackageTestSuite.java
 Wed Oct 11 08:49:33 2006
@@ -38,6 +38,7 @@
 suite.addTest(new TestSuite(DeferredFileOutputStreamTest.class));
 suite.addTest(new TestSuite(LockableFileWriterTest.class));
 suite.addTest(new TestSuite(NullOutputStreamTest.class));
+suite.addTest(new TestSuite(NullWriterTest.class));
 suite.addTest(new TestSuite(TeeOutputStreamTest.class));
 return suite;
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r462842 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/test/org/apache/commons/io/testtools/FileBasedTestCase.java

2006-10-11 Thread scolebourne
Author: scolebourne
Date: Wed Oct 11 09:30:24 2006
New Revision: 462842

URL: http://svn.apache.org/viewvc?view=revrev=462842
Log:
IO-96 - FileBasedTestCase - Fixed bug in compare content methods identified by 
GNU classpath
based on patch from Anthony Green

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/testtools/FileBasedTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=462842r1=462841r2=462842
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Wed Oct 11 09:30:24 2006
@@ -68,6 +68,9 @@
   - new long based methods getByteCount()/resetByteCount() added
   - existing methods changed to throw an exception if the count is greater 
than an int
 
+- FileBasedTestCase
+  - Fixed bug in compare content methods identified by GNU classpath
+
 
 Enhancements from 1.2
 -

Modified: 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/testtools/FileBasedTestCase.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/testtools/FileBasedTestCase.java?view=diffrev=462842r1=462841r2=462842
==
--- 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/testtools/FileBasedTestCase.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/testtools/FileBasedTestCase.java
 Wed Oct 11 09:30:24 2006
@@ -165,38 +165,38 @@
 }
 
 /** Assert that the content of a file is equal to that in a byte[]. */
-protected void assertEqualContent( byte[] b0, File file )
-throws IOException
-{
-InputStream is = new java.io.FileInputStream( file );
+protected void assertEqualContent(byte[] b0, File file) throws IOException 
{
+InputStream is = new java.io.FileInputStream(file);
+int count = 0, numRead = 0;
+byte[] b1 = new byte[b0.length];
 try {
-byte[] b1 = new byte[ b0.length ];
-int numRead = is.read( b1 );
-assertTrue( Different number of bytes, numRead == b0.length  
is.available() == 0 );
-for( int i = 0;
- i  numRead;
- assertTrue( Byte  + i +  differs ( + b0[ i ] +  !=  + 
b1[ i ] + ), 
-b0[ i ] == b1[ i ] ), i++
-);
+while (count  b0.length  numRead = 0) {
+numRead = is.read(b1, count, b0.length);
+count += numRead;
+}
+assertEquals(Different number of bytes: , b0.length, count);
+for (int i = 0; i  count; i++) {
+assertEquals(byte  + i +  differs, b0[i], b1[i]);
+}
 } finally {
 is.close();
 }
 }
 
 /** Assert that the content of a file is equal to that in a char[]. */
-protected void assertEqualContent( char[] c0, File file )
-throws IOException
-{
-Reader ir = new java.io.FileReader( file );
+protected void assertEqualContent(char[] c0, File file) throws IOException 
{
+Reader ir = new java.io.FileReader(file);
+int count = 0, numRead = 0;
+char[] c1 = new char[c0.length];
 try {
-char[] c1 = new char[ c0.length ];
-int numRead = ir.read( c1 );
-assertTrue( Different number of bytes, numRead == c0.length );
-for( int i = 0;
- i  numRead;
- assertTrue( Byte  + i +  differs ( + c0[ i ] +  !=  + 
c1[ i ] + ), 
-c0[ i ] == c1[ i ] ), i++
-);
+while (count  c0.length  numRead = 0) {
+numRead = ir.read(c1, count, c0.length);
+count += numRead;
+}
+assertEquals(Different number of chars: , c0.length, count);
+for (int i = 0; i  count; i++) {
+assertEquals(char  + i +  differs, c0[i], c1[i]);
+}
 } finally {
 ir.close();
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r462847 - in /jakarta/commons/proper/io/trunk/src: java/org/apache/commons/io/input/ test/org/apache/commons/io/input/

2006-10-11 Thread scolebourne
Author: scolebourne
Date: Wed Oct 11 09:44:06 2006
New Revision: 462847

URL: http://svn.apache.org/viewvc?view=revrev=462847
Log:
IO-94 - MockInputStream/MockReader

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockInputStreamTestCase.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockReaderTestCase.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/PackageTestSuite.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java?view=diffrev=462847r1=462846r2=462847
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java
 Wed Oct 11 09:44:06 2006
@@ -38,7 +38,6 @@
  * codeprocessBytes()/code methods can be implemented to generate
  * test data.
  *
- *
  * @since Commons IO 1.3
  * @version $Revision$
  */
@@ -53,7 +52,8 @@
 private boolean markSupported;
 
 /**
- * Create a mock [EMAIL PROTECTED] InputStream} of the specified size.
+ * Create a mock [EMAIL PROTECTED] InputStream} of the specified size
+ * which supports marking and does not throw EOFException.
  *
  * @param size The size of the mock input stream.
  */
@@ -113,7 +113,7 @@
 }
 
 /**
- * Close this inputstream - resets the internal state to
+ * Close this input stream - resets the internal state to
  * the initial values.
  *
  * @throws IOException If an error occurs.
@@ -268,12 +268,12 @@
 /**
  * Return a byte value for the  coderead()/code method.
  * p
- * strongN.B./strong This implementation returns
- * zero.
+ * This implementation returns zero.
  *
  * @return This implementation always returns zero.
  */
 protected int processByte() {
+// do nothing - overridable by subclass
 return 0;
 }
 
@@ -281,14 +281,14 @@
  * Process the bytes for the coderead(byte[], offset, length)/code
  * method.
  * p
- * strongN.B./strong This implementation leaves the byte
- * array unchanged.
+ * This implementation leaves the byte array unchanged.
  *
  * @param bytes The byte array
  * @param offset The offset to start at.
  * @param length The number of bytes.
  */
 protected void processBytes(byte[] bytes, int offset, int length) {
+// do nothing - overridable by subclass
 }
 
 /**
@@ -306,4 +306,5 @@
 }
 return -1;
 }
+
 }

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java?view=diffrev=462847r1=462846r2=462847
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java
 Wed Oct 11 09:44:06 2006
@@ -38,7 +38,6 @@
  * codeprocessChars()/code methods can be implemented to generate
  * test data.
  *
- *
  * @since Commons IO 1.3
  * @version $Revision$
  */
@@ -53,7 +52,8 @@
 private boolean markSupported;
 
 /**
- * Create a mock [EMAIL PROTECTED] Reader} of the specified size.
+ * Create a mock [EMAIL PROTECTED] Reader} of the specified size
+ * which supports marking and does not throw EOFException.
  *
  * @param size The size of the mock Reader.
  */
@@ -252,12 +252,12 @@
 /**
  * Return a character value for the  coderead()/code method.
  * p
- * strongN.B./strong This implementation returns
- * zero.
+ * This implementation returns zero.
  *
  * @return This implementation always returns zero.
  */
 protected int processChar() {
+// do nothing - overridable by subclass
 return 0;
 }
 
@@ -265,14 +265,14 @@
  * Process the characters for the coderead(char[], offset, length)/code
  * method.
  * p
- * strongN.B./strong This implementation leaves the character
- * array unchanged.
+ * This implementation leaves the character array unchanged.
  *
  * @param chars The character array
  * @param offset The offset to start at.
  * @param length The number of characters.
  */
 protected void processChars(char[] chars, int offset, int length) {
+// do nothing

svn commit: r453889 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileSystemUtils.java src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

2006-10-07 Thread scolebourne
Author: scolebourne
Date: Sat Oct  7 04:56:25 2006
New Revision: 453889

URL: http://svn.apache.org/viewvc?view=revrev=453889
Log:
IO-93 - FileSystemUtils - Fixed resource leak leading to 'Too many open files' 
error
- Previously did not destroy Process instances (as JDK Javadoc is so poor)
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4801027

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=453889r1=453888r2=453889
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Sat Oct  7 04:56:25 2006
@@ -51,6 +51,11 @@
 - FileSystemUtils.freeSpace [IO-91]
   - This is now documented not to work on SunOS 5
 
+- FileSystemUtils [IO-93]
+  - Fixed resource leak leading to 'Too many open files' error
+  - Previously did not destroy Process instances (as JDK Javadoc is so poor)
+  - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4801027
+
 - FileCleaner
   - This now handles the situation where an error occurs when deleting the file
 

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java?view=diffrev=453889r1=453888r2=453889
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
 Sat Oct  7 04:56:25 2006
@@ -18,7 +18,9 @@
 
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -113,8 +115,8 @@
  * As this is not very useful, this method is deprecated in favour
  * of [EMAIL PROTECTED] #freeSpaceKb(String)} which returns a result in 
kilobytes.
  * p
- * Note that some OS's are NOT currently supported, including OS/390
- * and SunOS 5. (SunOS is supported by codefreeSpaceKb/code.)
+ * Note that some OS's are NOT currently supported, including OS/390,
+ * OpenVMS and and SunOS 5. (SunOS is supported by 
codefreeSpaceKb/code.)
  * pre
  * FileSystemUtils.freeSpace(C:);   // Windows
  * FileSystemUtils.freeSpace(/volume);  // *nix
@@ -374,6 +376,7 @@
 }
 }
 
+//---
 /**
  * Performs the os command.
  *
@@ -383,16 +386,31 @@
  * @throws IOException if an error occurs
  */
 List performCommand(String[] cmdAttribs, int max) throws IOException {
-List lines = new ArrayList();
-BufferedReader in = null;
+// this method does what it can to avoid the 'Too many open files' 
error
+// based on trial and error and these links:
+// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4784692
+// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4801027
+// 
http://forum.java.sun.com/thread.jspa?threadID=533029messageID=2572018
+// however, its still not perfect as the JDK support is so poor
+// (see commond-exec or ant for a better multi-threaded multi-os 
solution)
+
+List lines = new ArrayList(20);
+Process proc = null;
+InputStream in = null;
+OutputStream out = null;
+InputStream err = null;
+BufferedReader inr = null;
 try {
-Process proc = openProcess(cmdAttribs);
-in = openProcessStream(proc);
-String line = in.readLine();
+proc = openProcess(cmdAttribs);
+in = proc.getInputStream();
+out = proc.getOutputStream();
+err = proc.getErrorStream();
+inr = new BufferedReader(new InputStreamReader(in));
+String line = inr.readLine();
 while (line != null  lines.size()  max) {
 line = line.toLowerCase().trim();
 lines.add(line);
-line = in.readLine();
+line = inr.readLine();
 }
 
 proc.waitFor();
@@ -416,6 +434,12 @@
 ' for command  + Arrays.asList(cmdAttribs));
 } finally {
 IOUtils.closeQuietly(in);
+IOUtils.closeQuietly(out);
+IOUtils.closeQuietly(err);
+IOUtils.closeQuietly(inr);
+if (proc

svn commit: r453893 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/IOUtils.java

2006-10-07 Thread scolebourne
Author: scolebourne
Date: Sat Oct  7 05:52:32 2006
New Revision: 453893

URL: http://svn.apache.org/viewvc?view=revrev=453893
Log:
IO-84 - IOUtils.copy - Comment about result byte/char count being limited to an 
int, thus being inacurate for large streams

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=453893r1=453892r2=453893
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Sat Oct  7 05:52:32 2006
@@ -59,6 +59,10 @@
 - FileCleaner
   - This now handles the situation where an error occurs when deleting the file
 
+- IOUtils.copy [IO-84]
+  - Comment about result byte/char count being limited to an int, thus
+being inacurate for large streams
+
 
 Enhancements from 1.2
 -

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=diffrev=453893r1=453892r2=453893
==
--- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java 
(original)
+++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java 
Sat Oct  7 05:52:32 2006
@@ -981,6 +981,9 @@
  * p
  * This method buffers the input internally, so there is no need to use a
  * codeBufferedInputStream/code.
+ * p
+ * Large streams (over 2GB) will return an inaccurate result count as the
+ * type is an int. The copy will complete correctly however.
  * 
  * @param input  the codeInputStream/code to read from
  * @param output  the codeOutputStream/code to write to
@@ -1058,6 +1061,9 @@
  * p
  * This method buffers the input internally, so there is no need to use a
  * codeBufferedReader/code.
+ * p
+ * Large streams (over 2GB) will return an inaccurate result count as the
+ * type is an int. The copy will complete correctly however.
  *
  * @param input  the codeReader/code to read from
  * @param output  the codeWriter/code to write to



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r453895 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java

2006-10-07 Thread scolebourne
Author: scolebourne
Date: Sat Oct  7 05:56:20 2006
New Revision: 453895

URL: http://svn.apache.org/viewvc?view=revrev=453895
Log:
Fix id tag

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java?view=diffrev=453895r1=453894r2=453895
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
 Sat Oct  7 05:56:20 2006
@@ -29,7 +29,7 @@
  * This class captures the strategy to use and is designed for user 
subclassing.
  *
  * @author Stephen Colebourne
- * @version $Id $
+ * @version $Id: $
  * @since Commons IO 1.3
  */
 public class FileDeleteStrategy {



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r453896 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java

2006-10-07 Thread scolebourne
Author: scolebourne
Date: Sat Oct  7 05:58:38 2006
New Revision: 453896

URL: http://svn.apache.org/viewvc?view=revrev=453896
Log:
Fix id tag

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java?view=diffrev=453896r1=453895r2=453896
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
 Sat Oct  7 05:58:38 2006
@@ -119,7 +119,7 @@
 //---
 /**
  * Gets a string describing the delete strategy.
- * 
+ *
  * @return a string describing the delete strategy
  */
 public String toString() {



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r453903 - in /jakarta/commons/proper/io/trunk/src: java/org/apache/commons/io/FileDeleteStrategy.java test/org/apache/commons/io/PackageTestSuite.java

2006-10-07 Thread scolebourne
Author: scolebourne
Date: Sat Oct  7 06:47:06 2006
New Revision: 453903

URL: http://svn.apache.org/viewvc?view=revrev=453903
Log:
Add tests for FileDeleteStrategy

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/PackageTestSuite.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java?view=diffrev=453903r1=453902r2=453903
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
 Sat Oct  7 06:47:06 2006
@@ -29,7 +29,7 @@
  * This class captures the strategy to use and is designed for user 
subclassing.
  *
  * @author Stephen Colebourne
- * @version $Id: $
+ * @version $Id$
  * @since Commons IO 1.3
  */
 public class FileDeleteStrategy {
@@ -70,7 +70,7 @@
  * @return true if the file was deleted, or there was no such file
  */
 public boolean deleteQuietly(File fileToDelete) {
-if (fileToDelete == null) {
+if (fileToDelete == null || fileToDelete.exists() == false) {
 return true;
 }
 try {
@@ -91,7 +91,7 @@
  * @throws IOException if an error occurs during file deletion
  */
 public void delete(File fileToDelete) throws IOException {
-if (doDelete(fileToDelete) == false) {
+if (fileToDelete.exists()  doDelete(fileToDelete) == false) {
 throw new IOException(Deletion failed:  + fileToDelete);
 }
 }
@@ -103,12 +103,12 @@
  * The implementation may return either false or an 
codeIOException/code
  * when deletion fails. The [EMAIL PROTECTED] #delete(File)} and [EMAIL 
PROTECTED] #deleteQuietly(File)}
  * methods will handle either response appropriately.
- * If the file does not exist, the implementation must return true.
+ * A check has been made to ensure that the file will exist.
  * p
  * This implementation uses [EMAIL PROTECTED] File#delete()}.
  *
- * @param fileToDelete  the file to delete, not null
- * @return true if the file was deleted, or there was no such file
+ * @param fileToDelete  the file to delete, exists, not null
+ * @return true if the file was deleteds
  * @throws NullPointerException if the file is null
  * @throws IOException if an error occurs during file deletion
  */
@@ -123,7 +123,7 @@
  * @return a string describing the delete strategy
  */
 public String toString() {
-return FileDelete[ + name + ];
+return FileDeleteStrategy[ + name + ];
 }
 
 //---
@@ -148,9 +148,7 @@
  * @throws IOException if an error occurs during file deletion
  */
 protected boolean doDelete(File fileToDelete) throws IOException {
-if (fileToDelete.exists()) {
-FileUtils.forceDelete(fileToDelete);
-}
+FileUtils.forceDelete(fileToDelete);
 return true;
 }
 }

Modified: 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/PackageTestSuite.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/PackageTestSuite.java?view=diffrev=453903r1=453902r2=453903
==
--- 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/PackageTestSuite.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/PackageTestSuite.java
 Sat Oct  7 06:47:06 2006
@@ -39,6 +39,7 @@
 suite.addTest(new TestSuite(DemuxTestCase.class));
 suite.addTest(new TestSuite(EndianUtilsTest.class));
 suite.addTest(new TestSuite(FileCleanerTestCase.class));
+suite.addTest(new TestSuite(FileDeleteStrategyTestCase.class));
 suite.addTest(new TestSuite(FilenameUtilsTestCase.class));
 suite.addTest(new TestSuite(FilenameUtilsWildcardTestCase.class));
 suite.addTest(new TestSuite(FileSystemUtilsTestCase.class));



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r453906 - /jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileDeleteStrategyTestCase.java

2006-10-07 Thread scolebourne
Author: scolebourne
Date: Sat Oct  7 06:53:09 2006
New Revision: 453906

URL: http://svn.apache.org/viewvc?view=revrev=453906
Log:
Add tests for FileDeleteStrategy

Added:

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileDeleteStrategyTestCase.java
   (with props)

Added: 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileDeleteStrategyTestCase.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileDeleteStrategyTestCase.java?view=autorev=453906
==
--- 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileDeleteStrategyTestCase.java
 (added)
+++ 
jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileDeleteStrategyTestCase.java
 Sat Oct  7 06:53:09 2006
@@ -0,0 +1,140 @@
+/*
+ * 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.io;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.io.testtools.FileBasedTestCase;
+
+/**
+ * Test for FileDeleteStrategy.
+ *
+ * @version $Id: DirectoryWalkerTestCase.java 438218 2006-08-29 21:15:11 + 
(Tue, 29 Aug 2006) scolebourne $
+ * @see FileDeleteStrategy
+ */
+public class FileDeleteStrategyTestCase extends FileBasedTestCase {
+
+public static Test suite() {
+return new TestSuite(FileDeleteStrategyTestCase.class);
+}
+
+public FileDeleteStrategyTestCase(String name) {
+super(name);
+}
+
+protected void setUp() throws Exception {
+super.setUp();
+}
+
+protected void tearDown() throws Exception {
+super.tearDown();
+}
+
+//---
+public void testDeleteNormal() throws Exception {
+File baseDir = getTestDirectory();
+File subDir = new File(baseDir, test);
+assertEquals(true, subDir.mkdir());
+File subFile = new File(subDir, a.txt);
+createFile(subFile, 16);
+
+assertEquals(true, subDir.exists());
+assertEquals(true, subFile.exists());
+// delete dir
+try {
+FileDeleteStrategy.NORMAL.delete(subDir);
+fail();
+} catch (IOException ex) {
+// expected
+}
+assertEquals(true, subDir.exists());
+assertEquals(true, subFile.exists());
+// delete file
+FileDeleteStrategy.NORMAL.delete(subFile);
+assertEquals(true, subDir.exists());
+assertEquals(false, subFile.exists());
+// delete dir
+FileDeleteStrategy.NORMAL.delete(subDir);
+assertEquals(false, subDir.exists());
+// delete dir
+FileDeleteStrategy.NORMAL.delete(subDir);  // no error
+assertEquals(false, subDir.exists());
+}
+
+public void testDeleteQuietlyNormal() throws Exception {
+File baseDir = getTestDirectory();
+File subDir = new File(baseDir, test);
+assertEquals(true, subDir.mkdir());
+File subFile = new File(subDir, a.txt);
+createFile(subFile, 16);
+
+assertEquals(true, subDir.exists());
+assertEquals(true, subFile.exists());
+// delete dir
+assertEquals(false, FileDeleteStrategy.NORMAL.deleteQuietly(subDir));
+assertEquals(true, subDir.exists());
+assertEquals(true, subFile.exists());
+// delete file
+assertEquals(true, FileDeleteStrategy.NORMAL.deleteQuietly(subFile));
+assertEquals(true, subDir.exists());
+assertEquals(false, subFile.exists());
+// delete dir
+assertEquals(true, FileDeleteStrategy.NORMAL.deleteQuietly(subDir));
+assertEquals(false, subDir.exists());
+// delete dir
+assertEquals(true, FileDeleteStrategy.NORMAL.deleteQuietly(subDir));  
// no error
+assertEquals(false, subDir.exists());
+}
+
+public void testDeleteForce() throws Exception {
+File baseDir = getTestDirectory();
+File subDir = new File(baseDir, test);
+assertEquals(true, subDir.mkdir());
+File

svn commit: r453928 - in /jakarta/commons/proper/io/trunk/src: java/org/apache/commons/io/DirectoryWalker.java test/org/apache/commons/io/DirectoryWalkerTestCase.java test/org/apache/commons/io/Packag

2006-10-07 Thread scolebourne
Author: scolebourne
Date: Sat Oct  7 08:15:26 2006
New Revision: 453928

URL: http://svn.apache.org/viewvc?view=revrev=453928
Log:
Add cancellation support to DirectoryWalker

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/DirectoryWalkerTestCase.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/PackageTestSuite.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java?view=diffrev=453928r1=453927r2=453928
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 Sat Oct  7 08:15:26 2006
@@ -94,6 +94,49 @@
  *
  * /pre
  *
+ * h3Cancellation/h3
+ *
+ * The DirectoryWalker contains some of the logic required for cancel 
processing.
+ * Subclasses must complete the implementation.
+ * This is for performance and to ensure you think about the multihreaded 
implications.
+ * p
+ * Before any processing occurs on each file or directory the
+ * codeisCancelled()/code method is called. If it returns codetrue/code
+ * then codehandleCancelled()code is called. This method can decide whether
+ * to accept or ignore the cancellation. If it accepts it then all further
+ * processing is skipped and the operation returns. If it rejects it then
+ * processing continues on as before. This is useful if a group of files has
+ * meaning and cancellation cannot occur in the middle of the group.
+ * p
+ * The default implementation of codeisCancelled()/code always
+ * returns codefalse/code and it is down to the implementation
+ * to fully implement the codeisCancelled()/code behaviour.
+ * p
+ * The following example uses the
+ * a 
href=http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#36930;
+ * volatile/a keyword to (hopefully) ensure it will work properly in
+ * a multi-threaded environment.
+ *
+ * pre
+ *  public class FooDirectoryWalker extends DirectoryWalker {
+ *
+ *private volatile boolean cancelled = false;
+ *
+ *public void cancel() {
+ *cancelled = true;
+ *}
+ *
+ *public boolean isCancelled() {
+ *return cancelled;
+ *}
+ *
+ *protected boolean handleCancelled(File file, int depth, Collection 
results) {
+ *   // implement any cancel processing here
+ *   return true;  // accept cancellation
+ *}
+ *  }
+ * /pre
+ *
  * @since Commons IO 1.3
  * @version $Revision: 424748 $
  */
@@ -109,6 +152,13 @@
 private final int depthLimit;
 
 /**
+ * Construct an instance with no filtering and unlimited idepth/i.
+ */
+protected DirectoryWalker() {
+this(null, -1);
+}
+
+/**
  * Construct an instance with a filter and limit the idepth/i 
navigated to.
  *
  * @param filter  the filter to limit the navigation/results, may be null
@@ -131,35 +181,49 @@
  * Once called, this method will emit events as it walks the hierarchy.
  * The event methods have the prefix codehandle/code.
  *
- * @param startDirectory  the directory to start from
+ * @param startDirectory  the directory to start from, not null
  * @param results  the collection of result objects, may be updated
+ * @return true if completed, false if cancelled
+ * @throws NullPointerException if the start directory is null
  */
-protected void walk(File startDirectory, Collection results) {
+protected boolean walk(File startDirectory, Collection results) {
 handleStart(startDirectory, results);
-walk(startDirectory, 0, results);
+if (walk(startDirectory, 0, results) == false) {
+return false;  // cancelled
+}
 handleEnd(results);
+return true;
 }
 
 /**
  * Main recursive method to examine the directory hierarchy.
  *
- * @param directory  the directory to examine
+ * @param directory  the directory to examine, not null
  * @param depth  the directory level (starting directory = 0)
  * @param results  the collection of result objects, may be updated
+ * @return false if cancelled
  */
-private void walk(File directory, int depth, Collection results) {
+private boolean walk(File directory, int depth, Collection results) {
+if (isCancelled()  handleCancelled(directory, depth, results)) {
+return false;  // cancelled
+}
 if (handleDirectory(directory, depth, results)) {
 handleDirectoryStart(directory, depth, results);
 int childDepth = depth + 1;
 if (depthLimit  0 || childDepth = depthLimit) {
 File

svn commit: r453413 - /jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

2006-10-05 Thread scolebourne
Author: scolebourne
Date: Thu Oct  5 15:43:19 2006
New Revision: 453413

URL: http://svn.apache.org/viewvc?view=revrev=453413
Log:
Fix spelling error in constant name

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diffrev=453413r1=453412r2=453413
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Thu Oct  5 15:43:19 2006
@@ -110,7 +110,7 @@
 - EmptyFileFilter
   - New IOFileFilter implementation
   - Accepts files or directories that are empty
-  - Singleton instances provided (EMPTY/NO_EMPTY)
+  - Singleton instances provided (EMPTY/NOT_EMPTY)
 
 - TrueFileFilter/FalseFileFilter/DirectoryFileFilter
   - New singleton instance constants (TRUE/FALSE/DIRECTORY)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r439102 - in /jakarta/commons/proper/io/trunk: ./ src/java/org/apache/commons/io/ src/test/org/apache/commons/io/

2006-08-31 Thread scolebourne
Author: scolebourne
Date: Thu Aug 31 16:34:31 2006
New Revision: 439102

URL: http://svn.apache.org/viewvc?rev=439102view=rev
Log:
IO-56,IO-70 - FileDeleteStrategy / FileCleaner
- FileDeleteStrategy is a strategy for handling file deletion and can be used 
as a calback in FileCleaner
- Together these allow FileCleaner to do a forceDelete to kill directories and 
provide hooks for secure delete

Added:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileDeleteStrategy.java
   (with props)
Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileCleanerTestCase.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/PackageTestSuite.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?rev=439102r1=439101r2=439102view=diff
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Thu Aug 31 16:34:31 2006
@@ -51,6 +51,9 @@
 - FileSystemUtils.freeSpace [IO-91]
   - This is now documented not to work on SunOS 5
 
+- FileCleaner
+  - This now handles the situation where an error occurs when deleting the file
+
 
 Enhancements from 1.2
 -
@@ -62,6 +65,19 @@
   - wildcardMatch - new method that has IOCase as a parameter
   - equals - new method that has IOCase as a parameter
 
+- FileUtils.isFileOlder
+  - add methods to check if a file is older (i.e. isFileOlder()) - counterparts
+to the existing isFileNewer() methods.
+
+- FileUtils.checksum, FileUtils.checksumCRC32
+  - add methods to create a checksum of a file
+
+- FileDeleteStrategy
+- FileCleaner[IO-56,IO-70]
+  - FileDeleteStrategy is a strategy for handling file deletion
+  - This can be used as a calback in FileCleaner
+  - Together these allow FileCleaner to do a forceDelete to kill directories
+
 - WildcardFileFilter
   - Replacement for WildcardFilter
   - Accepts both files and directories
@@ -105,13 +121,6 @@
 - FileFilterUtils
   - new sizeRangeFileFilter(long minimumSize, long maximumSize) method which 
 creates a filter that accepts files within the specified size range.
-
-- FileUtils
-  - add methods to check if a file is older (i.e. isFileOlder()) - counterparts
-to the existing isFileNewer() methods.
-
-- FileUtils.checksum, FileUtils.checksumCRC32
-  - add methods to create a checksum of a file
 
 
 Feedback

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java?rev=439102r1=439101r2=439102view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java 
Thu Aug 31 16:34:31 2006
@@ -81,69 +81,104 @@
 reaper.start();
 }
 
+//---
 /**
  * Track the specified file, using the provided marker, deleting the file
  * when the marker instance is garbage collected.
+ * The [EMAIL PROTECTED] FileDeleteStrategy#NORMAL normal} deletion 
strategy will be used.
  *
- * @param file   The file to be tracked.
- * @param marker The marker object used to track the file.
+ * @param file  the file to be tracked, not null
+ * @param marker  the marker object used to track the file, not null
+ * @throws NullPointerException if the file is null
  */
 public static void track(File file, Object marker) {
-trackers.add(new Tracker(file, marker, q));
+track(file, marker, (FileDeleteStrategy) null);
 }
 
 /**
  * Track the specified file, using the provided marker, deleting the file
  * when the marker instance is garbage collected.
+ * The speified deletion strategy is used.
  *
- * @param path   The full path to the file to be tracked.
- * @param marker The marker object used to track the file.
+ * @param file  the file to be tracked, not null
+ * @param marker  the marker object used to track the file, not null
+ * @param deleteStrategy  the strategy to delete the file, null means 
normal
+ * @throws NullPointerException if the file is null
+ */
+public static void track(File file, Object marker, FileDeleteStrategy 
deleteStrategy) {
+if (file == null) {
+throw new NullPointerException(The file must not be null);
+}
+trackers.add(new Tracker(file.getPath(), deleteStrategy, marker, q

svn commit: r438209 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileSystemUtils.java src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

2006-08-29 Thread scolebourne
Author: scolebourne
Date: Tue Aug 29 13:54:47 2006
New Revision: 438209

URL: http://svn.apache.org/viewvc?rev=438209view=rev
Log:
IO-91 - FileSystemUtils.freeSpace deprecated, replaced by freeSpaceKb
Document freeSpace not working with SunOS 5
info from Magnus Grimsell

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?rev=438209r1=438208r2=438209view=diff
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Tue Aug 29 13:54:47 2006
@@ -29,6 +29,12 @@
 - WildcardFilter deprecated, replaced by WildcardFileFilter
   - old class only accepted files, thus had a confusing dual purpose
 
+- FileSystemUtils.freeSpace deprecated, replaced by freeSpaceKb
+  - freeSpace returns a result that varies by operating system and
+thus isn't that useful
+  - freeSpaceKb returns much better and more consistent results
+  - freeSpaceKb existed in v1.2, so this is a gentle cutover
+
 
 Bug fixes from 1.2
 --
@@ -41,6 +47,9 @@
 - FileSystemUtils.freeSpace/freeSpaceKb [IO-90]
   - Avoid infinite looping in Windows
   - Catch more errors with nice messages
+
+- FileSystemUtils.freeSpace [IO-91]
+  - This is now documented not to work on SunOS 5
 
 
 Enhancements from 1.2

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java?rev=438209r1=438208r2=438209view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
 Tue Aug 29 13:54:47 2006
@@ -110,11 +110,11 @@
  * the command line.
  * This method does not normalize the result, and typically returns
  * bytes on Windows, 512 byte units on OS X and kilobytes on Unix.
+ * As this is not very useful, this method is deprecated in favour
+ * of [EMAIL PROTECTED] #freeSpaceKb(String)} which returns a result in 
kilobytes.
  * p
- * See also [EMAIL PROTECTED] #freeSpaceKb(String)} for a better 
implementation
- * which normalizes to kilobytes.
- * p
- * Note that some OS's are NOT currently supported, including OS/390.
+ * Note that some OS's are NOT currently supported, including OS/390
+ * and SunOS 5. (SunOS is supported by codefreeSpaceKb/code.)
  * pre
  * FileSystemUtils.freeSpace(C:);   // Windows
  * FileSystemUtils.freeSpace(/volume);  // *nix
@@ -127,6 +127,9 @@
  * @throws IllegalArgumentException if the path is invalid
  * @throws IllegalStateException if an error occurred in initialisation
  * @throws IOException if an error occurs when finding the free space
+ * @since Commons IO 1.1, enhanced OS support in 1.2 and 1.3
+ * @deprecated Use freeSpaceKb(String)
+ *  Deprecated from 1.3, may be removed in 2.0
  */
 public static long freeSpace(String path) throws IOException {
 return INSTANCE.freeSpaceOS(path, OS, false);
@@ -136,20 +139,26 @@
 /**
  * Returns the free space on a drive or volume in kilobytes by invoking
  * the command line.
- * Note that some OS's are NOT currently supported, including OS/390.
  * pre
  * FileSystemUtils.freeSpaceKb(C:);   // Windows
  * FileSystemUtils.freeSpaceKb(/volume);  // *nix
  * /pre
  * The free space is calculated via the command line.
  * It uses 'dir /-c' on Windows, 'df -kP' on AIX/HP-UX and 'df -k' on 
other Unix.
+ * p
+ * In order to work, you must be running Windows, or have a implementation 
of
+ * Unix df that supports GNU format when passed -k (or -kP). If you are 
going
+ * to rely on this code, please check that it works on your OS by running
+ * some simple tests to compare the command line with the output from this 
class.
+ * If your operating system isn't supported, please raise a JIRA call 
detailing
+ * the exact result from df -k and as much other detail as possible, 
thanks.
  *
  * @param path  the path to get free space for, not null, not empty on Unix
  * @return the amount of free drive space on the drive or volume in 
kilobytes
  * @throws IllegalArgumentException if the path is invalid
  * @throws IllegalStateException if an error occurred in initialisation
  * @throws IOException if an error occurs when finding the free space

svn commit: r438218 - in /jakarta/commons/proper/io/trunk/src: java/org/apache/commons/io/DirectoryWalker.java test/org/apache/commons/io/DirectoryWalkerTestCase.java

2006-08-29 Thread scolebourne
Author: scolebourne
Date: Tue Aug 29 14:15:11 2006
New Revision: 438218

URL: http://svn.apache.org/viewvc?rev=438218view=rev
Log:
Separate handleDirectory from handleDirectoryStart

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/DirectoryWalkerTestCase.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java?rev=438218r1=438217r2=438218view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 Tue Aug 29 14:15:11 2006
@@ -91,7 +91,7 @@
 
 //---
 /**
- * Internal method that walks the directory hierarchy.
+ * Internal method that walks the directory hierarchy in a depth-first 
manner.
  * p
  * Most users of this class do not need to call this method. This method 
will
  * be called automatically by another (public) method on the specific 
subclass.
@@ -117,13 +117,13 @@
  * @param results  the collection of result objects, may be updated
  */
 private void walk(File directory, int depth, Collection results) {
-boolean process = handleDirectoryStart(directory, depth, results);
-if (process) {
+if (handleDirectory(directory, depth, results)) {
+handleDirectoryStart(directory, depth, results);
 int childDepth = depth + 1;
 if (depthLimit  0 || childDepth = depthLimit) {
 File[] files = (filter == null ? directory.listFiles() : 
directory.listFiles(filter));
 if (files == null) {
-handleRestricted(directory);
+handleRestricted(directory, results);
 } else {
 for (int i = 0; i  files.length; i++) {
 if (files[i].isDirectory()) {
@@ -152,12 +152,11 @@
 }
 
 /**
- * Overridable callback method invoked at the start of processing each 
directory.
+ * Overridable callback method invoked to determine if a directory should 
be processed.
  * p
- * This method returns a boolean to indicate if the directory should be 
examined
- * or not. If you return false, the next event received will be the
- * [EMAIL PROTECTED] #handleDirectoryEnd} for that directory. Note that 
this functionality
- * is in addition to the filtering by file filter.
+ * This method returns a boolean to indicate if the directory should be 
examined or not.
+ * If you return false, the entire directory and any subdirectories will 
be skipped.
+ * Note that this functionality is in addition to the filtering by file 
filter.
  * p
  * This implementation does nothing and returns true.
  *
@@ -166,12 +165,25 @@
  * @param results  the collection of result objects, may be updated
  * @return true to process this directory, false to skip this directory
  */
-protected boolean handleDirectoryStart(File directory, int depth, 
Collection results) {
+protected boolean handleDirectory(File directory, int depth, Collection 
results) {
 // do nothing - overridable by subclass
 return true;
 }
 
 /**
+ * Overridable callback method invoked at the start of processing each 
directory.
+ * p
+ * This implementation does nothing.
+ *
+ * @param directory  the current directory being processed
+ * @param depth  the current directory level (starting directory = 0)
+ * @param results  the collection of result objects, may be updated
+ */
+protected void handleDirectoryStart(File directory, int depth, Collection 
results) {
+// do nothing - overridable by subclass
+}
+
+/**
  * Overridable callback method invoked for each (non-directory) file.
  * p
  * This implementation does nothing.
@@ -186,10 +198,13 @@
 
 /**
  * Overridable callback method invoked for each restricted directory.
+ * p
+ * This implementation does nothing.
  *
  * @param directory  the restricted directory
+ * @param results  the collection of result objects, may be updated
  */
-protected void handleRestricted(File directory) {
+protected void handleRestricted(File directory, Collection results) {
 // do nothing - overridable by subclass
 }
 
@@ -198,9 +213,9 @@
  * p
  * This implementation does nothing.
  *
- * @param directory The directory being processed
- * @param depth The directory level (starting directory = 0)
- * @param results The collection of files found

svn commit: r438281 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt project.xml src/java/org/apache/commons/io/FileUtils.java src/test/org/apache/commons/io/FileUtilsTestCase.java

2006-08-29 Thread scolebourne
Author: scolebourne
Date: Tue Aug 29 16:05:22 2006
New Revision: 438281

URL: http://svn.apache.org/viewvc?rev=438281view=rev
Log:
IO-54 - Add FileUtils.checksum / FileUtils.checksumCRC32 to simplify 
calculating checksums
from Emmanuel Bourg

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
jakarta/commons/proper/io/trunk/project.xml

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?rev=438281r1=438280r2=438281view=diff
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Tue Aug 29 16:05:22 2006
@@ -110,6 +110,8 @@
   - add methods to check if a file is older (i.e. isFileOlder()) - counterparts
 to the existing isFileNewer() methods.
 
+- FileUtils.checksum, FileUtils.checksumCRC32
+  - add methods to create a checksum of a file
 
 
 Feedback

Modified: jakarta/commons/proper/io/trunk/project.xml
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/project.xml?rev=438281r1=438280r2=438281view=diff
==
--- jakarta/commons/proper/io/trunk/project.xml (original)
+++ jakarta/commons/proper/io/trunk/project.xml Tue Aug 29 16:05:22 2006
@@ -187,6 +187,9 @@
   nameNathan Beyer/name
 /contributor
 contributor
+  nameEmmanuel Bourg/name
+/contributor
+contributor
   nameChris Eldredge/name
 /contributor
 contributor

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?rev=438281r1=438280r2=438281view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java 
Tue Aug 29 16:05:22 2006
@@ -30,6 +30,9 @@
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
+import java.util.zip.CRC32;
+import java.util.zip.CheckedInputStream;
+import java.util.zip.Checksum;
 
 import org.apache.commons.io.filefilter.DirectoryFileFilter;
 import org.apache.commons.io.filefilter.FalseFileFilter;
@@ -37,6 +40,7 @@
 import org.apache.commons.io.filefilter.IOFileFilter;
 import org.apache.commons.io.filefilter.SuffixFileFilter;
 import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.apache.commons.io.output.NullOutputStream;
 
 /**
  * General file manipulation utilities.
@@ -52,6 +56,7 @@
  * lilisting files and directories by filter and extension
  * licomparing file content
  * lifile last changed date
+ * licalculating a checksum
  * /ul
  * p
  * Origin of code: Excalibur, Alexandria, Commons-Utils
@@ -1358,4 +1363,53 @@
 }
 return file.lastModified()  timeMillis;
 }
+
+//---
+/**
+ * Computes the checksum of a file using the CRC32 checksum routine.
+ * The value of the checksum is returned.
+ *
+ * @param file  the file to checksum, not null
+ * @param checksum  the checksum object to be used, not null
+ * @return the checksum value
+ * @throws NullPointerException if the file or checksum is null
+ * @throws IllegalArgumentException if the file is a directory
+ * @since Commons IO 1.3
+ */
+public static long checksumCRC32(File file) throws IOException {
+CRC32 crc = new CRC32();
+checksum(file, crc);
+return crc.getValue();
+}
+
+/**
+ * Computes the checksum of a file using the specified checksum object.
+ * Multiple files may be checked using one codeChecksum/code instance
+ * if desired simply by reusing the same checksum object.
+ * For example:
+ * pre
+ *   long csum = FileUtils.checksum(file, new CRC32()).getValue();
+ * /pre
+ *
+ * @param file  the file to checksum, not null
+ * @param checksum  the checksum object to be used, not null
+ * @return the checksum specified, updated with the content of the file
+ * @throws NullPointerException if the file or checksum is null
+ * @throws IllegalArgumentException if the file is a directory
+ * @since Commons IO 1.3
+ */
+public static Checksum checksum(File file, Checksum checksum) throws 
IOException {
+if (file.isDirectory()) {
+throw new IllegalArgumentException(Checksums can't be computed on 
directories);
+}
+InputStream in = null;
+try {
+in = new

svn commit: r436964 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt project.xml src/java/org/apache/commons/io/FileSystemUtils.java src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

2006-08-25 Thread scolebourne
Author: scolebourne
Date: Fri Aug 25 14:39:06 2006
New Revision: 436964

URL: http://svn.apache.org/viewvc?rev=436964view=rev
Log:
IO-83 - Fix freeSpace for AIX and HP-UX
code from Magnus Grimsell, also from James Urie

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
jakarta/commons/proper/io/trunk/project.xml

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?rev=436964r1=436963r2=436964view=diff
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Fri Aug 25 14:39:06 2006
@@ -33,7 +33,10 @@
 Bug fixes from 1.2
 --
 - LineIterator now implements Iterator
-  (It was always supposed to...)
+  - It was always supposed to...
+
+- FileSystemUtils.freeSpace/freeSpaceKb [IO-83]
+  - These should now work on AIX and HP-UX
 
 
 Enhancements from 1.2

Modified: jakarta/commons/proper/io/trunk/project.xml
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/project.xml?rev=436964r1=436963r2=436964view=diff
==
--- jakarta/commons/proper/io/trunk/project.xml (original)
+++ jakarta/commons/proper/io/trunk/project.xml Fri Aug 25 14:39:06 2006
@@ -189,6 +189,9 @@
   nameChris Eldredge/name
 /contributor
 contributor
+  nameMagnus Grimsell/name
+/contributor
+contributor
   nameJim Harrington/name
 /contributor
 contributor
@@ -212,6 +215,9 @@
 /contributor
 contributor
   nameMasato Tezuka/name
+/contributor
+contributor
+  nameJames Urie/name
 /contributor
 contributor
   nameFrank W. Zammetti/name

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java?rev=436964r1=436963r2=436964view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
 Fri Aug 25 14:39:06 2006
@@ -35,6 +35,8 @@
  * @author Frank W. Zammetti
  * @author Stephen Colebourne
  * @author Thomas Ledoux
+ * @author James Urie
+ * @author Magnus Grimsell
  * @version $Id$
  * @since Commons IO 1.1
  */
@@ -51,6 +53,8 @@
 private static final int WINDOWS = 1;
 /** Operating system state flag for Unix. */
 private static final int UNIX = 2;
+/** Operating system state flag for Posix flavour Unix. */
+private static final int POSIX_UNIX = 3;
 
 /** The operating system flag. */
 private static final int OS;
@@ -70,14 +74,15 @@
 osName.indexOf(sunos) != -1 ||
 osName.indexOf(solaris) != -1 ||
 osName.indexOf(mpe/ix) != -1 ||
-osName.indexOf(hp-ux) != -1 ||
-osName.indexOf(aix) != -1 ||
 osName.indexOf(freebsd) != -1 ||
 osName.indexOf(irix) != -1 ||
 osName.indexOf(digital unix) != -1 ||
 osName.indexOf(unix) != -1 ||
 osName.indexOf(mac os x) != -1) {
 os = UNIX;
+} else if (osName.indexOf(hp-ux) != -1 ||
+osName.indexOf(aix) != -1) {
+os = POSIX_UNIX;
 } else {
 os = OTHER;
 }
@@ -133,7 +138,7 @@
  * FileSystemUtils.freeSpaceKb(/volume);  // *nix
  * /pre
  * The free space is calculated via the command line.
- * It uses 'dir /-c' on Windows and 'df -k' on *nix.
+ * It uses 'dir /-c' on Windows, 'df -kP' on AIX/HP-UX and 'df -k' on 
other Unix.
  *
  * @param path  the path to get free space for, not null, not empty on Unix
  * @return the amount of free drive space on the drive or volume in 
kilobytes
@@ -173,7 +178,9 @@
 case WINDOWS:
 return (kb ? freeSpaceWindows(path) / 1024 : 
freeSpaceWindows(path));
 case UNIX:
-return freeSpaceUnix(path, kb);
+return freeSpaceUnix(path, kb, false);
+case POSIX_UNIX:
+return freeSpaceUnix(path, kb, true);
 case OTHER:
 throw new IllegalStateException(Unsupported operating 
system);
 default:
@@ -278,19 +285,27 @@
  *
  * @param path  the path to get free space for
  * @param kb  whether to normalize to kilobytes
+ * @param posix  whether to use the posix standard

svn commit: r437031 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileSystemUtils.java src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

2006-08-25 Thread scolebourne
Author: scolebourne
Date: Fri Aug 25 17:08:08 2006
New Revision: 437031

URL: http://svn.apache.org/viewvc?rev=437031view=rev
Log:
IO-90 - Fix freeSpace to avoid infinite loops and other errors
includes some code from Thomas Ledoux

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?rev=437031r1=437030r2=437031view=diff
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Fri Aug 25 17:08:08 2006
@@ -38,6 +38,10 @@
 - FileSystemUtils.freeSpace/freeSpaceKb [IO-83]
   - These should now work on AIX and HP-UX
 
+- FileSystemUtils.freeSpace/freeSpaceKb [IO-90]
+  - Avoid infinite looping in Windows
+  - Catch more errors with nice messages
+
 
 Enhancements from 1.2
 -

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java?rev=437031r1=437030r2=437031view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
 Fri Aug 25 17:08:08 2006
@@ -16,9 +16,11 @@
 package org.apache.commons.io;
 
 import java.io.BufferedReader;
-import java.io.InputStreamReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 import java.util.StringTokenizer;
 
 /**
@@ -37,6 +39,7 @@
  * @author Thomas Ledoux
  * @author James Urie
  * @author Magnus Grimsell
+ * @author Thomas Ledoux
  * @version $Id$
  * @since Commons IO 1.1
  */
@@ -189,6 +192,7 @@
 }
 }
 
+//---
 /**
  * Find free space on the Windows platform using the 'dir' command.
  *
@@ -201,74 +205,71 @@
 if (path.length()  2  path.charAt(1) == ':') {
 path = path.substring(0, 2);  // seems to make it work
 }
-
+
 // build and run the 'dir' command
-String[] cmdAttrbs = new String[] {cmd.exe, /C, dir /-c  + path};
-
+String[] cmdAttribs = new String[] {cmd.exe, /C, dir /-c  + 
path};
+
 // read in the output of the command to an ArrayList
-BufferedReader in = null;
-String line = null;
-ArrayList lines = new ArrayList();
-try {
-in = openProcessStream(cmdAttrbs);
-line = in.readLine();
-while (line != null) {
-line = line.toLowerCase().trim();
-lines.add(line);
-line = in.readLine();
-}
-} finally {
-IOUtils.closeQuietly(in);
-}
-
-if (lines.size() == 0) {
-// unknown problem, throw exception
-throw new IOException(
-Command line 'dir /c' did not return any info  +
-for command ' + cmdAttrbs[2] + ');
-}
-
+List lines = performCommand(cmdAttribs, Integer.MAX_VALUE);
+
 // now iterate over the lines we just read and find the LAST
 // non-empty line (the free space bytes should be in the last element
 // of the ArrayList anyway, but this will ensure it works even if it's
 // not, still assuming it is on the last non-blank line)
-long bytes = -1;
-int i = lines.size() - 1;
-int bytesStart = 0;
-int bytesEnd = 0;
-outerLoop: while (i  0) {
-line = (String) lines.get(i);
+for (int i = lines.size() - 1; i = 0; i--) {
+String line = (String) lines.get(i);
 if (line.length()  0) {
-// found it, so now read from the end of the line to find the
-// last numeric character on the line, then continue until we
-// find the first non-numeric character, and everything between
-// that and the last numeric character inclusive is our free
-// space bytes count
-int j = line.length() - 1;
-innerLoop1: while (j = 0) {
-char c = line.charAt(j);
-if (Character.isDigit(c)) {
-  // found the last numeric character, this is the end of
-  // the free space bytes count
-  bytesEnd = j + 1

svn commit: r432694 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringStyle.java

2006-08-18 Thread scolebourne
Author: scolebourne
Date: Fri Aug 18 12:31:37 2006
New Revision: 432694

URL: http://svn.apache.org/viewvc?rev=432694view=rev
Log:
Change protected to package scope

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringStyle.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringStyle.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringStyle.java?rev=432694r1=432693r2=432694view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringStyle.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringStyle.java
 Fri Aug 18 12:31:37 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 The Apache Software Foundation.
+ * Copyright 2002-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -1993,7 +1993,7 @@
  *
  * pUse the static constant rather than instantiating./p
  */
-protected DefaultToStringStyle() {
+DefaultToStringStyle() {
 super();
 }
 
@@ -2026,7 +2026,7 @@
  *
  * pUse the static constant rather than instantiating./p
  */
-protected NoFieldNameToStringStyle() {
+NoFieldNameToStringStyle() {
 super();
 this.setUseFieldNames(false);
 }
@@ -2060,7 +2060,7 @@
  *
  * pUse the static constant rather than instantiating./p
  */
-protected ShortPrefixToStringStyle() {
+ShortPrefixToStringStyle() {
 super();
 this.setUseShortClassName(true);
 this.setUseIdentityHashCode(false);
@@ -2092,7 +2092,7 @@
  *
  * pUse the static constant rather than instantiating./p
  */
-protected SimpleToStringStyle() {
+SimpleToStringStyle() {
 super();
 this.setUseClassName(false);
 this.setUseIdentityHashCode(false);
@@ -2128,7 +2128,7 @@
  *
  * pUse the static constant rather than instantiating./p
  */
-protected MultiLineToStringStyle() {
+MultiLineToStringStyle() {
 super();
 this.setContentStart([);
 this.setFieldSeparator(SystemUtils.LINE_SEPARATOR +   );



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r432703 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/enums/Enum.java test/org/apache/commons/lang/enums/EnumEqualsTest.java

2006-08-18 Thread scolebourne
Author: scolebourne
Date: Fri Aug 18 12:51:26 2006
New Revision: 432703

URL: http://svn.apache.org/viewvc?rev=432703view=rev
Log:
Ensure classes are the same in Enum.compareTo

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java?rev=432703r1=432702r2=432703view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java
 Fri Aug 18 12:51:26 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 The Apache Software Foundation.
+ * Copyright 2002-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -584,6 +584,8 @@
 if (other.getClass().getName().equals(this.getClass().getName())) {
 return iName.compareTo( getNameInOtherClassLoader(other) );
 }
+throw new ClassCastException(
+Different enum class ' + 
ClassUtils.getShortClassName(other.getClass()) + ');
 }
 return iName.compareTo(((Enum) other).iName);
 }

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java?rev=432703r1=432702r2=432703view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java
 Fri Aug 18 12:51:26 2006
@@ -87,4 +87,33 @@
 assertEquals(false, TrafficlightColorEnum.RED.equals(new 
TotallyUnrelatedClass(some)));
 assertEquals(false, CarColorEnum.RED.equals(new 
TotallyUnrelatedClass(some)));
 }
+
+//---
+public void testCompareTo() {
+try {
+CarColorEnum.RED.compareTo(TrafficlightColorEnum.RED);
+fail();
+} catch (ClassCastException ex) {}
+try {
+CarColorEnum.YELLOW.compareTo(TrafficlightColorEnum.YELLOW);
+fail();
+} catch (ClassCastException ex) {}
+try {
+TrafficlightColorEnum.RED.compareTo(new 
TotallyUnrelatedClass(red));
+fail();
+} catch (ClassCastException ex) {}
+try {
+CarColorEnum.RED.compareTo(new TotallyUnrelatedClass(red));
+fail();
+} catch (ClassCastException ex) {}
+try {
+TrafficlightColorEnum.RED.compareTo(new 
TotallyUnrelatedClass(some));
+fail();
+} catch (ClassCastException ex) {}
+try {
+CarColorEnum.RED.compareTo(new TotallyUnrelatedClass(some));
+fail();
+} catch (ClassCastException ex) {}
+}
+
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r432748 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/enums/ test/org/apache/commons/lang/enums/

2006-08-18 Thread scolebourne
Author: scolebourne
Date: Fri Aug 18 15:21:47 2006
New Revision: 432748

URL: http://svn.apache.org/viewvc?rev=432748view=rev
Log:
LANG-259 - Fix compareTo to check the type is the same

Added:

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/ValuedLanguageEnum.java
   (with props)
Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/ValuedEnum.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/ValuedEnumTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/ValuedEnum.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/ValuedEnum.java?rev=432748r1=432747r2=432748view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/ValuedEnum.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/ValuedEnum.java
 Fri Aug 18 15:21:47 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2005 The Apache Software Foundation.
+ * Copyright 2002-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
  */
 package org.apache.commons.lang.enums;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.Iterator;
 import java.util.List;
 
@@ -165,7 +167,11 @@
  *
  * pThe default ordering is numeric by value, but this
  * can be overridden by subclasses./p
- * 
+ *
+ * pNOTE: From v2.2 the enums must be of the same type.
+ * If the parameter is in a different class loader than this instance,
+ * reflection is used to compare the values./p
+ *
  * @see java.lang.Comparable#compareTo(Object)
  * @param other  the other object to compare to
  * @return -ve if this is less than the other object, +ve if greater than,
@@ -174,7 +180,38 @@
  * @throws NullPointerException if other is codenull/code
  */
 public int compareTo(Object other) {
+if (other == this) {
+return 0;
+}
+if (other.getClass() != this.getClass()) {
+if (other.getClass().getName().equals(this.getClass().getName())) {
+return iValue - getValueInOtherClassLoader(other);
+}
+throw new ClassCastException(
+Different enum class ' + 
ClassUtils.getShortClassName(other.getClass()) + ');
+}
 return iValue - ((ValuedEnum) other).iValue;
+}
+
+/**
+ * pUse reflection to return an objects value./p
+ *
+ * @param other  the object to determine the value for
+ * @return the value
+ */
+private int getValueInOtherClassLoader(Object other) {
+try {
+Method mth = other.getClass().getMethod(getValue, null);
+Integer value = (Integer) mth.invoke(other, null);
+return value.intValue();
+} catch (NoSuchMethodException e) {
+// ignore - should never happen
+} catch (IllegalAccessException e) {
+// ignore - should never happen
+} catch (InvocationTargetException e) {
+// ignore - should never happen
+}
+throw new IllegalStateException(This should not happen);
 }
 
 /**

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java?rev=432748r1=432747r2=432748view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/enums/EnumEqualsTest.java
 Fri Aug 18 15:21:47 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 The Apache Software Foundation.
+ * Copyright 2004-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
  */
 package org.apache.commons.lang.enums;
 
+import java.net.URLClassLoader;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -86,6 +88,34 @@
 
 assertEquals(false, TrafficlightColorEnum.RED.equals(new 
TotallyUnrelatedClass(some)));
 assertEquals(false, CarColorEnum.RED.equals(new 
TotallyUnrelatedClass(some)));
+}
+
+public void testEquals_classloader_equal() throws Exception {
+ClassLoader cl

svn commit: r430537 - /jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java

2006-08-10 Thread scolebourne
Author: scolebourne
Date: Thu Aug 10 14:26:27 2006
New Revision: 430537

URL: http://svn.apache.org/viewvc?rev=430537view=rev
Log:
LANG-271 - Change tests now JDK1.6 states the US has two national languages

Modified:

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java?rev=430537r1=430536r2=430537view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java
 Thu Aug 10 14:26:27 2006
@@ -35,7 +35,7 @@
  *
  * @author Chris Hyzer
  * @author Stephen Colebourne
- * @version $Id$
+ * @version $Id: LocaleUtilsTest.java 307282 2005-10-08 10:04:20Z scolebourne $
  */
 public class LocaleUtilsTest extends TestCase {
 
@@ -423,7 +423,7 @@
  */
 public void testLanguagesByCountry() {
 assertLanguageByCountry(null, new String[0]);
-assertLanguageByCountry(US, new String[]{en});
+assertLanguageByCountry(GB, new String[]{en});
 assertLanguageByCountry(ZZ, new String[0]);
 assertLanguageByCountry(CH, new String[]{fr, de, it});
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r430176 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/StrSubstitutor.java test/org/apache/commons/lang/text/StrSubstitutorTest.java

2006-08-09 Thread scolebourne
Author: scolebourne
Date: Wed Aug  9 15:52:45 2006
New Revision: 430176

URL: http://svn.apache.org/viewvc?rev=430176view=rev
Log:
Enhance StrSubtstitutor with StringBuffer methods and replaceIn() methods

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java?rev=430176r1=430175r2=430176view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
 Wed Aug  9 15:52:45 2006
@@ -248,8 +248,51 @@
 
 //---
 /**
- * Replaces all the occurrences of variables in the given source array with
- * their matching values from the resolver.
+ * Replaces all the occurrences of variables with their matching values
+ * from the resolver using the given source string as a template.
+ *
+ * @param source  the string to replace in, null returns null
+ * @return the result of the replace operation
+ */
+public String replace(String source) {
+if (source == null) {
+return null;
+}
+StrBuilder buf = new StrBuilder(source);
+if (substitute(buf, 0, source.length()) == false) {
+return source;
+}
+return buf.toString();
+}
+
+/**
+ * Replaces all the occurrences of variables with their matching values
+ * from the resolver using the given source string as a template.
+ * p
+ * Only the specified portion of the string will be processed.
+ * The rest of the string is not processed, and is not returned.
+ *
+ * @param source  the string to replace in, null returns null
+ * @param offset  the start offset within the array, must be valid
+ * @param length  the length within the array to be processed, must be 
valid
+ * @return the result of the replace operation
+ */
+public String replace(String source, int offset, int length) {
+if (source == null) {
+return null;
+}
+StrBuilder buf = new StrBuilder(length).append(source, offset, length);
+if (substitute(buf, 0, length) == false) {
+return source.substring(offset, offset + length);
+}
+return buf.toString();
+}
+
+//---
+/**
+ * Replaces all the occurrences of variables with their matching values
+ * from the resolver using the given source array as a template.
+ * The array is not altered by this method.
  *
  * @param source  the character array to replace in, not altered, null 
returns null
  * @return the result of the replace operation
@@ -264,9 +307,12 @@
 }
 
 /**
- * Replaces all the occurrences of variables in the given source array by 
with
- * their matching values from the resolver.
+ * Replaces all the occurrences of variables with their matching values
+ * from the resolver using the given source array as a template.
+ * The array is not altered by this method.
+ * p
  * Only the specified portion of the array will be processed.
+ * The rest of the array is not processed, and is not returned.
  *
  * @param source  the character array to replace in, not altered, null 
returns null
  * @param offset  the start offset within the array, must be valid
@@ -284,41 +330,81 @@
 
 //---
 /**
- * Replaces all the occurrences of variables in the given source string 
with
- * their matching values from the resolver.
+ * Replaces all the occurrences of variables with their matching values
+ * from the resolver using the given source buffer as a template.
+ * The buffer is not altered by this method.
  *
- * @param source  the string to replace in, null returns null
+ * @param source  the buffer to use as a template, not changed, null 
returns null
  * @return the result of the replace operation
  */
-public String replace(String source) {
+public String replace(StringBuffer source) {
 if (source == null) {
 return null;
 }
-StrBuilder buf = new StrBuilder(source);
-if (substitute(buf, 0, source.length()) == false) {
-return source;
-}
+StrBuilder buf = new StrBuilder(source.length()).append(source);
+substitute(buf

svn commit: r429876 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/ValuedEnum.java

2006-08-08 Thread scolebourne
Author: scolebourne
Date: Tue Aug  8 16:24:49 2006
New Revision: 429876

URL: http://svn.apache.org/viewvc?rev=429876view=rev
Log:
Rename variable for JDK1.5 compliance

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/ValuedEnum.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/ValuedEnum.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/ValuedEnum.java?rev=429876r1=429875r2=429876view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/ValuedEnum.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/ValuedEnum.java
 Tue Aug  8 16:24:49 2006
@@ -144,9 +144,9 @@
 }
 List list = Enum.getEnumList(enumClass);
 for (Iterator it = list.iterator(); it.hasNext();) {
-ValuedEnum enum = (ValuedEnum) it.next();
-if (enum.getValue() == value) {
-return enum;
+ValuedEnum enumeration = (ValuedEnum) it.next();
+if (enumeration.getValue() == value) {
+return enumeration;
 }
 }
 return null;



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r429877 - /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrMatcher.java

2006-08-08 Thread scolebourne
Author: scolebourne
Date: Tue Aug  8 16:25:52 2006
New Revision: 429877

URL: http://svn.apache.org/viewvc?rev=429877view=rev
Log:
Javadoc

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrMatcher.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrMatcher.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrMatcher.java?rev=429877r1=429876r2=429877view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrMatcher.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrMatcher.java
 Tue Aug  8 16:25:52 2006
@@ -21,12 +21,12 @@
  * A matcher class that can be queried to determine if a character array
  * portion matches.
  * p
- * This class comes complete with various constants and factory methods.
+ * This class comes complete with various factory methods.
  * If these do not suffice, you can subclass and implement your own matcher.
  *
  * @author Stephen Colebourne
  * @since 2.2
- * @version $Id$
+ * @version $Id: StrMatcher.java 232652 2005-08-14 21:45:47Z scolebourne $
  */
 public abstract class StrMatcher {
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r429881 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/ test/org/apache/commons/lang/text/

2006-08-08 Thread scolebourne
Author: scolebourne
Date: Tue Aug  8 16:28:45 2006
New Revision: 429881

URL: http://svn.apache.org/viewvc?rev=429881view=rev
Log:
Create StrLookup by extraction from StrSubstitutor

Added:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java
   (with props)

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrLookupTest.java
   (with props)
Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java

Added: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java?rev=429881view=auto
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java
 (added)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java
 Tue Aug  8 16:28:45 2006
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.lang.text;
+
+import java.util.Map;
+
+/**
+ * Lookup a String key to a String value.
+ * p
+ * This class represents the simplest form of a string to string map.
+ * It has a benefit over a map in that it can create the result on
+ * demand based on the key.
+ * p
+ * This class comes complete with various factory methods.
+ * If these do not suffice, you can subclass and implement your own matcher.
+ * p
+ * For example, it would be possible to implement a lookup that used the
+ * key as a primary key, and looked up the value on demand from the database
+ *
+ * @author Stephen Colebourne
+ * @since 2.2
+ * @version $Id: $
+ */
+public abstract class StrLookup {
+
+/**
+ * Lookup that always returns null.
+ */
+private static final StrLookup NONE_LOOKUP;
+/**
+ * Lookup that uses System properties.
+ */
+private static final StrLookup SYSTEM_PROPERTIES_LOOKUP;
+static {
+NONE_LOOKUP = new MapStrLookup(null);
+StrLookup lookup = null;
+try {
+lookup = new MapStrLookup(System.getProperties());
+} catch (SecurityException ex) {
+lookup = NONE_LOOKUP;
+}
+SYSTEM_PROPERTIES_LOOKUP = lookup;
+}
+
+//---
+/**
+ * Returns a lookup which always returns null.
+ *
+ * @return a lookup that always returns null, not null
+ */
+public static StrLookup noneLookup() {
+return NONE_LOOKUP;
+}
+
+/**
+ * Returns a lookup which uses [EMAIL PROTECTED] System#getProperties() 
System properties}
+ * to lookup the key to value.
+ * p
+ * If a security manager blocked access to system properties, then null 
will
+ * be returned from every lookup.
+ * p
+ * If a null key is used, this lookup will throw a NullPointerException.
+ *
+ * @return a lookup using system properties, not null
+ */
+public static StrLookup systemPropertiesLookup() {
+return SYSTEM_PROPERTIES_LOOKUP;
+}
+
+/**
+ * Returns a lookup which looks up values using a map.
+ * p
+ * If the map is null, then null will be returned from every lookup.
+ * The map result object is converted to a string using toString().
+ *
+ * @param map  the map of keys to values, may be null
+ * @return a lookup using the map, not null
+ */
+public static StrLookup mapLookup(Map map) {
+return new MapStrLookup(map);
+}
+
+//---
+/**
+ * Constructor.
+ */
+protected StrLookup() {
+super();
+}
+
+/**
+ * Looks up a String key to a String value.
+ * p
+ * The internal implementation may use any mechanism to return the value.
+ * The simplest implementation is to use a Map. However, virtually any
+ * implementation is possible.
+ * p
+ * For example, it would be possible to implement a lookup that used the
+ * key as a primary key

svn commit: r429884 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/VariableFormatter.java test/org/apache/commons/lang/text/TextTestSuite.java test/org/apache/commons/l

2006-08-08 Thread scolebourne
Author: scolebourne
Date: Tue Aug  8 16:35:31 2006
New Revision: 429884

URL: http://svn.apache.org/viewvc?rev=429884view=rev
Log:
VariableFormatter became StrSubstitutor

Removed:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/VariableFormatter.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/VariableFormatterTest.java
Modified:

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java?rev=429884r1=429883r2=429884view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java
 Tue Aug  8 16:35:31 2006
@@ -55,7 +55,6 @@
 suite.addTest(StrMatcherTest.suite());
 suite.addTest(StrSubstitutorTest.suite());
 suite.addTest(StrTokenizerTest.suite());
-suite.addTestSuite(VariableFormatterTest.class);
 return suite;
 }
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r429507 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/StrSubstitutor.java test/org/apache/commons/lang/text/StrSubstitutorTest.java

2006-08-07 Thread scolebourne
Author: scolebourne
Date: Mon Aug  7 16:06:41 2006
New Revision: 429507

URL: http://svn.apache.org/viewvc?rev=429507view=rev
Log:
Give more power to StrSubstitutor subclasses

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java?rev=429507r1=429506r2=429507view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
 Mon Aug  7 16:06:41 2006
@@ -126,8 +126,8 @@
  * Replaces all the occurrences of variables in the given source object 
with
  * their matching values from the map.
  *
- * @param source  the source text containing the variables to substitute
- * @param valueMap  the map with the values
+ * @param source  the source text containing the variables to substitute, 
null returns null
+ * @param valueMap  the map with the values, may be null
  * @return the result of the replace operation
  */
 public static String replace(Object source, Map valueMap) {
@@ -139,11 +139,12 @@
  * their matching values from the map. This method allows to specifiy a
  * custom variable prefix and suffix
  *
- * @param source  the source text containing the variables to substitute
- * @param valueMap  the map with the values
- * @param prefix  the prefix of variables
- * @param suffix  the suffix of variables
+ * @param source  the source text containing the variables to substitute, 
null returns null
+ * @param valueMap  the map with the values, may be null
+ * @param prefix  the prefix of variables, not null
+ * @param suffix  the suffix of variables, not null
  * @return the result of the replace operation
+ * @throws IllegalArgumentException if the prefix or suffix is null
  */
 public static String replace(Object source, Map valueMap, String prefix, 
String suffix) {
 return new StrSubstitutor(valueMap, prefix, suffix).replace(source);
@@ -153,7 +154,7 @@
  * Replaces all the occurrences of variables in the given source object 
with
  * their matching values from the system properties.
  *
- * @param source  the source text containing the variables to substitute
+ * @param source  the source text containing the variables to substitute, 
null returns null
  * @return the result of the replace operation
  */
 public static String replaceSystemProperties(Object source) {
@@ -365,14 +366,20 @@
 
 //---
 /**
- * Main method for substituting variables.
+ * Internal method that substitutes the variables.
+ * p
+ * Most users of this class do not need to call this method. This method 
will
+ * be called automatically by another (public) method.
+ * p
+ * Writers of subclasses can override this method if they need access to
+ * the substitution process at the start or end.
  *
  * @param buf  the string builder to substitute into, not null
  * @param offset  the start offset within the builder, must be valid
  * @param length  the length within the builder to be processed, must be 
valid
  * @return true if altered
  */
-private boolean substitute(StrBuilder buf, int offset, int length) {
+protected boolean substitute(StrBuilder buf, int offset, int length) {
 return substitute(buf, offset, length, null)  0;
 }
 
@@ -439,7 +446,7 @@
 priorVariables.add(varName);
 
 // resolve the variable
-String varValue = resolveVariable(varName);
+String varValue = resolveVariable(varName, buf, 
startPos, endPos);
 if (varValue != null) {
 // recursive replace
 int varLen = varValue.length();
@@ -486,21 +493,28 @@
 }
 
 /**
- * Resolves the specified variable. This method is called whenever a 
variable
- * reference is detected in the source text. It is passed the variable's 
name
- * and must return the corresponding value. This implementation accesses 
the
- * value map using the variable's name as key. Derived classes may override
- * this method to implement a different strategy for resolving variables.
- *
- * @param varName  the name of the variable
+ * Internal method

svn commit: r428130 - in /jakarta/commons/proper/collections/trunk: ./ src/java/org/apache/commons/collections/ src/test/org/apache/commons/collections/

2006-08-02 Thread scolebourne
Author: scolebourne
Date: Wed Aug  2 13:24:02 2006
New Revision: 428130

URL: http://svn.apache.org/viewvc?rev=428130view=rev
Log:
COLLECTIONS-219 - CollectionUtils - Fix removeAll() method which was completely 
broken

Modified:
jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html

jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java

jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestCollectionUtils.java

jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestListUtils.java

Modified: jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html?rev=428130r1=428129r2=428130view=diff
==
--- jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html (original)
+++ jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html Wed Aug  2 
13:24:02 2006
@@ -56,6 +56,7 @@
 ul
 liFlat3Map - Fix setValue in MapIterator and EntrySetIterator to work 
correctly [COLLECTIONS-217]/li
 liExtendedProperties - Include property name had confused static/instance 
semantics [COLLECTIONS-214]/li
+liCollectionUtils - Fix removeAll() method which was completely broken 
[COLLECTIONS-219]/li
 /ul
 
 centerh3JAVADOC/h3/center

Modified: 
jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java?rev=428130r1=428129r2=428130view=diff
==
--- 
jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java
 (original)
+++ 
jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/CollectionUtils.java
 Wed Aug  2 13:24:02 2006
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2005 The Apache Software Foundation
+ *  Copyright 2001-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the License);
  *  you may not use this file except in compliance with the License.
@@ -1115,10 +1115,10 @@
  * @return a codeCollection/code containing all the elements of 
codecollection/code except
  * any elements that also occur in coderemove/code.
  * @throws NullPointerException if either parameter is null
- * @since Commons Collections 3.2
+ * @since Commons Collections 3.3 (method existed in 3.2 but was 
completely broken)
  */
 public static Collection removeAll(Collection collection, Collection 
remove) {
-return ListUtils.retainAll(collection, remove);
+return ListUtils.removeAll(collection, remove);
 }
 
 //---

Modified: 
jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestCollectionUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestCollectionUtils.java?rev=428130r1=428129r2=428130view=diff
==
--- 
jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestCollectionUtils.java
 (original)
+++ 
jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestCollectionUtils.java
 Wed Aug  2 13:24:02 2006
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2005 The Apache Software Foundation
+ *  Copyright 2001-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the License);
  *  you may not use this file except in compliance with the License.
@@ -1237,8 +1237,70 @@
 assertEquals(eltb,eltc);
 assertEquals(eltc,eltb);
 }
-
- public void testTransformedCollection() {
+
+//---
+public void testRetainAll() {
+List base = new ArrayList();
+base.add(A);
+base.add(B);
+base.add(C);
+List sub = new ArrayList();
+sub.add(A);
+sub.add(C);
+sub.add(X);
+
+Collection result = CollectionUtils.retainAll(base, sub);
+assertEquals(2, result.size());
+assertEquals(true, result.contains(A));
+assertEquals(false, result.contains(B));
+assertEquals(true, result.contains(C));
+assertEquals(3, base.size());
+assertEquals(true, base.contains(A));
+assertEquals(true, base.contains(B));
+assertEquals(true, base.contains(C));
+assertEquals(3, sub.size());
+assertEquals(true, sub.contains(A));
+assertEquals(true, sub.contains(C));
+assertEquals(true, sub.contains(X

svn commit: r424742 - in /jakarta/commons/proper/io/trunk: ./ src/java/org/apache/commons/io/filefilter/ src/test/org/apache/commons/io/filefilter/

2006-07-23 Thread scolebourne
Author: scolebourne
Date: Sun Jul 23 06:58:32 2006
New Revision: 424742

URL: http://svn.apache.org/viewvc?rev=424742view=rev
Log:
Add FileFileFilter that accepts files and not directories

Added:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFileFilter.java
   (with props)
Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?rev=424742r1=424741r2=424742view=diff
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Sun Jul 23 06:58:32 2006
@@ -54,6 +54,11 @@
 - NameFileFilter
   - Ability to control case-sensitivity
 
+- FileFileFilter
+  - New IOFileFilter implementation
+  - Accepts files where File.isFile() is true
+  - In other words it filters out directories
+
 - CanReadFileFilter
   - New IOFileFilter implementation
   - Accepts files where File.canRead() is true

Added: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFileFilter.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFileFilter.java?rev=424742view=auto
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFileFilter.java
 (added)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFileFilter.java
 Sun Jul 23 06:58:32 2006
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.io.filefilter;
+
+import java.io.File;
+
+/**
+ * This filter accepts codeFile/codes that are files (not directories).
+ * p
+ * For example, here is how to print out a list of the real files
+ * within the current directory:
+ *
+ * pre
+ * File dir = new File(.);
+ * String[] files = dir.list( FileFileFilter.FILE );
+ * for ( int i = 0; i lt; files.length; i++ ) {
+ * System.out.println(files[i]);
+ * }
+ * /pre
+ *
+ * @since Commons IO 1.3
+ * @version $Revision: 155419 $ $Date: 2005-02-26 13:02:41 + (Sat, 26 Feb 
2005) $
+ */
+public class FileFileFilter extends AbstractFileFilter {
+
+/** Singleton instance of file filter */
+public static final IOFileFilter FILE = new FileFileFilter();
+
+/**
+ * Restrictive consructor.
+ */
+protected FileFileFilter() {
+}
+
+/**
+ * Checks to see if the file is a file.
+ *
+ * @param file  the File to check
+ * @return true if the file is a file
+ */
+public boolean accept(File file) {
+return file.isFile();
+}
+
+}

Propchange: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFileFilter.java
--
svn:eol-style = native

Propchange: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFileFilter.java
--
svn:keywords = author date id revision

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java?rev=424742r1=424741r2=424742view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
 Sun Jul 23 06:58:32 2006
@@ -76,12 +76,21 @@
 /**
  * Returns a filter that checks if the file is a directory.
  * 
- * @return directory file filter
+ * @return file filter that accepts only directories and not files
  */
 public static IOFileFilter directoryFileFilter() {
 return DirectoryFileFilter.INSTANCE

svn commit: r424745 - in /jakarta/commons/proper/io/trunk: ./ src/java/org/apache/commons/io/filefilter/ src/test/org/apache/commons/io/filefilter/

2006-07-23 Thread scolebourne
Author: scolebourne
Date: Sun Jul 23 07:18:55 2006
New Revision: 424745

URL: http://svn.apache.org/viewvc?rev=424745view=rev
Log:
TrueFileFilter/FalseFileFilter/DirectoryFileFilter new constants
  - New singleton instance constants (TRUE/FALSE/DIRECTORY)
  - The new constants are more JDK 1.5 friendly with regards to static imports
(whereas if everything uses INSTANCE, then they just clash)
  - The old INSTANCE constants are still present and have not been deprecated

Modified:
jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/DirectoryFileFilter.java

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FalseFileFilter.java

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/TrueFileFilter.java

jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?rev=424745r1=424744r2=424745view=diff
==
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Sun Jul 23 07:18:55 2006
@@ -75,6 +75,12 @@
   - New IOFileFilter implementation
   - Accepts files or directories that are empty
 
+- TrueFileFilter/FalseFileFilter/DirectoryFileFilter
+  - New singleton instance constants (TRUE/FALSE/DIRECTORY)
+  - The new constants are more JDK 1.5 friendly with regards to static imports
+(whereas if everything uses INSTANCE, then they just clash)
+  - The old INSTANCE constants are still present and have not been deprecated
+
 
 Feedback
 

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/DirectoryFileFilter.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/DirectoryFileFilter.java?rev=424745r1=424744r2=424745view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/DirectoryFileFilter.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/DirectoryFileFilter.java
 Sun Jul 23 07:18:55 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2004 The Apache Software Foundation.
+ * Copyright 2002-2004,2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -33,30 +33,40 @@
  *
  * @since Commons IO 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Henri Yandell
  * @author Stephen Colebourne
  * @author Peter Donald
  */
 public class DirectoryFileFilter extends AbstractFileFilter {
-
-/** Singleton instance of directory filter */
-public static final IOFileFilter INSTANCE = new DirectoryFileFilter();
-
+
+/**
+ * Singleton instance of directory filter.
+ * @since Commons IO 1.3
+ */
+public static final IOFileFilter DIRECTORY = new DirectoryFileFilter();
+/**
+ * Singleton instance of directory filter.
+ * Please use the identical DirectoryFileFilter.DIRECTORY constant.
+ * The new name is more JDK 1.5 friendly as it doesn't clash with other
+ * values when using static imports.
+ */
+public static final IOFileFilter INSTANCE = DIRECTORY;
+
 /**
  * Restrictive consructor.
  */
 protected DirectoryFileFilter() {
 }
-
+
 /**
  * Checks to see if the file is a directory.
- * 
+ *
  * @param file  the File to check
  * @return true if the file is a directory
  */
 public boolean accept(File file) {
 return file.isDirectory();
 }
-
+
 }

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FalseFileFilter.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FalseFileFilter.java?rev=424745r1=424744r2=424745view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FalseFileFilter.java
 (original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FalseFileFilter.java
 Sun Jul 23 07:18:55 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2004 The Apache Software Foundation.
+ * Copyright 2002-2004,2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -19,37 +19,47 @@
 
 /**
  * A file filter that always returns false

svn commit: r424747 - in /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io: CopyUtils.java input/SwappedDataInputStream.java output/DeferredFileOutputStream.java

2006-07-23 Thread scolebourne
Author: scolebourne
Date: Sun Jul 23 07:22:04 2006
New Revision: 424747

URL: http://svn.apache.org/viewvc?rev=424747view=rev
Log:
Javadoc - unify paragraph tags to code readable style

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/CopyUtils.java

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/SwappedDataInputStream.java

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/DeferredFileOutputStream.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/CopyUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/CopyUtils.java?rev=424747r1=424746r2=424747view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/CopyUtils.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/CopyUtils.java 
Sun Jul 23 07:22:04 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2004,2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -26,13 +26,13 @@
 import java.io.Writer;
 
 /**
- * pThis class provides static utility methods for buffered
+ * This class provides static utility methods for buffered
  * copying between sources (codeInputStream/code, codeReader/code,
  * codeString/code and codebyte[]/code) and destinations
  * (codeOutputStream/code, codeWriter/code, codeString/code and
- * codebyte[]/code)./p
- *
- * pUnless otherwise noted, these codecopy/code methods do emnot/em
+ * codebyte[]/code).
+ * p
+ * Unless otherwise noted, these codecopy/code methods do emnot/em
  * flush or close the streams. Often doing so would require making non-portable
  * assumptions about the streams' origin and further use. This means that both
  * streams' codeclose()/code methods must be called after copying. if one
@@ -41,43 +41,42 @@
  * idea to rely on this mechanism. For a good overview of the distinction
  * between memory management and resource management, see
  * a href=http://www.unixreview.com/articles/1998/9804/9804ja/ja.htm;this
- * UnixReview article/a./p
- *
- * pFor byte-to-char methods, a codecopy/code variant allows the encoding
+ * UnixReview article/a.
+ * p
+ * For byte-to-char methods, a codecopy/code variant allows the encoding
  * to be selected (otherwise the platform default is used). We would like to
  * encourage you to always specify the encoding because relying on the platform
- * default can lead to unexpected results./p
- *
- * pWe don't provide special variants for the codecopy/code methods that
+ * default can lead to unexpected results.
+ * p
+ * We don't provide special variants for the codecopy/code methods that
  * let you specify the buffer size because in modern VMs the impact on speed
- * seems to be minimal. We're using a default buffer size of 4 KB./p
- *
- * pThe codecopy/code methods use an internal buffer when copying. It is
+ * seems to be minimal. We're using a default buffer size of 4 KB.
+ * p
+ * The codecopy/code methods use an internal buffer when copying. It is
  * therefore advisable emnot/em to deliberately wrap the stream arguments
  * to the codecopy/code methods in codeBuffered*/code streams. For
- * example, don't do the following:/p
- *
- * codecopy( new BufferedInputStream( in ),
- *   new BufferedOutputStream( out ) );/code
- *
- * pThe rationale is as follows:/p
- *
- * pImagine that an InputStream's read() is a very expensive operation, which
+ * example, don't do the following:
+ * pre
+ *  copy( new BufferedInputStream( in ), new BufferedOutputStream( out ) );
+ *  /pre
+ * The rationale is as follows:
+ * p
+ * Imagine that an InputStream's read() is a very expensive operation, which
  * would usually suggest wrapping in a BufferedInputStream. The
  * BufferedInputStream works by issuing infrequent
  * [EMAIL PROTECTED] java.io.InputStream#read(byte[] b, int off, int len)} 
requests on the
  * underlying InputStream, to fill an internal buffer, from which further
  * coderead/code requests can inexpensively get their data (until the 
buffer
- * runs out)./p
- *
- * pHowever, the codecopy/code methods do the same thing, keeping an
+ * runs out).
+ * p
+ * However, the codecopy/code methods do the same thing, keeping an
  * internal buffer, populated by
  * [EMAIL PROTECTED] InputStream#read(byte[] b, int off, int len)} requests. 
Having two
  * buffers (or three if the destination stream is also buffered) is pointless,
  * and the unnecessary buffer management hurts performance slightly (about 3%,
- * according to some simple experiments)./p
- *
- * pBehold, intrepid explorers; a map of this class:/p
+ * according to some simple experiments).
+ * p
+ * Behold, intrepid explorers; a map of this class:
  * pre

svn commit: r424748 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileFinder.java

2006-07-23 Thread scolebourne
Author: scolebourne
Date: Sun Jul 23 07:27:54 2006
New Revision: 424748

URL: http://svn.apache.org/viewvc?rev=424748view=rev
Log:
Allow subclasses to block skip directory processing
Add start and end callback methods
Improve documentation

Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileFinder.java

Modified: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileFinder.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileFinder.java?rev=424748r1=424747r2=424748view=diff
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileFinder.java 
(original)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileFinder.java 
Sun Jul 23 07:27:54 2006
@@ -20,26 +20,26 @@
 import java.util.List;
 import java.util.ArrayList;
 
+import org.apache.commons.io.filefilter.FileFilterUtils;
+import org.apache.commons.io.filefilter.IOFileFilter;
+
 /**
- * pNavigate/search through a File Hierarchy./p
- *
- * pFileFinder can be used as it is to provide a list
- * of the files and directories in a file hierarchy,
- * starting from a specified point./p
- * 
- * pIt can be used in conjunction with a codeFileFilter/code
- * to selectively filter the results produced. Commons IO
- * provides a number of useful
- * [EMAIL PROTECTED] org.apache.commons.io.filefilter.IOFileFilter} 
implementations
- * which can be used in conjunction with this class./p
- * 
- * pFileFinder can also be extended to provide custom implementations
- * that process the file hierarchy further (see example file cleaner 
below)./p
+ * Finds files in a directory hierarchy, with the potential for subclasses
+ * to add additiional behaviour.
+ * p
+ * FileFinder can be used without changes to provide a list of the files
+ * and directories in a file hierarchy starting from a specified point.
+ * This list can be filtered by hierarchy depth and using a
+ * [EMAIL PROTECTED] IOFileFilter file filter}.
+ * p
+ * Commons IO supplies many common filter implementations in the
+ * codefilefilter/code package, see [EMAIL PROTECTED] FileFilterUtils}.
+ * You can also create your own custom implementation, such as in the
+ * file cleaner example below.
  *
  * h4Example 1 - List all files and directories/h4
- * pExample, showing how to list all files and directories
- * starting from the current directory:/p
- *
+ * Example, showing how to list all files and directories starting from
+ * the current directory:
  * pre
  * List files = FileFinder.ALL_FILES.find();
  * for (int i = 0; i  files.size(); i++) {
@@ -49,14 +49,12 @@
  * /pre
  *
  * h4Example 2 - Filtered list of files and directories/h4
- * pExample, showing how to list all directories and
- * files ending in .java starting in a directory called
- * src:/p
- *
+ * Example, showing how to list all files ending in .java starting in
+ * a directory called src:
  * pre
- * IOFileFilter dirFilter  = DirectoryFileFilter.INSTANCE;
- * IOFileFilter fileFilter = new SuffixFileFilter(.java);
- * IOFileFilter filter = new OrFileFilter(directories, txtFiles);
+ * IOFileFilter filesFilter = FileFileFilter.FILE;
+ * IOFileFilter javaFilter  = new SuffixFileFilter(.java);
+ * IOFileFilter filter  = new AndFileFilter(filesFilter, javaFilter);
  * 
  * FileFinder finder = new FileFinder(filter);
  * 
@@ -68,28 +66,27 @@
  * /pre
  *
  * h4Example 3 - Custom Implementation/h4
- * pExample, showing how to create an implementation that
- * deletes files and directories and returns a list of
- * what has been deleted./p
+ * Example, showing how to create an implementation that deletes files
+ * and directories and returns a list of what has been deleted.
  *
  * pre
  *  public class FileDelete extends FileFinder {
  *
- *  public FileDelete() {
- *  }
- *  
- *  protected void handleDirectoryStart(File directory, int depth, List 
results) {
- *  }
- *
- *  protected void handleDirectoryEnd(File directory, int depth, List 
results) {
- *  directory.delete();
- *  results.add(directory);
- *  }
- *
- *  protected void handleFile(File file, int depth, List results) {
- *  file.delete();
- *  results.add(file);
- *  }
+ *public FileDelete() {
+ *}
+ *
+ *protected void handleDirectoryStart(File directory, int depth, List 
results) {
+ *}
+ *
+ *protected void handleDirectoryEnd(File directory, int depth, List 
results) {
+ *  directory.delete();
+ *  results.add(directory);
+ *}
+ *
+ *protected void handleFile(File file, int depth, List results) {
+ *  file.delete();
+ *  results.add(file);
+ *}
  *  }
  * /pre
  *
@@ -111,19 +108,18 @@
 }
 
 /**
- * pConstruct an instance with a filter./p
+ * Construct an instance with a filter.
  *
- * @param filter Filter to limit

svn commit: r424750 - in /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io: DirectoryWalker.java FileFinder.java

2006-07-23 Thread scolebourne
Author: scolebourne
Date: Sun Jul 23 07:57:17 2006
New Revision: 424750

URL: http://svn.apache.org/viewvc?rev=424750view=rev
Log:
Create DirectoryWalker by extracting from FileFinder

Added:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
   (with props)
Modified:

jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileFinder.java

Added: 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java?rev=424750view=auto
==
--- 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 (added)
+++ 
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/DirectoryWalker.java
 Sun Jul 23 07:57:17 2006
@@ -0,0 +1,219 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.io;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.filefilter.IOFileFilter;
+
+/**
+ * Abstract class that walks through a directory hierarchy and provides
+ * subclasses with convenient hooks to add specific behaviour.
+ * p
+ * This class operates with a [EMAIL PROTECTED] IOFileFilter file filter} and 
maximum
+ * depth to limit the files and direcories visited. Commons IO supplies many
+ * common filter implementations in the codefilefilter/code package.
+ * p
+ * This class is extended within Commons IO to provide a file finder facility.
+ * However there are many other possible extensions. For example, to delete all
+ * files and '.svn' directories, and return a list of deleted files:
+ * pre
+ *  public class FileCleaner extends DirectoryWalker {
+ *
+ *public List clean(File startDirectory) {
+ *  return walk(startDirectory);
+ *}
+ *
+ *protected boolean handleDirectoryStart(File directory, int depth, List 
results) {
+ *  // skip contents of svn directories
+ *  return !.svn.equals(directory.getName());
+ *}
+ *
+ *protected void handleDirectoryEnd(File directory, int depth, List 
results) {
+ *  // delete svn directories
+ *  if (.svn.equals(directory.getName())) {
+ *directory.delete();
+ *  }
+ *}
+ *
+ *protected void handleFile(File file, int depth, List results) {
+ *  // delete file and add to list of deleted
+ *  file.delete();
+ *  results.add(file);
+ *}
+ *  }
+ * /pre
+ *
+ * @since Commons IO 1.3
+ * @version $Revision: 424748 $
+ */
+public abstract class DirectoryWalker {
+
+/**
+ * The file filter to use to filter files and directories.
+ */
+private final FileFilter filter;
+/**
+ * The limit on the directory depth to walk.
+ */
+private final int depthLimit;
+
+/**
+ * Construct an instance with a filter and limit the idepth/i 
navigated to.
+ *
+ * @param filter  the filter to limit the navigation/results, may be null
+ * @param depthLimit  controls how ideep/i the hierarchy is
+ *  navigated to (less than 0 means unlimited)
+ */
+protected DirectoryWalker(FileFilter filter, int depthLimit) {
+this.filter = filter;
+this.depthLimit = depthLimit;
+}
+
+//---
+/**
+ * Internal method that walks the directory hierarchy.
+ * p
+ * Most users of this class do not need to call this method. This method 
will
+ * be called automatically by another (public) method on the specific 
subclass.
+ * p
+ * Writers of subclasses should call this method to start the directory 
walk.
+ * Once called, this method will emit events as it walks the hierarchy.
+ * The event methods have the prefix codehandle/code.
+ *
+ * @param startDirectory  the directory to start from
+ * @return the collection of result objects, typically File objects
+ */
+protected List walk(File startDirectory) {
+List results = new ArrayList();
+handleStart(startDirectory, results);
+walk(startDirectory, 0, results);
+handleEnd(results);
+return results;
+}
+
+/**
+ * Main recursive method to examine the directory hierarchy

svn commit: r424871 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/StrSubstitutor.java test/org/apache/commons/lang/text/StrSubstitutorTest.java

2006-07-23 Thread scolebourne
Author: scolebourne
Date: Sun Jul 23 18:00:37 2006
New Revision: 424871

URL: http://svn.apache.org/viewvc?rev=424871view=rev
Log:
Initial commit of StrSubstitutor (VariableFormatter) for review

Added:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
   (with props)

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java
   (with props)

Added: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java?rev=424871view=auto
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
 (added)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java
 Sun Jul 23 18:00:37 2006
@@ -0,0 +1,729 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.lang.text;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Substitutes variables within a string by values.
+ * p
+ * This class takes a piece of text and substitutes all the variables within 
it.
+ * The default definition of a variable is code${variableName}/code.
+ * The prefix and suffix can be changed via constructors and set methods.
+ * p
+ * Variable values are typically resolved from a map, but could also be 
resolved
+ * from system properties, or by supplying a custom variable resolver.
+ * p
+ * The simplest example is to use this class to replace Java System 
properties. For example:
+ * pre
+ * StrSubstitutor.replaceSystemProperties(
+ *  You are running with java.version = ${java.version} and os.name = 
${os.name}.);
+ * /pre
+ * p
+ * Typical usage of this class follows the following pattern: First an 
instance is created
+ * and initialized with the map that contains the values for the available 
variables.
+ * If a prefix and/or suffix for variables should be used other than the 
default ones,
+ * the appropriate settings can be performed. After that the 
codereplace()/code
+ * method can be called passing in the source text for interpolation. In the 
returned
+ * text all variable references (as long as their values are known) will be 
resolved.
+ * The following example demonstrates this:
+ * pre
+ * Map valuesMap = HashMap();
+ * valuesMap.put(quot;animalquot;, quot;quick brown foxquot;);
+ * valuesMap.put(quot;targetquot;, quot;lazy dogquot;);
+ * String templateString = quot;The ${animal} jumped over the 
${target}.quot;;
+ * StrSubstitutor sub = new StrSubstitutor(valuesMap);
+ * String resolvedString = sub.replace(templateString);
+ * /pre
+ * yielding:
+ * pre
+ *  The quick brown fox jumped over the lazy dog.
+ * /pre
+ * p
+ * In addition to this usage pattern there are some static convenience methods 
that
+ * cover the most common use cases. These methods can be used without the need 
of
+ * manually creating an instance. However if multiple replace operations are 
to be
+ * performed, creating and reusing an instance of this class will be more 
efficient.
+ * p
+ * Variable replacement works in a recursive way. Thus, if a variable value 
contains
+ * a variable then that variable will also be replaced. Cyclic replacements are
+ * detected and will cause an exception to be thrown.
+ * p
+ * Sometimes the interpolation's result must contain a variable prefix. As an 
example
+ * take the following source text:
+ * pre
+ *   The variable ${${name}} must be used.
+ * /pre
+ * Here only the variable's name refered to in the text should be replaced 
resulting
+ * in the text (assuming that the value of the codename/code variable is 
codex/code:
+ * pre
+ *   The variable ${x} must be used.
+ * /pre
+ * To achieve this effect there are two possibilities: Either set a different 
prefix
+ * and suffix for variables which do not conflict with the result text you 
want to
+ * produce. The other possibility is to use the escape character, by default 
'$'.
+ * If this character is placed before a variable reference, this reference is 
ignored
+ * and won't be replaced. For example:
+ * pre
+ *   The variable $${${name}} must be used.
+ * /pre
+ *
+ * @author Oliver Heger
+ * @author Stephen Colebourne

svn commit: r424596 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/StrTokenizer.java test/org/apache/commons/lang/text/StrTokenizerTest.java

2006-07-22 Thread scolebourne
Author: scolebourne
Date: Sat Jul 22 09:08:25 2006
New Revision: 424596

URL: http://svn.apache.org/viewvc?rev=424596view=rev
Log:
Add method to get all tokens as a list as well as an array

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java?rev=424596r1=424595r2=424596view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 Sat Jul 22 09:08:25 2006
@@ -446,13 +446,27 @@
 }
 
 /**
- * Gets a copy of the full token list.
+ * Gets a copy of the full token list as an independent modifiable array.
  *
  * @return the tokens as a String array
  */
-public String[] getAllTokens() {
+public String[] getTokenArray() {
 tokenize();
 return (String[]) tokens.clone();
+}
+
+/**
+ * Gets a copy of the full token list as an independent modifiable list.
+ *
+ * @return the tokens as a String array
+ */
+public List getTokenList() {
+tokenize();
+List list = new ArrayList(tokens.length);
+for (int i = 0; i  tokens.length; i++) {
+list.add(tokens[i]);
+}
+return list;
 }
 
 /**

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java?rev=424596r1=424595r2=424596view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
 Sat Jul 22 09:08:25 2006
@@ -16,6 +16,8 @@
 
 package org.apache.commons.lang.text;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.NoSuchElementException;
 
 import junit.framework.Test;
@@ -70,7 +72,7 @@
 tok.setQuoteChar('');
 tok.setIgnoredMatcher(StrMatcher.trimMatcher());
 tok.setIgnoreEmptyTokens(false);
-String tokens[] = tok.getAllTokens();
+String tokens[] = tok.getTokenArray();
 
 String expected[] = new String[]{a, b, c, d;\e, f, , , 
,};
 
@@ -90,7 +92,7 @@
 tok.setQuoteChar('');
 tok.setIgnoredMatcher(StrMatcher.noneMatcher());
 tok.setIgnoreEmptyTokens(false);
-String tokens[] = tok.getAllTokens();
+String tokens[] = tok.getTokenArray();
 
 String expected[] = new String[]{a, b, c , d;\e, f,  ,  
, ,};
 
@@ -110,7 +112,7 @@
 tok.setQuoteChar('');
 tok.setIgnoredMatcher(StrMatcher.noneMatcher());
 tok.setIgnoreEmptyTokens(false);
-String tokens[] = tok.getAllTokens();
+String tokens[] = tok.getTokenArray();
 
 String expected[] = new String[]{a, b,  c, d;\e, f,  ,  
, ,};
 
@@ -130,7 +132,7 @@
 tok.setQuoteChar('');
 tok.setIgnoredMatcher(StrMatcher.trimMatcher());
 tok.setIgnoreEmptyTokens(true);
-String tokens[] = tok.getAllTokens();
+String tokens[] = tok.getTokenArray();
 
 String expected[] = new String[]{a, b, c, d;\e, f,};
 
@@ -151,7 +153,7 @@
 tok.setIgnoredMatcher(StrMatcher.trimMatcher());
 tok.setIgnoreEmptyTokens(false);
 tok.setEmptyTokenAsNull(true);
-String tokens[] = tok.getAllTokens();
+String tokens[] = tok.getTokenArray();
 
 String expected[] = new String[]{a, b, c, d;\e, f, null, 
null, null,};
 
@@ -172,7 +174,7 @@
 tok.setIgnoredMatcher(StrMatcher.trimMatcher());
 tok.setIgnoreEmptyTokens(false);
 // tok.setTreatingEmptyAsNull(true);
-String tokens[] = tok.getAllTokens();
+String tokens[] = tok.getTokenArray();
 
 String expected[] = new String[]{a, b,  c, d;\e, f, null, 
null, null,};
 
@@ -206,7 +208,7 @@
 tok.setQuoteMatcher(StrMatcher.doubleQuoteMatcher());
 tok.setIgnoredMatcher(StrMatcher.noneMatcher());
 tok.setIgnoreEmptyTokens(false);
-String tokens[] = tok.getAllTokens();
+String tokens[] = tok.getTokenArray();
 
 String expected[] = new String[]{a, , , b, c, d e, f, 
,};
 
@@ -226,7 +228,7 @@
 tok.setQuoteMatcher(StrMatcher.doubleQuoteMatcher());
 tok.setIgnoredMatcher(StrMatcher.noneMatcher());
 tok.setIgnoreEmptyTokens(true

svn commit: r424608 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/StrTokenizer.java test/org/apache/commons/lang/text/StrTokenizerTest.java

2006-07-22 Thread scolebourne
Author: scolebourne
Date: Sat Jul 22 10:25:38 2006
New Revision: 424608

URL: http://svn.apache.org/viewvc?rev=424608view=rev
Log:
Allow tokenizer state to be adjusted before and after tokenizing

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java?rev=424608r1=424607r2=424608view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 Sat Jul 22 10:25:38 2006
@@ -16,12 +16,11 @@
 package org.apache.commons.lang.text;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.lang.ArrayUtils;
-
 /**
  * Tokenizes a string based based on delimiters (separators)
  * and supporting quoting and ignored character concepts.
@@ -107,10 +106,8 @@
 TSV_TOKENIZER_PROTOTYPE.setIgnoreEmptyTokens(false);
 }
 
-/** The text to work on */
+/** The text to work on. */
 private char chars[];
-/** The input text, null if char[] input */
-private String text;
 /** The parsed tokens */
 private String tokens[];
 /** The current iteration position */
@@ -241,8 +238,7 @@
  */
 public StrTokenizer() {
 super();
-this.text = ;
-this.chars = new char[0];
+this.chars = null;
 }
 
 /**
@@ -253,7 +249,6 @@
  */
 public StrTokenizer(String input) {
 super();
-text = input;
 if (input != null) {
 chars = input.toCharArray();
 } else {
@@ -331,7 +326,6 @@
  */
 public StrTokenizer(char[] input) {
 super();
-this.text = null;
 this.chars = input;
 }
 
@@ -417,7 +411,7 @@
  * @return the number of matched tokens
  */
 public int size() {
-tokenize();
+checkTokenized();
 return tokens.length;
 }
 
@@ -451,7 +445,7 @@
  * @return the tokens as a String array
  */
 public String[] getTokenArray() {
-tokenize();
+checkTokenized();
 return (String[]) tokens.clone();
 }
 
@@ -461,7 +455,7 @@
  * @return the tokens as a String array
  */
 public List getTokenList() {
-tokenize();
+checkTokenized();
 List list = new ArrayList(tokens.length);
 for (int i = 0; i  tokens.length; i++) {
 list.add(tokens[i]);
@@ -492,11 +486,10 @@
  */
 public StrTokenizer reset(String input) {
 reset();
-text = input;
 if (input != null) {
-chars = input.toCharArray();
+this.chars = input.toCharArray();
 } else {
-chars = null;
+this.chars = null;
 }
 return this;
 }
@@ -514,8 +507,7 @@
  */
 public StrTokenizer reset(char[] input) {
 reset();
-text = null;
-chars = input;
+this.chars = input;
 return this;
 }
 
@@ -527,7 +519,7 @@
  * @return true if there are more tokens
  */
 public boolean hasNext() {
-tokenize();
+checkTokenized();
 return tokenPos  tokens.length;
 }
 
@@ -558,7 +550,7 @@
  * @return true if there are previous tokens
  */
 public boolean hasPrevious() {
-tokenize();
+checkTokenized();
 return tokenPos  0;
 }
 
@@ -613,42 +605,60 @@
 // Implementation
 //---
 /**
- * Performs the tokenization if it hasn't already been done.
+ * Checks if tokenization has been done, and if not then do it.
  */
-private void tokenize() {
+private void checkTokenized() {
 if (tokens == null) {
-tokens = readTokens();
+if (chars == null) {
+// still call tokenize as subclass may do some work
+List split = tokenize(null, 0, 0);
+tokens = (String[]) split.toArray(new String[split.size()]);
+} else {
+List split = tokenize(chars, 0, chars.length);
+tokens = (String[]) split.toArray(new String[split.size()]);
+}
 }
 }
 
 /**
- * Read all the tokens.
+ * Internal method to performs the tokenization.
+ * p
+ * Most users of this class do not need to call this method. This method
+ * will be called automatically by other (public

svn commit: r424611 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/StrTokenizer.java test/org/apache/commons/lang/text/StrTokenizerTest.java

2006-07-22 Thread scolebourne
Author: scolebourne
Date: Sat Jul 22 11:09:27 2006
New Revision: 424611

URL: http://svn.apache.org/viewvc?rev=424611view=rev
Log:
Add toString

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java?rev=424611r1=424610r2=424611view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 Sat Jul 22 11:09:27 2006
@@ -1068,13 +1068,17 @@
  * @return the string content being parsed
  */
 public String getContent() {
+if (chars == null) {
+return null;
+}
 return new String(chars);
 }
 
 //---
 /**
- * Creates a new instance of this Tokenizer. The new instance is reset so 
that it will be at the start of the token
- * list. If a [EMAIL PROTECTED] CloneNotSupportedException} is caught, 
return codenull/code.
+ * Creates a new instance of this Tokenizer. The new instance is reset so
+ * that it will be at the start of the token list.
+ * If a [EMAIL PROTECTED] CloneNotSupportedException} is caught, return 
codenull/code.
  * 
  * @return a new instance of this Tokenizer which has been reset.
  */
@@ -1087,8 +1091,8 @@
 }
 
 /**
- * Creates a new instance of this Tokenizer. The new instance is reset so 
that it will be at the start of the token
- * list.
+ * Creates a new instance of this Tokenizer. The new instance is reset so 
that
+ * it will be at the start of the token list.
  * 
  * @return a new instance of this Tokenizer which has been reset.
  * @throws CloneNotSupportedException if there is a problem cloning
@@ -1100,6 +1104,20 @@
 }
 cloned.reset();
 return cloned;
+}
+
+//---
+/**
+ * Gets the String content that the tokenizer is parsing.
+ *
+ * @return the string content being parsed
+ */
+public String toString() {
+if (tokens == null) {
+return StrTokenizer[not tokenized yet];
+} else {
+return StrTokenizer + getTokenList();
+}
 }
 
 }

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java?rev=424611r1=424610r2=424611view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
 Sat Jul 22 11:09:27 2006
@@ -536,6 +536,9 @@
 
 tok = new StrTokenizer(input.toCharArray());
 assertEquals(input, tok.getContent());
+
+tok = new StrTokenizer();
+assertEquals(null, tok.getContent());
 }
 
 //---
@@ -828,6 +831,14 @@
 assertEquals(c, tkn.next());
 assertEquals(b, tkn.next());
 assertEquals(a, tkn.next());
+}
+
+//---
+public void testToString() {
+StrTokenizer tkn = new StrTokenizer(a b c d e);
+assertEquals(StrTokenizer[not tokenized yet], tkn.toString());
+tkn.next();
+assertEquals(StrTokenizer[a, b, c, d, e], tkn.toString());
 }
 
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r424612 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/StrBuilder.java test/org/apache/commons/lang/text/StrBuilderTest.java

2006-07-22 Thread scolebourne
Author: scolebourne
Date: Sat Jul 22 11:10:16 2006
New Revision: 424612

URL: http://svn.apache.org/viewvc?rev=424612view=rev
Log:
Link builder to tokenizer properly

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrBuilderTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java?rev=424612r1=424611r2=424612view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
 Sat Jul 22 11:10:16 2006
@@ -19,6 +19,7 @@
 import java.io.Writer;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.SystemUtils;
@@ -1943,21 +1944,39 @@
 
 //---
 /**
- * Creates a tokenizer using the current contents of this builder.
+ * Creates a tokenizer that can tokenize the contents of this builder.
  * p
- * This method allows the contents of the builder to be tokenized.
- * The tokenizer will be setup to tokenize on space, tab, newline
- * and formfeed (as per StringTokenizer). These values can be changed
- * on the tokenizer class, before retrieving the tokens.
- * p
- * Note that the internal character array is shared between the two
- * objects and no synchronization occurs. Once you call this method
- * you must complete the tokenization before altering this buffer again.
+ * This method allows the contents of this builder to be tokenized.
+ * The tokenizer will be setup by default to tokenize on space, tab,
+ * newline and formfeed (as per StringTokenizer). These values can be
+ * changed on the tokenizer class, before retrieving the tokens.
+ * p
+ * The returned tokenizer is linked to this builder. You may intermix
+ * calls to the buider and tokenizer within certain limits, however
+ * there is no synchronization. Once the tokenizer has been used once,
+ * it must be [EMAIL PROTECTED] StrTokenizer#reset() reset} to pickup the 
latest
+ * changes in the builder. For example:
+ * pre
+ * StrBuilder b = new StrBuilder();
+ * b.append(a b );
+ * StrTokenizer t = b.asTokenizer();
+ * String[] tokens1 = t.getTokenArray();  // returns a,b
+ * b.append(c d );
+ * String[] tokens2 = t.getTokenArray();  // returns a,b (c and d ignored)
+ * t.reset();  // reset causes builder changes to be picked up
+ * String[] tokens3 = t.getTokenArray();  // returns a,b,c,d
+ * /pre
+ * In addition to simply intermixing appends and tokenization, you can also
+ * call the set methods on the tokenizer to alter how it tokenizes. Just
+ * remember to call reset when you want to pickup builder changes.
+ * p
+ * Calling [EMAIL PROTECTED] StrTokenizer#reset(String)} or [EMAIL 
PROTECTED] StrTokenizer#reset(char[])}
+ * with a non-null value will break the link with the builder.
  *
- * @return a StrTokenizer instance
+ * @return a tokenizer that is linked to this builder
  */
 public StrTokenizer asTokenizer() {
-return new StrTokenizer(buffer);
+return new StrBuilderTokenizer();
 }
 
 //---
@@ -2179,6 +2198,37 @@
 
 //---
 /**
+ * Inner class to allow StrBuilder to operate as a tokenizer.
+ */
+class StrBuilderTokenizer extends StrTokenizer {
+
+/** [EMAIL PROTECTED] */
+StrBuilderTokenizer() {
+super();
+}
+
+/** [EMAIL PROTECTED] */
+protected List tokenize(char[] chars, int offset, int count) {
+if (chars == null) {
+return super.tokenize(StrBuilder.this.buffer, 0, 
StrBuilder.this.size());
+} else {
+return super.tokenize(chars, offset, count);
+}
+}
+
+/** [EMAIL PROTECTED] */
+public String getContent() {
+String str = super.getContent();
+if (str == null) {
+return StrBuilder.this.toString();
+} else {
+return str;
+}
+}
+}
+
+//---
+/**
  * Inner class to allow StrBuilder to operate as a writer.
  */
 class StrBuilderReader extends Reader {
@@ -2202,7 +2252,7

svn commit: r424613 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/text/ test/org/apache/commons/lang/text/

2006-07-22 Thread scolebourne
Author: scolebourne
Date: Sat Jul 22 11:12:41 2006
New Revision: 424613

URL: http://svn.apache.org/viewvc?rev=424613view=rev
Log:
Copyright dates

Modified:

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java

jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrBuilderTest.java

jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java?rev=424613r1=424612r2=424613view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
 Sat Jul 22 11:12:41 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 The Apache Software Foundation.
+ * Copyright 2004-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java?rev=424613r1=424612r2=424613view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrTokenizer.java
 Sat Jul 22 11:12:41 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 The Apache Software Foundation.
+ * Copyright 2003-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrBuilderTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrBuilderTest.java?rev=424613r1=424612r2=424613view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrBuilderTest.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrBuilderTest.java
 Sat Jul 22 11:12:41 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.

Modified: 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java?rev=424613r1=424612r2=424613view=diff
==
--- 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrTokenizerTest.java
 Sat Jul 22 11:12:41 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2005 The Apache Software Foundation.
+ * Copyright 2003-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  1   2   3   4   5   6   7   8   9   10   >