Commit Graph

2404 Commits

Author SHA1 Message Date
Gary D. Gregory 655050f6fd Use INDEX_NOT_FOUND instead of magic number.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@920546 13f79535-47bb-0310-9956-ffa450edef68
2010-03-08 22:22:31 +00:00
Joerg Schaible 7f23ec3d90 ContextedRuntimeException must extend RuntimeException (LANG-602).
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@920544 13f79535-47bb-0310-9956-ffa450edef68
2010-03-08 22:20:12 +00:00
Gary D. Gregory 7cfa8a9328 Change StringUtils arguments from String to CharSequence.
Details: Working with (trunk) StringUtils (SU) I see the following emerge: 

- In SVN already and continuing: Change StringUtils arguments from String to CharSequence (CS).

- This leads to replacing calls to String.substring(int[,int]) with calls to CharSequence.subSequence(int)

- This leads to creating a CharSequenceUtils class (in SVN now, more on this new class below) and CharSequenceUtils.subSequence(CharSequence,int) to avoid changing "str.substring(start)" over and over to "str.subSequence(start, str.length())". For examples, see new versions of capitalize and uncapitalize.

- We end up using a toString() on CharSequence to return a String from StringUtil when working with a CharSequence.

So we have StringUtils using CharSequence inputs as much as possible instead of String, which is nice. 

The CharSequence method subSequence returns a CharSequence; though the Javadoc states "Returns a new CharSequence that is a subsequence of this sequence.", this does not guaranteed the return value to be the same kind of CharSequence as the receiver). Since we are after all in a class called StringUtil, calling toString() is a must.

I propose that we create when possible the methods that are now StringUtils CharSequence methods into CharSequenceUtils and let StringUtil call CharSequenceUtils and then do its toString() and other String specific logic. Later we could have other CharSequence type of utils (for CharBuffer, StringBuiler, StringBuffer, etc) that use the 'primitives' from CharSequenceUtils.
This means that for methods that are based solely on methods that are now in CharSequence, these can be moved to CharSequenceUtils without effort (all is* methods only call CharSequence#length() and charAt() for example and are now typed as CS, still in SU). 

We can leave @deprecateds method in SU as a nicety to avoid too much porting pain: First change the package to lang3 then you can 'optimize' by changing call sites from SU to CSU.

As a start, I put in SVN a CharSequenceUtils (CSU) implementation for length() and subSequence().


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@920543 13f79535-47bb-0310-9956-ffa450edef68
2010-03-08 22:15:08 +00:00
Gary D. Gregory 9c0379850b Convert defaultIfEmpty from String to CharSequence.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@920187 13f79535-47bb-0310-9956-ffa450edef68
2010-03-08 03:41:49 +00:00
Niall Pemberton e1077c023d Re-generate the download pages using the new commons-build-plugin .12 (via commons-parent version 13)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@920156 13f79535-47bb-0310-9956-ffa450edef68
2010-03-08 00:11:50 +00:00
Niall Pemberton 0195cd60c5 Upgrade to version 13 of commons-parent
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@920154 13f79535-47bb-0310-9956-ffa450edef68
2010-03-08 00:05:47 +00:00
Gary D. Gregory 9abfbaecab More tests for length()
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@919872 13f79535-47bb-0310-9956-ffa450edef68
2010-03-06 22:54:34 +00:00
Gary D. Gregory 543f2d36e4 Change length(String) to length(CharSequence)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@919859 13f79535-47bb-0310-9956-ffa450edef68
2010-03-06 22:09:37 +00:00
Henri Yandell f91a7c97d3 Per David M. Sledge's patch to LANG-599, added support to ClassUtils.getClass(String) to support inner classes being separated by '.' as well as the official '$'
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@919340 13f79535-47bb-0310-9956-ffa450edef68
2010-03-05 09:05:47 +00:00
Henri Yandell 51df5ea90c Closing the paragraph tag on the ThreadSafe notation. LANG-370
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918868 13f79535-47bb-0310-9956-ffa450edef68
2010-03-04 06:22:16 +00:00
Sebastian Bazley 18e7603cac Fix threadsafety comments
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918836 13f79535-47bb-0310-9956-ffa450edef68
2010-03-04 03:12:36 +00:00
Sebastian Bazley 26cdd7ba56 Iterator is not threadsafe
Make private field final

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918829 13f79535-47bb-0310-9956-ffa450edef68
2010-03-04 02:57:03 +00:00
Henri Yandell c84c4669aa Some more #ThreadSafe# tags per LANG-370
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918373 13f79535-47bb-0310-9956-ffa450edef68
2010-03-03 09:22:46 +00:00
Henri Yandell bb0d189f1b Adding ThreadSafe notes to some obviously threadsafe classes (LANG-370)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918369 13f79535-47bb-0310-9956-ffa450edef68
2010-03-03 09:16:38 +00:00
Henri Yandell 36a29645fb Fixing javadoc @see tags
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918368 13f79535-47bb-0310-9956-ffa450edef68
2010-03-03 09:09:14 +00:00
Henri Yandell 45488c9826 Adding info on the LANG-559 commits
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918367 13f79535-47bb-0310-9956-ffa450edef68
2010-03-03 08:58:10 +00:00
Henri Yandell 4f31ae757c Applying Valentin Rocher's patch from LANG-559, adding isInstanceOf and isAssignableFrom methods.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918366 13f79535-47bb-0310-9956-ffa450edef68
2010-03-03 08:56:22 +00:00
Sebastian Bazley 6699e44845 Javadoc fixes
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918240 13f79535-47bb-0310-9956-ffa450edef68
2010-03-02 23:01:54 +00:00
Sebastian Bazley 52baa809b8 Unused import; missing @Override markers
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918239 13f79535-47bb-0310-9956-ffa450edef68
2010-03-02 23:01:40 +00:00
Sebastian Bazley 8e4147b75c Fix raw types
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918238 13f79535-47bb-0310-9956-ffa450edef68
2010-03-02 22:55:22 +00:00
Sebastian Bazley 11272085d7 Tab police
Also removed extraneous trailing spaces

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@918237 13f79535-47bb-0310-9956-ffa450edef68
2010-03-02 22:52:09 +00:00
Henri Yandell b72207ccf4 Updating package.html files (LANG-490).
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@917897 13f79535-47bb-0310-9956-ffa450edef68
2010-03-02 06:58:04 +00:00
Paul C. Benedict Jr 7721acd0ef LANG-594: Add truncatedEquals and truncatedCompareTo
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@916906 13f79535-47bb-0310-9956-ffa450edef68
2010-02-27 03:29:43 +00:00
Niall Pemberton e49c05bdce 2.5 changes report should show LANG-348 instead of LANG-438
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@916449 13f79535-47bb-0310-9956-ffa450edef68
2010-02-25 20:51:17 +00:00
Niall Pemberton 13692fdce3 Add Lang 2.5 release
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@916242 13f79535-47bb-0310-9956-ffa450edef68
2010-02-25 10:54:19 +00:00
Henri Yandell 90f45b447a Adding toString test. LANG-588
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@916099 13f79535-47bb-0310-9956-ffa450edef68
2010-02-25 03:11:48 +00:00
Henri Yandell 88d44051a1 Applying Matt's patch with my modifications from LANG-588. Adds a Pair class to Lang.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@916098 13f79535-47bb-0310-9956-ffa450edef68
2010-02-25 03:04:19 +00:00
Henri Yandell e0ddfa767c Adding BasicThreadFactory class. Same as Oliver's original patch in LANG-582, with an @since 3.0 added
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@916095 13f79535-47bb-0310-9956-ffa450edef68
2010-02-25 02:53:04 +00:00
Niall Pemberton cf74865561 Update site for 2.5 release
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@916082 13f79535-47bb-0310-9956-ffa450edef68
2010-02-25 01:29:36 +00:00
Niall Pemberton 43fca0d749 Port @since tags from 2.x branch
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@916081 13f79535-47bb-0310-9956-ffa450edef68
2010-02-25 01:28:13 +00:00
Niall Pemberton 8c16b39c3d Minor javadoc changes
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@915111 13f79535-47bb-0310-9956-ffa450edef68
2010-02-22 23:25:21 +00:00
Niall Pemberton 1fdcb829bb Minor code simplification
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@915110 13f79535-47bb-0310-9956-ffa450edef68
2010-02-22 23:22:18 +00:00
Niall Pemberton 3afb07ec81 Remove Maven1 XML documents
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@911992 13f79535-47bb-0310-9956-ffa450edef68
2010-02-19 21:31:32 +00:00
Niall Pemberton 6aca4b61a0 Checkstyle changes only
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@911987 13f79535-47bb-0310-9956-ffa450edef68
2010-02-19 21:27:31 +00:00
Joerg Schaible 7b6ab58a01 Add methods for Cloneables to ObjectUtils (LANG-576).
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@908745 13f79535-47bb-0310-9956-ffa450edef68
2010-02-10 23:22:05 +00:00
Sebastian Bazley 7a304cfc7b Javadoc clarification
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907630 13f79535-47bb-0310-9956-ffa450edef68
2010-02-08 12:22:32 +00:00
Henri Yandell 1b5c1b4371 Adding extra javadoc to point out that usually indexOf on an empty String == -1. LANG-589
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907561 13f79535-47bb-0310-9956-ffa450edef68
2010-02-08 06:57:34 +00:00
Henri Yandell 10cc16fe82 Moving the indexOf(String, String, int) method above the ordinalIndexOf methods to put it with its overloaded peers. LANG-590
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907385 13f79535-47bb-0310-9956-ffa450edef68
2010-02-07 07:10:14 +00:00
Henri Yandell ab759f7d06 Removing JDK 1.2/1.3 protecting bugfix. We're now on JDK 1.5. LANG-590
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907384 13f79535-47bb-0310-9956-ffa450edef68
2010-02-07 07:08:58 +00:00
Henri Yandell 779828c9a2 Applying Valentin Rocher's patch to LANG-579, adding new regexp and in range methods to Validate
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907382 13f79535-47bb-0310-9956-ffa450edef68
2010-02-07 05:40:10 +00:00
Matthew Jason Benson 76660f4a98 reread ThreadLocal value in synchronized block to avoid any timing issues
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907375 13f79535-47bb-0310-9956-ffa450edef68
2010-02-07 03:42:08 +00:00
Matthew Jason Benson 1f35e7c99b [LANG-586] Clear ThreadLocal for HashCodeBuilder as well
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907373 13f79535-47bb-0310-9956-ffa450edef68
2010-02-07 03:14:09 +00:00
Matthew Jason Benson 2fb9e71da6 promote uniformity between branches by using registry accessor
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907126 13f79535-47bb-0310-9956-ffa450edef68
2010-02-05 23:11:43 +00:00
Matthew Jason Benson 8f675dd3cb [LANG-587] avoid NPE in ClassUtils.toClass(Object[])
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907102 13f79535-47bb-0310-9956-ffa450edef68
2010-02-05 21:31:38 +00:00
Matthew Jason Benson 5d5a31a827 clean up toClass(Object[]) test
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907099 13f79535-47bb-0310-9956-ffa450edef68
2010-02-05 21:22:29 +00:00
Matthew Jason Benson 0d828cd075 unused imports + uh, why would you synchronize access to a ThreadLocal? :P
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@906682 13f79535-47bb-0310-9956-ffa450edef68
2010-02-04 22:10:24 +00:00
Matthew Jason Benson a2bb711aee [LANG-586] part 2: refactor ToStringStyle and ToStringBuilderTest to verify that we are unsetting the registry when no longer needed
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@906676 13f79535-47bb-0310-9956-ffa450edef68
2010-02-04 21:57:58 +00:00
Matthew Jason Benson 5c3ec55e15 [LANG-586] clear ThreadLocal recursion registry (compatibly with existing tests, first pass)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@906673 13f79535-47bb-0310-9956-ffa450edef68
2010-02-04 21:46:22 +00:00
Niall Pemberton c98d0840bc LANG-454 implement Iterable<Character> and some javadoc changes
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@906028 13f79535-47bb-0310-9956-ffa450edef68
2010-02-03 12:22:27 +00:00
Sebastian Bazley 63ad5b063e LANG-585. Don't suggest catching Throwable, catch Exception instead.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@906015 13f79535-47bb-0310-9956-ffa450edef68
2010-02-03 11:40:06 +00:00